diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 4417ad2..ba40981 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -68,6 +68,39 @@ Always run builds from the `firmware/` directory – `platformio.ini` is there. ## C++ Style & Conventions +### Copyright Header (mandatory) + +Every source file (`.cpp`, `.h`, `.c`) **must** start with the GPL-3.0 copyright +header. For HTML files, use `` comment syntax. For Python files, use +`#` comment syntax. + +```cpp +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ +``` + +When creating a **new** file, always include this header as the very first thing. +Existing Doxygen `/** … */` file-level documentation follows **after** the +copyright block. + ### Language Standard - ESP32 targets: **`-std=gnu++2a`** (C++20 on GCC 8.4) - Native/sim targets: **`-std=gnu++20`** @@ -167,6 +200,7 @@ The CI workflow (`.github/workflows/ci.yml`) runs on push/PR to main/master: | `build-sim-tx` | `pio run -e sim_tx` (needs `libsdl2-dev`) | | `clang-format` | Formatting check (clang-format-19) | | `cppcheck` | Static analysis | +| `license-headers` | Copyright header check (SPDX identifier) | After ANY code change, verify at minimum: 1. `pio test -e native` – all 90 tests pass @@ -174,6 +208,7 @@ After ANY code change, verify at minimum: 3. `pio run -e transmitter` – compiles 4. **clang-format** – all changed files must be formatted before committing 5. **cppcheck** – no new warnings allowed +6. **copyright header** – all new files must have the GPL-3.0 header ### clang-format (mandatory) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4305b7e..7064754 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -208,3 +208,43 @@ jobs: -I firmware/lib/odh-web \ firmware/src \ firmware/lib + + # ── Copyright / license header check ─────────────────────────────────── + license-headers: + name: Copyright header check + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Check copyright headers + run: | + missing=0 + # C/C++ files: expect "SPDX-License-Identifier: GPL-3.0-or-later" in /* */ block + while IFS= read -r -d '' f; do + if ! head -25 "$f" | grep -q 'SPDX-License-Identifier: GPL-3.0-or-later'; then + echo "::error file=$f::Missing copyright header: $f" + missing=$((missing + 1)) + fi + done < <(find firmware/src firmware/lib firmware/sim firmware/include firmware/test \ + \( -name '*.cpp' -o -name '*.h' -o -name '*.c' \) \ + ! -path '*/.pio/*' -print0) + # HTML files + while IFS= read -r -d '' f; do + if ! head -25 "$f" | grep -q 'SPDX-License-Identifier: GPL-3.0-or-later'; then + echo "::error file=$f::Missing copyright header: $f" + missing=$((missing + 1)) + fi + done < <(find firmware/data -name '*.html' -print0) + # Python files + while IFS= read -r -d '' f; do + if ! head -25 "$f" | grep -q 'SPDX-License-Identifier: GPL-3.0-or-later'; then + echo "::error file=$f::Missing copyright header: $f" + missing=$((missing + 1)) + fi + done < <(find firmware/sim -name '*.py' -print0) + if [ "$missing" -gt 0 ]; then + echo "::error::$missing file(s) missing the GPL-3.0 copyright header." + exit 1 + fi + echo "All files have correct copyright headers." \ No newline at end of file diff --git a/firmware/data/receiver/index.html b/firmware/data/receiver/index.html index e5ffa4d..b65372a 100644 --- a/firmware/data/receiver/index.html +++ b/firmware/data/receiver/index.html @@ -1,3 +1,23 @@ + diff --git a/firmware/data/transmitter/index.html b/firmware/data/transmitter/index.html index 231667d..7f1d58a 100644 --- a/firmware/data/transmitter/index.html +++ b/firmware/data/transmitter/index.html @@ -1,3 +1,23 @@ + diff --git a/firmware/include/User_Setup.h b/firmware/include/User_Setup.h index b0c6003..481ae70 100644 --- a/firmware/include/User_Setup.h +++ b/firmware/include/User_Setup.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * TFT_eSPI user setup for OpenDriveHub transmitter. * diff --git a/firmware/include/lv_conf.h b/firmware/include/lv_conf.h index f5ce777..a283fa0 100644 --- a/firmware/include/lv_conf.h +++ b/firmware/include/lv_conf.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * LVGL v8 configuration for OpenDriveHub transmitter display. * diff --git a/firmware/lib/odh-config/Config.h b/firmware/lib/odh-config/Config.h index 3589a7c..fd70604 100644 --- a/firmware/lib/odh-config/Config.h +++ b/firmware/lib/odh-config/Config.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * OpenDriveHub – Unified Compile-Time Configuration * diff --git a/firmware/lib/odh-config/NvsStore.h b/firmware/lib/odh-config/NvsStore.h index aa69879..8d71aa7 100644 --- a/firmware/lib/odh-config/NvsStore.h +++ b/firmware/lib/odh-config/NvsStore.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * NvsStore – RAII wrapper around ESP32 Preferences for NVS access. * diff --git a/firmware/lib/odh-protocol/FunctionMap.h b/firmware/lib/odh-protocol/FunctionMap.h index e582d60..eeb5cd4 100644 --- a/firmware/lib/odh-protocol/FunctionMap.h +++ b/firmware/lib/odh-protocol/FunctionMap.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * FunctionMap – vehicle model presets and function-to-channel mapping utilities * diff --git a/firmware/lib/odh-protocol/Protocol.h b/firmware/lib/odh-protocol/Protocol.h index 888a3e8..f4b08a3 100644 --- a/firmware/lib/odh-protocol/Protocol.h +++ b/firmware/lib/odh-protocol/Protocol.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * OpenDriveHub Protocol – Modern C++ Definitions * diff --git a/firmware/lib/odh-radio/IRadioLink.h b/firmware/lib/odh-radio/IRadioLink.h index d4f03ba..75bf8aa 100644 --- a/firmware/lib/odh-radio/IRadioLink.h +++ b/firmware/lib/odh-radio/IRadioLink.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * IRadioLink – abstract interface for ESP-NOW radio links. * diff --git a/firmware/lib/odh-radio/ReceiverRadioLink.cpp b/firmware/lib/odh-radio/ReceiverRadioLink.cpp index 4b76dc4..84da2e8 100644 --- a/firmware/lib/odh-radio/ReceiverRadioLink.cpp +++ b/firmware/lib/odh-radio/ReceiverRadioLink.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + #include "ReceiverRadioLink.h" #include diff --git a/firmware/lib/odh-radio/ReceiverRadioLink.h b/firmware/lib/odh-radio/ReceiverRadioLink.h index cbea46a..31a5f1b 100644 --- a/firmware/lib/odh-radio/ReceiverRadioLink.h +++ b/firmware/lib/odh-radio/ReceiverRadioLink.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * ReceiverRadioLink – ESP-NOW radio link for the receiver side. * diff --git a/firmware/lib/odh-radio/TransmitterRadioLink.cpp b/firmware/lib/odh-radio/TransmitterRadioLink.cpp index 9c4ddff..4f4b19f 100644 --- a/firmware/lib/odh-radio/TransmitterRadioLink.cpp +++ b/firmware/lib/odh-radio/TransmitterRadioLink.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + #include "TransmitterRadioLink.h" #include diff --git a/firmware/lib/odh-radio/TransmitterRadioLink.h b/firmware/lib/odh-radio/TransmitterRadioLink.h index f9535d2..7038770 100644 --- a/firmware/lib/odh-radio/TransmitterRadioLink.h +++ b/firmware/lib/odh-radio/TransmitterRadioLink.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * TransmitterRadioLink – ESP-NOW radio link for the transmitter side. * diff --git a/firmware/lib/odh-telemetry/BatteryMonitor.cpp b/firmware/lib/odh-telemetry/BatteryMonitor.cpp index 21b978f..0209817 100644 --- a/firmware/lib/odh-telemetry/BatteryMonitor.cpp +++ b/firmware/lib/odh-telemetry/BatteryMonitor.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + #include "BatteryMonitor.h" #include diff --git a/firmware/lib/odh-telemetry/BatteryMonitor.h b/firmware/lib/odh-telemetry/BatteryMonitor.h index e292b7c..b8e7e95 100644 --- a/firmware/lib/odh-telemetry/BatteryMonitor.h +++ b/firmware/lib/odh-telemetry/BatteryMonitor.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * BatteryMonitor – unified ADC battery voltage measurement. * diff --git a/firmware/lib/odh-telemetry/TelemetryData.cpp b/firmware/lib/odh-telemetry/TelemetryData.cpp index 0ee64e1..93ad97d 100644 --- a/firmware/lib/odh-telemetry/TelemetryData.cpp +++ b/firmware/lib/odh-telemetry/TelemetryData.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + #include "TelemetryData.h" #include diff --git a/firmware/lib/odh-telemetry/TelemetryData.h b/firmware/lib/odh-telemetry/TelemetryData.h index 9a995b2..b877cb0 100644 --- a/firmware/lib/odh-telemetry/TelemetryData.h +++ b/firmware/lib/odh-telemetry/TelemetryData.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * TelemetryData – telemetry snapshot received from the receiver. * diff --git a/firmware/lib/odh-web/ApiHandler.h b/firmware/lib/odh-web/ApiHandler.h index c315804..f0beb27 100644 --- a/firmware/lib/odh-web/ApiHandler.h +++ b/firmware/lib/odh-web/ApiHandler.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * ApiHandler – JSON REST API helper utilities. * diff --git a/firmware/lib/odh-web/OdhWebServer.cpp b/firmware/lib/odh-web/OdhWebServer.cpp index b65fc2f..7eb52bc 100644 --- a/firmware/lib/odh-web/OdhWebServer.cpp +++ b/firmware/lib/odh-web/OdhWebServer.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + #include "OdhWebServer.h" #ifndef NATIVE_SIM diff --git a/firmware/lib/odh-web/OdhWebServer.h b/firmware/lib/odh-web/OdhWebServer.h index 00edae6..56cee6f 100644 --- a/firmware/lib/odh-web/OdhWebServer.h +++ b/firmware/lib/odh-web/OdhWebServer.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * WebServer – ESPAsyncWebServer + LittleFS wrapper. * diff --git a/firmware/sim/include/Adafruit_ADS1X15.h b/firmware/sim/include/Adafruit_ADS1X15.h index 1cf6294..df084f2 100644 --- a/firmware/sim/include/Adafruit_ADS1X15.h +++ b/firmware/sim/include/Adafruit_ADS1X15.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Adafruit_ADS1X15.h – Simulation stub for ADS1115 ADC. * @@ -33,11 +54,23 @@ typedef enum { class Adafruit_ADS1115 { public: - Adafruit_ADS1115(uint8_t addr = 0x48) { (void)addr; } - bool begin(uint8_t addr = 0x48) { (void)addr; return true; } - void setGain(adsGain_t g) { (void)g; } - void setDataRate(ads1115DataRate_t r) { (void)r; } - int16_t readADC_SingleEnded(uint8_t channel) { (void)channel; return 16384; } + Adafruit_ADS1115(uint8_t addr = 0x48) { + (void)addr; + } + bool begin(uint8_t addr = 0x48) { + (void)addr; + return true; + } + void setGain(adsGain_t g) { + (void)g; + } + void setDataRate(ads1115DataRate_t r) { + (void)r; + } + int16_t readADC_SingleEnded(uint8_t channel) { + (void)channel; + return 16384; + } }; #endif /* SIM_ADAFRUIT_ADS1X15_H */ diff --git a/firmware/sim/include/Adafruit_PCF8574.h b/firmware/sim/include/Adafruit_PCF8574.h index 95fd570..d652305 100644 --- a/firmware/sim/include/Adafruit_PCF8574.h +++ b/firmware/sim/include/Adafruit_PCF8574.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Adafruit_PCF8574 simulation shim. * Provides a stub so transmitter code compiles on native/sim. diff --git a/firmware/sim/include/Arduino.h b/firmware/sim/include/Arduino.h index 95a6dc1..b33c6dd 100644 --- a/firmware/sim/include/Arduino.h +++ b/firmware/sim/include/Arduino.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Arduino.h – Simulation shim for native Linux builds. * diff --git a/firmware/sim/include/ESPAsyncWebServer.h b/firmware/sim/include/ESPAsyncWebServer.h index 816485a..ad00221 100644 --- a/firmware/sim/include/ESPAsyncWebServer.h +++ b/firmware/sim/include/ESPAsyncWebServer.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * ESPAsyncWebServer simulation shim. * diff --git a/firmware/sim/include/LittleFS.h b/firmware/sim/include/LittleFS.h index bb59071..34ad3aa 100644 --- a/firmware/sim/include/LittleFS.h +++ b/firmware/sim/include/LittleFS.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * LittleFS simulation shim. * Provides a stub FS object that compiles but does nothing. diff --git a/firmware/sim/include/Preferences.h b/firmware/sim/include/Preferences.h index 60e3097..7867617 100644 --- a/firmware/sim/include/Preferences.h +++ b/firmware/sim/include/Preferences.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Preferences.h – Simulation shim (in-memory key-value store). * diff --git a/firmware/sim/include/TFT_eSPI.h b/firmware/sim/include/TFT_eSPI.h index 28a4b39..8595eb9 100644 --- a/firmware/sim/include/TFT_eSPI.h +++ b/firmware/sim/include/TFT_eSPI.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * TFT_eSPI.h – Simulation shim (stub). * @@ -19,7 +40,9 @@ class TFT_eSPI { void setRotation(uint8_t) {} void fillScreen(uint16_t) {} void setTouch(uint16_t *) {} - bool getTouch(uint16_t *, uint16_t *, uint16_t = 600) { return false; } + bool getTouch(uint16_t *, uint16_t *, uint16_t = 600) { + return false; + } void startWrite() {} void endWrite() {} diff --git a/firmware/sim/include/WiFi.h b/firmware/sim/include/WiFi.h index 385467b..6ff84b6 100644 --- a/firmware/sim/include/WiFi.h +++ b/firmware/sim/include/WiFi.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * WiFi.h – Simulation shim (stubs). */ @@ -5,10 +26,10 @@ #ifndef SIM_WIFI_H #define SIM_WIFI_H -#include - #include "Arduino.h" +#include + typedef enum { WIFI_STA, WIFI_AP, @@ -18,19 +39,27 @@ typedef enum { class IPAddress { uint32_t _addr; + public: - IPAddress() : _addr(0x0100007F) {} /* 127.0.0.1 */ + IPAddress() + : _addr(0x0100007F) {} /* 127.0.0.1 */ /* Implicit conversion lets Serial.print(ip) use the const char* overload. */ - operator const char *() const { return "127.0.0.1"; } + operator const char *() const { + return "127.0.0.1"; + } }; class WiFiClass { public: void mode(wifi_mode_t) {} void disconnect(bool = false) {} - bool softAP(const char *, const char * = nullptr) { return true; } + bool softAP(const char *, const char * = nullptr) { + return true; + } void softAPdisconnect(bool = false) {} - IPAddress softAPIP() { return IPAddress(); } + IPAddress softAPIP() { + return IPAddress(); + } }; extern WiFiClass WiFi; diff --git a/firmware/sim/include/Wire.h b/firmware/sim/include/Wire.h index 6cd2f72..de61743 100644 --- a/firmware/sim/include/Wire.h +++ b/firmware/sim/include/Wire.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Wire.h – Simulation shim (I²C stub). * @@ -8,8 +29,8 @@ #ifndef SIM_WIRE_H #define SIM_WIRE_H -#include #include +#include class TwoWire { public: @@ -18,13 +39,25 @@ class TwoWire { void beginTransmission(uint8_t) {} /** Always returns 2 (NACK) – no I²C devices present. */ - uint8_t endTransmission(bool = true) { return 2; } + uint8_t endTransmission(bool = true) { + return 2; + } - uint8_t requestFrom(uint8_t, uint8_t) { return 0; } - size_t write(uint8_t) { return 1; } - size_t write(const uint8_t *, size_t len) { return len; } - int available() { return 0; } - int read() { return -1; } + uint8_t requestFrom(uint8_t, uint8_t) { + return 0; + } + size_t write(uint8_t) { + return 1; + } + size_t write(const uint8_t *, size_t len) { + return len; + } + int available() { + return 0; + } + int read() { + return -1; + } }; extern TwoWire Wire; diff --git a/firmware/sim/include/esp_now.h b/firmware/sim/include/esp_now.h index 3c2aae6..1a79e2d 100644 --- a/firmware/sim/include/esp_now.h +++ b/firmware/sim/include/esp_now.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * esp_now.h – Simulation shim using UDP sockets. * @@ -47,10 +68,10 @@ bool esp_now_is_peer_exist(const uint8_t *peer_addr); #ifdef SIM_TX #define SIM_LISTEN_PORT 6001 -#define SIM_SEND_PORT 6002 +#define SIM_SEND_PORT 6002 #else #define SIM_LISTEN_PORT 6002 -#define SIM_SEND_PORT 6001 +#define SIM_SEND_PORT 6001 #endif #endif /* SIM_ESP_NOW_H */ diff --git a/firmware/sim/include/freertos/FreeRTOS.h b/firmware/sim/include/freertos/FreeRTOS.h index bba4ee1..415661d 100644 --- a/firmware/sim/include/freertos/FreeRTOS.h +++ b/firmware/sim/include/freertos/FreeRTOS.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * freertos/FreeRTOS.h – Simulation shim. * @@ -14,16 +35,16 @@ typedef int32_t BaseType_t; typedef uint32_t UBaseType_t; typedef uint32_t TickType_t; -#define pdTRUE 1 +#define pdTRUE 1 #define pdFALSE 0 -#define pdPASS pdTRUE -#define pdFAIL pdFALSE +#define pdPASS pdTRUE +#define pdFAIL pdFALSE /** Assume 1 ms per tick for the simulation. */ #define configTICK_RATE_HZ 1000 #define pdMS_TO_TICKS(ms) ((TickType_t)(ms)) -#define pdTICKS_TO_MS(t) ((uint32_t)(t)) +#define pdTICKS_TO_MS(t) ((uint32_t)(t)) #define portMAX_DELAY 0xFFFFFFFF diff --git a/firmware/sim/include/freertos/semphr.h b/firmware/sim/include/freertos/semphr.h index 847069f..7058d56 100644 --- a/firmware/sim/include/freertos/semphr.h +++ b/firmware/sim/include/freertos/semphr.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * freertos/semphr.h – Simulation shim using pthreads mutexes. */ diff --git a/firmware/sim/include/freertos/task.h b/firmware/sim/include/freertos/task.h index ec20121..b2fd17e 100644 --- a/firmware/sim/include/freertos/task.h +++ b/firmware/sim/include/freertos/task.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * freertos/task.h – Simulation shim using pthreads. */ @@ -15,9 +36,6 @@ TickType_t xTaskGetTickCount(); void vTaskDelay(TickType_t ticks); void vTaskDelayUntil(TickType_t *previousWakeTime, TickType_t increment); -BaseType_t xTaskCreatePinnedToCore(TaskFunction_t fn, const char *name, - uint32_t stackDepth, void *param, - UBaseType_t priority, TaskHandle_t *handle, - BaseType_t core); +BaseType_t xTaskCreatePinnedToCore(TaskFunction_t fn, const char *name, uint32_t stackDepth, void *param, UBaseType_t priority, TaskHandle_t *handle, BaseType_t core); #endif /* SIM_FREERTOS_TASK_H */ diff --git a/firmware/sim/include/sim_keyboard.h b/firmware/sim/include/sim_keyboard.h index 3408f60..a092eed 100644 --- a/firmware/sim/include/sim_keyboard.h +++ b/firmware/sim/include/sim_keyboard.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * sim_keyboard.h – Keyboard-to-channel mapping for the TX simulator. * diff --git a/firmware/sim/sim_build.py b/firmware/sim/sim_build.py index 349abc5..ed3bf84 100644 --- a/firmware/sim/sim_build.py +++ b/firmware/sim/sim_build.py @@ -1,3 +1,22 @@ +# Copyright (C) 2026 Peter Buchegger +# +# This file is part of OpenDriveHub. +# +# OpenDriveHub is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# OpenDriveHub is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenDriveHub. If not, see . +# +# SPDX-License-Identifier: GPL-3.0-or-later + """ sim_build.py – PlatformIO extra_script for the simulation environment. diff --git a/firmware/sim/src/sim_arduino.cpp b/firmware/sim/src/sim_arduino.cpp index bd37800..a1ded52 100644 --- a/firmware/sim/src/sim_arduino.cpp +++ b/firmware/sim/src/sim_arduino.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * sim_arduino.cpp – Arduino API implementation for Linux simulation. */ @@ -19,14 +40,12 @@ static auto s_startTime = std::chrono::steady_clock::now(); uint32_t millis() { auto now = std::chrono::steady_clock::now(); - return static_cast( - std::chrono::duration_cast(now - s_startTime).count()); + return static_cast(std::chrono::duration_cast(now - s_startTime).count()); } uint32_t micros() { auto now = std::chrono::steady_clock::now(); - return static_cast( - std::chrono::duration_cast(now - s_startTime).count()); + return static_cast(std::chrono::duration_cast(now - s_startTime).count()); } void delay(uint32_t ms) { diff --git a/firmware/sim/src/sim_async_webserver.cpp b/firmware/sim/src/sim_async_webserver.cpp index cbd220d..44eb0d5 100644 --- a/firmware/sim/src/sim_async_webserver.cpp +++ b/firmware/sim/src/sim_async_webserver.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * sim_async_webserver.cpp – Working ESPAsyncWebServer simulation. * diff --git a/firmware/sim/src/sim_espnow.cpp b/firmware/sim/src/sim_espnow.cpp index 3378257..11777d7 100644 --- a/firmware/sim/src/sim_espnow.cpp +++ b/firmware/sim/src/sim_espnow.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * sim_espnow.cpp – ESP-NOW over UDP sockets. * @@ -7,8 +28,8 @@ * sender's address. */ -#include "esp_now.h" #include "Arduino.h" +#include "esp_now.h" #include #include @@ -22,9 +43,9 @@ /* ── Internal state ─────────────────────────────────────────────────────── */ -static int s_sock = -1; -static esp_now_recv_cb_t s_recvCb = nullptr; -static esp_now_send_cb_t s_sendCb = nullptr; +static int s_sock = -1; +static esp_now_recv_cb_t s_recvCb = nullptr; +static esp_now_send_cb_t s_sendCb = nullptr; static pthread_t s_recvThread; static bool s_running = false; @@ -63,7 +84,7 @@ int esp_now_init() { int opt = 1; setsockopt(s_sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); - struct sockaddr_in addr {}; + struct sockaddr_in addr{}; addr.sin_family = AF_INET; addr.sin_port = htons(SIM_LISTEN_PORT); addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); @@ -76,7 +97,7 @@ int esp_now_init() { } /* Set a receive timeout so the thread can check s_running. */ - struct timeval tv { .tv_sec = 0, .tv_usec = 100000 }; /* 100 ms */ + struct timeval tv{.tv_sec = 0, .tv_usec = 100000}; /* 100 ms */ setsockopt(s_sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); esp_read_mac(s_localMac, ESP_MAC_WIFI_STA); @@ -85,8 +106,7 @@ int esp_now_init() { s_running = true; pthread_create(&s_recvThread, nullptr, recvLoop, nullptr); - printf("[SIM] ESP-NOW init OK – listening on port %d, sending to port %d\n", - SIM_LISTEN_PORT, SIM_SEND_PORT); + printf("[SIM] ESP-NOW init OK – listening on port %d, sending to port %d\n", SIM_LISTEN_PORT, SIM_SEND_PORT); return ESP_OK; } @@ -111,7 +131,8 @@ int esp_now_register_send_cb(esp_now_send_cb_t cb) { } int esp_now_send(const uint8_t *peer_addr, const uint8_t *data, int len) { - if (s_sock < 0 || len <= 0) return ESP_FAIL; + if (s_sock < 0 || len <= 0) + return ESP_FAIL; /* Prepend our MAC address to the payload. */ uint8_t buf[6 + ESP_NOW_MAX_DATA_LEN]; @@ -119,16 +140,14 @@ int esp_now_send(const uint8_t *peer_addr, const uint8_t *data, int len) { int copyLen = len < ESP_NOW_MAX_DATA_LEN ? len : ESP_NOW_MAX_DATA_LEN; memcpy(buf + 6, data, copyLen); - struct sockaddr_in dest {}; + struct sockaddr_in dest{}; dest.sin_family = AF_INET; dest.sin_port = htons(SIM_SEND_PORT); dest.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - ssize_t sent = sendto(s_sock, buf, 6 + copyLen, 0, - reinterpret_cast(&dest), sizeof(dest)); + ssize_t sent = sendto(s_sock, buf, 6 + copyLen, 0, reinterpret_cast(&dest), sizeof(dest)); - esp_now_send_status_t status = - (sent > 0) ? ESP_NOW_SEND_SUCCESS : ESP_NOW_SEND_FAIL; + esp_now_send_status_t status = (sent > 0) ? ESP_NOW_SEND_SUCCESS : ESP_NOW_SEND_FAIL; if (s_sendCb) { s_sendCb(peer_addr, status); @@ -138,11 +157,13 @@ int esp_now_send(const uint8_t *peer_addr, const uint8_t *data, int len) { } int esp_now_add_peer(const esp_now_peer_info_t *peer) { - if (!peer) return ESP_FAIL; + if (!peer) + return ESP_FAIL; std::lock_guard lock(s_peerMutex); /* Don't add duplicates. */ for (auto &p : s_peers) { - if (memcmp(p.mac, peer->peer_addr, 6) == 0) return ESP_OK; + if (memcmp(p.mac, peer->peer_addr, 6) == 0) + return ESP_OK; } PeerEntry e; memcpy(e.mac, peer->peer_addr, 6); @@ -165,7 +186,8 @@ int esp_now_del_peer(const uint8_t *peer_addr) { bool esp_now_is_peer_exist(const uint8_t *peer_addr) { std::lock_guard lock(s_peerMutex); for (auto &p : s_peers) { - if (memcmp(p.mac, peer_addr, 6) == 0) return true; + if (memcmp(p.mac, peer_addr, 6) == 0) + return true; } return false; } diff --git a/firmware/sim/src/sim_freertos.cpp b/firmware/sim/src/sim_freertos.cpp index 2429bba..543a0df 100644 --- a/firmware/sim/src/sim_freertos.cpp +++ b/firmware/sim/src/sim_freertos.cpp @@ -1,13 +1,33 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * sim_freertos.cpp – FreeRTOS API implementation using pthreads. */ +#include "Arduino.h" #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" #include "freertos/task.h" -#include "Arduino.h" - #include #include #include @@ -44,10 +64,7 @@ static void *taskWrapper(void *arg) { return nullptr; } -BaseType_t xTaskCreatePinnedToCore(TaskFunction_t fn, const char *, - uint32_t, void *param, - UBaseType_t, TaskHandle_t *handle, - BaseType_t) { +BaseType_t xTaskCreatePinnedToCore(TaskFunction_t fn, const char *, uint32_t, void *param, UBaseType_t, TaskHandle_t *handle, BaseType_t) { auto *p = new TaskParams{fn, param}; auto *th = new pthread_t; int ret = pthread_create(th, nullptr, taskWrapper, p); @@ -70,7 +87,8 @@ SemaphoreHandle_t xSemaphoreCreateMutex() { } BaseType_t xSemaphoreTake(SemaphoreHandle_t sem, TickType_t timeout) { - if (!sem) return pdFALSE; + if (!sem) + return pdFALSE; auto *mtx = static_cast(sem); if (timeout == portMAX_DELAY) { @@ -90,16 +108,19 @@ BaseType_t xSemaphoreTake(SemaphoreHandle_t sem, TickType_t timeout) { } BaseType_t xSemaphoreGive(SemaphoreHandle_t sem) { - if (!sem) return pdFALSE; + if (!sem) + return pdFALSE; return pthread_mutex_unlock(static_cast(sem)) == 0 ? pdTRUE : pdFALSE; } BaseType_t xSemaphoreTakeFromISR(SemaphoreHandle_t sem, BaseType_t *higherPrioWoken) { - if (higherPrioWoken) *higherPrioWoken = pdFALSE; + if (higherPrioWoken) + *higherPrioWoken = pdFALSE; return xSemaphoreTake(sem, 0); } BaseType_t xSemaphoreGiveFromISR(SemaphoreHandle_t sem, BaseType_t *higherPrioWoken) { - if (higherPrioWoken) *higherPrioWoken = pdFALSE; + if (higherPrioWoken) + *higherPrioWoken = pdFALSE; return xSemaphoreGive(sem); } diff --git a/firmware/sim/src/sim_keyboard.cpp b/firmware/sim/src/sim_keyboard.cpp index feaf15b..ecfc618 100644 --- a/firmware/sim/src/sim_keyboard.cpp +++ b/firmware/sim/src/sim_keyboard.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * sim_keyboard.cpp – Keyboard channel control implementation. */ diff --git a/firmware/sim/src/sim_preferences.cpp b/firmware/sim/src/sim_preferences.cpp index 5dae1fc..8e10a09 100644 --- a/firmware/sim/src/sim_preferences.cpp +++ b/firmware/sim/src/sim_preferences.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * sim_preferences.cpp – In-memory NVS implementation. */ diff --git a/firmware/sim/src/sim_wifi.cpp b/firmware/sim/src/sim_wifi.cpp index 9f5a562..0481b86 100644 --- a/firmware/sim/src/sim_wifi.cpp +++ b/firmware/sim/src/sim_wifi.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * sim_wifi.cpp – WiFi class stub instance. */ diff --git a/firmware/sim/src/sim_wire.cpp b/firmware/sim/src/sim_wire.cpp index 919f3fd..1db0195 100644 --- a/firmware/sim/src/sim_wire.cpp +++ b/firmware/sim/src/sim_wire.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * sim_wire.cpp – TwoWire class stub instance. */ diff --git a/firmware/src/receiver/OutputManager.cpp b/firmware/src/receiver/OutputManager.cpp index 0b21f93..fc7c220 100644 --- a/firmware/src/receiver/OutputManager.cpp +++ b/firmware/src/receiver/OutputManager.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + #include "OutputManager.h" #include diff --git a/firmware/src/receiver/OutputManager.h b/firmware/src/receiver/OutputManager.h index 20887da..689f4ba 100644 --- a/firmware/src/receiver/OutputManager.h +++ b/firmware/src/receiver/OutputManager.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * OutputManager – owns and manages all output drivers for the receiver. * diff --git a/firmware/src/receiver/ReceiverApp.cpp b/firmware/src/receiver/ReceiverApp.cpp index 49fa231..a230106 100644 --- a/firmware/src/receiver/ReceiverApp.cpp +++ b/firmware/src/receiver/ReceiverApp.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + #include "ReceiverApp.h" #include diff --git a/firmware/src/receiver/ReceiverApp.h b/firmware/src/receiver/ReceiverApp.h index 52a95ad..5b06342 100644 --- a/firmware/src/receiver/ReceiverApp.h +++ b/firmware/src/receiver/ReceiverApp.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * ReceiverApp – top-level application class for the receiver firmware. * diff --git a/firmware/src/receiver/main.cpp b/firmware/src/receiver/main.cpp index 4eb8cfa..290391e 100644 --- a/firmware/src/receiver/main.cpp +++ b/firmware/src/receiver/main.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * OpenDriveHub – Receiver Firmware Entry Point * diff --git a/firmware/src/receiver/output/IOutputDriver.h b/firmware/src/receiver/output/IOutputDriver.h index 2e426be..7187989 100644 --- a/firmware/src/receiver/output/IOutputDriver.h +++ b/firmware/src/receiver/output/IOutputDriver.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * IOutputDriver – abstract interface for model outputs. * diff --git a/firmware/src/receiver/output/LoggingOutput.h b/firmware/src/receiver/output/LoggingOutput.h index fa05a75..b44db59 100644 --- a/firmware/src/receiver/output/LoggingOutput.h +++ b/firmware/src/receiver/output/LoggingOutput.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * LoggingOutput – simulation-only output driver that logs values. */ diff --git a/firmware/src/receiver/output/Pca9685Output.cpp b/firmware/src/receiver/output/Pca9685Output.cpp index 16d66e7..892adfa 100644 --- a/firmware/src/receiver/output/Pca9685Output.cpp +++ b/firmware/src/receiver/output/Pca9685Output.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + #include "Pca9685Output.h" #ifndef NATIVE_SIM diff --git a/firmware/src/receiver/output/Pca9685Output.h b/firmware/src/receiver/output/Pca9685Output.h index 92a20ff..a0d64b8 100644 --- a/firmware/src/receiver/output/Pca9685Output.h +++ b/firmware/src/receiver/output/Pca9685Output.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Pca9685Output – servo/ESC output via PCA9685 16-channel I²C PWM driver. * diff --git a/firmware/src/receiver/web/ReceiverApi.cpp b/firmware/src/receiver/web/ReceiverApi.cpp index 4a0304e..922e03d 100644 --- a/firmware/src/receiver/web/ReceiverApi.cpp +++ b/firmware/src/receiver/web/ReceiverApi.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + #include "ReceiverApi.h" #include "ApiHandler.h" diff --git a/firmware/src/receiver/web/ReceiverApi.h b/firmware/src/receiver/web/ReceiverApi.h index c9608d3..8d5b058 100644 --- a/firmware/src/receiver/web/ReceiverApi.h +++ b/firmware/src/receiver/web/ReceiverApi.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * ReceiverApi – REST API endpoints for the receiver web configuration. * diff --git a/firmware/src/transmitter/TransmitterApp.cpp b/firmware/src/transmitter/TransmitterApp.cpp index 99c3959..e32a4b0 100644 --- a/firmware/src/transmitter/TransmitterApp.cpp +++ b/firmware/src/transmitter/TransmitterApp.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * TransmitterApp – implementation. */ diff --git a/firmware/src/transmitter/TransmitterApp.h b/firmware/src/transmitter/TransmitterApp.h index 9cb7064..baaf31c 100644 --- a/firmware/src/transmitter/TransmitterApp.h +++ b/firmware/src/transmitter/TransmitterApp.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * TransmitterApp – top-level application class for the transmitter. * diff --git a/firmware/src/transmitter/backplane/Backplane.cpp b/firmware/src/transmitter/backplane/Backplane.cpp index 768c7e6..7256c15 100644 --- a/firmware/src/transmitter/backplane/Backplane.cpp +++ b/firmware/src/transmitter/backplane/Backplane.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Backplane – implementation. */ diff --git a/firmware/src/transmitter/backplane/Backplane.h b/firmware/src/transmitter/backplane/Backplane.h index e9f4aa5..17851d7 100644 --- a/firmware/src/transmitter/backplane/Backplane.h +++ b/firmware/src/transmitter/backplane/Backplane.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Backplane – TCA9548A I²C-multiplexer manager. * diff --git a/firmware/src/transmitter/display/Display.cpp b/firmware/src/transmitter/display/Display.cpp index d5dab88..8fe8337 100644 --- a/firmware/src/transmitter/display/Display.cpp +++ b/firmware/src/transmitter/display/Display.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Display – implementation. * diff --git a/firmware/src/transmitter/display/Display.h b/firmware/src/transmitter/display/Display.h index 07fa1a2..4dafaa7 100644 --- a/firmware/src/transmitter/display/Display.h +++ b/firmware/src/transmitter/display/Display.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Display – ILI9341 LCD + XPT2046 touch screen (LVGL-based). * diff --git a/firmware/src/transmitter/display/display_utils.h b/firmware/src/transmitter/display/display_utils.h index 2cd75a3..c8f46d8 100644 --- a/firmware/src/transmitter/display/display_utils.h +++ b/firmware/src/transmitter/display/display_utils.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * display_utils.h – pure, hardware-independent display helper functions. * diff --git a/firmware/src/transmitter/main.cpp b/firmware/src/transmitter/main.cpp index a81f4eb..c789aa5 100644 --- a/firmware/src/transmitter/main.cpp +++ b/firmware/src/transmitter/main.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * OpenDriveHub – Transmitter Firmware * Minimal entry point – all logic in TransmitterApp. diff --git a/firmware/src/transmitter/modules/ButtonModule.cpp b/firmware/src/transmitter/modules/ButtonModule.cpp index 07dfd17..0d2f81f 100644 --- a/firmware/src/transmitter/modules/ButtonModule.cpp +++ b/firmware/src/transmitter/modules/ButtonModule.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * ButtonModule – implementation. */ diff --git a/firmware/src/transmitter/modules/ButtonModule.h b/firmware/src/transmitter/modules/ButtonModule.h index 21f49bc..4a524c3 100644 --- a/firmware/src/transmitter/modules/ButtonModule.h +++ b/firmware/src/transmitter/modules/ButtonModule.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * ButtonModule – 8-way momentary push-button bank. * diff --git a/firmware/src/transmitter/modules/EncoderModule.cpp b/firmware/src/transmitter/modules/EncoderModule.cpp index cf8d681..4e3c2ea 100644 --- a/firmware/src/transmitter/modules/EncoderModule.cpp +++ b/firmware/src/transmitter/modules/EncoderModule.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * EncoderModule – implementation. */ diff --git a/firmware/src/transmitter/modules/EncoderModule.h b/firmware/src/transmitter/modules/EncoderModule.h index 16f7bb1..dc04579 100644 --- a/firmware/src/transmitter/modules/EncoderModule.h +++ b/firmware/src/transmitter/modules/EncoderModule.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * EncoderModule – magnetic rotary encoder. * diff --git a/firmware/src/transmitter/modules/IModule.h b/firmware/src/transmitter/modules/IModule.h index bbb7be4..39588b9 100644 --- a/firmware/src/transmitter/modules/IModule.h +++ b/firmware/src/transmitter/modules/IModule.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * IModule – abstract interface for all plug-in input modules. * diff --git a/firmware/src/transmitter/modules/InputMap.h b/firmware/src/transmitter/modules/InputMap.h index a7f9639..941f162 100644 --- a/firmware/src/transmitter/modules/InputMap.h +++ b/firmware/src/transmitter/modules/InputMap.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * InputMap – physical input → logical function assignment. * diff --git a/firmware/src/transmitter/modules/ModuleManager.cpp b/firmware/src/transmitter/modules/ModuleManager.cpp index e8c2a99..01e8aed 100644 --- a/firmware/src/transmitter/modules/ModuleManager.cpp +++ b/firmware/src/transmitter/modules/ModuleManager.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * ModuleManager – implementation. */ diff --git a/firmware/src/transmitter/modules/ModuleManager.h b/firmware/src/transmitter/modules/ModuleManager.h index adddd73..8b89e73 100644 --- a/firmware/src/transmitter/modules/ModuleManager.h +++ b/firmware/src/transmitter/modules/ModuleManager.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * ModuleManager – detection, initialisation, and periodic update of * all plug-in modules behind the I²C-mux backplane. diff --git a/firmware/src/transmitter/modules/PotModule.cpp b/firmware/src/transmitter/modules/PotModule.cpp index 55eab4f..cdc31d7 100644 --- a/firmware/src/transmitter/modules/PotModule.cpp +++ b/firmware/src/transmitter/modules/PotModule.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * PotModule – implementation. */ diff --git a/firmware/src/transmitter/modules/PotModule.h b/firmware/src/transmitter/modules/PotModule.h index e6e35e8..9e85bde 100644 --- a/firmware/src/transmitter/modules/PotModule.h +++ b/firmware/src/transmitter/modules/PotModule.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * PotModule – potentiometer / fader bank module. * diff --git a/firmware/src/transmitter/modules/SwitchModule.cpp b/firmware/src/transmitter/modules/SwitchModule.cpp index bfd2fd7..b7eb28f 100644 --- a/firmware/src/transmitter/modules/SwitchModule.cpp +++ b/firmware/src/transmitter/modules/SwitchModule.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * SwitchModule – implementation. */ diff --git a/firmware/src/transmitter/modules/SwitchModule.h b/firmware/src/transmitter/modules/SwitchModule.h index 4d84e55..7eff8e0 100644 --- a/firmware/src/transmitter/modules/SwitchModule.h +++ b/firmware/src/transmitter/modules/SwitchModule.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * SwitchModule – 8-way switch bank. * diff --git a/firmware/src/transmitter/web/TransmitterApi.cpp b/firmware/src/transmitter/web/TransmitterApi.cpp index 8df8819..b4854ab 100644 --- a/firmware/src/transmitter/web/TransmitterApi.cpp +++ b/firmware/src/transmitter/web/TransmitterApi.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * TransmitterApi – implementation. */ diff --git a/firmware/src/transmitter/web/TransmitterApi.h b/firmware/src/transmitter/web/TransmitterApi.h index 28960d5..d890004 100644 --- a/firmware/src/transmitter/web/TransmitterApi.h +++ b/firmware/src/transmitter/web/TransmitterApi.h @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * TransmitterApi – REST API endpoints for transmitter configuration. * diff --git a/firmware/test/test_native/test_display.cpp b/firmware/test/test_native/test_display.cpp index 5b5a336..73d9c84 100644 --- a/firmware/test/test_native/test_display.cpp +++ b/firmware/test/test_native/test_display.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Native unit tests for the display utility helpers (display_utils.h). * diff --git a/firmware/test/test_native/test_function_map.cpp b/firmware/test/test_native/test_function_map.cpp index 525e630..45cce31 100644 --- a/firmware/test/test_native/test_function_map.cpp +++ b/firmware/test/test_native/test_function_map.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Native unit tests for the function map and vehicle model presets. * @@ -94,8 +115,7 @@ void test_channel_to_function_found(void) { auto m = defaultFunctionMap(ModelType::Tractor); auto func = channelToFunction(m, 2); TEST_ASSERT_TRUE(func.has_value()); - TEST_ASSERT_EQUAL_UINT8(static_cast(Function::Pto), - static_cast(func.value())); + TEST_ASSERT_EQUAL_UINT8(static_cast(Function::Pto), static_cast(func.value())); } void test_channel_to_function_not_found(void) { diff --git a/firmware/test/test_native/test_protocol.cpp b/firmware/test/test_native/test_protocol.cpp index 18c8b70..4653194 100644 --- a/firmware/test/test_native/test_protocol.cpp +++ b/firmware/test/test_native/test_protocol.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2026 Peter Buchegger + * + * This file is part of OpenDriveHub. + * + * OpenDriveHub is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenDriveHub is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenDriveHub. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + /** * Native unit tests for the ODH protocol utilities. * @@ -32,10 +53,8 @@ void test_checksum_xor_properties(void) { } void test_checksum_known_vector(void) { - uint8_t data[] = {kMagic0, kMagic1, kProtocolVersion, - static_cast(PacketType::Control)}; - uint8_t expected = - kMagic0 ^ kMagic1 ^ kProtocolVersion ^ static_cast(PacketType::Control); + uint8_t data[] = {kMagic0, kMagic1, kProtocolVersion, static_cast(PacketType::Control)}; + uint8_t expected = kMagic0 ^ kMagic1 ^ kProtocolVersion ^ static_cast(PacketType::Control); TEST_ASSERT_EQUAL_UINT8(expected, checksum(data, 4)); } @@ -151,8 +170,7 @@ void test_announce_name_max_length(void) { /* ── Disconnect packet type ──────────────────────────────────────────────── */ void test_disconnect_packet_type(void) { - TEST_ASSERT_NOT_EQUAL(static_cast(PacketType::Bind), - static_cast(PacketType::Disconnect)); + TEST_ASSERT_NOT_EQUAL(static_cast(PacketType::Bind), static_cast(PacketType::Disconnect)); TEST_ASSERT_EQUAL_UINT8(0x40, static_cast(PacketType::Disconnect)); } @@ -175,14 +193,10 @@ void test_link_state_scanning_value(void) { } void test_link_state_scanning_distinct(void) { - TEST_ASSERT_NOT_EQUAL(static_cast(LinkState::Disconnected), - static_cast(LinkState::Scanning)); - TEST_ASSERT_NOT_EQUAL(static_cast(LinkState::Binding), - static_cast(LinkState::Scanning)); - TEST_ASSERT_NOT_EQUAL(static_cast(LinkState::Connected), - static_cast(LinkState::Scanning)); - TEST_ASSERT_NOT_EQUAL(static_cast(LinkState::Failsafe), - static_cast(LinkState::Scanning)); + TEST_ASSERT_NOT_EQUAL(static_cast(LinkState::Disconnected), static_cast(LinkState::Scanning)); + TEST_ASSERT_NOT_EQUAL(static_cast(LinkState::Binding), static_cast(LinkState::Scanning)); + TEST_ASSERT_NOT_EQUAL(static_cast(LinkState::Connected), static_cast(LinkState::Scanning)); + TEST_ASSERT_NOT_EQUAL(static_cast(LinkState::Failsafe), static_cast(LinkState::Scanning)); } void test_max_discovered_constant(void) { @@ -196,8 +210,7 @@ static uint16_t pot_map(int32_t raw, int32_t adcMax) { raw = 0; if (raw > adcMax) raw = adcMax; - uint32_t mapped = kChannelMin + (static_cast(raw) * (kChannelMax - kChannelMin)) / - static_cast(adcMax); + uint32_t mapped = kChannelMin + (static_cast(raw) * (kChannelMax - kChannelMin)) / static_cast(adcMax); return static_cast(mapped); } @@ -225,8 +238,7 @@ void test_pot_map_clamps_overflow(void) { static uint16_t enc_map(uint16_t raw) { if (raw > 4095) raw = 4095; - uint32_t mapped = - kChannelMin + (static_cast(raw) * (kChannelMax - kChannelMin)) / 4095u; + uint32_t mapped = kChannelMin + (static_cast(raw) * (kChannelMax - kChannelMin)) / 4095u; return static_cast(mapped); }