From 6572fcac4f0988b6217c1389d926a563537fbe57 Mon Sep 17 00:00:00 2001 From: Zyun Lam Date: Sat, 9 Sep 2023 22:32:17 -0500 Subject: [PATCH 1/6] Add instruction for a precommit hook to automatically clang-tidy the codebase before each commit. --- README.md | 24 +++++++++++++----------- tools/pre-commit | 3 +++ 2 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 tools/pre-commit diff --git a/README.md b/README.md index 81a33cd6..7759bc49 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ # TARS Flight Software Repository -Illinois Space Society's flight software codebase for the TARS system. - -
-
-Click to see a cool video! +Illinois Space Society's flight software codebase for the TARS system. + +
+
+Click to see a cool video!
### Directory Structure: -- `TARS/`: Mission critical flight software running on TARS. This is the code that actually flies on the rocket - - `src/`: All the flight code that we write ourselves is in this directory. - - `common/`: Utility code we write that is used across microcontrollers. - - `mcu_main/`: Code for the primary microcontroller on TARS (Teensy 4.1) - - `mcu_telemetry/`: Code for the microcontroller in charge of telemetry and GPS (ESP32-S3) - - `mcu_power`: Code for the microcontroller on the power board (ATMega328P) +- `TARS/`: Mission critical flight software running on TARS. This is the code that actually flies on the rocket + - `src/`: All the flight code that we write ourselves is in this directory. + - `common/`: Utility code we write that is used across microcontrollers. + - `mcu_main/`: Code for the primary microcontroller on TARS (Teensy 4.1) + - `mcu_telemetry/`: Code for the microcontroller in charge of telemetry and GPS (ESP32-S3) + - `mcu_power`: Code for the microcontroller on the power board (ATMega328P) - `lib/`: Third-party libraries that are not available on the PlatformIO Registry. Other libraries are included via the `lib_deps` build flag in `platformio.ini` - `ground/`: Code running on ground station hardware (Adafruit LoRa Feather) @@ -72,3 +72,5 @@ Things to keep in mind about code formatting: - Exempt directories should be listed in `.clang-format-ignore` so they don't get auto-formatted by the script. - Exempt directories should also be listed in `.github/workflows/clang_format_check.yml` on the lines with `exclude:`, so they're not checked for style violations by GitHub. - Changing/tweaking the style guide is always option! If you have ideas, reach out! + + - You can copy the file tools/pre-commit to .git/hooks with the command `cp tools/pre-commit .git/hooks/pre-commit` to automatically run clang tidy before committing. diff --git a/tools/pre-commit b/tools/pre-commit new file mode 100644 index 00000000..a99b959a --- /dev/null +++ b/tools/pre-commit @@ -0,0 +1,3 @@ +#!/bin/sh +python run_clang_format.py -r -i . +exit 0 From 32f7ce6af3dc5510edfed78d26f0f07ca5a0c475 Mon Sep 17 00:00:00 2001 From: Zyun Lam Date: Sat, 9 Sep 2023 23:07:31 -0500 Subject: [PATCH 2/6] Add instruction for a precommit hook to automatically clang-tidy the codebase before each commit. --- tools/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/pre-commit b/tools/pre-commit index a99b959a..cd7c4c2e 100644 --- a/tools/pre-commit +++ b/tools/pre-commit @@ -1,3 +1,3 @@ #!/bin/sh -python run_clang_format.py -r -i . +python run_clang_format.py -r -i TARS exit 0 From 25dc20e105ca9dc7d891c1fe6c206bc80c1f80ea Mon Sep 17 00:00:00 2001 From: Zyun Lam Date: Sat, 9 Sep 2023 23:17:00 -0500 Subject: [PATCH 3/6] Make sure files are added before the commit --- TARS/src/mcu_main/telemetry.h | 4 ++-- TARS/src/mcu_telemetry/main.cpp | 4 ++-- tools/pre-commit | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TARS/src/mcu_main/telemetry.h b/TARS/src/mcu_main/telemetry.h index 6a0d1d74..446dbe02 100644 --- a/TARS/src/mcu_main/telemetry.h +++ b/TARS/src/mcu_main/telemetry.h @@ -23,7 +23,7 @@ class Telemetry; extern Telemetry tlm; struct TelemetryDataLite { - systime_t timestamp; //[0, 2^32] + systime_t timestamp; //[0, 2^32] uint16_t barometer_pressure; //[0, 4096] int16_t highG_ax; //[128, -128] @@ -33,7 +33,7 @@ struct TelemetryDataLite { int16_t bno_pitch; //[-4,4] int16_t bno_yaw; //[-4,4] - float flap_extension; //[0, 256] + float flap_extension; //[0, 256] }; struct TelemetryPacket { diff --git a/TARS/src/mcu_telemetry/main.cpp b/TARS/src/mcu_telemetry/main.cpp index d6655655..b0db00d6 100644 --- a/TARS/src/mcu_telemetry/main.cpp +++ b/TARS/src/mcu_telemetry/main.cpp @@ -13,11 +13,11 @@ (https://www.sparkfun.com/products/14425) Open the serial monitor at 115200 baud to see the output */ -#include //Needed for I2C to GNSS +#include //Needed for I2C to GNSS #include //http://librarymanager/All#SparkFun_u-blox_GNSS_v3 -SFE_UBLOX_GNSS myGNSS; // SFE_UBLOX_GNSS uses I2C. For Serial or SPI, see Example2 and Example3 +SFE_UBLOX_GNSS myGNSS; // SFE_UBLOX_GNSS uses I2C. For Serial or SPI, see Example2 and Example3 void setup() { Serial.begin(115200); diff --git a/tools/pre-commit b/tools/pre-commit index cd7c4c2e..8b999a9b 100644 --- a/tools/pre-commit +++ b/tools/pre-commit @@ -1,3 +1,4 @@ #!/bin/sh python run_clang_format.py -r -i TARS +git add . exit 0 From 14600eaa0c856b16be26a3b9bc5ab0b718fb9b31 Mon Sep 17 00:00:00 2001 From: Zyun Lam Date: Sat, 9 Sep 2023 23:19:10 -0500 Subject: [PATCH 4/6] Revert "Auxiliary commit to revert individual files from 25dc20e105ca9dc7d891c1fe6c206bc80c1f80ea" This reverts commit 2061694ecd09aad4d000026ead2702cd2cf73561. From 197c85181b6cb5f14048e47206a8e48d7825f537 Mon Sep 17 00:00:00 2001 From: Zyun Lam Date: Sat, 9 Sep 2023 23:19:45 -0500 Subject: [PATCH 5/6] Revert "Auxiliary commit to revert individual files from 25dc20e105ca9dc7d891c1fe6c206bc80c1f80ea" This reverts commit 76bf38c48cda407d53f9e56075cc03d0659f1f3b. From f1ec884caf67f551f785cd5a6d42e89342034711 Mon Sep 17 00:00:00 2001 From: Zyun Lam Date: Sat, 9 Sep 2023 23:20:22 -0500 Subject: [PATCH 6/6] Revert "Auxiliary commit to revert individual files from 25dc20e105ca9dc7d891c1fe6c206bc80c1f80ea" This reverts commit da4240b7ffdb3d352a59b2cf47eed9333752c1c0. --- TARS/src/mcu_main/telemetry.h | 4 ++-- TARS/src/mcu_telemetry/main.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TARS/src/mcu_main/telemetry.h b/TARS/src/mcu_main/telemetry.h index 446dbe02..6a0d1d74 100644 --- a/TARS/src/mcu_main/telemetry.h +++ b/TARS/src/mcu_main/telemetry.h @@ -23,7 +23,7 @@ class Telemetry; extern Telemetry tlm; struct TelemetryDataLite { - systime_t timestamp; //[0, 2^32] + systime_t timestamp; //[0, 2^32] uint16_t barometer_pressure; //[0, 4096] int16_t highG_ax; //[128, -128] @@ -33,7 +33,7 @@ struct TelemetryDataLite { int16_t bno_pitch; //[-4,4] int16_t bno_yaw; //[-4,4] - float flap_extension; //[0, 256] + float flap_extension; //[0, 256] }; struct TelemetryPacket { diff --git a/TARS/src/mcu_telemetry/main.cpp b/TARS/src/mcu_telemetry/main.cpp index b0db00d6..d6655655 100644 --- a/TARS/src/mcu_telemetry/main.cpp +++ b/TARS/src/mcu_telemetry/main.cpp @@ -13,11 +13,11 @@ (https://www.sparkfun.com/products/14425) Open the serial monitor at 115200 baud to see the output */ -#include //Needed for I2C to GNSS +#include //Needed for I2C to GNSS #include //http://librarymanager/All#SparkFun_u-blox_GNSS_v3 -SFE_UBLOX_GNSS myGNSS; // SFE_UBLOX_GNSS uses I2C. For Serial or SPI, see Example2 and Example3 +SFE_UBLOX_GNSS myGNSS; // SFE_UBLOX_GNSS uses I2C. For Serial or SPI, see Example2 and Example3 void setup() { Serial.begin(115200);