Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.gnu.org/licenses/>.
*
* 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`**
Expand Down Expand Up @@ -167,13 +200,15 @@ 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
2. `pio run -e receiver` – compiles
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)

Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
20 changes: 20 additions & 0 deletions firmware/data/receiver/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
<!--
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 <https://www.gnu.org/licenses/>.

SPDX-License-Identifier: GPL-3.0-or-later
-->
<!DOCTYPE html>
<html lang="en">

Expand Down
20 changes: 20 additions & 0 deletions firmware/data/transmitter/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
<!--
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 <https://www.gnu.org/licenses/>.

SPDX-License-Identifier: GPL-3.0-or-later
-->
<!DOCTYPE html>
<html lang="en">

Expand Down
21 changes: 21 additions & 0 deletions firmware/include/User_Setup.h
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/

/**
* TFT_eSPI user setup for OpenDriveHub transmitter.
*
Expand Down
21 changes: 21 additions & 0 deletions firmware/include/lv_conf.h
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/

/**
* LVGL v8 configuration for OpenDriveHub transmitter display.
*
Expand Down
21 changes: 21 additions & 0 deletions firmware/lib/odh-config/Config.h
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/

/**
* OpenDriveHub – Unified Compile-Time Configuration
*
Expand Down
21 changes: 21 additions & 0 deletions firmware/lib/odh-config/NvsStore.h
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/

/**
* NvsStore – RAII wrapper around ESP32 Preferences for NVS access.
*
Expand Down
21 changes: 21 additions & 0 deletions firmware/lib/odh-protocol/FunctionMap.h
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/

/**
* FunctionMap – vehicle model presets and function-to-channel mapping utilities
*
Expand Down
21 changes: 21 additions & 0 deletions firmware/lib/odh-protocol/Protocol.h
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/

/**
* OpenDriveHub Protocol – Modern C++ Definitions
*
Expand Down
21 changes: 21 additions & 0 deletions firmware/lib/odh-radio/IRadioLink.h
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/

/**
* IRadioLink – abstract interface for ESP-NOW radio links.
*
Expand Down
21 changes: 21 additions & 0 deletions firmware/lib/odh-radio/ReceiverRadioLink.cpp
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#include "ReceiverRadioLink.h"

#include <Arduino.h>
Expand Down
21 changes: 21 additions & 0 deletions firmware/lib/odh-radio/ReceiverRadioLink.h
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/

/**
* ReceiverRadioLink – ESP-NOW radio link for the receiver side.
*
Expand Down
21 changes: 21 additions & 0 deletions firmware/lib/odh-radio/TransmitterRadioLink.cpp
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#include "TransmitterRadioLink.h"

#include <Arduino.h>
Expand Down
Loading