From d7e0e627a3c499f0a5afd71324d16e994d167a78 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 19 Mar 2024 17:19:08 +1300 Subject: [PATCH 001/109] chore(library): Bump version date to `2024-3-19` This is to ensure the relevant pull request for this branch gets created as early as possible, because this branch will introduce an exciting new feature... --- examples/flight_modes/flight_modes.ino | 2 +- examples/link_stats/link_stats.ino | 2 +- examples/platformio/main.cpp | 2 +- examples/rc_channels/rc_channels.ino | 2 +- examples/telemetry/telemetry.ino | 2 +- src/CFA_Config.hpp | 4 ++-- src/CRSFforArduino.cpp | 2 +- src/CRSFforArduino.hpp | 2 +- src/SerialReceiver/CRC/CRC.cpp | 2 +- src/SerialReceiver/CRC/CRC.hpp | 2 +- src/SerialReceiver/CRSF/CRSF.cpp | 2 +- src/SerialReceiver/CRSF/CRSF.hpp | 2 +- src/SerialReceiver/CRSF/CRSFProtocol.hpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.cpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.hpp | 2 +- src/SerialReceiver/SerialReceiver.cpp | 2 +- src/SerialReceiver/SerialReceiver.hpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.cpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.hpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.cpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.hpp | 2 +- 21 files changed, 22 insertions(+), 22 deletions(-) diff --git a/examples/flight_modes/flight_modes.ino b/examples/flight_modes/flight_modes.ino index 26d0aa15..f3cbee6c 100644 --- a/examples/flight_modes/flight_modes.ino +++ b/examples/flight_modes/flight_modes.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read flight modes from a receiver. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/link_stats/link_stats.ino b/examples/link_stats/link_stats.ino index 1707d208..81830cb1 100644 --- a/examples/link_stats/link_stats.ino +++ b/examples/link_stats/link_stats.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read link statistics from a receiver. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/platformio/main.cpp b/examples/platformio/main.cpp index f93ab0ff..e812c347 100644 --- a/examples/platformio/main.cpp +++ b/examples/platformio/main.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the main development file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/rc_channels/rc_channels.ino b/examples/rc_channels/rc_channels.ino index a4c11c77..89e57e9b 100644 --- a/examples/rc_channels/rc_channels.ino +++ b/examples/rc_channels/rc_channels.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read rc channels from a receiver. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/telemetry/telemetry.ino b/examples/telemetry/telemetry.ino index d6c3e5ab..b0ae94fb 100644 --- a/examples/telemetry/telemetry.ino +++ b/examples/telemetry/telemetry.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to send telemetry back to your RC handset using CRSF for Arduino. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index c7f17c50..9fda3b6a 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the configuration file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -37,7 +37,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-3-8" +#define CRSFFORARDUINO_VERSION_DATE "2024-3-19" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/CRSFforArduino.cpp b/src/CRSFforArduino.cpp index 8651480b..3cc6e39a 100644 --- a/src/CRSFforArduino.cpp +++ b/src/CRSFforArduino.cpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CRSFforArduino.hpp b/src/CRSFforArduino.hpp index 606f6713..b5bcaba7 100644 --- a/src/CRSFforArduino.hpp +++ b/src/CRSFforArduino.hpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRC/CRC.cpp b/src/SerialReceiver/CRC/CRC.cpp index f2100e93..3cf00638 100644 --- a/src/SerialReceiver/CRC/CRC.cpp +++ b/src/SerialReceiver/CRC/CRC.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRC/CRC.hpp b/src/SerialReceiver/CRC/CRC.hpp index 5e30e4a0..32eac55b 100644 --- a/src/SerialReceiver/CRC/CRC.hpp +++ b/src/SerialReceiver/CRC/CRC.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.cpp b/src/SerialReceiver/CRSF/CRSF.cpp index b6e68d77..f9ca60fe 100644 --- a/src/SerialReceiver/CRSF/CRSF.cpp +++ b/src/SerialReceiver/CRSF/CRSF.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index 294fa675..13ed0777 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSFProtocol.hpp b/src/SerialReceiver/CRSF/CRSFProtocol.hpp index e60cab94..9b666260 100644 --- a/src/SerialReceiver/CRSF/CRSFProtocol.hpp +++ b/src/SerialReceiver/CRSF/CRSFProtocol.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This file contains enums and structs for the CRSF protocol. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp index 8e5baa08..f1cb4513 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp index 4796fbed..772fd216 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index 81dc96ca..1405d956 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.hpp b/src/SerialReceiver/SerialReceiver.hpp index 41814075..14e5247b 100644 --- a/src/SerialReceiver/SerialReceiver.hpp +++ b/src/SerialReceiver/SerialReceiver.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.cpp b/src/SerialReceiver/Telemetry/Telemetry.cpp index 050f0679..7d05ee3e 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.cpp +++ b/src/SerialReceiver/Telemetry/Telemetry.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index e18813d1..b6dbbdca 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.cpp b/src/hal/CompatibilityTable/CompatibilityTable.cpp index 6d46c45b..d9604db3 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.cpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.hpp b/src/hal/CompatibilityTable/CompatibilityTable.hpp index c8a3f5ea..7185eddd 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.hpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-3-8 + * @date 2024-3-19 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From 9174a6bc9cffe1e88be0893a8860bf671a482bb8 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 9 Apr 2024 09:40:32 +1200 Subject: [PATCH 002/109] chore(library): Bump version date to `2024-4-9` --- examples/flight_modes/flight_modes.ino | 2 +- examples/link_stats/link_stats.ino | 2 +- examples/platformio/main.cpp | 2 +- examples/rc_channels/rc_channels.ino | 2 +- examples/telemetry/telemetry.ino | 2 +- src/CFA_Config.hpp | 4 ++-- src/CRSFforArduino.cpp | 2 +- src/CRSFforArduino.hpp | 2 +- src/SerialReceiver/CRC/CRC.cpp | 2 +- src/SerialReceiver/CRC/CRC.hpp | 2 +- src/SerialReceiver/CRSF/CRSF.cpp | 2 +- src/SerialReceiver/CRSF/CRSF.hpp | 2 +- src/SerialReceiver/CRSF/CRSFProtocol.hpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.cpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.hpp | 2 +- src/SerialReceiver/SerialReceiver.cpp | 2 +- src/SerialReceiver/SerialReceiver.hpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.cpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.hpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.cpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.hpp | 2 +- 21 files changed, 22 insertions(+), 22 deletions(-) diff --git a/examples/flight_modes/flight_modes.ino b/examples/flight_modes/flight_modes.ino index f3cbee6c..d8ba02ce 100644 --- a/examples/flight_modes/flight_modes.ino +++ b/examples/flight_modes/flight_modes.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read flight modes from a receiver. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/link_stats/link_stats.ino b/examples/link_stats/link_stats.ino index 81830cb1..404912c6 100644 --- a/examples/link_stats/link_stats.ino +++ b/examples/link_stats/link_stats.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read link statistics from a receiver. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/platformio/main.cpp b/examples/platformio/main.cpp index e812c347..976acf8d 100644 --- a/examples/platformio/main.cpp +++ b/examples/platformio/main.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the main development file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/rc_channels/rc_channels.ino b/examples/rc_channels/rc_channels.ino index 89e57e9b..5e762764 100644 --- a/examples/rc_channels/rc_channels.ino +++ b/examples/rc_channels/rc_channels.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read rc channels from a receiver. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/telemetry/telemetry.ino b/examples/telemetry/telemetry.ino index b0ae94fb..b8a33794 100644 --- a/examples/telemetry/telemetry.ino +++ b/examples/telemetry/telemetry.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to send telemetry back to your RC handset using CRSF for Arduino. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 9fda3b6a..a955c61b 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the configuration file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -37,7 +37,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-3-19" +#define CRSFFORARDUINO_VERSION_DATE "2024-4-9" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/CRSFforArduino.cpp b/src/CRSFforArduino.cpp index 3cc6e39a..e6014729 100644 --- a/src/CRSFforArduino.cpp +++ b/src/CRSFforArduino.cpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CRSFforArduino.hpp b/src/CRSFforArduino.hpp index b5bcaba7..be5164fe 100644 --- a/src/CRSFforArduino.hpp +++ b/src/CRSFforArduino.hpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRC/CRC.cpp b/src/SerialReceiver/CRC/CRC.cpp index 3cf00638..e8419884 100644 --- a/src/SerialReceiver/CRC/CRC.cpp +++ b/src/SerialReceiver/CRC/CRC.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRC/CRC.hpp b/src/SerialReceiver/CRC/CRC.hpp index 32eac55b..7bf6863c 100644 --- a/src/SerialReceiver/CRC/CRC.hpp +++ b/src/SerialReceiver/CRC/CRC.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.cpp b/src/SerialReceiver/CRSF/CRSF.cpp index f9ca60fe..f15341a3 100644 --- a/src/SerialReceiver/CRSF/CRSF.cpp +++ b/src/SerialReceiver/CRSF/CRSF.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index 13ed0777..a9533b20 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSFProtocol.hpp b/src/SerialReceiver/CRSF/CRSFProtocol.hpp index 9b666260..4b673316 100644 --- a/src/SerialReceiver/CRSF/CRSFProtocol.hpp +++ b/src/SerialReceiver/CRSF/CRSFProtocol.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This file contains enums and structs for the CRSF protocol. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp index f1cb4513..f70abd2d 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp index 772fd216..57e2673f 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index 1405d956..f4f0b059 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.hpp b/src/SerialReceiver/SerialReceiver.hpp index 14e5247b..b7f7ac9c 100644 --- a/src/SerialReceiver/SerialReceiver.hpp +++ b/src/SerialReceiver/SerialReceiver.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.cpp b/src/SerialReceiver/Telemetry/Telemetry.cpp index 7d05ee3e..f1120fbe 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.cpp +++ b/src/SerialReceiver/Telemetry/Telemetry.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index b6dbbdca..5a42a13d 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.cpp b/src/hal/CompatibilityTable/CompatibilityTable.cpp index d9604db3..ee681a64 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.cpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.hpp b/src/hal/CompatibilityTable/CompatibilityTable.hpp index 7185eddd..b35381ec 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.hpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-3-19 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From fd448be90968720a854e2026de64f03ebe6c9965 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 9 Apr 2024 11:02:30 +1200 Subject: [PATCH 003/109] feat(serial transmitter layer): :sparkles: Initial commit for Serial Transmitter Interface This sets the precedence for the Serial Transmitter's API This is not yet functional. --- src/SerialTransmitter/SerialTransmitter.cpp | 103 ++++++++++++++++++++ src/SerialTransmitter/SerialTransmitter.hpp | 48 +++++++++ 2 files changed, 151 insertions(+) create mode 100644 src/SerialTransmitter/SerialTransmitter.cpp create mode 100644 src/SerialTransmitter/SerialTransmitter.hpp diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp new file mode 100644 index 00000000..34d93989 --- /dev/null +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -0,0 +1,103 @@ +/** + * @file SerialReceiver.cpp + * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) + * @brief The Serial Transmitter layer for the CRSF for Arduino library. + * @version 1.1.0 + * @date 2024-4-9 + * + * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. + * + * @section License GNU General Public License v3.0 + * This source file is a part of the CRSF for Arduino library. + * CRSF for Arduino 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. + * + * CRSF for Arduino 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 CRSF for Arduino. If not, see . + * + */ + +#include "SerialTransmitter.hpp" +#include "../hal/CompatibilityTable/CompatibilityTable.hpp" +#include "Arduino.h" + +using namespace hal; + +namespace serialTransmitterLayer +{ + SerialTransmitter::SerialTransmitter() + { + #if defined(ARDUINO_ARCH_STM32) +#if defined(HAVE_HWSERIAL1) + _uart = &Serial1; +#elif defined(HAVE_HWSERIAL2) + _uart = &Serial2; +#elif defined(HAVE_HWSERIAL3) + _uart = &Serial3; +#endif +#elif defined(ARDUINO_ARCH_ESP32) + _uart = &Serial1; + +#if defined(D0) + _rxPin = D0; +#else + _rxPin = 0; +#endif + +#if defined(D1) + _txPin = D1; +#else + _txPin = 1; +#endif +#else + _uart = &Serial1; +#endif + } + + SerialTransmitter::SerialTransmitter(HardwareSerial *hwUartPort) + { + _uart = hwUartPort; + +#if defined(ARDUINO_ARCH_ESP32) +#if defined(D0) + _rxPin = D0; +#else + _rxPin = 0; +#endif + +#if defined(D1) + _txPin = D1; +#else + _txPin = 1; +#endif +#endif + } + + SerialTransmitter::SerialTransmitter(HardwareSerial *hwUartPort, int8_t rxPin, int8_t txPin) + { + _uart = hwUartPort; + +#if defined(ARDUINO_ARCH_ESP32) + _rxPin = rxPin; + _txPin = txPin; +#else + (void)rxPin; + (void)txPin; +#endif + } + + SerialTransmitter::~SerialTransmitter() + { + _uart = nullptr; + + _rxPin = -1; + _txPin = -1; + } +} // namespace serialTransmitterLayer diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp new file mode 100644 index 00000000..75175054 --- /dev/null +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -0,0 +1,48 @@ +/** + * @file SerialTransmitter.hpp + * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) + * @brief The Serial Transmitter layer for the CRSF for Arduino library. + * @version 1.1.0 + * @date 2024-4-9 + * + * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. + * + * @section License GNU General Public License v3.0 + * This source file is a part of the CRSF for Arduino library. + * CRSF for Arduino 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. + * + * CRSF for Arduino 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 CRSF for Arduino. If not, see . + * + */ + +#pragma once + +#include "../CFA_Config.hpp" +#include "Arduino.h" + +namespace serialTransmitterLayer +{ + class SerialTransmitter + { + public: + SerialTransmitter(); + SerialTransmitter(HardwareSerial *hwUartPort); + SerialTransmitter(HardwareSerial *hwUartPort, int8_t rxPin, int8_t txPin); + virtual ~SerialTransmitter(); + + private: + HardwareSerial *_uart; + + int8_t _rxPin = -1; + int8_t _txPin = -1; + }; +} // namespace serialTransmitterLayer From 580b543123bd80d33f95f51c0d7dde4148caf338 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 20 Apr 2024 11:19:46 +1200 Subject: [PATCH 004/109] chore(library): Bump version date to `2024-4-20` --- examples/flight_modes/flight_modes.ino | 2 +- examples/link_stats/link_stats.ino | 2 +- examples/platformio/main.cpp | 2 +- examples/rc_channels/rc_channels.ino | 2 +- examples/telemetry/telemetry.ino | 2 +- src/CFA_Config.hpp | 4 ++-- src/CRSFforArduino.cpp | 2 +- src/CRSFforArduino.hpp | 2 +- src/SerialReceiver/CRC/CRC.cpp | 2 +- src/SerialReceiver/CRC/CRC.hpp | 2 +- src/SerialReceiver/CRSF/CRSF.cpp | 2 +- src/SerialReceiver/CRSF/CRSF.hpp | 2 +- src/SerialReceiver/CRSF/CRSFProtocol.hpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.cpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.hpp | 2 +- src/SerialReceiver/SerialReceiver.cpp | 2 +- src/SerialReceiver/SerialReceiver.hpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.cpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.hpp | 2 +- src/SerialTransmitter/SerialTransmitter.cpp | 2 +- src/SerialTransmitter/SerialTransmitter.hpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.cpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.hpp | 2 +- 23 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/flight_modes/flight_modes.ino b/examples/flight_modes/flight_modes.ino index 4c7388f2..54498ad9 100644 --- a/examples/flight_modes/flight_modes.ino +++ b/examples/flight_modes/flight_modes.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read flight modes from a receiver. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/link_stats/link_stats.ino b/examples/link_stats/link_stats.ino index c62d8f33..440bf787 100644 --- a/examples/link_stats/link_stats.ino +++ b/examples/link_stats/link_stats.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read link statistics from a receiver. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/platformio/main.cpp b/examples/platformio/main.cpp index 69279774..d280eca6 100644 --- a/examples/platformio/main.cpp +++ b/examples/platformio/main.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the main development file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/rc_channels/rc_channels.ino b/examples/rc_channels/rc_channels.ino index fb4ebec7..45526b0f 100644 --- a/examples/rc_channels/rc_channels.ino +++ b/examples/rc_channels/rc_channels.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read rc channels from a receiver. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/telemetry/telemetry.ino b/examples/telemetry/telemetry.ino index 4a75e0c1..8a94b827 100644 --- a/examples/telemetry/telemetry.ino +++ b/examples/telemetry/telemetry.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to send telemetry back to your RC handset using CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 519acdbe..a238bdc0 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the configuration file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -37,7 +37,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-4-18" +#define CRSFFORARDUINO_VERSION_DATE "2024-4-20" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/CRSFforArduino.cpp b/src/CRSFforArduino.cpp index e69c540b..92513f1d 100644 --- a/src/CRSFforArduino.cpp +++ b/src/CRSFforArduino.cpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CRSFforArduino.hpp b/src/CRSFforArduino.hpp index 4b005674..4bca6021 100644 --- a/src/CRSFforArduino.hpp +++ b/src/CRSFforArduino.hpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRC/CRC.cpp b/src/SerialReceiver/CRC/CRC.cpp index 3b987718..baa14c7f 100644 --- a/src/SerialReceiver/CRC/CRC.cpp +++ b/src/SerialReceiver/CRC/CRC.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRC/CRC.hpp b/src/SerialReceiver/CRC/CRC.hpp index 789dc1cb..80f54a41 100644 --- a/src/SerialReceiver/CRC/CRC.hpp +++ b/src/SerialReceiver/CRC/CRC.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.cpp b/src/SerialReceiver/CRSF/CRSF.cpp index 9c58a5e6..ea6c14e0 100644 --- a/src/SerialReceiver/CRSF/CRSF.cpp +++ b/src/SerialReceiver/CRSF/CRSF.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index 6684507b..98c1ea03 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSFProtocol.hpp b/src/SerialReceiver/CRSF/CRSFProtocol.hpp index b187cd7f..9594df98 100644 --- a/src/SerialReceiver/CRSF/CRSFProtocol.hpp +++ b/src/SerialReceiver/CRSF/CRSFProtocol.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This file contains enums and structs for the CRSF protocol. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp index 9189d55d..be74c7e0 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp index c55369e6..4e61a88d 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index f5c5f9e2..98127106 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.hpp b/src/SerialReceiver/SerialReceiver.hpp index 537caabc..ddc81fae 100644 --- a/src/SerialReceiver/SerialReceiver.hpp +++ b/src/SerialReceiver/SerialReceiver.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.cpp b/src/SerialReceiver/Telemetry/Telemetry.cpp index 811cbfdf..40b4a112 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.cpp +++ b/src/SerialReceiver/Telemetry/Telemetry.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index 17af0ca3..3fca2b8d 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index 34d93989..09bf7181 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index 75175054..c9b0278d 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.cpp b/src/hal/CompatibilityTable/CompatibilityTable.cpp index 669a703d..0709d953 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.cpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.hpp b/src/hal/CompatibilityTable/CompatibilityTable.hpp index 6a1001f8..04670989 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.hpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-18 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From 30b620ea662ba35daa3137563e5b101c820c33e7 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 20 Apr 2024 11:24:08 +1200 Subject: [PATCH 005/109] fix(defect): :adhesive_bandage: Class `SerialTransmitter` has a constructor that is not explicit --- src/SerialTransmitter/SerialTransmitter.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index c9b0278d..ffb80960 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -26,7 +26,9 @@ #pragma once +#ifndef ENV_DEFECT_DETECTOR #include "../CFA_Config.hpp" +#endif #include "Arduino.h" namespace serialTransmitterLayer @@ -35,7 +37,7 @@ namespace serialTransmitterLayer { public: SerialTransmitter(); - SerialTransmitter(HardwareSerial *hwUartPort); + explicit SerialTransmitter(HardwareSerial *hwUartPort); SerialTransmitter(HardwareSerial *hwUartPort, int8_t rxPin, int8_t txPin); virtual ~SerialTransmitter(); From 8c434de50b988076df93fb7a83e32912ca60d98c Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 20 Apr 2024 11:27:04 +1200 Subject: [PATCH 006/109] build(`platformio.ini`): Temporarily restrict Quality Control builds to commonly used targets This temporarily speeds up development of the Serial Transmitter Interface. Once development on it is complete, running Quality Control on all supported targets will be reinstated. --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index d438cf92..328e8571 100644 --- a/platformio.ini +++ b/platformio.ini @@ -13,7 +13,7 @@ core_dir = .pio/core default_envs = ; defect_detector ; development - ${build.all} + ${build.commonly_used} extra_configs = targets/common.ini targets/quality_control.ini From 86e9337cbfb34aeebdca5894949e701a9886824b Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 14:31:09 +1200 Subject: [PATCH 007/109] chore(library): :construction: Initial commit on working Serial Transmitter Interface prototype This is initially populated with the typical Arduino "boiler plate" code what prints "Hello, World!" to the terminal. --- .../serial_transmitter_prototype.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/platformio/serial_transmitter_prototype.cpp diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp new file mode 100644 index 00000000..ea619f9c --- /dev/null +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -0,0 +1,21 @@ +#if __has_include("Arduino.h") +#include "Arduino.h" +#define ARDUINO_IS_INCLUDED 1 +#else +#define ARDUINO_IS_INCLUDED 0 +#endif + +#if ARDUINO_IS_INCLUDED == 1 +void setup() +{ + Serial.begin(115200); + while (!Serial) + { + delay(10); + } + Serial.println("Hello, World!"); +} + +void loop() +{} +#endif From 2e8b53bf0b8a8118c78177149b5c3bee05d10973 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 14:33:45 +1200 Subject: [PATCH 008/109] build(`platformio.ini`): :wrench: Create a secure development environment and enable it This development environment will remain enabled until development of the Serial Transmitter Interface is complete. --- platformio.ini | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/platformio.ini b/platformio.ini index 328e8571..c1e539a7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,8 +12,8 @@ core_dir = .pio/core default_envs = ; defect_detector - ; development - ${build.commonly_used} + development + ; ${build.commonly_used} extra_configs = targets/common.ini targets/quality_control.ini @@ -29,11 +29,31 @@ lib_dir = src src_dir = src test_dir = -; [env:development] -; board = adafruit_metro_m4 -; build_src_filter = -; +<../examples/platformio/cfa_code_test.cpp> -; +<*/*/*.cpp> -; +<*.cpp> -; build_type = debug -; extends = env_common_samd51 +[env:development] +board = adafruit_metro_m4 +build_flags = +build_src_flags = + ; Compile hardening flags: + -O2 + -Wall + -Wextra + -Wformat + -Wformat=2 + ; -Wconversion ; Disabled due to spamming conversion issues in packages outside the scope of CRSF for Arduino. + -Wimplicit-fallthrough + -U_FORTIFY_SOURCE + -D_FORTIFY_SOURCE=3 + -D_GLIBCXX_ASSERTIONS + ; -fsrict-flex-arrays=3 ; Not available in GCC Arm Compiler v12.3.1 + -fstack-clash-protection + -fstack-protector-strong +build_src_filter = + +<../examples/platformio/serial_transmitter_prototype.cpp> + +<*/*/*.cpp> + +<*.cpp> +build_type = debug +build_unflags = + -Os +extends = env_common_samd51 +platform_packages = + platformio/toolchain-gccarmnoneeabi @ 1.120301.0 ; PlatformIO's latest GCC Compiler version From 8573a744a2e01d09a18c236917c395e38a11a615 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 18:55:38 +1200 Subject: [PATCH 009/109] refactor(serial transmitter prototype): :construction: Print the time delta (in microseconds) to the terminal at the selected packet rate Pakcet rates are based on ExpressLRS' packet rates. --- .../serial_transmitter_prototype.cpp | 99 ++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index ea619f9c..4ebfe2a1 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -5,6 +5,48 @@ #define ARDUINO_IS_INCLUDED 0 #endif +/* Packet rate enumeration. */ +typedef enum packet_rate_index_e +{ + PACKET_RATE_4HZ, + PACKET_RATE_25HZ, + PACKET_RATE_50HZ, + PACKET_RATE_100HZ, + PACKET_RATE_150HZ, + PACKET_RATE_200HZ, + PACKET_RATE_250HZ, + PACKET_RATE_333HZ, + PACKET_RATE_500HZ, + PACKET_RATE_1000HZ, + PACKET_RATE_COUNT +} packet_rate_index_t; + +/* Selected packet rate. */ +const packet_rate_index_t selected_packet_rate = PACKET_RATE_50HZ; +uint32_t *packet_rate_us = nullptr; + +/* Time structure for the packet rate. */ +typedef struct time_s +{ + uint32_t time_us = 0; + uint32_t time_us_last = 0xFFFFFFFF; + uint32_t time_us_delta = 0xFFFFFFFF; +} time_t; + +/* Time structure instance. */ +time_t *time = nullptr; + +/* Exit handler. */ +void exitHandler() +{ + /* Clean up and stop. */ + delete[] packet_rate_us; + delete time; + + /* Print a message to the serial monitor. */ + Serial.println("Done!"); +} + #if ARDUINO_IS_INCLUDED == 1 void setup() { @@ -13,9 +55,62 @@ void setup() { delay(10); } - Serial.println("Hello, World!"); + + /* Dynamically allocate memory for the packet rate, + and calculate the time in microseconds for each packet rate. */ + packet_rate_us = new uint32_t[PACKET_RATE_COUNT]; + packet_rate_us[PACKET_RATE_4HZ] = (1000000UL / 4UL); + packet_rate_us[PACKET_RATE_25HZ] = (1000000UL / 25UL); + packet_rate_us[PACKET_RATE_50HZ] = (1000000UL / 50UL); + packet_rate_us[PACKET_RATE_100HZ] = (1000000UL / 100UL); + packet_rate_us[PACKET_RATE_150HZ] = (1000000UL / 150UL); + packet_rate_us[PACKET_RATE_200HZ] = (1000000UL / 200UL); + packet_rate_us[PACKET_RATE_250HZ] = (1000000UL / 250UL); + packet_rate_us[PACKET_RATE_333HZ] = (1000000UL / 333UL); + packet_rate_us[PACKET_RATE_500HZ] = (1000000UL / 500UL); + packet_rate_us[PACKET_RATE_1000HZ] = (1000000UL / 1000UL); + + /* Initialize the time structure. */ + time = new time_t; + + /* Set the time in microseconds for the selected packet rate. */ + time->time_us = packet_rate_us[selected_packet_rate]; } void loop() -{} +{ + + static uint32_t iteration = 0; + + /* Calculate the number of iterations based on the selected packet rate and the equivalent total execution time of three seconds. */ + static const uint32_t iterations = (3000000UL / packet_rate_us[selected_packet_rate]); + + if (iteration < iterations) + { + /* Calculate the time delta in microseconds. */ + time->time_us = micros(); + time->time_us_delta = time->time_us - time->time_us_last; + + /* Check if the time delta is greater than the time in microseconds for the selected packet rate. */ + if (time->time_us_delta >= packet_rate_us[selected_packet_rate]) + { + /* Print the time delta in microseconds. */ + Serial.print("Time Delta: "); + Serial.print(time->time_us_delta); + Serial.println(" us"); + + /* Set the last time in microseconds. */ + time->time_us_last = time->time_us; + + /* Increment the iteration. */ + iteration++; + } + } + else + { + /* Exit the program. */ + atexit(exitHandler); + exit(EXIT_SUCCESS); + } +} #endif From 2a735619a4dcdc13f68d78cdb1237c56f782fa5a Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 19:08:28 +1200 Subject: [PATCH 010/109] fix(serial transmitter prototype): :bug: Fix `time_us` overflow on first iteration --- examples/platformio/serial_transmitter_prototype.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 4ebfe2a1..79aae5b3 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -29,8 +29,8 @@ uint32_t *packet_rate_us = nullptr; typedef struct time_s { uint32_t time_us = 0; - uint32_t time_us_last = 0xFFFFFFFF; - uint32_t time_us_delta = 0xFFFFFFFF; + uint32_t time_us_last = 0; + uint32_t time_us_delta = 0; } time_t; /* Time structure instance. */ @@ -73,8 +73,9 @@ void setup() /* Initialize the time structure. */ time = new time_t; - /* Set the time in microseconds for the selected packet rate. */ - time->time_us = packet_rate_us[selected_packet_rate]; + /* Set the time in microseconds. */ + time->time_us = micros(); + time->time_us_last = time->time_us; } void loop() From b8f00e611ad729da7a7f2368cf5ea664b7a6dcc9 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 20:21:45 +1200 Subject: [PATCH 011/109] feat(serial transmitter prototype): :sparkles: Write 64 bytes of data with `Serial1` at the selected packet rate This sets the stage for CRSF packets. --- examples/platformio/serial_transmitter_prototype.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 79aae5b3..8687b283 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -36,6 +36,9 @@ typedef struct time_s /* Time structure instance. */ time_t *time = nullptr; +const size_t serial_buffer_size = 64; +uint8_t serial_buffer[serial_buffer_size] = { 0 }; + /* Exit handler. */ void exitHandler() { @@ -73,6 +76,10 @@ void setup() /* Initialize the time structure. */ time = new time_t; + /* Initialise Serial1 with 1.87M baud rate. */ + Serial1.begin(1875000); + memset(serial_buffer, 0, serial_buffer_size); + /* Set the time in microseconds. */ time->time_us = micros(); time->time_us_last = time->time_us; @@ -103,6 +110,9 @@ void loop() /* Set the last time in microseconds. */ time->time_us_last = time->time_us; + /* Write 64 bytes to Serial1. */ + Serial1.write(serial_buffer, serial_buffer_size); + /* Increment the iteration. */ iteration++; } From 4419b03c5f05beff4c8166366916ff7763148c1c Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 20:23:07 +1200 Subject: [PATCH 012/109] feat(serial transmitter prototype): :sparkles: Prototype transmit frame error This drops a frame when the time jitter is more than two microseconds. --- .../serial_transmitter_prototype.cpp | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 8687b283..f2af1767 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -31,6 +31,7 @@ typedef struct time_s uint32_t time_us = 0; uint32_t time_us_last = 0; uint32_t time_us_delta = 0; + int32_t time_us_error = 0; } time_t; /* Time structure instance. */ @@ -99,8 +100,11 @@ void loop() time->time_us = micros(); time->time_us_delta = time->time_us - time->time_us_last; - /* Check if the time delta is greater than the time in microseconds for the selected packet rate. */ - if (time->time_us_delta >= packet_rate_us[selected_packet_rate]) + /* Calculate the time error in microseconds. */ + time->time_us_error = time->time_us - (time->time_us_last + packet_rate_us[selected_packet_rate]); + + /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than 2 microseconds. */ + if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < 2) { /* Print the time delta in microseconds. */ Serial.print("Time Delta: "); @@ -116,6 +120,24 @@ void loop() /* Increment the iteration. */ iteration++; } + + /* If the time error is greater than or equal to 2 microseconds. */ + else if (time->time_us_error >= 2) + { + /* Print an error message to the serial monitor. */ + Serial.println("Error: Time error is greater than or equal to 2 microseconds."); + + /* Print how far the time error is from the packet rate in microseconds. */ + Serial.print("Time Error: "); + Serial.print(time->time_us_error); + Serial.println(" us"); + + /* Increment the iteration. */ + iteration++; + + /* Set the last time in microseconds. */ + time->time_us_last = time->time_us; + } } else { From f44f2c18956eabaaad33ec49bee5a266b8c821a7 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 08:59:23 +1200 Subject: [PATCH 013/109] build(`platformio.ini`): :construction_worker: Explicitly use CppCheck in development environment CppCheck is used to check for any defects during development. --- platformio.ini | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platformio.ini b/platformio.ini index c1e539a7..e6b26d32 100644 --- a/platformio.ini +++ b/platformio.ini @@ -54,6 +54,13 @@ build_src_filter = build_type = debug build_unflags = -Os +check_flags = + --enable=all + --disable=missingInclude + --disable=unusedFunction +check_severity = low, medium, high +check_skip_packages = yes +check_tool = cppcheck extends = env_common_samd51 platform_packages = platformio/toolchain-gccarmnoneeabi @ 1.120301.0 ; PlatformIO's latest GCC Compiler version From 60a2f689aaece62f203a74df35560ee871441bf3 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 09:03:47 +1200 Subject: [PATCH 014/109] chore(`platformio.ini`): :wrench: Upgrade C++11 to GNU C++23 Using the latest version of C++ keeps its security up-to-date. --- platformio.ini | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platformio.ini b/platformio.ini index e6b26d32..578557d2 100644 --- a/platformio.ini +++ b/platformio.ini @@ -33,6 +33,8 @@ test_dir = board = adafruit_metro_m4 build_flags = build_src_flags = + ; Force GNU C++ 23: + -std=c++23 ; Compile hardening flags: -O2 -Wall @@ -53,11 +55,14 @@ build_src_filter = +<*.cpp> build_type = debug build_unflags = + -c++11 -Os check_flags = --enable=all --disable=missingInclude --disable=unusedFunction + --language=c++ + --std=c++23 check_severity = low, medium, high check_skip_packages = yes check_tool = cppcheck From a88225d420c2a1d65420fa16d72b4de211bd68d4 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 09:21:36 +1200 Subject: [PATCH 015/109] chore(`platformio.ini`): Explicitly specify `gnu++23` --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 578557d2..25c75a8e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -34,7 +34,7 @@ board = adafruit_metro_m4 build_flags = build_src_flags = ; Force GNU C++ 23: - -std=c++23 + -std=gnu++23 ; Compile hardening flags: -O2 -Wall From 7dfe13c20777af952962b9d3c1d510f5bbfafad0 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 09:33:33 +1200 Subject: [PATCH 016/109] refactor(serial transmitter prototype): :recycle: Use `const int32_t` for maximum allowed time error --- examples/platformio/serial_transmitter_prototype.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index f2af1767..126745b4 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -32,6 +32,7 @@ typedef struct time_s uint32_t time_us_last = 0; uint32_t time_us_delta = 0; int32_t time_us_error = 0; + const int32_t time_us_max_allowed_error = 2; } time_t; /* Time structure instance. */ @@ -103,8 +104,8 @@ void loop() /* Calculate the time error in microseconds. */ time->time_us_error = time->time_us - (time->time_us_last + packet_rate_us[selected_packet_rate]); - /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than 2 microseconds. */ - if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < 2) + /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than the maximum allowed error. */ + if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < time->time_us_max_allowed_error) { /* Print the time delta in microseconds. */ Serial.print("Time Delta: "); @@ -121,8 +122,8 @@ void loop() iteration++; } - /* If the time error is greater than or equal to 2 microseconds. */ - else if (time->time_us_error >= 2) + /* If the time error is greater than or equal to the maximum allowed error. */ + else if (time->time_us_error >= time->time_us_max_allowed_error) { /* Print an error message to the serial monitor. */ Serial.println("Error: Time error is greater than or equal to 2 microseconds."); From a6a13ce87ace11d35c610e77db6d6b17c82a2d0b Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 10:16:14 +1200 Subject: [PATCH 017/109] refactor(serial transmitter prototype): :recycle: Replace `serial_buffer` placeholder with `crsf_tx_frame` --- .../serial_transmitter_prototype.cpp | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 126745b4..fca73777 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -35,11 +35,28 @@ typedef struct time_s const int32_t time_us_max_allowed_error = 2; } time_t; +/* CRSF Frame structure and union. */ +typedef struct crsf_frame_s +{ + uint8_t sync; + uint8_t length; + uint8_t type; + uint8_t payload[60]; + uint8_t crc; +} crsf_frame_t; + +const size_t crsf_frame_size = sizeof(crsf_frame_t); + +typedef union crsf_tx_frame_u +{ + crsf_frame_t frame; + uint8_t buffer[crsf_frame_size]; +} crsf_tx_frame_t; + /* Time structure instance. */ time_t *time = nullptr; -const size_t serial_buffer_size = 64; -uint8_t serial_buffer[serial_buffer_size] = { 0 }; +crsf_tx_frame_t crsf_tx_frame; /* Exit handler. */ void exitHandler() @@ -80,7 +97,7 @@ void setup() /* Initialise Serial1 with 1.87M baud rate. */ Serial1.begin(1875000); - memset(serial_buffer, 0, serial_buffer_size); + memset(&crsf_tx_frame, 0, crsf_frame_size); /* Set the time in microseconds. */ time->time_us = micros(); @@ -116,7 +133,7 @@ void loop() time->time_us_last = time->time_us; /* Write 64 bytes to Serial1. */ - Serial1.write(serial_buffer, serial_buffer_size); + Serial1.write(crsf_tx_frame.buffer, crsf_frame_size); /* Increment the iteration. */ iteration++; From 0515624a096efcb15cd2960ab5645f30be04eaa1 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 10:36:48 +1200 Subject: [PATCH 018/109] refactor(serial transmitter prototype): :recycle: Improve error handling Instead of spamming the time delta in the Terminal, a simple notification is sent; and the prototyp test now halts when the `time_us_max_allowed_error` is exceeded. --- .../serial_transmitter_prototype.cpp | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index fca73777..38461423 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -58,15 +58,31 @@ time_t *time = nullptr; crsf_tx_frame_t crsf_tx_frame; -/* Exit handler. */ -void exitHandler() +/* Exit handlers. */ +void exit_success_handler() { /* Clean up and stop. */ delete[] packet_rate_us; delete time; /* Print a message to the serial monitor. */ - Serial.println("Done!"); + Serial.println("Program has ended successfully."); +} + +void exit_time_max_allowed_error_handler() +{ + /* Print a message to the serial monitor. */ + Serial.print("Program has ended with an error: "); + Serial.println("Time error is greater than the maximum allowed error."); + + /* Print how far the time error is from the packet rate in microseconds. */ + Serial.print("Time Error: "); + Serial.print(time->time_us_error); + Serial.println(" us"); + + /* Clean up and stop. */ + delete[] packet_rate_us; + delete time; } #if ARDUINO_IS_INCLUDED == 1 @@ -99,6 +115,9 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); + /* Print a message to the serial monitor. */ + Serial.println("Testing CRSF Serial Transmitter Prototype..."); + /* Set the time in microseconds. */ time->time_us = micros(); time->time_us_last = time->time_us; @@ -124,11 +143,6 @@ void loop() /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than the maximum allowed error. */ if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < time->time_us_max_allowed_error) { - /* Print the time delta in microseconds. */ - Serial.print("Time Delta: "); - Serial.print(time->time_us_delta); - Serial.println(" us"); - /* Set the last time in microseconds. */ time->time_us_last = time->time_us; @@ -142,25 +156,15 @@ void loop() /* If the time error is greater than or equal to the maximum allowed error. */ else if (time->time_us_error >= time->time_us_max_allowed_error) { - /* Print an error message to the serial monitor. */ - Serial.println("Error: Time error is greater than or equal to 2 microseconds."); - - /* Print how far the time error is from the packet rate in microseconds. */ - Serial.print("Time Error: "); - Serial.print(time->time_us_error); - Serial.println(" us"); - - /* Increment the iteration. */ - iteration++; - - /* Set the last time in microseconds. */ - time->time_us_last = time->time_us; + /* Exit the program. */ + atexit(exit_time_max_allowed_error_handler); + exit(EXIT_FAILURE); } } else { /* Exit the program. */ - atexit(exitHandler); + atexit(exit_success_handler); exit(EXIT_SUCCESS); } } From ed3de8dd99a999bc3afcd3e21d70755281f3e0ab Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:37:39 +1200 Subject: [PATCH 019/109] refactor(serial transmitter prototype): :construction: Introduce CRC8-DVB-S2 functions These will be used to calculate the CRC to be appended to the CRSF RC Channels data packet. --- .../serial_transmitter_prototype.cpp | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 38461423..69da9263 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -58,6 +58,37 @@ time_t *time = nullptr; crsf_tx_frame_t crsf_tx_frame; +/* CRC8-DVB-S2. */ +uint8_t crc8_dvb_s2(uint8_t crc, const uint8_t data) +{ + crc ^= data; + for (uint8_t i = 0; i < 8; i++) + { + if (crc & 0x80) + { + crc = (crc << 1) ^ 0xD5; + } + else + { + crc <<= 1; + } + } + return crc; +} + +/* This function calculates the CRC for the CRSF frame +from the type to the end of the payload. */ +uint8_t calculate_crc(const crsf_tx_frame_t *crsf_tx_frame) +{ + uint8_t crc = 0; + crc = crc8_dvb_s2(crc, crsf_tx_frame->frame.type); + for (uint8_t i = 0; i < crsf_tx_frame->frame.length - 2; i++) + { + crc = crc8_dvb_s2(crc, crsf_tx_frame->frame.payload[i]); + } + return crc; +} + /* Exit handlers. */ void exit_success_handler() { From 613e80387fcd7c112dcf09c84160d2f9fed34749 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:39:58 +1200 Subject: [PATCH 020/109] refactor(serial transmitter prototype): :construction: Flesh out packed RC Channels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All RC Channels are 'centred' except for `ch5` which is initialised to `1000 µS`. --- .../serial_transmitter_prototype.cpp | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 69da9263..7f9b3240 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -35,6 +35,29 @@ typedef struct time_s const int32_t time_us_max_allowed_error = 2; } time_t; +/* Packed 11-bit RC Channels. */ +struct rc_channels_packed_s +{ + uint16_t ch1 : 11; + uint16_t ch2 : 11; + uint16_t ch3 : 11; + uint16_t ch4 : 11; + uint16_t ch5 : 11; + uint16_t ch6 : 11; + uint16_t ch7 : 11; + uint16_t ch8 : 11; + uint16_t ch9 : 11; + uint16_t ch10 : 11; + uint16_t ch11 : 11; + uint16_t ch12 : 11; + uint16_t ch13 : 11; + uint16_t ch14 : 11; + uint16_t ch15 : 11; + uint16_t ch16 : 11; +} __attribute__((packed)); + +typedef struct rc_channels_packed_s rc_channels_packed_t; + /* CRSF Frame structure and union. */ typedef struct crsf_frame_s { @@ -146,6 +169,26 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); + /* Initialise the RC Channels structure. */ + rc_channels_packed_t rc_channels_packed; + rc_channels_packed.ch1 = 992; + rc_channels_packed.ch2 = 992; + rc_channels_packed.ch3 = 992; + rc_channels_packed.ch4 = 992; + rc_channels_packed.ch5 = 178; + rc_channels_packed.ch6 = 992; + rc_channels_packed.ch7 = 992; + rc_channels_packed.ch8 = 992; + rc_channels_packed.ch9 = 992; + rc_channels_packed.ch10 = 992; + rc_channels_packed.ch11 = 992; + rc_channels_packed.ch12 = 992; + rc_channels_packed.ch13 = 992; + rc_channels_packed.ch14 = 992; + rc_channels_packed.ch15 = 992; + rc_channels_packed.ch16 = 992; + + /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); From 0252a806037c083d8213d7e0170bd9f997b32a8c Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:40:57 +1200 Subject: [PATCH 021/109] refactor(serial transmitter prototype): :recycle: Prepare CRSF RC Channels Packed data... ...and send it at the selected packet rate. --- examples/platformio/serial_transmitter_prototype.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 7f9b3240..f283db9d 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -188,6 +188,12 @@ void setup() rc_channels_packed.ch15 = 992; rc_channels_packed.ch16 = 992; + /* Prepare the CRSF RC Channels Packed frame. */ + crsf_tx_frame.frame.sync = 0xC8; // NB: EdgeTX uses 0xEE which is incorrect. + crsf_tx_frame.frame.length = 24; + crsf_tx_frame.frame.type = 0x16; + memcpy(crsf_tx_frame.frame.payload, &rc_channels_packed, sizeof(rc_channels_packed)); + crsf_tx_frame.frame.crc = calculate_crc(&crsf_tx_frame); /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); @@ -221,7 +227,7 @@ void loop() time->time_us_last = time->time_us; /* Write 64 bytes to Serial1. */ - Serial1.write(crsf_tx_frame.buffer, crsf_frame_size); + Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); /* Increment the iteration. */ iteration++; From f2d42ed5851683b854a46920fb22c1228ba0d19e Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 27 Apr 2024 09:04:51 +1200 Subject: [PATCH 022/109] fix(serial transmitter prototype): :rotating_light: Rename time structure to avoid naming conflicts --- .../serial_transmitter_prototype.cpp | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index f283db9d..ae003278 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -26,14 +26,14 @@ const packet_rate_index_t selected_packet_rate = PACKET_RATE_50HZ; uint32_t *packet_rate_us = nullptr; /* Time structure for the packet rate. */ -typedef struct time_s +typedef struct software_realtime_counter_s { uint32_t time_us = 0; uint32_t time_us_last = 0; uint32_t time_us_delta = 0; int32_t time_us_error = 0; const int32_t time_us_max_allowed_error = 2; -} time_t; +} software_realtime_counter_t; /* Packed 11-bit RC Channels. */ struct rc_channels_packed_s @@ -77,7 +77,7 @@ typedef union crsf_tx_frame_u } crsf_tx_frame_t; /* Time structure instance. */ -time_t *time = nullptr; +software_realtime_counter_t *sw_timer = nullptr; crsf_tx_frame_t crsf_tx_frame; @@ -117,7 +117,7 @@ void exit_success_handler() { /* Clean up and stop. */ delete[] packet_rate_us; - delete time; + delete sw_timer; /* Print a message to the serial monitor. */ Serial.println("Program has ended successfully."); @@ -129,14 +129,14 @@ void exit_time_max_allowed_error_handler() Serial.print("Program has ended with an error: "); Serial.println("Time error is greater than the maximum allowed error."); - /* Print how far the time error is from the packet rate in microseconds. */ + /* Print how far the sw_timer error is from the packet rate in microseconds. */ Serial.print("Time Error: "); - Serial.print(time->time_us_error); + Serial.print(sw_timer->time_us_error); Serial.println(" us"); /* Clean up and stop. */ delete[] packet_rate_us; - delete time; + delete sw_timer; } #if ARDUINO_IS_INCLUDED == 1 @@ -149,7 +149,7 @@ void setup() } /* Dynamically allocate memory for the packet rate, - and calculate the time in microseconds for each packet rate. */ + and calculate the sw_timer in microseconds for each packet rate. */ packet_rate_us = new uint32_t[PACKET_RATE_COUNT]; packet_rate_us[PACKET_RATE_4HZ] = (1000000UL / 4UL); packet_rate_us[PACKET_RATE_25HZ] = (1000000UL / 25UL); @@ -162,8 +162,8 @@ void setup() packet_rate_us[PACKET_RATE_500HZ] = (1000000UL / 500UL); packet_rate_us[PACKET_RATE_1000HZ] = (1000000UL / 1000UL); - /* Initialize the time structure. */ - time = new time_t; + /* Initialize the sw_timer structure. */ + sw_timer = new software_realtime_counter_t; /* Initialise Serial1 with 1.87M baud rate. */ Serial1.begin(1875000); @@ -199,8 +199,8 @@ void setup() Serial.println("Testing CRSF Serial Transmitter Prototype..."); /* Set the time in microseconds. */ - time->time_us = micros(); - time->time_us_last = time->time_us; + sw_timer->time_us = micros(); + sw_timer->time_us_last = sw_timer->time_us; } void loop() @@ -214,17 +214,17 @@ void loop() if (iteration < iterations) { /* Calculate the time delta in microseconds. */ - time->time_us = micros(); - time->time_us_delta = time->time_us - time->time_us_last; + sw_timer->time_us = micros(); + sw_timer->time_us_delta = sw_timer->time_us - sw_timer->time_us_last; /* Calculate the time error in microseconds. */ - time->time_us_error = time->time_us - (time->time_us_last + packet_rate_us[selected_packet_rate]); + sw_timer->time_us_error = sw_timer->time_us - (sw_timer->time_us_last + packet_rate_us[selected_packet_rate]); /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than the maximum allowed error. */ - if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < time->time_us_max_allowed_error) + if (sw_timer->time_us_delta >= packet_rate_us[selected_packet_rate] && sw_timer->time_us_error < sw_timer->time_us_max_allowed_error) { /* Set the last time in microseconds. */ - time->time_us_last = time->time_us; + sw_timer->time_us_last = sw_timer->time_us; /* Write 64 bytes to Serial1. */ Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); @@ -234,7 +234,7 @@ void loop() } /* If the time error is greater than or equal to the maximum allowed error. */ - else if (time->time_us_error >= time->time_us_max_allowed_error) + else if (sw_timer->time_us_error >= sw_timer->time_us_max_allowed_error) { /* Exit the program. */ atexit(exit_time_max_allowed_error_handler); From ab1e72aee2dc9636a40484ff2c8faebb8b37b7cc Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sun, 28 Apr 2024 10:04:34 +1200 Subject: [PATCH 023/109] chore(library): :truck: Move CRC source and header files to `common` subfolder `CRC.cpp` and `CRC.hpp` will be shared across the Serial Receiver Interface and the Serial Transmitter Interface. --- src/SerialReceiver/CRSF/CRSF.hpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.hpp | 2 +- src/{SerialReceiver => common}/CRC/CRC.cpp | 0 src/{SerialReceiver => common}/CRC/CRC.hpp | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename src/{SerialReceiver => common}/CRC/CRC.cpp (100%) rename src/{SerialReceiver => common}/CRC/CRC.hpp (100%) diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index 98c1ea03..fdc0ab80 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -26,7 +26,7 @@ #pragma once -#include "../CRC/CRC.hpp" +#include "../common/CRC/CRC.hpp" #include "CRSFProtocol.hpp" namespace serialReceiverLayer diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index 3fca2b8d..98cf35d4 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -28,7 +28,7 @@ #include "Arduino.h" -#include "../CRC/CRC.hpp" +#include "../common/CRC/CRC.hpp" #include "../CRSF/CRSFProtocol.hpp" #include "../SerialBuffer/SerialBuffer.hpp" diff --git a/src/SerialReceiver/CRC/CRC.cpp b/src/common/CRC/CRC.cpp similarity index 100% rename from src/SerialReceiver/CRC/CRC.cpp rename to src/common/CRC/CRC.cpp diff --git a/src/SerialReceiver/CRC/CRC.hpp b/src/common/CRC/CRC.hpp similarity index 100% rename from src/SerialReceiver/CRC/CRC.hpp rename to src/common/CRC/CRC.hpp From 4cf30e2443fa2d578281c9a011850953e3a8a995 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Mon, 20 May 2024 08:52:52 +1200 Subject: [PATCH 024/109] chore(library): Bump version date to `2024-5-20` --- examples/flight_modes/flight_modes.ino | 2 +- examples/link_stats/link_stats.ino | 2 +- examples/platformio/main.cpp | 2 +- examples/rc_channels/rc_channels.ino | 2 +- examples/telemetry/telemetry.ino | 2 +- src/CFA_Config.hpp | 4 ++-- src/CRSFforArduino.cpp | 2 +- src/CRSFforArduino.hpp | 2 +- src/SerialReceiver/CRSF/CRSF.cpp | 2 +- src/SerialReceiver/CRSF/CRSF.hpp | 2 +- src/SerialReceiver/CRSF/CRSFProtocol.hpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.cpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.hpp | 2 +- src/SerialReceiver/SerialReceiver.cpp | 2 +- src/SerialReceiver/SerialReceiver.hpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.cpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.hpp | 2 +- src/SerialTransmitter/SerialTransmitter.cpp | 2 +- src/SerialTransmitter/SerialTransmitter.hpp | 2 +- src/common/CRC/CRC.cpp | 2 +- src/common/CRC/CRC.hpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.cpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.hpp | 2 +- 23 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/flight_modes/flight_modes.ino b/examples/flight_modes/flight_modes.ino index 54498ad9..a405e4f4 100644 --- a/examples/flight_modes/flight_modes.ino +++ b/examples/flight_modes/flight_modes.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read flight modes from a receiver. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/link_stats/link_stats.ino b/examples/link_stats/link_stats.ino index 440bf787..55a7b282 100644 --- a/examples/link_stats/link_stats.ino +++ b/examples/link_stats/link_stats.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read link statistics from a receiver. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/platformio/main.cpp b/examples/platformio/main.cpp index d280eca6..b9684fa6 100644 --- a/examples/platformio/main.cpp +++ b/examples/platformio/main.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the main development file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/rc_channels/rc_channels.ino b/examples/rc_channels/rc_channels.ino index 45526b0f..c6ee7bfd 100644 --- a/examples/rc_channels/rc_channels.ino +++ b/examples/rc_channels/rc_channels.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read rc channels from a receiver. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/telemetry/telemetry.ino b/examples/telemetry/telemetry.ino index 8a94b827..386054bc 100644 --- a/examples/telemetry/telemetry.ino +++ b/examples/telemetry/telemetry.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to send telemetry back to your RC handset using CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index a238bdc0..e01f777b 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the configuration file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -37,7 +37,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-4-20" +#define CRSFFORARDUINO_VERSION_DATE "2024-5-20" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/CRSFforArduino.cpp b/src/CRSFforArduino.cpp index 92513f1d..ce9fb6bf 100644 --- a/src/CRSFforArduino.cpp +++ b/src/CRSFforArduino.cpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CRSFforArduino.hpp b/src/CRSFforArduino.hpp index 4bca6021..32ad2236 100644 --- a/src/CRSFforArduino.hpp +++ b/src/CRSFforArduino.hpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.cpp b/src/SerialReceiver/CRSF/CRSF.cpp index ea6c14e0..d72394c3 100644 --- a/src/SerialReceiver/CRSF/CRSF.cpp +++ b/src/SerialReceiver/CRSF/CRSF.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index fdc0ab80..8fa3cd84 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSFProtocol.hpp b/src/SerialReceiver/CRSF/CRSFProtocol.hpp index 9594df98..ba0b2c6f 100644 --- a/src/SerialReceiver/CRSF/CRSFProtocol.hpp +++ b/src/SerialReceiver/CRSF/CRSFProtocol.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This file contains enums and structs for the CRSF protocol. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp index be74c7e0..71ad202e 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp index 4e61a88d..c9fd7012 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index 98127106..a77ffa1a 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.hpp b/src/SerialReceiver/SerialReceiver.hpp index ddc81fae..a7b4019d 100644 --- a/src/SerialReceiver/SerialReceiver.hpp +++ b/src/SerialReceiver/SerialReceiver.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.cpp b/src/SerialReceiver/Telemetry/Telemetry.cpp index 40b4a112..06db5bce 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.cpp +++ b/src/SerialReceiver/Telemetry/Telemetry.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index 98cf35d4..fbf3184c 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index 09bf7181..9a31dc5d 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index ffb80960..64fe6da9 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/common/CRC/CRC.cpp b/src/common/CRC/CRC.cpp index baa14c7f..a8595e0b 100644 --- a/src/common/CRC/CRC.cpp +++ b/src/common/CRC/CRC.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/common/CRC/CRC.hpp b/src/common/CRC/CRC.hpp index 80f54a41..c5070605 100644 --- a/src/common/CRC/CRC.hpp +++ b/src/common/CRC/CRC.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.cpp b/src/hal/CompatibilityTable/CompatibilityTable.cpp index 0709d953..905af23c 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.cpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.hpp b/src/hal/CompatibilityTable/CompatibilityTable.hpp index aa86792a..01b35afc 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.hpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From f7d5c7d505c20273cd582ecb7e503266a31e6d0f Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Mon, 1 Jul 2024 09:49:58 +1200 Subject: [PATCH 025/109] chore(library): Bump verion date to 2024-7-2 Setting the version date to tomorrow's date, because that's when I'm picking development up on CRSF for Arduino again... after a nealry two-month long quiet hiatus. --- examples/flight_modes/flight_modes.ino | 2 +- examples/link_stats/link_stats.ino | 2 +- examples/platformio/main.cpp | 2 +- examples/rc_channels/rc_channels.ino | 2 +- examples/telemetry/telemetry.ino | 2 +- src/CFA_Config.hpp | 4 ++-- src/CRSFforArduino.cpp | 2 +- src/CRSFforArduino.hpp | 2 +- src/SerialReceiver/CRSF/CRSF.cpp | 2 +- src/SerialReceiver/CRSF/CRSF.hpp | 2 +- src/SerialReceiver/CRSF/CRSFProtocol.hpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.cpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.hpp | 2 +- src/SerialReceiver/SerialReceiver.cpp | 2 +- src/SerialReceiver/SerialReceiver.hpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.cpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.hpp | 2 +- src/SerialTransmitter/SerialTransmitter.cpp | 2 +- src/SerialTransmitter/SerialTransmitter.hpp | 2 +- src/common/CRC/CRC.cpp | 2 +- src/common/CRC/CRC.hpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.cpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.hpp | 2 +- 23 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/flight_modes/flight_modes.ino b/examples/flight_modes/flight_modes.ino index a405e4f4..5283caf0 100644 --- a/examples/flight_modes/flight_modes.ino +++ b/examples/flight_modes/flight_modes.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read flight modes from a receiver. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/link_stats/link_stats.ino b/examples/link_stats/link_stats.ino index 55a7b282..084f46a9 100644 --- a/examples/link_stats/link_stats.ino +++ b/examples/link_stats/link_stats.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read link statistics from a receiver. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/platformio/main.cpp b/examples/platformio/main.cpp index b9684fa6..01a6827e 100644 --- a/examples/platformio/main.cpp +++ b/examples/platformio/main.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the main development file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/rc_channels/rc_channels.ino b/examples/rc_channels/rc_channels.ino index c6ee7bfd..7be9d6a9 100644 --- a/examples/rc_channels/rc_channels.ino +++ b/examples/rc_channels/rc_channels.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read rc channels from a receiver. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/telemetry/telemetry.ino b/examples/telemetry/telemetry.ino index 386054bc..4a522d3c 100644 --- a/examples/telemetry/telemetry.ino +++ b/examples/telemetry/telemetry.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to send telemetry back to your RC handset using CRSF for Arduino. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index e01f777b..441b05ae 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the configuration file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -37,7 +37,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-5-20" +#define CRSFFORARDUINO_VERSION_DATE "2024-7-2" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/CRSFforArduino.cpp b/src/CRSFforArduino.cpp index ce9fb6bf..cae7c071 100644 --- a/src/CRSFforArduino.cpp +++ b/src/CRSFforArduino.cpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CRSFforArduino.hpp b/src/CRSFforArduino.hpp index 32ad2236..32d6e05d 100644 --- a/src/CRSFforArduino.hpp +++ b/src/CRSFforArduino.hpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.cpp b/src/SerialReceiver/CRSF/CRSF.cpp index d72394c3..0750b0d0 100644 --- a/src/SerialReceiver/CRSF/CRSF.cpp +++ b/src/SerialReceiver/CRSF/CRSF.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index 8fa3cd84..b066ade8 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSFProtocol.hpp b/src/SerialReceiver/CRSF/CRSFProtocol.hpp index ba0b2c6f..7713523a 100644 --- a/src/SerialReceiver/CRSF/CRSFProtocol.hpp +++ b/src/SerialReceiver/CRSF/CRSFProtocol.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This file contains enums and structs for the CRSF protocol. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp index 71ad202e..05833cbd 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp index c9fd7012..b76a7359 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index a77ffa1a..9c54d54b 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.hpp b/src/SerialReceiver/SerialReceiver.hpp index a7b4019d..41475138 100644 --- a/src/SerialReceiver/SerialReceiver.hpp +++ b/src/SerialReceiver/SerialReceiver.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.cpp b/src/SerialReceiver/Telemetry/Telemetry.cpp index 06db5bce..96ae966a 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.cpp +++ b/src/SerialReceiver/Telemetry/Telemetry.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index fbf3184c..a6b9cb4f 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index 9a31dc5d..b45c0c96 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index 64fe6da9..e2805936 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/common/CRC/CRC.cpp b/src/common/CRC/CRC.cpp index a8595e0b..3fb93ff1 100644 --- a/src/common/CRC/CRC.cpp +++ b/src/common/CRC/CRC.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/common/CRC/CRC.hpp b/src/common/CRC/CRC.hpp index c5070605..a2d29f5a 100644 --- a/src/common/CRC/CRC.hpp +++ b/src/common/CRC/CRC.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.cpp b/src/hal/CompatibilityTable/CompatibilityTable.cpp index 905af23c..158cdec0 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.cpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.hpp b/src/hal/CompatibilityTable/CompatibilityTable.hpp index 01b35afc..6067f791 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.hpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From b88331d368cfd3d0950f309705eaef4b12443bc9 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 9 Apr 2024 09:40:32 +1200 Subject: [PATCH 026/109] chore(library): Bump version date to `2024-4-9` --- examples/flight_modes/flight_modes.ino | 4 ++-- examples/link_stats/link_stats.ino | 4 ++-- examples/platformio/main.cpp | 4 ++-- examples/rc_channels/rc_channels.ino | 4 ++-- examples/telemetry/telemetry.ino | 4 ++-- src/CFA_Config.hpp | 6 +++--- src/CRSFforArduino.cpp | 4 ++-- src/CRSFforArduino.hpp | 4 ++-- src/SerialReceiver/CRC/CRC.cpp | 4 ++-- src/SerialReceiver/CRC/CRC.hpp | 4 ++-- src/SerialReceiver/CRSF/CRSF.cpp | 2 +- src/SerialReceiver/CRSF/CRSF.hpp | 4 ++-- src/SerialReceiver/CRSF/CRSFProtocol.hpp | 4 ++-- src/SerialReceiver/SerialBuffer/SerialBuffer.cpp | 4 ++-- src/SerialReceiver/SerialBuffer/SerialBuffer.hpp | 4 ++-- src/SerialReceiver/SerialReceiver.cpp | 4 ++-- src/SerialReceiver/SerialReceiver.hpp | 4 ++-- src/SerialReceiver/Telemetry/Telemetry.cpp | 4 ++-- src/SerialReceiver/Telemetry/Telemetry.hpp | 4 ++-- src/hal/CompatibilityTable/CompatibilityTable.cpp | 4 ++-- src/hal/CompatibilityTable/CompatibilityTable.hpp | 4 ++-- 21 files changed, 42 insertions(+), 42 deletions(-) diff --git a/examples/flight_modes/flight_modes.ino b/examples/flight_modes/flight_modes.ino index 86c8d7f3..fe64e355 100644 --- a/examples/flight_modes/flight_modes.ino +++ b/examples/flight_modes/flight_modes.ino @@ -2,8 +2,8 @@ * @file flight_modes.ino * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read flight modes from a receiver. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/link_stats/link_stats.ino b/examples/link_stats/link_stats.ino index 17275d54..b79d6001 100644 --- a/examples/link_stats/link_stats.ino +++ b/examples/link_stats/link_stats.ino @@ -2,8 +2,8 @@ * @file link_stats.ino * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read link statistics from a receiver. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/platformio/main.cpp b/examples/platformio/main.cpp index 9f5f836a..d63cbeb7 100644 --- a/examples/platformio/main.cpp +++ b/examples/platformio/main.cpp @@ -2,8 +2,8 @@ * @file main.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the main development file for CRSF for Arduino. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/rc_channels/rc_channels.ino b/examples/rc_channels/rc_channels.ino index d2415595..ed72acd1 100644 --- a/examples/rc_channels/rc_channels.ino +++ b/examples/rc_channels/rc_channels.ino @@ -2,8 +2,8 @@ * @file rc_channels.ino * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read rc channels from a receiver. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/telemetry/telemetry.ino b/examples/telemetry/telemetry.ino index a98600d5..81d027b3 100644 --- a/examples/telemetry/telemetry.ino +++ b/examples/telemetry/telemetry.ino @@ -2,8 +2,8 @@ * @file flight_modes.ino * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to send telemetry back to your RC handset using CRSF for Arduino. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 3ab50c29..4f851947 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -2,8 +2,8 @@ * @file CFA_Config.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the configuration file for CRSF for Arduino. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -37,7 +37,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-7-21" +#define CRSFFORARDUINO_VERSION_DATE "2024-4-9" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/CRSFforArduino.cpp b/src/CRSFforArduino.cpp index e5376650..49a13004 100644 --- a/src/CRSFforArduino.cpp +++ b/src/CRSFforArduino.cpp @@ -3,8 +3,8 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CRSFforArduino.hpp b/src/CRSFforArduino.hpp index 307f9af2..e63bbfd4 100644 --- a/src/CRSFforArduino.hpp +++ b/src/CRSFforArduino.hpp @@ -3,8 +3,8 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRC/CRC.cpp b/src/SerialReceiver/CRC/CRC.cpp index 00e821ec..e826b01c 100644 --- a/src/SerialReceiver/CRC/CRC.cpp +++ b/src/SerialReceiver/CRC/CRC.cpp @@ -2,8 +2,8 @@ * @file CRC.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRC/CRC.hpp b/src/SerialReceiver/CRC/CRC.hpp index bb2710ed..3cdf0387 100644 --- a/src/SerialReceiver/CRC/CRC.hpp +++ b/src/SerialReceiver/CRC/CRC.hpp @@ -2,8 +2,8 @@ * @file GenericCRC.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.cpp b/src/SerialReceiver/CRSF/CRSF.cpp index 4be17e0a..f86c7e0a 100644 --- a/src/SerialReceiver/CRSF/CRSF.cpp +++ b/src/SerialReceiver/CRSF/CRSF.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-7-21 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index a8e18c53..e2d8734a 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -2,8 +2,8 @@ * @file CRSF.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSFProtocol.hpp b/src/SerialReceiver/CRSF/CRSFProtocol.hpp index 0a67627c..c8d9d452 100644 --- a/src/SerialReceiver/CRSF/CRSFProtocol.hpp +++ b/src/SerialReceiver/CRSF/CRSFProtocol.hpp @@ -2,8 +2,8 @@ * @file CRSFProtocol.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This file contains enums and structs for the CRSF protocol. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp index 8620aac0..0ee05be3 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp @@ -2,8 +2,8 @@ * @file SerialBuffer.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp index 383cc5b6..82fdb169 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp @@ -2,8 +2,8 @@ * @file SerialBuffer.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index b97da874..9d7ecff8 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -2,8 +2,8 @@ * @file SerialReceiver.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.hpp b/src/SerialReceiver/SerialReceiver.hpp index 461ba490..ef5c701b 100644 --- a/src/SerialReceiver/SerialReceiver.hpp +++ b/src/SerialReceiver/SerialReceiver.hpp @@ -2,8 +2,8 @@ * @file SerialReceiver.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.cpp b/src/SerialReceiver/Telemetry/Telemetry.cpp index bf71d357..03014fba 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.cpp +++ b/src/SerialReceiver/Telemetry/Telemetry.cpp @@ -2,8 +2,8 @@ * @file Telemetry.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index 61be5d37..a6f0eb25 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -2,8 +2,8 @@ * @file Telemetry.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.cpp b/src/hal/CompatibilityTable/CompatibilityTable.cpp index a934751b..7a898d51 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.cpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.cpp @@ -2,8 +2,8 @@ * @file CompatibilityTable.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.hpp b/src/hal/CompatibilityTable/CompatibilityTable.hpp index 175a5a1d..3938ed1d 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.hpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.hpp @@ -2,8 +2,8 @@ * @file CompatibilityTable.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 + * @version 1.1.0 + * @date 2024-4-9 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From 2d3c689e6425581b20f992b17d9f244d056b4c62 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 9 Apr 2024 11:02:30 +1200 Subject: [PATCH 027/109] feat(serial transmitter layer): :sparkles: Initial commit for Serial Transmitter Interface This sets the precedence for the Serial Transmitter's API This is not yet functional. --- src/SerialTransmitter/SerialTransmitter.cpp | 103 ++++++++++++++++++++ src/SerialTransmitter/SerialTransmitter.hpp | 48 +++++++++ 2 files changed, 151 insertions(+) create mode 100644 src/SerialTransmitter/SerialTransmitter.cpp create mode 100644 src/SerialTransmitter/SerialTransmitter.hpp diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp new file mode 100644 index 00000000..34d93989 --- /dev/null +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -0,0 +1,103 @@ +/** + * @file SerialReceiver.cpp + * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) + * @brief The Serial Transmitter layer for the CRSF for Arduino library. + * @version 1.1.0 + * @date 2024-4-9 + * + * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. + * + * @section License GNU General Public License v3.0 + * This source file is a part of the CRSF for Arduino library. + * CRSF for Arduino 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. + * + * CRSF for Arduino 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 CRSF for Arduino. If not, see . + * + */ + +#include "SerialTransmitter.hpp" +#include "../hal/CompatibilityTable/CompatibilityTable.hpp" +#include "Arduino.h" + +using namespace hal; + +namespace serialTransmitterLayer +{ + SerialTransmitter::SerialTransmitter() + { + #if defined(ARDUINO_ARCH_STM32) +#if defined(HAVE_HWSERIAL1) + _uart = &Serial1; +#elif defined(HAVE_HWSERIAL2) + _uart = &Serial2; +#elif defined(HAVE_HWSERIAL3) + _uart = &Serial3; +#endif +#elif defined(ARDUINO_ARCH_ESP32) + _uart = &Serial1; + +#if defined(D0) + _rxPin = D0; +#else + _rxPin = 0; +#endif + +#if defined(D1) + _txPin = D1; +#else + _txPin = 1; +#endif +#else + _uart = &Serial1; +#endif + } + + SerialTransmitter::SerialTransmitter(HardwareSerial *hwUartPort) + { + _uart = hwUartPort; + +#if defined(ARDUINO_ARCH_ESP32) +#if defined(D0) + _rxPin = D0; +#else + _rxPin = 0; +#endif + +#if defined(D1) + _txPin = D1; +#else + _txPin = 1; +#endif +#endif + } + + SerialTransmitter::SerialTransmitter(HardwareSerial *hwUartPort, int8_t rxPin, int8_t txPin) + { + _uart = hwUartPort; + +#if defined(ARDUINO_ARCH_ESP32) + _rxPin = rxPin; + _txPin = txPin; +#else + (void)rxPin; + (void)txPin; +#endif + } + + SerialTransmitter::~SerialTransmitter() + { + _uart = nullptr; + + _rxPin = -1; + _txPin = -1; + } +} // namespace serialTransmitterLayer diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp new file mode 100644 index 00000000..75175054 --- /dev/null +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -0,0 +1,48 @@ +/** + * @file SerialTransmitter.hpp + * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) + * @brief The Serial Transmitter layer for the CRSF for Arduino library. + * @version 1.1.0 + * @date 2024-4-9 + * + * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. + * + * @section License GNU General Public License v3.0 + * This source file is a part of the CRSF for Arduino library. + * CRSF for Arduino 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. + * + * CRSF for Arduino 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 CRSF for Arduino. If not, see . + * + */ + +#pragma once + +#include "../CFA_Config.hpp" +#include "Arduino.h" + +namespace serialTransmitterLayer +{ + class SerialTransmitter + { + public: + SerialTransmitter(); + SerialTransmitter(HardwareSerial *hwUartPort); + SerialTransmitter(HardwareSerial *hwUartPort, int8_t rxPin, int8_t txPin); + virtual ~SerialTransmitter(); + + private: + HardwareSerial *_uart; + + int8_t _rxPin = -1; + int8_t _txPin = -1; + }; +} // namespace serialTransmitterLayer From 8b9613ec25377231e93db1e305f1d47c0c5d283f Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 20 Apr 2024 11:19:46 +1200 Subject: [PATCH 028/109] chore(library): Bump version date to `2024-4-20` --- examples/flight_modes/flight_modes.ino | 2 +- examples/link_stats/link_stats.ino | 2 +- examples/platformio/main.cpp | 2 +- examples/rc_channels/rc_channels.ino | 2 +- examples/telemetry/telemetry.ino | 2 +- src/CFA_Config.hpp | 4 ++-- src/CRSFforArduino.cpp | 2 +- src/CRSFforArduino.hpp | 2 +- src/SerialReceiver/CRC/CRC.cpp | 2 +- src/SerialReceiver/CRC/CRC.hpp | 2 +- src/SerialReceiver/CRSF/CRSF.cpp | 2 +- src/SerialReceiver/CRSF/CRSF.hpp | 2 +- src/SerialReceiver/CRSF/CRSFProtocol.hpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.cpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.hpp | 2 +- src/SerialReceiver/SerialReceiver.cpp | 2 +- src/SerialReceiver/SerialReceiver.hpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.cpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.hpp | 2 +- src/SerialTransmitter/SerialTransmitter.cpp | 2 +- src/SerialTransmitter/SerialTransmitter.hpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.cpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.hpp | 2 +- 23 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/flight_modes/flight_modes.ino b/examples/flight_modes/flight_modes.ino index fe64e355..6763bedf 100644 --- a/examples/flight_modes/flight_modes.ino +++ b/examples/flight_modes/flight_modes.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read flight modes from a receiver. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/link_stats/link_stats.ino b/examples/link_stats/link_stats.ino index b79d6001..d587ca45 100644 --- a/examples/link_stats/link_stats.ino +++ b/examples/link_stats/link_stats.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read link statistics from a receiver. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/platformio/main.cpp b/examples/platformio/main.cpp index d63cbeb7..91030131 100644 --- a/examples/platformio/main.cpp +++ b/examples/platformio/main.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the main development file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/rc_channels/rc_channels.ino b/examples/rc_channels/rc_channels.ino index ed72acd1..274e91f6 100644 --- a/examples/rc_channels/rc_channels.ino +++ b/examples/rc_channels/rc_channels.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read rc channels from a receiver. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/telemetry/telemetry.ino b/examples/telemetry/telemetry.ino index 81d027b3..88047a55 100644 --- a/examples/telemetry/telemetry.ino +++ b/examples/telemetry/telemetry.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to send telemetry back to your RC handset using CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 4f851947..f1bf471f 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the configuration file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -37,7 +37,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-4-9" +#define CRSFFORARDUINO_VERSION_DATE "2024-4-20" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/CRSFforArduino.cpp b/src/CRSFforArduino.cpp index 49a13004..7182f055 100644 --- a/src/CRSFforArduino.cpp +++ b/src/CRSFforArduino.cpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CRSFforArduino.hpp b/src/CRSFforArduino.hpp index e63bbfd4..ca07700d 100644 --- a/src/CRSFforArduino.hpp +++ b/src/CRSFforArduino.hpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRC/CRC.cpp b/src/SerialReceiver/CRC/CRC.cpp index e826b01c..f57943dc 100644 --- a/src/SerialReceiver/CRC/CRC.cpp +++ b/src/SerialReceiver/CRC/CRC.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRC/CRC.hpp b/src/SerialReceiver/CRC/CRC.hpp index 3cdf0387..304080cd 100644 --- a/src/SerialReceiver/CRC/CRC.hpp +++ b/src/SerialReceiver/CRC/CRC.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.cpp b/src/SerialReceiver/CRSF/CRSF.cpp index f86c7e0a..33839cd9 100644 --- a/src/SerialReceiver/CRSF/CRSF.cpp +++ b/src/SerialReceiver/CRSF/CRSF.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index e2d8734a..ce038c45 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSFProtocol.hpp b/src/SerialReceiver/CRSF/CRSFProtocol.hpp index c8d9d452..14077150 100644 --- a/src/SerialReceiver/CRSF/CRSFProtocol.hpp +++ b/src/SerialReceiver/CRSF/CRSFProtocol.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This file contains enums and structs for the CRSF protocol. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp index 0ee05be3..f2474e4a 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp index 82fdb169..9a81bbea 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index 9d7ecff8..80597eae 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.hpp b/src/SerialReceiver/SerialReceiver.hpp index ef5c701b..40d6eac9 100644 --- a/src/SerialReceiver/SerialReceiver.hpp +++ b/src/SerialReceiver/SerialReceiver.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.cpp b/src/SerialReceiver/Telemetry/Telemetry.cpp index 03014fba..b2d5aef5 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.cpp +++ b/src/SerialReceiver/Telemetry/Telemetry.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index a6f0eb25..bcfb350c 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index 34d93989..09bf7181 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index 75175054..c9b0278d 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.cpp b/src/hal/CompatibilityTable/CompatibilityTable.cpp index 7a898d51..8bf659a5 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.cpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.hpp b/src/hal/CompatibilityTable/CompatibilityTable.hpp index 3938ed1d..5367a3e6 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.hpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From c697f6d787aa855736037352bbbebb39fdbf42f7 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 20 Apr 2024 11:24:08 +1200 Subject: [PATCH 029/109] fix(defect): :adhesive_bandage: Class `SerialTransmitter` has a constructor that is not explicit --- src/SerialTransmitter/SerialTransmitter.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index c9b0278d..ffb80960 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -26,7 +26,9 @@ #pragma once +#ifndef ENV_DEFECT_DETECTOR #include "../CFA_Config.hpp" +#endif #include "Arduino.h" namespace serialTransmitterLayer @@ -35,7 +37,7 @@ namespace serialTransmitterLayer { public: SerialTransmitter(); - SerialTransmitter(HardwareSerial *hwUartPort); + explicit SerialTransmitter(HardwareSerial *hwUartPort); SerialTransmitter(HardwareSerial *hwUartPort, int8_t rxPin, int8_t txPin); virtual ~SerialTransmitter(); From 460f6abd12c47e9e9d96b79ffcfdc3bb9a1f4e1f Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 20 Apr 2024 11:27:04 +1200 Subject: [PATCH 030/109] build(`platformio.ini`): Temporarily restrict Quality Control builds to commonly used targets This temporarily speeds up development of the Serial Transmitter Interface. Once development on it is complete, running Quality Control on all supported targets will be reinstated. --- platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index a0883b29..d10e4a12 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,8 +12,8 @@ core_dir = .pio/core default_envs = ; defect_detector - development - ; ${build.all} + ; development + ${build.commonly_used} extra_configs = targets/common.ini targets/quality_control.ini From dcc0e56124bdee0123ee77721a9f6f636657f057 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 14:31:09 +1200 Subject: [PATCH 031/109] chore(library): :construction: Initial commit on working Serial Transmitter Interface prototype This is initially populated with the typical Arduino "boiler plate" code what prints "Hello, World!" to the terminal. --- .../serial_transmitter_prototype.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/platformio/serial_transmitter_prototype.cpp diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp new file mode 100644 index 00000000..ea619f9c --- /dev/null +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -0,0 +1,21 @@ +#if __has_include("Arduino.h") +#include "Arduino.h" +#define ARDUINO_IS_INCLUDED 1 +#else +#define ARDUINO_IS_INCLUDED 0 +#endif + +#if ARDUINO_IS_INCLUDED == 1 +void setup() +{ + Serial.begin(115200); + while (!Serial) + { + delay(10); + } + Serial.println("Hello, World!"); +} + +void loop() +{} +#endif From f2ffb4f1f6724169335db116eb739af21bc2bdd1 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 14:33:45 +1200 Subject: [PATCH 032/109] build(`platformio.ini`): :wrench: Create a secure development environment and enable it This development environment will remain enabled until development of the Serial Transmitter Interface is complete. --- platformio.ini | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index d10e4a12..c1e539a7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,8 +12,8 @@ core_dir = .pio/core default_envs = ; defect_detector - ; development - ${build.commonly_used} + development + ; ${build.commonly_used} extra_configs = targets/common.ini targets/quality_control.ini @@ -31,9 +31,29 @@ test_dir = [env:development] board = adafruit_metro_m4 +build_flags = +build_src_flags = + ; Compile hardening flags: + -O2 + -Wall + -Wextra + -Wformat + -Wformat=2 + ; -Wconversion ; Disabled due to spamming conversion issues in packages outside the scope of CRSF for Arduino. + -Wimplicit-fallthrough + -U_FORTIFY_SOURCE + -D_FORTIFY_SOURCE=3 + -D_GLIBCXX_ASSERTIONS + ; -fsrict-flex-arrays=3 ; Not available in GCC Arm Compiler v12.3.1 + -fstack-clash-protection + -fstack-protector-strong build_src_filter = - +<../examples/platformio/main.cpp> + +<../examples/platformio/serial_transmitter_prototype.cpp> +<*/*/*.cpp> +<*.cpp> build_type = debug +build_unflags = + -Os extends = env_common_samd51 +platform_packages = + platformio/toolchain-gccarmnoneeabi @ 1.120301.0 ; PlatformIO's latest GCC Compiler version From eb74067e25818987772cc7355ecd8c0deaf7a29f Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 18:55:38 +1200 Subject: [PATCH 033/109] refactor(serial transmitter prototype): :construction: Print the time delta (in microseconds) to the terminal at the selected packet rate Pakcet rates are based on ExpressLRS' packet rates. --- .../serial_transmitter_prototype.cpp | 99 ++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index ea619f9c..4ebfe2a1 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -5,6 +5,48 @@ #define ARDUINO_IS_INCLUDED 0 #endif +/* Packet rate enumeration. */ +typedef enum packet_rate_index_e +{ + PACKET_RATE_4HZ, + PACKET_RATE_25HZ, + PACKET_RATE_50HZ, + PACKET_RATE_100HZ, + PACKET_RATE_150HZ, + PACKET_RATE_200HZ, + PACKET_RATE_250HZ, + PACKET_RATE_333HZ, + PACKET_RATE_500HZ, + PACKET_RATE_1000HZ, + PACKET_RATE_COUNT +} packet_rate_index_t; + +/* Selected packet rate. */ +const packet_rate_index_t selected_packet_rate = PACKET_RATE_50HZ; +uint32_t *packet_rate_us = nullptr; + +/* Time structure for the packet rate. */ +typedef struct time_s +{ + uint32_t time_us = 0; + uint32_t time_us_last = 0xFFFFFFFF; + uint32_t time_us_delta = 0xFFFFFFFF; +} time_t; + +/* Time structure instance. */ +time_t *time = nullptr; + +/* Exit handler. */ +void exitHandler() +{ + /* Clean up and stop. */ + delete[] packet_rate_us; + delete time; + + /* Print a message to the serial monitor. */ + Serial.println("Done!"); +} + #if ARDUINO_IS_INCLUDED == 1 void setup() { @@ -13,9 +55,62 @@ void setup() { delay(10); } - Serial.println("Hello, World!"); + + /* Dynamically allocate memory for the packet rate, + and calculate the time in microseconds for each packet rate. */ + packet_rate_us = new uint32_t[PACKET_RATE_COUNT]; + packet_rate_us[PACKET_RATE_4HZ] = (1000000UL / 4UL); + packet_rate_us[PACKET_RATE_25HZ] = (1000000UL / 25UL); + packet_rate_us[PACKET_RATE_50HZ] = (1000000UL / 50UL); + packet_rate_us[PACKET_RATE_100HZ] = (1000000UL / 100UL); + packet_rate_us[PACKET_RATE_150HZ] = (1000000UL / 150UL); + packet_rate_us[PACKET_RATE_200HZ] = (1000000UL / 200UL); + packet_rate_us[PACKET_RATE_250HZ] = (1000000UL / 250UL); + packet_rate_us[PACKET_RATE_333HZ] = (1000000UL / 333UL); + packet_rate_us[PACKET_RATE_500HZ] = (1000000UL / 500UL); + packet_rate_us[PACKET_RATE_1000HZ] = (1000000UL / 1000UL); + + /* Initialize the time structure. */ + time = new time_t; + + /* Set the time in microseconds for the selected packet rate. */ + time->time_us = packet_rate_us[selected_packet_rate]; } void loop() -{} +{ + + static uint32_t iteration = 0; + + /* Calculate the number of iterations based on the selected packet rate and the equivalent total execution time of three seconds. */ + static const uint32_t iterations = (3000000UL / packet_rate_us[selected_packet_rate]); + + if (iteration < iterations) + { + /* Calculate the time delta in microseconds. */ + time->time_us = micros(); + time->time_us_delta = time->time_us - time->time_us_last; + + /* Check if the time delta is greater than the time in microseconds for the selected packet rate. */ + if (time->time_us_delta >= packet_rate_us[selected_packet_rate]) + { + /* Print the time delta in microseconds. */ + Serial.print("Time Delta: "); + Serial.print(time->time_us_delta); + Serial.println(" us"); + + /* Set the last time in microseconds. */ + time->time_us_last = time->time_us; + + /* Increment the iteration. */ + iteration++; + } + } + else + { + /* Exit the program. */ + atexit(exitHandler); + exit(EXIT_SUCCESS); + } +} #endif From daabce7e310557941a5bf3d1d6948bb49e9d44bd Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 19:08:28 +1200 Subject: [PATCH 034/109] fix(serial transmitter prototype): :bug: Fix `time_us` overflow on first iteration --- examples/platformio/serial_transmitter_prototype.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 4ebfe2a1..79aae5b3 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -29,8 +29,8 @@ uint32_t *packet_rate_us = nullptr; typedef struct time_s { uint32_t time_us = 0; - uint32_t time_us_last = 0xFFFFFFFF; - uint32_t time_us_delta = 0xFFFFFFFF; + uint32_t time_us_last = 0; + uint32_t time_us_delta = 0; } time_t; /* Time structure instance. */ @@ -73,8 +73,9 @@ void setup() /* Initialize the time structure. */ time = new time_t; - /* Set the time in microseconds for the selected packet rate. */ - time->time_us = packet_rate_us[selected_packet_rate]; + /* Set the time in microseconds. */ + time->time_us = micros(); + time->time_us_last = time->time_us; } void loop() From aa2eeebdcab19a5e2f0bfeb58f2137e9903f66e9 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 20:21:45 +1200 Subject: [PATCH 035/109] feat(serial transmitter prototype): :sparkles: Write 64 bytes of data with `Serial1` at the selected packet rate This sets the stage for CRSF packets. --- examples/platformio/serial_transmitter_prototype.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 79aae5b3..8687b283 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -36,6 +36,9 @@ typedef struct time_s /* Time structure instance. */ time_t *time = nullptr; +const size_t serial_buffer_size = 64; +uint8_t serial_buffer[serial_buffer_size] = { 0 }; + /* Exit handler. */ void exitHandler() { @@ -73,6 +76,10 @@ void setup() /* Initialize the time structure. */ time = new time_t; + /* Initialise Serial1 with 1.87M baud rate. */ + Serial1.begin(1875000); + memset(serial_buffer, 0, serial_buffer_size); + /* Set the time in microseconds. */ time->time_us = micros(); time->time_us_last = time->time_us; @@ -103,6 +110,9 @@ void loop() /* Set the last time in microseconds. */ time->time_us_last = time->time_us; + /* Write 64 bytes to Serial1. */ + Serial1.write(serial_buffer, serial_buffer_size); + /* Increment the iteration. */ iteration++; } From 96cfa3e62badb77aebabbffd13e18557b896a000 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 20:23:07 +1200 Subject: [PATCH 036/109] feat(serial transmitter prototype): :sparkles: Prototype transmit frame error This drops a frame when the time jitter is more than two microseconds. --- .../serial_transmitter_prototype.cpp | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 8687b283..f2af1767 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -31,6 +31,7 @@ typedef struct time_s uint32_t time_us = 0; uint32_t time_us_last = 0; uint32_t time_us_delta = 0; + int32_t time_us_error = 0; } time_t; /* Time structure instance. */ @@ -99,8 +100,11 @@ void loop() time->time_us = micros(); time->time_us_delta = time->time_us - time->time_us_last; - /* Check if the time delta is greater than the time in microseconds for the selected packet rate. */ - if (time->time_us_delta >= packet_rate_us[selected_packet_rate]) + /* Calculate the time error in microseconds. */ + time->time_us_error = time->time_us - (time->time_us_last + packet_rate_us[selected_packet_rate]); + + /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than 2 microseconds. */ + if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < 2) { /* Print the time delta in microseconds. */ Serial.print("Time Delta: "); @@ -116,6 +120,24 @@ void loop() /* Increment the iteration. */ iteration++; } + + /* If the time error is greater than or equal to 2 microseconds. */ + else if (time->time_us_error >= 2) + { + /* Print an error message to the serial monitor. */ + Serial.println("Error: Time error is greater than or equal to 2 microseconds."); + + /* Print how far the time error is from the packet rate in microseconds. */ + Serial.print("Time Error: "); + Serial.print(time->time_us_error); + Serial.println(" us"); + + /* Increment the iteration. */ + iteration++; + + /* Set the last time in microseconds. */ + time->time_us_last = time->time_us; + } } else { From b0e258befc6cfcf9ce9d206b8075f54946c5655b Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 08:59:23 +1200 Subject: [PATCH 037/109] build(`platformio.ini`): :construction_worker: Explicitly use CppCheck in development environment CppCheck is used to check for any defects during development. --- platformio.ini | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platformio.ini b/platformio.ini index c1e539a7..e6b26d32 100644 --- a/platformio.ini +++ b/platformio.ini @@ -54,6 +54,13 @@ build_src_filter = build_type = debug build_unflags = -Os +check_flags = + --enable=all + --disable=missingInclude + --disable=unusedFunction +check_severity = low, medium, high +check_skip_packages = yes +check_tool = cppcheck extends = env_common_samd51 platform_packages = platformio/toolchain-gccarmnoneeabi @ 1.120301.0 ; PlatformIO's latest GCC Compiler version From ae6ed2d76a18ed0a3267757be509048251e49d65 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 09:03:47 +1200 Subject: [PATCH 038/109] chore(`platformio.ini`): :wrench: Upgrade C++11 to GNU C++23 Using the latest version of C++ keeps its security up-to-date. --- platformio.ini | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platformio.ini b/platformio.ini index e6b26d32..578557d2 100644 --- a/platformio.ini +++ b/platformio.ini @@ -33,6 +33,8 @@ test_dir = board = adafruit_metro_m4 build_flags = build_src_flags = + ; Force GNU C++ 23: + -std=c++23 ; Compile hardening flags: -O2 -Wall @@ -53,11 +55,14 @@ build_src_filter = +<*.cpp> build_type = debug build_unflags = + -c++11 -Os check_flags = --enable=all --disable=missingInclude --disable=unusedFunction + --language=c++ + --std=c++23 check_severity = low, medium, high check_skip_packages = yes check_tool = cppcheck From 8e05de6943ab50214a1e6e2ccd8bca1761cfcbc7 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 09:21:36 +1200 Subject: [PATCH 039/109] chore(`platformio.ini`): Explicitly specify `gnu++23` --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 578557d2..25c75a8e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -34,7 +34,7 @@ board = adafruit_metro_m4 build_flags = build_src_flags = ; Force GNU C++ 23: - -std=c++23 + -std=gnu++23 ; Compile hardening flags: -O2 -Wall From 1c70a7a953204a82395aedce15ee12f63d0935b2 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 09:33:33 +1200 Subject: [PATCH 040/109] refactor(serial transmitter prototype): :recycle: Use `const int32_t` for maximum allowed time error --- examples/platformio/serial_transmitter_prototype.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index f2af1767..126745b4 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -32,6 +32,7 @@ typedef struct time_s uint32_t time_us_last = 0; uint32_t time_us_delta = 0; int32_t time_us_error = 0; + const int32_t time_us_max_allowed_error = 2; } time_t; /* Time structure instance. */ @@ -103,8 +104,8 @@ void loop() /* Calculate the time error in microseconds. */ time->time_us_error = time->time_us - (time->time_us_last + packet_rate_us[selected_packet_rate]); - /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than 2 microseconds. */ - if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < 2) + /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than the maximum allowed error. */ + if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < time->time_us_max_allowed_error) { /* Print the time delta in microseconds. */ Serial.print("Time Delta: "); @@ -121,8 +122,8 @@ void loop() iteration++; } - /* If the time error is greater than or equal to 2 microseconds. */ - else if (time->time_us_error >= 2) + /* If the time error is greater than or equal to the maximum allowed error. */ + else if (time->time_us_error >= time->time_us_max_allowed_error) { /* Print an error message to the serial monitor. */ Serial.println("Error: Time error is greater than or equal to 2 microseconds."); From 0727a7b2205cba1e3966b850592189ab8b8fca71 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 10:16:14 +1200 Subject: [PATCH 041/109] refactor(serial transmitter prototype): :recycle: Replace `serial_buffer` placeholder with `crsf_tx_frame` --- .../serial_transmitter_prototype.cpp | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 126745b4..fca73777 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -35,11 +35,28 @@ typedef struct time_s const int32_t time_us_max_allowed_error = 2; } time_t; +/* CRSF Frame structure and union. */ +typedef struct crsf_frame_s +{ + uint8_t sync; + uint8_t length; + uint8_t type; + uint8_t payload[60]; + uint8_t crc; +} crsf_frame_t; + +const size_t crsf_frame_size = sizeof(crsf_frame_t); + +typedef union crsf_tx_frame_u +{ + crsf_frame_t frame; + uint8_t buffer[crsf_frame_size]; +} crsf_tx_frame_t; + /* Time structure instance. */ time_t *time = nullptr; -const size_t serial_buffer_size = 64; -uint8_t serial_buffer[serial_buffer_size] = { 0 }; +crsf_tx_frame_t crsf_tx_frame; /* Exit handler. */ void exitHandler() @@ -80,7 +97,7 @@ void setup() /* Initialise Serial1 with 1.87M baud rate. */ Serial1.begin(1875000); - memset(serial_buffer, 0, serial_buffer_size); + memset(&crsf_tx_frame, 0, crsf_frame_size); /* Set the time in microseconds. */ time->time_us = micros(); @@ -116,7 +133,7 @@ void loop() time->time_us_last = time->time_us; /* Write 64 bytes to Serial1. */ - Serial1.write(serial_buffer, serial_buffer_size); + Serial1.write(crsf_tx_frame.buffer, crsf_frame_size); /* Increment the iteration. */ iteration++; From 097cfa56abe5b3c70b33aa02602ec97dc9724afe Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 10:36:48 +1200 Subject: [PATCH 042/109] refactor(serial transmitter prototype): :recycle: Improve error handling Instead of spamming the time delta in the Terminal, a simple notification is sent; and the prototyp test now halts when the `time_us_max_allowed_error` is exceeded. --- .../serial_transmitter_prototype.cpp | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index fca73777..38461423 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -58,15 +58,31 @@ time_t *time = nullptr; crsf_tx_frame_t crsf_tx_frame; -/* Exit handler. */ -void exitHandler() +/* Exit handlers. */ +void exit_success_handler() { /* Clean up and stop. */ delete[] packet_rate_us; delete time; /* Print a message to the serial monitor. */ - Serial.println("Done!"); + Serial.println("Program has ended successfully."); +} + +void exit_time_max_allowed_error_handler() +{ + /* Print a message to the serial monitor. */ + Serial.print("Program has ended with an error: "); + Serial.println("Time error is greater than the maximum allowed error."); + + /* Print how far the time error is from the packet rate in microseconds. */ + Serial.print("Time Error: "); + Serial.print(time->time_us_error); + Serial.println(" us"); + + /* Clean up and stop. */ + delete[] packet_rate_us; + delete time; } #if ARDUINO_IS_INCLUDED == 1 @@ -99,6 +115,9 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); + /* Print a message to the serial monitor. */ + Serial.println("Testing CRSF Serial Transmitter Prototype..."); + /* Set the time in microseconds. */ time->time_us = micros(); time->time_us_last = time->time_us; @@ -124,11 +143,6 @@ void loop() /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than the maximum allowed error. */ if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < time->time_us_max_allowed_error) { - /* Print the time delta in microseconds. */ - Serial.print("Time Delta: "); - Serial.print(time->time_us_delta); - Serial.println(" us"); - /* Set the last time in microseconds. */ time->time_us_last = time->time_us; @@ -142,25 +156,15 @@ void loop() /* If the time error is greater than or equal to the maximum allowed error. */ else if (time->time_us_error >= time->time_us_max_allowed_error) { - /* Print an error message to the serial monitor. */ - Serial.println("Error: Time error is greater than or equal to 2 microseconds."); - - /* Print how far the time error is from the packet rate in microseconds. */ - Serial.print("Time Error: "); - Serial.print(time->time_us_error); - Serial.println(" us"); - - /* Increment the iteration. */ - iteration++; - - /* Set the last time in microseconds. */ - time->time_us_last = time->time_us; + /* Exit the program. */ + atexit(exit_time_max_allowed_error_handler); + exit(EXIT_FAILURE); } } else { /* Exit the program. */ - atexit(exitHandler); + atexit(exit_success_handler); exit(EXIT_SUCCESS); } } From 2857cb521c28fd4bd5816ce77ebc7118e0ea1bc8 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:37:39 +1200 Subject: [PATCH 043/109] refactor(serial transmitter prototype): :construction: Introduce CRC8-DVB-S2 functions These will be used to calculate the CRC to be appended to the CRSF RC Channels data packet. --- .../serial_transmitter_prototype.cpp | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 38461423..69da9263 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -58,6 +58,37 @@ time_t *time = nullptr; crsf_tx_frame_t crsf_tx_frame; +/* CRC8-DVB-S2. */ +uint8_t crc8_dvb_s2(uint8_t crc, const uint8_t data) +{ + crc ^= data; + for (uint8_t i = 0; i < 8; i++) + { + if (crc & 0x80) + { + crc = (crc << 1) ^ 0xD5; + } + else + { + crc <<= 1; + } + } + return crc; +} + +/* This function calculates the CRC for the CRSF frame +from the type to the end of the payload. */ +uint8_t calculate_crc(const crsf_tx_frame_t *crsf_tx_frame) +{ + uint8_t crc = 0; + crc = crc8_dvb_s2(crc, crsf_tx_frame->frame.type); + for (uint8_t i = 0; i < crsf_tx_frame->frame.length - 2; i++) + { + crc = crc8_dvb_s2(crc, crsf_tx_frame->frame.payload[i]); + } + return crc; +} + /* Exit handlers. */ void exit_success_handler() { From 0fe7a46eb333e81e129678c50e6e692390669a49 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:39:58 +1200 Subject: [PATCH 044/109] refactor(serial transmitter prototype): :construction: Flesh out packed RC Channels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All RC Channels are 'centred' except for `ch5` which is initialised to `1000 µS`. --- .../serial_transmitter_prototype.cpp | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 69da9263..7f9b3240 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -35,6 +35,29 @@ typedef struct time_s const int32_t time_us_max_allowed_error = 2; } time_t; +/* Packed 11-bit RC Channels. */ +struct rc_channels_packed_s +{ + uint16_t ch1 : 11; + uint16_t ch2 : 11; + uint16_t ch3 : 11; + uint16_t ch4 : 11; + uint16_t ch5 : 11; + uint16_t ch6 : 11; + uint16_t ch7 : 11; + uint16_t ch8 : 11; + uint16_t ch9 : 11; + uint16_t ch10 : 11; + uint16_t ch11 : 11; + uint16_t ch12 : 11; + uint16_t ch13 : 11; + uint16_t ch14 : 11; + uint16_t ch15 : 11; + uint16_t ch16 : 11; +} __attribute__((packed)); + +typedef struct rc_channels_packed_s rc_channels_packed_t; + /* CRSF Frame structure and union. */ typedef struct crsf_frame_s { @@ -146,6 +169,26 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); + /* Initialise the RC Channels structure. */ + rc_channels_packed_t rc_channels_packed; + rc_channels_packed.ch1 = 992; + rc_channels_packed.ch2 = 992; + rc_channels_packed.ch3 = 992; + rc_channels_packed.ch4 = 992; + rc_channels_packed.ch5 = 178; + rc_channels_packed.ch6 = 992; + rc_channels_packed.ch7 = 992; + rc_channels_packed.ch8 = 992; + rc_channels_packed.ch9 = 992; + rc_channels_packed.ch10 = 992; + rc_channels_packed.ch11 = 992; + rc_channels_packed.ch12 = 992; + rc_channels_packed.ch13 = 992; + rc_channels_packed.ch14 = 992; + rc_channels_packed.ch15 = 992; + rc_channels_packed.ch16 = 992; + + /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); From f725d4daa089ae7cc52169f34e57c5d8e9885ace Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:40:57 +1200 Subject: [PATCH 045/109] refactor(serial transmitter prototype): :recycle: Prepare CRSF RC Channels Packed data... ...and send it at the selected packet rate. --- examples/platformio/serial_transmitter_prototype.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 7f9b3240..f283db9d 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -188,6 +188,12 @@ void setup() rc_channels_packed.ch15 = 992; rc_channels_packed.ch16 = 992; + /* Prepare the CRSF RC Channels Packed frame. */ + crsf_tx_frame.frame.sync = 0xC8; // NB: EdgeTX uses 0xEE which is incorrect. + crsf_tx_frame.frame.length = 24; + crsf_tx_frame.frame.type = 0x16; + memcpy(crsf_tx_frame.frame.payload, &rc_channels_packed, sizeof(rc_channels_packed)); + crsf_tx_frame.frame.crc = calculate_crc(&crsf_tx_frame); /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); @@ -221,7 +227,7 @@ void loop() time->time_us_last = time->time_us; /* Write 64 bytes to Serial1. */ - Serial1.write(crsf_tx_frame.buffer, crsf_frame_size); + Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); /* Increment the iteration. */ iteration++; From ec3206263273b3c4ed0fd2d149860776928ba37d Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 27 Apr 2024 09:04:51 +1200 Subject: [PATCH 046/109] fix(serial transmitter prototype): :rotating_light: Rename time structure to avoid naming conflicts --- .../serial_transmitter_prototype.cpp | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index f283db9d..ae003278 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -26,14 +26,14 @@ const packet_rate_index_t selected_packet_rate = PACKET_RATE_50HZ; uint32_t *packet_rate_us = nullptr; /* Time structure for the packet rate. */ -typedef struct time_s +typedef struct software_realtime_counter_s { uint32_t time_us = 0; uint32_t time_us_last = 0; uint32_t time_us_delta = 0; int32_t time_us_error = 0; const int32_t time_us_max_allowed_error = 2; -} time_t; +} software_realtime_counter_t; /* Packed 11-bit RC Channels. */ struct rc_channels_packed_s @@ -77,7 +77,7 @@ typedef union crsf_tx_frame_u } crsf_tx_frame_t; /* Time structure instance. */ -time_t *time = nullptr; +software_realtime_counter_t *sw_timer = nullptr; crsf_tx_frame_t crsf_tx_frame; @@ -117,7 +117,7 @@ void exit_success_handler() { /* Clean up and stop. */ delete[] packet_rate_us; - delete time; + delete sw_timer; /* Print a message to the serial monitor. */ Serial.println("Program has ended successfully."); @@ -129,14 +129,14 @@ void exit_time_max_allowed_error_handler() Serial.print("Program has ended with an error: "); Serial.println("Time error is greater than the maximum allowed error."); - /* Print how far the time error is from the packet rate in microseconds. */ + /* Print how far the sw_timer error is from the packet rate in microseconds. */ Serial.print("Time Error: "); - Serial.print(time->time_us_error); + Serial.print(sw_timer->time_us_error); Serial.println(" us"); /* Clean up and stop. */ delete[] packet_rate_us; - delete time; + delete sw_timer; } #if ARDUINO_IS_INCLUDED == 1 @@ -149,7 +149,7 @@ void setup() } /* Dynamically allocate memory for the packet rate, - and calculate the time in microseconds for each packet rate. */ + and calculate the sw_timer in microseconds for each packet rate. */ packet_rate_us = new uint32_t[PACKET_RATE_COUNT]; packet_rate_us[PACKET_RATE_4HZ] = (1000000UL / 4UL); packet_rate_us[PACKET_RATE_25HZ] = (1000000UL / 25UL); @@ -162,8 +162,8 @@ void setup() packet_rate_us[PACKET_RATE_500HZ] = (1000000UL / 500UL); packet_rate_us[PACKET_RATE_1000HZ] = (1000000UL / 1000UL); - /* Initialize the time structure. */ - time = new time_t; + /* Initialize the sw_timer structure. */ + sw_timer = new software_realtime_counter_t; /* Initialise Serial1 with 1.87M baud rate. */ Serial1.begin(1875000); @@ -199,8 +199,8 @@ void setup() Serial.println("Testing CRSF Serial Transmitter Prototype..."); /* Set the time in microseconds. */ - time->time_us = micros(); - time->time_us_last = time->time_us; + sw_timer->time_us = micros(); + sw_timer->time_us_last = sw_timer->time_us; } void loop() @@ -214,17 +214,17 @@ void loop() if (iteration < iterations) { /* Calculate the time delta in microseconds. */ - time->time_us = micros(); - time->time_us_delta = time->time_us - time->time_us_last; + sw_timer->time_us = micros(); + sw_timer->time_us_delta = sw_timer->time_us - sw_timer->time_us_last; /* Calculate the time error in microseconds. */ - time->time_us_error = time->time_us - (time->time_us_last + packet_rate_us[selected_packet_rate]); + sw_timer->time_us_error = sw_timer->time_us - (sw_timer->time_us_last + packet_rate_us[selected_packet_rate]); /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than the maximum allowed error. */ - if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < time->time_us_max_allowed_error) + if (sw_timer->time_us_delta >= packet_rate_us[selected_packet_rate] && sw_timer->time_us_error < sw_timer->time_us_max_allowed_error) { /* Set the last time in microseconds. */ - time->time_us_last = time->time_us; + sw_timer->time_us_last = sw_timer->time_us; /* Write 64 bytes to Serial1. */ Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); @@ -234,7 +234,7 @@ void loop() } /* If the time error is greater than or equal to the maximum allowed error. */ - else if (time->time_us_error >= time->time_us_max_allowed_error) + else if (sw_timer->time_us_error >= sw_timer->time_us_max_allowed_error) { /* Exit the program. */ atexit(exit_time_max_allowed_error_handler); From 2b697cf9d126a38a92e680bfd2b9e64a8cff2f01 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sun, 28 Apr 2024 10:04:34 +1200 Subject: [PATCH 047/109] chore(library): :truck: Move CRC source and header files to `common` subfolder `CRC.cpp` and `CRC.hpp` will be shared across the Serial Receiver Interface and the Serial Transmitter Interface. --- src/SerialReceiver/CRSF/CRSF.hpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.hpp | 2 +- src/{SerialReceiver => common}/CRC/CRC.cpp | 0 src/{SerialReceiver => common}/CRC/CRC.hpp | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename src/{SerialReceiver => common}/CRC/CRC.cpp (100%) rename src/{SerialReceiver => common}/CRC/CRC.hpp (100%) diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index ce038c45..9a618e01 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -26,7 +26,7 @@ #pragma once -#include "../CRC/CRC.hpp" +#include "../common/CRC/CRC.hpp" #include "CRSFProtocol.hpp" namespace serialReceiverLayer diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index bcfb350c..e7f49fb7 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -28,7 +28,7 @@ #include "Arduino.h" -#include "../CRC/CRC.hpp" +#include "../common/CRC/CRC.hpp" #include "../CRSF/CRSFProtocol.hpp" #include "../SerialBuffer/SerialBuffer.hpp" diff --git a/src/SerialReceiver/CRC/CRC.cpp b/src/common/CRC/CRC.cpp similarity index 100% rename from src/SerialReceiver/CRC/CRC.cpp rename to src/common/CRC/CRC.cpp diff --git a/src/SerialReceiver/CRC/CRC.hpp b/src/common/CRC/CRC.hpp similarity index 100% rename from src/SerialReceiver/CRC/CRC.hpp rename to src/common/CRC/CRC.hpp From 60d9268498c67fa461b1ab7c278f2b8fc2051b9d Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Mon, 20 May 2024 08:52:52 +1200 Subject: [PATCH 048/109] chore(library): Bump version date to `2024-5-20` --- examples/flight_modes/flight_modes.ino | 2 +- examples/link_stats/link_stats.ino | 2 +- examples/platformio/main.cpp | 2 +- examples/rc_channels/rc_channels.ino | 2 +- examples/telemetry/telemetry.ino | 2 +- src/CFA_Config.hpp | 4 ++-- src/CRSFforArduino.cpp | 2 +- src/CRSFforArduino.hpp | 2 +- src/SerialReceiver/CRSF/CRSF.cpp | 2 +- src/SerialReceiver/CRSF/CRSF.hpp | 2 +- src/SerialReceiver/CRSF/CRSFProtocol.hpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.cpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.hpp | 2 +- src/SerialReceiver/SerialReceiver.cpp | 2 +- src/SerialReceiver/SerialReceiver.hpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.cpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.hpp | 2 +- src/SerialTransmitter/SerialTransmitter.cpp | 2 +- src/SerialTransmitter/SerialTransmitter.hpp | 2 +- src/common/CRC/CRC.cpp | 2 +- src/common/CRC/CRC.hpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.cpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.hpp | 2 +- 23 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/flight_modes/flight_modes.ino b/examples/flight_modes/flight_modes.ino index 6763bedf..7db80d3c 100644 --- a/examples/flight_modes/flight_modes.ino +++ b/examples/flight_modes/flight_modes.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read flight modes from a receiver. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/link_stats/link_stats.ino b/examples/link_stats/link_stats.ino index d587ca45..1760345a 100644 --- a/examples/link_stats/link_stats.ino +++ b/examples/link_stats/link_stats.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read link statistics from a receiver. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/platformio/main.cpp b/examples/platformio/main.cpp index 91030131..e06ca7aa 100644 --- a/examples/platformio/main.cpp +++ b/examples/platformio/main.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the main development file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/rc_channels/rc_channels.ino b/examples/rc_channels/rc_channels.ino index 274e91f6..c95f9408 100644 --- a/examples/rc_channels/rc_channels.ino +++ b/examples/rc_channels/rc_channels.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read rc channels from a receiver. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/telemetry/telemetry.ino b/examples/telemetry/telemetry.ino index 88047a55..ad7ef386 100644 --- a/examples/telemetry/telemetry.ino +++ b/examples/telemetry/telemetry.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to send telemetry back to your RC handset using CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index f1bf471f..573273b7 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the configuration file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -37,7 +37,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-4-20" +#define CRSFFORARDUINO_VERSION_DATE "2024-5-20" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/CRSFforArduino.cpp b/src/CRSFforArduino.cpp index 7182f055..29bcf46d 100644 --- a/src/CRSFforArduino.cpp +++ b/src/CRSFforArduino.cpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CRSFforArduino.hpp b/src/CRSFforArduino.hpp index ca07700d..0de722d6 100644 --- a/src/CRSFforArduino.hpp +++ b/src/CRSFforArduino.hpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.cpp b/src/SerialReceiver/CRSF/CRSF.cpp index 33839cd9..be2cf28c 100644 --- a/src/SerialReceiver/CRSF/CRSF.cpp +++ b/src/SerialReceiver/CRSF/CRSF.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index 9a618e01..2d4b7379 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSFProtocol.hpp b/src/SerialReceiver/CRSF/CRSFProtocol.hpp index 14077150..4b7eeb0c 100644 --- a/src/SerialReceiver/CRSF/CRSFProtocol.hpp +++ b/src/SerialReceiver/CRSF/CRSFProtocol.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This file contains enums and structs for the CRSF protocol. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp index f2474e4a..69b2e4ad 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp index 9a81bbea..e7611927 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index 80597eae..de27d481 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.hpp b/src/SerialReceiver/SerialReceiver.hpp index 40d6eac9..5413dc61 100644 --- a/src/SerialReceiver/SerialReceiver.hpp +++ b/src/SerialReceiver/SerialReceiver.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.cpp b/src/SerialReceiver/Telemetry/Telemetry.cpp index b2d5aef5..af64e74d 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.cpp +++ b/src/SerialReceiver/Telemetry/Telemetry.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index e7f49fb7..15dd66fe 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index 09bf7181..9a31dc5d 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index ffb80960..64fe6da9 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/common/CRC/CRC.cpp b/src/common/CRC/CRC.cpp index f57943dc..08b742bf 100644 --- a/src/common/CRC/CRC.cpp +++ b/src/common/CRC/CRC.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/common/CRC/CRC.hpp b/src/common/CRC/CRC.hpp index 304080cd..5e359e56 100644 --- a/src/common/CRC/CRC.hpp +++ b/src/common/CRC/CRC.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.cpp b/src/hal/CompatibilityTable/CompatibilityTable.cpp index 8bf659a5..8c32b171 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.cpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.hpp b/src/hal/CompatibilityTable/CompatibilityTable.hpp index 5367a3e6..48fc1745 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.hpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From f1fe711ded576d742dec202ee1a0eb4472468626 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Mon, 1 Jul 2024 09:49:58 +1200 Subject: [PATCH 049/109] chore(library): Bump verion date to 2024-7-2 Setting the version date to tomorrow's date, because that's when I'm picking development up on CRSF for Arduino again... after a nealry two-month long quiet hiatus. --- examples/flight_modes/flight_modes.ino | 2 +- examples/link_stats/link_stats.ino | 2 +- examples/platformio/main.cpp | 2 +- examples/rc_channels/rc_channels.ino | 2 +- examples/telemetry/telemetry.ino | 2 +- src/CFA_Config.hpp | 4 ++-- src/CRSFforArduino.cpp | 2 +- src/CRSFforArduino.hpp | 2 +- src/SerialReceiver/CRSF/CRSF.cpp | 2 +- src/SerialReceiver/CRSF/CRSF.hpp | 2 +- src/SerialReceiver/CRSF/CRSFProtocol.hpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.cpp | 2 +- src/SerialReceiver/SerialBuffer/SerialBuffer.hpp | 2 +- src/SerialReceiver/SerialReceiver.cpp | 2 +- src/SerialReceiver/SerialReceiver.hpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.cpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.hpp | 2 +- src/SerialTransmitter/SerialTransmitter.cpp | 2 +- src/SerialTransmitter/SerialTransmitter.hpp | 2 +- src/common/CRC/CRC.cpp | 2 +- src/common/CRC/CRC.hpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.cpp | 2 +- src/hal/CompatibilityTable/CompatibilityTable.hpp | 2 +- 23 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/flight_modes/flight_modes.ino b/examples/flight_modes/flight_modes.ino index 7db80d3c..0495530b 100644 --- a/examples/flight_modes/flight_modes.ino +++ b/examples/flight_modes/flight_modes.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read flight modes from a receiver. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/link_stats/link_stats.ino b/examples/link_stats/link_stats.ino index 1760345a..e0e8de1b 100644 --- a/examples/link_stats/link_stats.ino +++ b/examples/link_stats/link_stats.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read link statistics from a receiver. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/platformio/main.cpp b/examples/platformio/main.cpp index e06ca7aa..57fef29b 100644 --- a/examples/platformio/main.cpp +++ b/examples/platformio/main.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the main development file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/rc_channels/rc_channels.ino b/examples/rc_channels/rc_channels.ino index c95f9408..0aecb237 100644 --- a/examples/rc_channels/rc_channels.ino +++ b/examples/rc_channels/rc_channels.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read rc channels from a receiver. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/telemetry/telemetry.ino b/examples/telemetry/telemetry.ino index ad7ef386..a97c0811 100644 --- a/examples/telemetry/telemetry.ino +++ b/examples/telemetry/telemetry.ino @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to send telemetry back to your RC handset using CRSF for Arduino. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 573273b7..85492464 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the configuration file for CRSF for Arduino. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -37,7 +37,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-5-20" +#define CRSFFORARDUINO_VERSION_DATE "2024-7-2" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/CRSFforArduino.cpp b/src/CRSFforArduino.cpp index 29bcf46d..46096341 100644 --- a/src/CRSFforArduino.cpp +++ b/src/CRSFforArduino.cpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CRSFforArduino.hpp b/src/CRSFforArduino.hpp index 0de722d6..85bb26e3 100644 --- a/src/CRSFforArduino.hpp +++ b/src/CRSFforArduino.hpp @@ -4,7 +4,7 @@ * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.cpp b/src/SerialReceiver/CRSF/CRSF.cpp index be2cf28c..ac7cb471 100644 --- a/src/SerialReceiver/CRSF/CRSF.cpp +++ b/src/SerialReceiver/CRSF/CRSF.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index 2d4b7379..4184044f 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSFProtocol.hpp b/src/SerialReceiver/CRSF/CRSFProtocol.hpp index 4b7eeb0c..432a1388 100644 --- a/src/SerialReceiver/CRSF/CRSFProtocol.hpp +++ b/src/SerialReceiver/CRSF/CRSFProtocol.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This file contains enums and structs for the CRSF protocol. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp index 69b2e4ad..54c5cdf6 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp index e7611927..9d3483a9 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index de27d481..eb359a4a 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.hpp b/src/SerialReceiver/SerialReceiver.hpp index 5413dc61..ac99919d 100644 --- a/src/SerialReceiver/SerialReceiver.hpp +++ b/src/SerialReceiver/SerialReceiver.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.cpp b/src/SerialReceiver/Telemetry/Telemetry.cpp index af64e74d..12380f43 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.cpp +++ b/src/SerialReceiver/Telemetry/Telemetry.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index 15dd66fe..522bf221 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index 9a31dc5d..b45c0c96 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index 64fe6da9..e2805936 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/common/CRC/CRC.cpp b/src/common/CRC/CRC.cpp index 08b742bf..95fbf48d 100644 --- a/src/common/CRC/CRC.cpp +++ b/src/common/CRC/CRC.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/common/CRC/CRC.hpp b/src/common/CRC/CRC.hpp index 5e359e56..9f0e18b1 100644 --- a/src/common/CRC/CRC.hpp +++ b/src/common/CRC/CRC.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.cpp b/src/hal/CompatibilityTable/CompatibilityTable.cpp index 8c32b171..13599274 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.cpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.hpp b/src/hal/CompatibilityTable/CompatibilityTable.hpp index 48fc1745..54184110 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.hpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From 266c99a15aa7b9c4c09f4d58c2e58bea040dbc75 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sun, 21 Jul 2024 10:22:24 +1200 Subject: [PATCH 050/109] chore(library): Fix Semantic Versioning inconsistencies --- examples/flight_modes/flight_modes.ino | 4 ++-- examples/link_stats/link_stats.ino | 4 ++-- examples/platformio/main.cpp | 4 ++-- examples/rc_channels/rc_channels.ino | 4 ++-- examples/telemetry/telemetry.ino | 4 ++-- src/CFA_Config.hpp | 6 +++--- src/CRSFforArduino.cpp | 4 ++-- src/CRSFforArduino.hpp | 4 ++-- src/SerialReceiver/SerialReceiver.cpp | 4 ++-- src/SerialReceiver/SerialReceiver.hpp | 4 ++-- src/SerialTransmitter/SerialTransmitter.cpp | 4 ++-- src/SerialTransmitter/SerialTransmitter.hpp | 4 ++-- src/common/CRC/CRC.cpp | 4 ++-- src/common/CRC/CRC.hpp | 4 ++-- src/hal/CompatibilityTable/CompatibilityTable.cpp | 4 ++-- src/hal/CompatibilityTable/CompatibilityTable.hpp | 4 ++-- 16 files changed, 33 insertions(+), 33 deletions(-) diff --git a/examples/flight_modes/flight_modes.ino b/examples/flight_modes/flight_modes.ino index 0495530b..86c8d7f3 100644 --- a/examples/flight_modes/flight_modes.ino +++ b/examples/flight_modes/flight_modes.ino @@ -2,8 +2,8 @@ * @file flight_modes.ino * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read flight modes from a receiver. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/link_stats/link_stats.ino b/examples/link_stats/link_stats.ino index e0e8de1b..17275d54 100644 --- a/examples/link_stats/link_stats.ino +++ b/examples/link_stats/link_stats.ino @@ -2,8 +2,8 @@ * @file link_stats.ino * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read link statistics from a receiver. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/platformio/main.cpp b/examples/platformio/main.cpp index 57fef29b..9f5f836a 100644 --- a/examples/platformio/main.cpp +++ b/examples/platformio/main.cpp @@ -2,8 +2,8 @@ * @file main.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the main development file for CRSF for Arduino. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/rc_channels/rc_channels.ino b/examples/rc_channels/rc_channels.ino index 0aecb237..d2415595 100644 --- a/examples/rc_channels/rc_channels.ino +++ b/examples/rc_channels/rc_channels.ino @@ -2,8 +2,8 @@ * @file rc_channels.ino * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read rc channels from a receiver. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/telemetry/telemetry.ino b/examples/telemetry/telemetry.ino index a97c0811..a98600d5 100644 --- a/examples/telemetry/telemetry.ino +++ b/examples/telemetry/telemetry.ino @@ -2,8 +2,8 @@ * @file flight_modes.ino * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to send telemetry back to your RC handset using CRSF for Arduino. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 85492464..3ab50c29 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -2,8 +2,8 @@ * @file CFA_Config.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the configuration file for CRSF for Arduino. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -37,7 +37,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-7-2" +#define CRSFFORARDUINO_VERSION_DATE "2024-7-21" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/CRSFforArduino.cpp b/src/CRSFforArduino.cpp index 46096341..e5376650 100644 --- a/src/CRSFforArduino.cpp +++ b/src/CRSFforArduino.cpp @@ -3,8 +3,8 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CRSFforArduino.hpp b/src/CRSFforArduino.hpp index 85bb26e3..307f9af2 100644 --- a/src/CRSFforArduino.hpp +++ b/src/CRSFforArduino.hpp @@ -3,8 +3,8 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index eb359a4a..b97da874 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -2,8 +2,8 @@ * @file SerialReceiver.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.hpp b/src/SerialReceiver/SerialReceiver.hpp index ac99919d..461ba490 100644 --- a/src/SerialReceiver/SerialReceiver.hpp +++ b/src/SerialReceiver/SerialReceiver.hpp @@ -2,8 +2,8 @@ * @file SerialReceiver.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index b45c0c96..25cee4ac 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -2,8 +2,8 @@ * @file SerialReceiver.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index e2805936..2301cd90 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -2,8 +2,8 @@ * @file SerialTransmitter.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/common/CRC/CRC.cpp b/src/common/CRC/CRC.cpp index 95fbf48d..00e821ec 100644 --- a/src/common/CRC/CRC.cpp +++ b/src/common/CRC/CRC.cpp @@ -2,8 +2,8 @@ * @file CRC.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/common/CRC/CRC.hpp b/src/common/CRC/CRC.hpp index 9f0e18b1..bb2710ed 100644 --- a/src/common/CRC/CRC.hpp +++ b/src/common/CRC/CRC.hpp @@ -2,8 +2,8 @@ * @file GenericCRC.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.cpp b/src/hal/CompatibilityTable/CompatibilityTable.cpp index 13599274..a934751b 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.cpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.cpp @@ -2,8 +2,8 @@ * @file CompatibilityTable.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.hpp b/src/hal/CompatibilityTable/CompatibilityTable.hpp index 54184110..175a5a1d 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.hpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.hpp @@ -2,8 +2,8 @@ * @file CompatibilityTable.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From a33e846fbb3dec42004681ddcad40d21421b231e Mon Sep 17 00:00:00 2001 From: "Cassandra \"ZZ Cat\" Robinson" Date: Sat, 31 Aug 2024 08:36:35 +1200 Subject: [PATCH 051/109] chore(library): Discontinue V1.0.x-maintenance-branch (#136) Development focus is now on the upcoming Version 1.1.0 of CRSF for Arduino. --- .github/workflows/codeql.yml | 4 +- .github/workflows/quality_control.yml | 4 +- examples/flight_modes/flight_modes.ino | 2 - examples/link_stats/link_stats.ino | 2 - examples/platformio/main.cpp | 2 - examples/rc_channels/rc_channels.ino | 2 - examples/telemetry/telemetry.ino | 2 - src/CFA_Config.hpp | 10 +- src/CRSFforArduino.cpp | 6 +- src/CRSFforArduino.hpp | 4 +- src/SerialReceiver/CRSF/CRSF.cpp | 4 +- src/SerialReceiver/CRSF/CRSF.hpp | 2 - src/SerialReceiver/CRSF/CRSFProtocol.hpp | 5 +- .../SerialBuffer/SerialBuffer.cpp | 2 - .../SerialBuffer/SerialBuffer.hpp | 2 - src/SerialReceiver/SerialReceiver.cpp | 199 +++++++++++++++++- src/SerialReceiver/SerialReceiver.hpp | 4 +- src/SerialReceiver/Telemetry/Telemetry.cpp | 2 - src/SerialReceiver/Telemetry/Telemetry.hpp | 2 - src/common/CRC/CRC.cpp | 2 - src/common/CRC/CRC.hpp | 2 - .../CompatibilityTable/CompatibilityTable.cpp | 2 - .../CompatibilityTable/CompatibilityTable.hpp | 4 +- 23 files changed, 206 insertions(+), 64 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3ef5b72b..bf23cc5f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,9 +13,9 @@ name: "CodeQL" on: push: - branches: [ "Main-Trunk" ] + branches: [ "Main-Trunk", "Version-1.1.0-Development" ] pull_request: - branches: [ "Main-Trunk" ] + branches: [ "Main-Trunk", "Version-1.1.0-Development" ] schedule: - cron: '31 20 * * 6' diff --git a/.github/workflows/quality_control.yml b/.github/workflows/quality_control.yml index 7a08885e..f19a00ec 100644 --- a/.github/workflows/quality_control.yml +++ b/.github/workflows/quality_control.yml @@ -2,9 +2,9 @@ name: Quality Control on: push: - branches: [ "Main-Trunk" ] + branches: [ "Main-Trunk", "Version-1.1.0-Development" ] pull_request: - branches: [ "Main-Trunk" ] + branches: [ "Main-Trunk", "Version-1.1.0-Development" ] jobs: # Code formatting with clang-format diff --git a/examples/flight_modes/flight_modes.ino b/examples/flight_modes/flight_modes.ino index 86c8d7f3..19dfd392 100644 --- a/examples/flight_modes/flight_modes.ino +++ b/examples/flight_modes/flight_modes.ino @@ -2,8 +2,6 @@ * @file flight_modes.ino * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read flight modes from a receiver. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/link_stats/link_stats.ino b/examples/link_stats/link_stats.ino index 17275d54..e0e3ee5a 100644 --- a/examples/link_stats/link_stats.ino +++ b/examples/link_stats/link_stats.ino @@ -2,8 +2,6 @@ * @file link_stats.ino * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read link statistics from a receiver. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/platformio/main.cpp b/examples/platformio/main.cpp index 9f5f836a..47cf3bed 100644 --- a/examples/platformio/main.cpp +++ b/examples/platformio/main.cpp @@ -2,8 +2,6 @@ * @file main.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the main development file for CRSF for Arduino. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/rc_channels/rc_channels.ino b/examples/rc_channels/rc_channels.ino index d2415595..292bbe6f 100644 --- a/examples/rc_channels/rc_channels.ino +++ b/examples/rc_channels/rc_channels.ino @@ -2,8 +2,6 @@ * @file rc_channels.ino * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to read rc channels from a receiver. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/examples/telemetry/telemetry.ino b/examples/telemetry/telemetry.ino index a98600d5..f07ae4c4 100644 --- a/examples/telemetry/telemetry.ino +++ b/examples/telemetry/telemetry.ino @@ -2,8 +2,6 @@ * @file flight_modes.ino * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief Example of how to send telemetry back to your RC handset using CRSF for Arduino. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 3ab50c29..0382e3c7 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -2,8 +2,6 @@ * @file CFA_Config.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the configuration file for CRSF for Arduino. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -121,11 +119,11 @@ and assign them to a switch on your controller. */ /* Debug Options - DEBUG_ENABLED: Enables or disables debug output over the selected serial port. - CRSF_DEBUG_SERIAL_PORT: The serial port to use for debug output. Usually the native USB port. -- CRSF_DEBUG_ENABLE_COMPATIBILITY_TABLE_OUTPUT: Enables or disables debug output from the compatibility table. */ -#define CRSF_DEBUG_ENABLED 1 +- CRSF_DEBUG_ENABLE_COMPATIBILITY_TABLE_OUTPUT: Enables or disables debug output from the compatibility table. +- CRSF_DEBUG_ENABLE_CONFIGURATION_DUMP: When enabled, this will print the configuration of CFA to the Serial Monitor.*/ #define CRSF_DEBUG_SERIAL_PORT Serial -#define CRSF_DEBUG_ENABLE_COMPATIBILITY_TABLE_OUTPUT 1 -#define CRSF_DEBUG_ENABLE_VERSION_OUTPUT 1 +#define CRSF_DEBUG_ENABLE_COMPATIBILITY_TABLE_OUTPUT 0 +#define CRSF_DEBUG_ENABLE_CONFIGURATION_DUMP 0 /* All warnings and asserts below this point are to ensure that the configuration is valid. */ diff --git a/src/CRSFforArduino.cpp b/src/CRSFforArduino.cpp index e5376650..66e40b1f 100644 --- a/src/CRSFforArduino.cpp +++ b/src/CRSFforArduino.cpp @@ -3,8 +3,6 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -70,7 +68,7 @@ namespace sketchLayer * * @return true if CRSF for Arduino was initialised successfully. */ - bool CRSFforArduino::begin() + bool CRSFforArduino::begin(const uint32_t baud_rate) { #if CRSF_DEBUG_ENABLED > 0 && CRSF_DEBUG_ENABLE_VERSION_OUTPUT > 0 CRSF_DEBUG_SERIAL_PORT.println("[CRSF for Arduino | INFO]: "); @@ -89,7 +87,7 @@ namespace sketchLayer #endif #if CRSF_RC_ENABLED > 0 || CRSF_TELEMETRY_ENABLED > 0 - return this->SerialReceiver::begin(); + return this->SerialReceiver::begin(baud_rate); #else // Return false if RC is disabled return false; diff --git a/src/CRSFforArduino.hpp b/src/CRSFforArduino.hpp index 307f9af2..75a33ea5 100644 --- a/src/CRSFforArduino.hpp +++ b/src/CRSFforArduino.hpp @@ -3,8 +3,6 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino. * It is intended to be used by the user in their sketches. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -39,7 +37,7 @@ namespace sketchLayer explicit CRSFforArduino(HardwareSerial *serialPort); CRSFforArduino(HardwareSerial *serialPort, int rxPin, int txPin); ~CRSFforArduino(); - bool begin(); + bool begin(const uint32_t baud_rate = crsfProtocol::BAUD_RATE); void end(); void update(); diff --git a/src/SerialReceiver/CRSF/CRSF.cpp b/src/SerialReceiver/CRSF/CRSF.cpp index ac7cb471..debe5751 100644 --- a/src/SerialReceiver/CRSF/CRSF.cpp +++ b/src/SerialReceiver/CRSF/CRSF.cpp @@ -2,8 +2,6 @@ * @file CRSF.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. - * @version 1.1.0 - * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -124,7 +122,7 @@ namespace serialReceiverLayer frameStartTime = currentTime; } - /* Assume the full frame lenthg is 5 bytes until the frame length byte is received. */ + /* Assume the full frame length is 5 bytes until the frame length byte is received. */ const int fullFrameLength = framePosition < 3 ? 5 : min(rxFrame.frame.frameLength + CRSF_FRAME_LENGTH_ADDRESS + CRSF_FRAME_LENGTH_FRAMELENGTH, (int)CRSF_FRAME_SIZE_MAX); if (framePosition < fullFrameLength) diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index 4184044f..17ae4ecf 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -2,8 +2,6 @@ * @file CRSF.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This decodes CRSF frames from a serial port. - * @version 1.1.0 - * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/CRSF/CRSFProtocol.hpp b/src/SerialReceiver/CRSF/CRSFProtocol.hpp index 432a1388..cfdacfaa 100644 --- a/src/SerialReceiver/CRSF/CRSFProtocol.hpp +++ b/src/SerialReceiver/CRSF/CRSFProtocol.hpp @@ -2,8 +2,6 @@ * @file CRSFProtocol.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This file contains enums and structs for the CRSF protocol. - * @version 1.1.0 - * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -263,6 +261,7 @@ namespace crsfProtocol enum baudRate_e { - BAUD_RATE = 420000 + BAUD_RATE_LEGACY = 420000, + BAUD_RATE = 416666 }; } // namespace crsfProtocol diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp index 54c5cdf6..7d92f790 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.cpp @@ -2,8 +2,6 @@ * @file SerialBuffer.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. - * @version 1.1.0 - * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp index 9d3483a9..af1601e3 100644 --- a/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp +++ b/src/SerialReceiver/SerialBuffer/SerialBuffer.hpp @@ -2,8 +2,6 @@ * @file SerialBuffer.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic serial buffer for the CRSF for Arduino library. - * @version 1.1.0 - * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index b97da874..501334d2 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -2,8 +2,6 @@ * @file SerialReceiver.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -212,9 +210,36 @@ namespace serialReceiverLayer #endif } - bool SerialReceiver::begin() + bool SerialReceiver::begin(const uint32_t baudRate) { #if CRSF_DEBUG_ENABLED > 0 + for (int i = 0; i < 93; i++) + { + CRSF_DEBUG_SERIAL_PORT.print("="); + } + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.flush(); + + CRSF_DEBUG_SERIAL_PORT.println("Cassie Robinson's"); + CRSF_DEBUG_SERIAL_PORT.println("CRSF for Arduino"); + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.flush(); + + CRSF_DEBUG_SERIAL_PORT.print("Version: "); + CRSF_DEBUG_SERIAL_PORT.println(CRSFFORARDUINO_VERSION); + CRSF_DEBUG_SERIAL_PORT.print("Build date: "); + CRSF_DEBUG_SERIAL_PORT.println(CRSFFORARDUINO_VERSION_DATE); + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.flush(); + + for (int i = 0; i < 93; i++) + { + CRSF_DEBUG_SERIAL_PORT.print("-"); + } + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.flush(); + CRSF_DEBUG_SERIAL_PORT.print("[Serial Receiver | INFO]: Initialising... "); #endif @@ -262,13 +287,23 @@ namespace serialReceiverLayer /* Check if the target development board is compatible with the CRSF Protocol, and return false if it isn't. */ CompatibilityTable *ct = new CompatibilityTable(); - if (!ct->isDevboardCompatible(ct->getDevboardName())) + const char *devboardName = ct->getDevboardName(); + if (!ct->isDevboardCompatible(devboardName)) { delete ct; ct = nullptr; #if CRSF_DEBUG_ENABLED > 0 - CRSF_DEBUG_SERIAL_PORT.println("\r\n[Serial Receiver | FATAL ERROR]: Devboard is not compatible with CRSF Protocol."); +#if CRSF_DEBUG_ENABLE_COMPATIBILITY_TABLE_OUTPUT == 0 + CRSF_DEBUG_SERIAL_PORT.println("\r\n[Serial Receiver | FATAL ERROR]: Your device is not compatible with CRSF for Arduino."); +#endif + + for (int i = 0; i < 93; i++) + { + CRSF_DEBUG_SERIAL_PORT.print("="); + } + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.flush(); #endif return false; } @@ -279,11 +314,11 @@ namespace serialReceiverLayer /* Initialise the CRSF Protocol and Telemetry. */ crsf = new CRSF(); crsf->begin(); - crsf->setFrameTime(BAUD_RATE, 10); + crsf->setFrameTime(baudRate, 10); #if defined(ARDUINO_ARCH_ESP32) - _uart->begin(BAUD_RATE, SERIAL_8N1, _rxPin, _txPin); + _uart->begin(baudRate, SERIAL_8N1, _rxPin, _txPin); #else - _uart->begin(BAUD_RATE); + _uart->begin(baudRate); #endif #if CRSF_TELEMETRY_ENABLED > 0 @@ -300,6 +335,152 @@ namespace serialReceiverLayer #if CRSF_DEBUG_ENABLED > 0 CRSF_DEBUG_SERIAL_PORT.println("Done."); + + +#if CRSF_DEBUG_ENABLE_CONFIGURATION_DUMP > 0 + for (int i = 0; i < 93; i++) + { + CRSF_DEBUG_SERIAL_PORT.print("-"); + } + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.flush(); + + CRSF_DEBUG_SERIAL_PORT.println("CRSF for Arduino initialised with the following configuration:"); + + CRSF_DEBUG_SERIAL_PORT.println(" - Device:"); + CRSF_DEBUG_SERIAL_PORT.print(" - Name: "); + CRSF_DEBUG_SERIAL_PORT.println(devboardName); + CRSF_DEBUG_SERIAL_PORT.println(" - UART:"); + CRSF_DEBUG_SERIAL_PORT.print(" - Baud rate: "); + CRSF_DEBUG_SERIAL_PORT.println(baudRate); + CRSF_DEBUG_SERIAL_PORT.print(" - Rx pin: "); + CRSF_DEBUG_SERIAL_PORT.println(_rxPin == -1 ? PIN_SERIAL1_RX : _rxPin); + CRSF_DEBUG_SERIAL_PORT.print(" - Tx pin: "); + CRSF_DEBUG_SERIAL_PORT.println(_txPin == -1 ? PIN_SERIAL1_TX : _txPin); + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.flush(); + + CRSF_DEBUG_SERIAL_PORT.println(" - Failsafe thresholds:"); + CRSF_DEBUG_SERIAL_PORT.print(" - LQI threshold: "); + CRSF_DEBUG_SERIAL_PORT.println(CRSF_FAILSAFE_LQI_THRESHOLD); + CRSF_DEBUG_SERIAL_PORT.print(" - RSSI threshold: "); + CRSF_DEBUG_SERIAL_PORT.println(CRSF_FAILSAFE_RSSI_THRESHOLD); + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.flush(); + + CRSF_DEBUG_SERIAL_PORT.println(" - RC Channels API:"); + CRSF_DEBUG_SERIAL_PORT.print(" - Enabled: "); +#if CRSF_RC_ENABLED > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); + + CRSF_DEBUG_SERIAL_PORT.print(" - RC channels: "); + CRSF_DEBUG_SERIAL_PORT.println(CRSF_RC_MAX_CHANNELS); + CRSF_DEBUG_SERIAL_PORT.print(" - Minimum RC Channel value: "); + CRSF_DEBUG_SERIAL_PORT.println((uint16_t)((CRSF_RC_CHANNEL_MIN * 0.62477120195241F) + 881)); + CRSF_DEBUG_SERIAL_PORT.print(" - Maximum RC Channel value: "); + CRSF_DEBUG_SERIAL_PORT.println((uint16_t)((CRSF_RC_CHANNEL_MAX * 0.62477120195241F) + 881)); + CRSF_DEBUG_SERIAL_PORT.print(" - Center RC Channel value: "); + CRSF_DEBUG_SERIAL_PORT.println((uint16_t)((CRSF_RC_CHANNEL_CENTER * 0.62477120195241F) + 881)); + + CRSF_DEBUG_SERIAL_PORT.print(" - Initialise RC channels: "); +#if CRSF_RC_INITIALISE_CHANNELS > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); + + CRSF_DEBUG_SERIAL_PORT.print(" - Initialise Arm channel: "); +#if CRSF_RC_INITIALISE_ARMCHANNEL > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); +#else + CRSF_DEBUG_SERIAL_PORT.println("No"); +#endif + + CRSF_DEBUG_SERIAL_PORT.print(" - Initialise Throttle channel: "); +#if CRSF_RC_INITIALISE_THROTTLECHANNEL > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); +#else + CRSF_DEBUG_SERIAL_PORT.println("No"); +#endif +#else + CRSF_DEBUG_SERIAL_PORT.println("No"); +#endif +#endif + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.flush(); + + CRSF_DEBUG_SERIAL_PORT.println(" - Flight Modes API:"); + CRSF_DEBUG_SERIAL_PORT.print(" - Enabled: "); +#if CRSF_FLIGHTMODES_ENABLED > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); + + CRSF_DEBUG_SERIAL_PORT.print(" - Custom Flight Modes enabled: "); +#if CRSF_CUSTOM_FLIGHT_MODES_ENABLED > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); +#else + CRSF_DEBUG_SERIAL_PORT.println("No"); +#endif +#else + CRSF_DEBUG_SERIAL_PORT.println("No"); +#endif + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.flush(); + + + CRSF_DEBUG_SERIAL_PORT.println(" - Telemetry API:"); + CRSF_DEBUG_SERIAL_PORT.print(" - Enabled: "); +#if CRSF_TELEMETRY_ENABLED > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); + + CRSF_DEBUG_SERIAL_PORT.print(" - Attitude telemetry enabled: "); +#if CRSF_TELEMETRY_ATTITUDE_ENABLED > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); +#else + CRSF_DEBUG_SERIAL_PORT.println("No"); +#endif + + CRSF_DEBUG_SERIAL_PORT.print(" - Barometric altitude telemetry enabled: "); +#if CRSF_TELEMETRY_BAROALTITUDE_ENABLED > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); +#else + CRSF_DEBUG_SERIAL_PORT.println("No"); +#endif + + CRSF_DEBUG_SERIAL_PORT.print(" - Battery telemetry enabled: "); +#if CRSF_TELEMETRY_BATTERY_ENABLED > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); +#else + CRSF_DEBUG_SERIAL_PORT.println("No"); +#endif + + CRSF_DEBUG_SERIAL_PORT.print(" - Flight Mode telemetry enabled: "); +#if CRSF_TELEMETRY_FLIGHTMODE_ENABLED > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); +#else + CRSF_DEBUG_SERIAL_PORT.println("No"); +#endif + + CRSF_DEBUG_SERIAL_PORT.print(" - GPS telemetry enabled: "); +#if CRSF_TELEMETRY_GPS_ENABLED > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); +#else + CRSF_DEBUG_SERIAL_PORT.println("No"); +#endif + + CRSF_DEBUG_SERIAL_PORT.print(" - Link Statistics telemetry enabled: "); +#if CRSF_LINK_STATISTICS_ENABLED > 0 + CRSF_DEBUG_SERIAL_PORT.println("Yes"); +#else + CRSF_DEBUG_SERIAL_PORT.println("No"); +#endif +#endif + CRSF_DEBUG_SERIAL_PORT.println(); +#endif + + for (int i = 0; i < 93; i++) + { + CRSF_DEBUG_SERIAL_PORT.print("="); + } + CRSF_DEBUG_SERIAL_PORT.println(); + CRSF_DEBUG_SERIAL_PORT.flush(); #endif return true; } @@ -408,7 +589,7 @@ namespace serialReceiverLayer else { /* Convert RC value from raw to microseconds. - - Mininum: 172 (988us) + - Minimum: 172 (988us) - Middle: 992 (1500us) - Maximum: 1811 (2012us) - Scale factor = (2012 - 988) / (1811 - 172) = 0.62477120195241 diff --git a/src/SerialReceiver/SerialReceiver.hpp b/src/SerialReceiver/SerialReceiver.hpp index 461ba490..082e335c 100644 --- a/src/SerialReceiver/SerialReceiver.hpp +++ b/src/SerialReceiver/SerialReceiver.hpp @@ -2,8 +2,6 @@ * @file SerialReceiver.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Receiver layer for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -82,7 +80,7 @@ namespace serialReceiverLayer SerialReceiver &operator=(const SerialReceiver &serialReceiver); virtual ~SerialReceiver(); - bool begin(); + bool begin(const uint32_t baudRate); void end(); #if CRSF_RC_ENABLED > 0 || CRSF_TELEMETRY_ENABLED > 0 || CRSF_LINK_STATISTICS_ENABLED > 0 diff --git a/src/SerialReceiver/Telemetry/Telemetry.cpp b/src/SerialReceiver/Telemetry/Telemetry.cpp index 12380f43..8a7ba7e2 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.cpp +++ b/src/SerialReceiver/Telemetry/Telemetry.cpp @@ -2,8 +2,6 @@ * @file Telemetry.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. - * @version 1.1.0 - * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index 522bf221..e56f82e5 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -2,8 +2,6 @@ * @file Telemetry.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief This encodes data into CRSF telemetry frames for transmission to the RC handset. - * @version 1.1.0 - * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/common/CRC/CRC.cpp b/src/common/CRC/CRC.cpp index 00e821ec..439fbefb 100644 --- a/src/common/CRC/CRC.cpp +++ b/src/common/CRC/CRC.cpp @@ -2,8 +2,6 @@ * @file CRC.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/common/CRC/CRC.hpp b/src/common/CRC/CRC.hpp index bb2710ed..bad784f4 100644 --- a/src/common/CRC/CRC.hpp +++ b/src/common/CRC/CRC.hpp @@ -2,8 +2,6 @@ * @file GenericCRC.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief A generic CRC8 implementation for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.cpp b/src/hal/CompatibilityTable/CompatibilityTable.cpp index a934751b..8a60e2bc 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.cpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.cpp @@ -2,8 +2,6 @@ * @file CompatibilityTable.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/hal/CompatibilityTable/CompatibilityTable.hpp b/src/hal/CompatibilityTable/CompatibilityTable.hpp index 175a5a1d..0b206f0c 100644 --- a/src/hal/CompatibilityTable/CompatibilityTable.hpp +++ b/src/hal/CompatibilityTable/CompatibilityTable.hpp @@ -2,8 +2,6 @@ * @file CompatibilityTable.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * @@ -104,7 +102,7 @@ namespace hal DEVBOARD_ARDUINO_PORTENTA_H7, DEVBOARD_ARDUINO_PORTENTA_H7_M4, - // Espresif ESP32 boards. + // Espressif ESP32 boards. DEVBOARD_ESPRESSIF_ESP32C3_DEVKIT, DEVBOARD_ESPRESSIF_ESP32S3_DEVKIT, From d53e15139892220eeb0d0693b60f3edb264ea8d7 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 31 Aug 2024 09:56:47 +1200 Subject: [PATCH 052/109] chore(`CFA_Config.hpp`): :wrench: Add missing preprocessor defines These were obliterated in the previous re-base. --- src/CFA_Config.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 0382e3c7..2c6425f9 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -120,10 +120,13 @@ and assign them to a switch on your controller. */ - DEBUG_ENABLED: Enables or disables debug output over the selected serial port. - CRSF_DEBUG_SERIAL_PORT: The serial port to use for debug output. Usually the native USB port. - CRSF_DEBUG_ENABLE_COMPATIBILITY_TABLE_OUTPUT: Enables or disables debug output from the compatibility table. -- CRSF_DEBUG_ENABLE_CONFIGURATION_DUMP: When enabled, this will print the configuration of CFA to the Serial Monitor.*/ +- CRSF_DEBUG_ENABLE_CONFIGURATION_DUMP: When enabled, this will print the configuration of CFA to the Serial Monitor. +- CRSF_DEBUG_ENABLE_VERSION_OUTPUT: When enabled, this will print the version of CFA to the Serial Monitor. */ +#define CRSF_DEBUG_ENABLED 0 #define CRSF_DEBUG_SERIAL_PORT Serial #define CRSF_DEBUG_ENABLE_COMPATIBILITY_TABLE_OUTPUT 0 #define CRSF_DEBUG_ENABLE_CONFIGURATION_DUMP 0 +#define CRSF_DEBUG_ENABLE_VERSION_OUTPUT 1 /* All warnings and asserts below this point are to ensure that the configuration is valid. */ From 35c06925e2d780b9f4cb244cc8dd4d0ced7adb75 Mon Sep 17 00:00:00 2001 From: ddanilchenko Date: Sun, 1 Sep 2024 00:09:57 +0300 Subject: [PATCH 053/109] feat(serial receiver interface): :sparkles: Introduce three new callbacks (#134) Three new callback functions are added to the Serial Receiver Interface: - `onLinkDownCallback` Runs when no CRSF data is received within `CRSF_FAILSAFE_STAGE1_MS` (default is 300 milliseconds), and this may be used to facilitate fail-safe conditions. - `onLinkUpCallback` Runs when a reconnection is established, and this may be used to facilitate fail-safe recovery. - `onRawDataCallback` Runs whenever individual bytes from the raw CRSF data stream is received, and this may be used to facilitate UART pass-through. Signed-off-by: Dmytro Co-authored-by: Cassandra "ZZ Cat" Robinson --- src/CRSFforArduino.cpp | 15 ++++++++ src/CRSFforArduino.hpp | 4 +++ src/SerialReceiver/SerialReceiver.cpp | 50 ++++++++++++++++++++++++--- src/SerialReceiver/SerialReceiver.hpp | 21 +++++++++++ 4 files changed, 86 insertions(+), 4 deletions(-) diff --git a/src/CRSFforArduino.cpp b/src/CRSFforArduino.cpp index 66e40b1f..596425e5 100644 --- a/src/CRSFforArduino.cpp +++ b/src/CRSFforArduino.cpp @@ -190,6 +190,21 @@ namespace sketchLayer #endif } + void CRSFforArduino::setRawDataCallback(void (*callback)(int8_t byteReceived)) + { + this->SerialReceiver::setRawDataCallback(callback); + } + + void CRSFforArduino::setLinkUpCallback(void (*callback)()) + { + this->SerialReceiver::setLinkUpCallback(callback); + } + + void CRSFforArduino::setLinkDownCallback(void (*callback)()) + { + this->SerialReceiver::setLinkDownCallback(callback); + } + void CRSFforArduino::setLinkStatisticsCallback(void (*callback)(serialReceiverLayer::link_statistics_t linkStatistics)) { #if CRSF_LINK_STATISTICS_ENABLED > 0 diff --git a/src/CRSFforArduino.hpp b/src/CRSFforArduino.hpp index 75a33ea5..5626ae51 100644 --- a/src/CRSFforArduino.hpp +++ b/src/CRSFforArduino.hpp @@ -54,6 +54,10 @@ namespace sketchLayer bool setFlightMode(serialReceiverLayer::flightModeId_t flightModeId, const char *flightModeName, uint8_t channel, uint16_t min, uint16_t max); bool setFlightMode(serialReceiverLayer::flightModeId_t flightMode, uint8_t channel, uint16_t min, uint16_t max); void setFlightModeCallback(void (*callback)(serialReceiverLayer::flightModeId_t flightMode)); + void setRawDataCallback(void (*callback)(int8_t byteReceived)); + + void setLinkUpCallback(void (*callback)()); + void setLinkDownCallback(void (*callback)()); // Telemetry functions. void telemetryWriteAttitude(int16_t roll, int16_t pitch, int16_t yaw); diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index 501334d2..2a279a30 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -31,7 +31,7 @@ using namespace hal; namespace serialReceiverLayer { - SerialReceiver::SerialReceiver() + SerialReceiver::SerialReceiver(): _linkIsUp(false), _lastChannelsPacket(0) { #if defined(ARDUINO_ARCH_STM32) #if defined(HAVE_HWSERIAL1) @@ -70,7 +70,7 @@ namespace serialReceiverLayer #endif } - SerialReceiver::SerialReceiver(HardwareSerial *hwUartPort) + SerialReceiver::SerialReceiver(HardwareSerial *hwUartPort) : _linkIsUp(false), _lastChannelsPacket(0) { _uart = hwUartPort; @@ -99,7 +99,7 @@ namespace serialReceiverLayer #endif } - SerialReceiver::SerialReceiver(HardwareSerial *hwUartPort, int8_t rxPin, int8_t txPin) + SerialReceiver::SerialReceiver(HardwareSerial *hwUartPort, int8_t rxPin, int8_t txPin) : _linkIsUp(false), _lastChannelsPacket(0) { _uart = hwUartPort; @@ -128,6 +128,8 @@ namespace serialReceiverLayer _rxPin = serialReceiver._rxPin; _txPin = serialReceiver._txPin; + _linkIsUp = serialReceiver._linkIsUp; + _lastChannelsPacket= serialReceiver._lastChannelsPacket; #if CRSF_RC_ENABLED > 0 _rcChannels = new rcChannels_t; @@ -157,6 +159,11 @@ namespace serialReceiverLayer _txPin = serialReceiver._txPin; crsf = serialReceiver.crsf; + _linkIsUp = serialReceiver._linkIsUp; + _lastChannelsPacket = serialReceiver._lastChannelsPacket; + _rawDataCallback = serialReceiver._rawDataCallback; + _linkUpCallback = serialReceiver._linkUpCallback; + _linkDownCallback = serialReceiver._linkDownCallback; #if CRSF_TELEMETRY_ENABLED > 0 telemetry = serialReceiver.telemetry; @@ -522,7 +529,8 @@ namespace serialReceiverLayer { while (_uart->available() > 0) { - if (crsf->receiveFrames((uint8_t)_uart->read())) + uint8_t byteReceived = (uint8_t)_uart->read(); + if (crsf->receiveFrames(byteReceived)) { flushRemainingFrames(); @@ -549,11 +557,40 @@ namespace serialReceiverLayer _rcChannelsCallback(_rcChannels); } #endif + setLinkUp(); } + + if (_rawDataCallback != nullptr) + { + _rawDataCallback(byteReceived); + } + } + checkLinkDown(); } #endif +void SerialReceiver::setLinkDownCallback(linkDownCallback_t callback) { _linkDownCallback = callback; } +void SerialReceiver::setLinkUpCallback(linkUpCallback_t callback) { _linkUpCallback = callback; } + +bool SerialReceiver::isLinkUp() const { return _linkIsUp; } + +void SerialReceiver::setLinkUp() +{ + if (!_linkIsUp && _linkUpCallback) _linkUpCallback(); + _linkIsUp = true; + _lastChannelsPacket = millis(); +} + +void SerialReceiver::checkLinkDown() +{ + if (_linkIsUp && millis() - _lastChannelsPacket > CRSF_FAILSAFE_STAGE1_MS) { + if (_linkDownCallback) _linkDownCallback(); + _linkIsUp = false; + } +} + + #if CRSF_LINK_STATISTICS_ENABLED > 0 void SerialReceiver::setLinkStatisticsCallback(linkStatisticsCallback_t callback) { @@ -572,6 +609,11 @@ namespace serialReceiverLayer } #endif + void SerialReceiver::setRawDataCallback(rawDataCallback_t callback) + { + _rawDataCallback = callback; + } + #if CRSF_RC_ENABLED > 0 void SerialReceiver::setRcChannelsCallback(rcChannelsCallback_t callback) { diff --git a/src/SerialReceiver/SerialReceiver.hpp b/src/SerialReceiver/SerialReceiver.hpp index 082e335c..03a93e1d 100644 --- a/src/SerialReceiver/SerialReceiver.hpp +++ b/src/SerialReceiver/SerialReceiver.hpp @@ -69,10 +69,16 @@ namespace serialReceiverLayer typedef void (*rcChannelsCallback_t)(rcChannels_t *); typedef void (*flightModeCallback_t)(flightModeId_t); typedef void (*linkStatisticsCallback_t)(link_statistics_t); + typedef void (*rawDataCallback_t)(int8_t); + + typedef void (*linkUpCallback_t)(); + typedef void (*linkDownCallback_t)(); class SerialReceiver { public: + static const unsigned int CRSF_FAILSAFE_STAGE1_MS = 300; + SerialReceiver(); explicit SerialReceiver(HardwareSerial *hwUartPort); SerialReceiver(HardwareSerial *hwUartPort, int8_t rxPin, int8_t txPin); @@ -87,6 +93,8 @@ namespace serialReceiverLayer void processFrames(); #endif + + #if CRSF_LINK_STATISTICS_ENABLED > 0 void setLinkStatisticsCallback(linkStatisticsCallback_t callback); #endif @@ -106,6 +114,13 @@ namespace serialReceiverLayer #endif #endif + void setRawDataCallback(rawDataCallback_t callback); + void setLinkDownCallback(linkDownCallback_t callback); + void setLinkUpCallback(linkUpCallback_t callback); + bool isLinkUp() const; + void checkLinkDown(); + void setLinkUp(); + #if CRSF_TELEMETRY_ENABLED > 0 void telemetryWriteAttitude(int16_t roll, int16_t pitch, int16_t yaw); void telemetryWriteBaroAltitude(uint16_t altitude, int16_t vario); @@ -121,6 +136,8 @@ namespace serialReceiverLayer int8_t _rxPin = -1; int8_t _txPin = -1; + bool _linkIsUp; + uint32_t _lastChannelsPacket; #if CRSF_TELEMETRY_ENABLED > 0 Telemetry *telemetry = nullptr; @@ -156,5 +173,9 @@ namespace serialReceiverLayer #if CRSF_RC_ENABLED > 0 || CRSF_TELEMETRY_ENABLED > 0 void flushRemainingFrames(); #endif + + rawDataCallback_t _rawDataCallback = nullptr; + linkUpCallback_t _linkUpCallback = nullptr; + linkDownCallback_t _linkDownCallback = nullptr; }; } // namespace serialReceiverLayer From 0f8e1a820a3bb55cddd5112de7821bc225039b39 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 9 Apr 2024 09:40:32 +1200 Subject: [PATCH 054/109] chore(library): Bump version date to `2024-4-9` --- src/CFA_Config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 2c6425f9..935c9ece 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-7-21" +#define CRSFFORARDUINO_VERSION_DATE "2024-4-9" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 From 4fb7aaebb6b0d5ca11209a8205a6f4cdeef6046b Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 20 Apr 2024 11:19:46 +1200 Subject: [PATCH 055/109] chore(library): Bump version date to `2024-4-20` --- src/CFA_Config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 935c9ece..3effa45e 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-4-9" +#define CRSFFORARDUINO_VERSION_DATE "2024-4-20" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 From ba8d46fe012343b10693c54911557c8518e28c42 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Mon, 20 May 2024 08:52:52 +1200 Subject: [PATCH 056/109] chore(library): Bump version date to `2024-5-20` --- src/CFA_Config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 3effa45e..e6d5ea81 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-4-20" +#define CRSFFORARDUINO_VERSION_DATE "2024-5-20" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 From e88628d1d275cc1f8f48e3956af84cb1e3badbec Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Mon, 1 Jul 2024 09:49:58 +1200 Subject: [PATCH 057/109] chore(library): Bump verion date to 2024-7-2 Setting the version date to tomorrow's date, because that's when I'm picking development up on CRSF for Arduino again... after a nealry two-month long quiet hiatus. --- src/CFA_Config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index e6d5ea81..967e7120 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-5-20" +#define CRSFFORARDUINO_VERSION_DATE "2024-7-2" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 From 80d18d1ec23e0bd098997b131e976a667d5bf410 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 20:21:45 +1200 Subject: [PATCH 058/109] feat(serial transmitter prototype): :sparkles: Write 64 bytes of data with `Serial1` at the selected packet rate This sets the stage for CRSF packets. --- examples/platformio/serial_transmitter_prototype.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index ae003278..47cec23a 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -198,6 +198,10 @@ void setup() /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); + /* Initialise Serial1 with 1.87M baud rate. */ + Serial1.begin(1875000); + memset(serial_buffer, 0, serial_buffer_size); + /* Set the time in microseconds. */ sw_timer->time_us = micros(); sw_timer->time_us_last = sw_timer->time_us; @@ -229,6 +233,9 @@ void loop() /* Write 64 bytes to Serial1. */ Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); + /* Write 64 bytes to Serial1. */ + Serial1.write(serial_buffer, serial_buffer_size); + /* Increment the iteration. */ iteration++; } From 56d9c24a807d0b81ffcf240470ae66b5aeb31607 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 10:16:14 +1200 Subject: [PATCH 059/109] refactor(serial transmitter prototype): :recycle: Replace `serial_buffer` placeholder with `crsf_tx_frame` --- .../serial_transmitter_prototype.cpp | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 47cec23a..16d9c97d 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -76,6 +76,24 @@ typedef union crsf_tx_frame_u uint8_t buffer[crsf_frame_size]; } crsf_tx_frame_t; +/* CRSF Frame structure and union. */ +typedef struct crsf_frame_s +{ + uint8_t sync; + uint8_t length; + uint8_t type; + uint8_t payload[60]; + uint8_t crc; +} crsf_frame_t; + +const size_t crsf_frame_size = sizeof(crsf_frame_t); + +typedef union crsf_tx_frame_u +{ + crsf_frame_t frame; + uint8_t buffer[crsf_frame_size]; +} crsf_tx_frame_t; + /* Time structure instance. */ software_realtime_counter_t *sw_timer = nullptr; @@ -200,7 +218,7 @@ void setup() /* Initialise Serial1 with 1.87M baud rate. */ Serial1.begin(1875000); - memset(serial_buffer, 0, serial_buffer_size); + memset(&crsf_tx_frame, 0, crsf_frame_size); /* Set the time in microseconds. */ sw_timer->time_us = micros(); @@ -234,7 +252,7 @@ void loop() Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); /* Write 64 bytes to Serial1. */ - Serial1.write(serial_buffer, serial_buffer_size); + Serial1.write(crsf_tx_frame.buffer, crsf_frame_size); /* Increment the iteration. */ iteration++; From fc2756da128cce48c7e700e68ba8005b56342a87 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 10:36:48 +1200 Subject: [PATCH 060/109] refactor(serial transmitter prototype): :recycle: Improve error handling Instead of spamming the time delta in the Terminal, a simple notification is sent; and the prototyp test now halts when the `time_us_max_allowed_error` is exceeded. --- examples/platformio/serial_transmitter_prototype.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 16d9c97d..c5d7e7a5 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -220,6 +220,9 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); + /* Print a message to the serial monitor. */ + Serial.println("Testing CRSF Serial Transmitter Prototype..."); + /* Set the time in microseconds. */ sw_timer->time_us = micros(); sw_timer->time_us_last = sw_timer->time_us; From c09381bbfe9bac5cd19051a3147969fc6384965d Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:39:58 +1200 Subject: [PATCH 061/109] refactor(serial transmitter prototype): :construction: Flesh out packed RC Channels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All RC Channels are 'centred' except for `ch5` which is initialised to `1000 µS`. --- .../serial_transmitter_prototype.cpp | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index c5d7e7a5..c812e407 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -76,6 +76,29 @@ typedef union crsf_tx_frame_u uint8_t buffer[crsf_frame_size]; } crsf_tx_frame_t; +/* Packed 11-bit RC Channels. */ +struct rc_channels_packed_s +{ + uint16_t ch1 : 11; + uint16_t ch2 : 11; + uint16_t ch3 : 11; + uint16_t ch4 : 11; + uint16_t ch5 : 11; + uint16_t ch6 : 11; + uint16_t ch7 : 11; + uint16_t ch8 : 11; + uint16_t ch9 : 11; + uint16_t ch10 : 11; + uint16_t ch11 : 11; + uint16_t ch12 : 11; + uint16_t ch13 : 11; + uint16_t ch14 : 11; + uint16_t ch15 : 11; + uint16_t ch16 : 11; +} __attribute__((packed)); + +typedef struct rc_channels_packed_s rc_channels_packed_t; + /* CRSF Frame structure and union. */ typedef struct crsf_frame_s { @@ -220,6 +243,26 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); + /* Initialise the RC Channels structure. */ + rc_channels_packed_t rc_channels_packed; + rc_channels_packed.ch1 = 992; + rc_channels_packed.ch2 = 992; + rc_channels_packed.ch3 = 992; + rc_channels_packed.ch4 = 992; + rc_channels_packed.ch5 = 178; + rc_channels_packed.ch6 = 992; + rc_channels_packed.ch7 = 992; + rc_channels_packed.ch8 = 992; + rc_channels_packed.ch9 = 992; + rc_channels_packed.ch10 = 992; + rc_channels_packed.ch11 = 992; + rc_channels_packed.ch12 = 992; + rc_channels_packed.ch13 = 992; + rc_channels_packed.ch14 = 992; + rc_channels_packed.ch15 = 992; + rc_channels_packed.ch16 = 992; + + /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); From 9b678031cf91d751330ab158464d213e44cb205c Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:40:57 +1200 Subject: [PATCH 062/109] refactor(serial transmitter prototype): :recycle: Prepare CRSF RC Channels Packed data... ...and send it at the selected packet rate. --- examples/platformio/serial_transmitter_prototype.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index c812e407..698b3fb0 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -262,6 +262,12 @@ void setup() rc_channels_packed.ch15 = 992; rc_channels_packed.ch16 = 992; + /* Prepare the CRSF RC Channels Packed frame. */ + crsf_tx_frame.frame.sync = 0xC8; // NB: EdgeTX uses 0xEE which is incorrect. + crsf_tx_frame.frame.length = 24; + crsf_tx_frame.frame.type = 0x16; + memcpy(crsf_tx_frame.frame.payload, &rc_channels_packed, sizeof(rc_channels_packed)); + crsf_tx_frame.frame.crc = calculate_crc(&crsf_tx_frame); /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); @@ -298,7 +304,7 @@ void loop() Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); /* Write 64 bytes to Serial1. */ - Serial1.write(crsf_tx_frame.buffer, crsf_frame_size); + Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); /* Increment the iteration. */ iteration++; From 287fcd5be19eaf7d000a9cbfa5f7ceecb9555689 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sun, 21 Jul 2024 10:22:24 +1200 Subject: [PATCH 063/109] chore(library): Fix Semantic Versioning inconsistencies --- src/CFA_Config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 967e7120..2c6425f9 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-7-2" +#define CRSFFORARDUINO_VERSION_DATE "2024-7-21" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 From d6e6dc7d1a386aa5cc32b6b842cec2b92f2f7359 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sun, 1 Sep 2024 11:02:55 +1200 Subject: [PATCH 064/109] chore(library): :fire: Remove obsolete Semantic Version tracking from the Serial Transmitter Interface's boiler plate --- src/SerialTransmitter/SerialTransmitter.cpp | 2 -- src/SerialTransmitter/SerialTransmitter.hpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index 25cee4ac..b147a58b 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -2,8 +2,6 @@ * @file SerialReceiver.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index 2301cd90..4e8b69d7 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -2,8 +2,6 @@ * @file SerialTransmitter.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From 44404a7fca4b925aa05e0f4d69fc60e6244d5f80 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 9 Apr 2024 09:40:32 +1200 Subject: [PATCH 065/109] chore(library): Bump version date to `2024-4-9` --- src/CFA_Config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 2c6425f9..935c9ece 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-7-21" +#define CRSFFORARDUINO_VERSION_DATE "2024-4-9" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 From 93b560ba81406f0518a364f980d242cba7e4ffed Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 9 Apr 2024 11:02:30 +1200 Subject: [PATCH 066/109] feat(serial transmitter layer): :sparkles: Initial commit for Serial Transmitter Interface This sets the precedence for the Serial Transmitter's API This is not yet functional. --- src/SerialTransmitter/SerialTransmitter.cpp | 103 ++++++++++++++++++++ src/SerialTransmitter/SerialTransmitter.hpp | 48 +++++++++ 2 files changed, 151 insertions(+) create mode 100644 src/SerialTransmitter/SerialTransmitter.cpp create mode 100644 src/SerialTransmitter/SerialTransmitter.hpp diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp new file mode 100644 index 00000000..34d93989 --- /dev/null +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -0,0 +1,103 @@ +/** + * @file SerialReceiver.cpp + * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) + * @brief The Serial Transmitter layer for the CRSF for Arduino library. + * @version 1.1.0 + * @date 2024-4-9 + * + * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. + * + * @section License GNU General Public License v3.0 + * This source file is a part of the CRSF for Arduino library. + * CRSF for Arduino 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. + * + * CRSF for Arduino 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 CRSF for Arduino. If not, see . + * + */ + +#include "SerialTransmitter.hpp" +#include "../hal/CompatibilityTable/CompatibilityTable.hpp" +#include "Arduino.h" + +using namespace hal; + +namespace serialTransmitterLayer +{ + SerialTransmitter::SerialTransmitter() + { + #if defined(ARDUINO_ARCH_STM32) +#if defined(HAVE_HWSERIAL1) + _uart = &Serial1; +#elif defined(HAVE_HWSERIAL2) + _uart = &Serial2; +#elif defined(HAVE_HWSERIAL3) + _uart = &Serial3; +#endif +#elif defined(ARDUINO_ARCH_ESP32) + _uart = &Serial1; + +#if defined(D0) + _rxPin = D0; +#else + _rxPin = 0; +#endif + +#if defined(D1) + _txPin = D1; +#else + _txPin = 1; +#endif +#else + _uart = &Serial1; +#endif + } + + SerialTransmitter::SerialTransmitter(HardwareSerial *hwUartPort) + { + _uart = hwUartPort; + +#if defined(ARDUINO_ARCH_ESP32) +#if defined(D0) + _rxPin = D0; +#else + _rxPin = 0; +#endif + +#if defined(D1) + _txPin = D1; +#else + _txPin = 1; +#endif +#endif + } + + SerialTransmitter::SerialTransmitter(HardwareSerial *hwUartPort, int8_t rxPin, int8_t txPin) + { + _uart = hwUartPort; + +#if defined(ARDUINO_ARCH_ESP32) + _rxPin = rxPin; + _txPin = txPin; +#else + (void)rxPin; + (void)txPin; +#endif + } + + SerialTransmitter::~SerialTransmitter() + { + _uart = nullptr; + + _rxPin = -1; + _txPin = -1; + } +} // namespace serialTransmitterLayer diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp new file mode 100644 index 00000000..75175054 --- /dev/null +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -0,0 +1,48 @@ +/** + * @file SerialTransmitter.hpp + * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) + * @brief The Serial Transmitter layer for the CRSF for Arduino library. + * @version 1.1.0 + * @date 2024-4-9 + * + * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. + * + * @section License GNU General Public License v3.0 + * This source file is a part of the CRSF for Arduino library. + * CRSF for Arduino 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. + * + * CRSF for Arduino 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 CRSF for Arduino. If not, see . + * + */ + +#pragma once + +#include "../CFA_Config.hpp" +#include "Arduino.h" + +namespace serialTransmitterLayer +{ + class SerialTransmitter + { + public: + SerialTransmitter(); + SerialTransmitter(HardwareSerial *hwUartPort); + SerialTransmitter(HardwareSerial *hwUartPort, int8_t rxPin, int8_t txPin); + virtual ~SerialTransmitter(); + + private: + HardwareSerial *_uart; + + int8_t _rxPin = -1; + int8_t _txPin = -1; + }; +} // namespace serialTransmitterLayer From 22a4e7256c5773e3d5d8cb43c12d4fa713fbbef7 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 20 Apr 2024 11:19:46 +1200 Subject: [PATCH 067/109] chore(library): Bump version date to `2024-4-20` --- src/CFA_Config.hpp | 2 +- src/SerialTransmitter/SerialTransmitter.cpp | 2 +- src/SerialTransmitter/SerialTransmitter.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 935c9ece..3effa45e 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-4-9" +#define CRSFFORARDUINO_VERSION_DATE "2024-4-20" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index 34d93989..09bf7181 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index 75175054..c9b0278d 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-9 + * @date 2024-4-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From 338fb1096e6f98cf6efc1ae64ddaf67b01a1090a Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 20 Apr 2024 11:24:08 +1200 Subject: [PATCH 068/109] fix(defect): :adhesive_bandage: Class `SerialTransmitter` has a constructor that is not explicit --- src/SerialTransmitter/SerialTransmitter.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index c9b0278d..ffb80960 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -26,7 +26,9 @@ #pragma once +#ifndef ENV_DEFECT_DETECTOR #include "../CFA_Config.hpp" +#endif #include "Arduino.h" namespace serialTransmitterLayer @@ -35,7 +37,7 @@ namespace serialTransmitterLayer { public: SerialTransmitter(); - SerialTransmitter(HardwareSerial *hwUartPort); + explicit SerialTransmitter(HardwareSerial *hwUartPort); SerialTransmitter(HardwareSerial *hwUartPort, int8_t rxPin, int8_t txPin); virtual ~SerialTransmitter(); From d44d539a53b9200924747f8d22f736a314bfaa68 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 20 Apr 2024 11:27:04 +1200 Subject: [PATCH 069/109] build(`platformio.ini`): Temporarily restrict Quality Control builds to commonly used targets This temporarily speeds up development of the Serial Transmitter Interface. Once development on it is complete, running Quality Control on all supported targets will be reinstated. --- platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index a0883b29..d10e4a12 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,8 +12,8 @@ core_dir = .pio/core default_envs = ; defect_detector - development - ; ${build.all} + ; development + ${build.commonly_used} extra_configs = targets/common.ini targets/quality_control.ini From dec792ed453769a26448373103c83f12803a1e5d Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 14:31:09 +1200 Subject: [PATCH 070/109] chore(library): :construction: Initial commit on working Serial Transmitter Interface prototype This is initially populated with the typical Arduino "boiler plate" code what prints "Hello, World!" to the terminal. --- .../serial_transmitter_prototype.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/platformio/serial_transmitter_prototype.cpp diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp new file mode 100644 index 00000000..ea619f9c --- /dev/null +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -0,0 +1,21 @@ +#if __has_include("Arduino.h") +#include "Arduino.h" +#define ARDUINO_IS_INCLUDED 1 +#else +#define ARDUINO_IS_INCLUDED 0 +#endif + +#if ARDUINO_IS_INCLUDED == 1 +void setup() +{ + Serial.begin(115200); + while (!Serial) + { + delay(10); + } + Serial.println("Hello, World!"); +} + +void loop() +{} +#endif From 55c5ddc602c3e980f34887d9e666d88227af9017 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 14:33:45 +1200 Subject: [PATCH 071/109] build(`platformio.ini`): :wrench: Create a secure development environment and enable it This development environment will remain enabled until development of the Serial Transmitter Interface is complete. --- platformio.ini | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index d10e4a12..c1e539a7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,8 +12,8 @@ core_dir = .pio/core default_envs = ; defect_detector - ; development - ${build.commonly_used} + development + ; ${build.commonly_used} extra_configs = targets/common.ini targets/quality_control.ini @@ -31,9 +31,29 @@ test_dir = [env:development] board = adafruit_metro_m4 +build_flags = +build_src_flags = + ; Compile hardening flags: + -O2 + -Wall + -Wextra + -Wformat + -Wformat=2 + ; -Wconversion ; Disabled due to spamming conversion issues in packages outside the scope of CRSF for Arduino. + -Wimplicit-fallthrough + -U_FORTIFY_SOURCE + -D_FORTIFY_SOURCE=3 + -D_GLIBCXX_ASSERTIONS + ; -fsrict-flex-arrays=3 ; Not available in GCC Arm Compiler v12.3.1 + -fstack-clash-protection + -fstack-protector-strong build_src_filter = - +<../examples/platformio/main.cpp> + +<../examples/platformio/serial_transmitter_prototype.cpp> +<*/*/*.cpp> +<*.cpp> build_type = debug +build_unflags = + -Os extends = env_common_samd51 +platform_packages = + platformio/toolchain-gccarmnoneeabi @ 1.120301.0 ; PlatformIO's latest GCC Compiler version From e0b217955c58977c94f9f5a656fa0b6690548414 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 18:55:38 +1200 Subject: [PATCH 072/109] refactor(serial transmitter prototype): :construction: Print the time delta (in microseconds) to the terminal at the selected packet rate Pakcet rates are based on ExpressLRS' packet rates. --- .../serial_transmitter_prototype.cpp | 99 ++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index ea619f9c..4ebfe2a1 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -5,6 +5,48 @@ #define ARDUINO_IS_INCLUDED 0 #endif +/* Packet rate enumeration. */ +typedef enum packet_rate_index_e +{ + PACKET_RATE_4HZ, + PACKET_RATE_25HZ, + PACKET_RATE_50HZ, + PACKET_RATE_100HZ, + PACKET_RATE_150HZ, + PACKET_RATE_200HZ, + PACKET_RATE_250HZ, + PACKET_RATE_333HZ, + PACKET_RATE_500HZ, + PACKET_RATE_1000HZ, + PACKET_RATE_COUNT +} packet_rate_index_t; + +/* Selected packet rate. */ +const packet_rate_index_t selected_packet_rate = PACKET_RATE_50HZ; +uint32_t *packet_rate_us = nullptr; + +/* Time structure for the packet rate. */ +typedef struct time_s +{ + uint32_t time_us = 0; + uint32_t time_us_last = 0xFFFFFFFF; + uint32_t time_us_delta = 0xFFFFFFFF; +} time_t; + +/* Time structure instance. */ +time_t *time = nullptr; + +/* Exit handler. */ +void exitHandler() +{ + /* Clean up and stop. */ + delete[] packet_rate_us; + delete time; + + /* Print a message to the serial monitor. */ + Serial.println("Done!"); +} + #if ARDUINO_IS_INCLUDED == 1 void setup() { @@ -13,9 +55,62 @@ void setup() { delay(10); } - Serial.println("Hello, World!"); + + /* Dynamically allocate memory for the packet rate, + and calculate the time in microseconds for each packet rate. */ + packet_rate_us = new uint32_t[PACKET_RATE_COUNT]; + packet_rate_us[PACKET_RATE_4HZ] = (1000000UL / 4UL); + packet_rate_us[PACKET_RATE_25HZ] = (1000000UL / 25UL); + packet_rate_us[PACKET_RATE_50HZ] = (1000000UL / 50UL); + packet_rate_us[PACKET_RATE_100HZ] = (1000000UL / 100UL); + packet_rate_us[PACKET_RATE_150HZ] = (1000000UL / 150UL); + packet_rate_us[PACKET_RATE_200HZ] = (1000000UL / 200UL); + packet_rate_us[PACKET_RATE_250HZ] = (1000000UL / 250UL); + packet_rate_us[PACKET_RATE_333HZ] = (1000000UL / 333UL); + packet_rate_us[PACKET_RATE_500HZ] = (1000000UL / 500UL); + packet_rate_us[PACKET_RATE_1000HZ] = (1000000UL / 1000UL); + + /* Initialize the time structure. */ + time = new time_t; + + /* Set the time in microseconds for the selected packet rate. */ + time->time_us = packet_rate_us[selected_packet_rate]; } void loop() -{} +{ + + static uint32_t iteration = 0; + + /* Calculate the number of iterations based on the selected packet rate and the equivalent total execution time of three seconds. */ + static const uint32_t iterations = (3000000UL / packet_rate_us[selected_packet_rate]); + + if (iteration < iterations) + { + /* Calculate the time delta in microseconds. */ + time->time_us = micros(); + time->time_us_delta = time->time_us - time->time_us_last; + + /* Check if the time delta is greater than the time in microseconds for the selected packet rate. */ + if (time->time_us_delta >= packet_rate_us[selected_packet_rate]) + { + /* Print the time delta in microseconds. */ + Serial.print("Time Delta: "); + Serial.print(time->time_us_delta); + Serial.println(" us"); + + /* Set the last time in microseconds. */ + time->time_us_last = time->time_us; + + /* Increment the iteration. */ + iteration++; + } + } + else + { + /* Exit the program. */ + atexit(exitHandler); + exit(EXIT_SUCCESS); + } +} #endif From c82a2325abecd666970bb0a77a8a82427171b1ea Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 19:08:28 +1200 Subject: [PATCH 073/109] fix(serial transmitter prototype): :bug: Fix `time_us` overflow on first iteration --- examples/platformio/serial_transmitter_prototype.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 4ebfe2a1..79aae5b3 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -29,8 +29,8 @@ uint32_t *packet_rate_us = nullptr; typedef struct time_s { uint32_t time_us = 0; - uint32_t time_us_last = 0xFFFFFFFF; - uint32_t time_us_delta = 0xFFFFFFFF; + uint32_t time_us_last = 0; + uint32_t time_us_delta = 0; } time_t; /* Time structure instance. */ @@ -73,8 +73,9 @@ void setup() /* Initialize the time structure. */ time = new time_t; - /* Set the time in microseconds for the selected packet rate. */ - time->time_us = packet_rate_us[selected_packet_rate]; + /* Set the time in microseconds. */ + time->time_us = micros(); + time->time_us_last = time->time_us; } void loop() From 100a258e4fa215084fafa9704841fddacafa3993 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 20:21:45 +1200 Subject: [PATCH 074/109] feat(serial transmitter prototype): :sparkles: Write 64 bytes of data with `Serial1` at the selected packet rate This sets the stage for CRSF packets. --- examples/platformio/serial_transmitter_prototype.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 79aae5b3..8687b283 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -36,6 +36,9 @@ typedef struct time_s /* Time structure instance. */ time_t *time = nullptr; +const size_t serial_buffer_size = 64; +uint8_t serial_buffer[serial_buffer_size] = { 0 }; + /* Exit handler. */ void exitHandler() { @@ -73,6 +76,10 @@ void setup() /* Initialize the time structure. */ time = new time_t; + /* Initialise Serial1 with 1.87M baud rate. */ + Serial1.begin(1875000); + memset(serial_buffer, 0, serial_buffer_size); + /* Set the time in microseconds. */ time->time_us = micros(); time->time_us_last = time->time_us; @@ -103,6 +110,9 @@ void loop() /* Set the last time in microseconds. */ time->time_us_last = time->time_us; + /* Write 64 bytes to Serial1. */ + Serial1.write(serial_buffer, serial_buffer_size); + /* Increment the iteration. */ iteration++; } From d81bbcb69b112f6f64ea960b7b089f3b0d946457 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 20:23:07 +1200 Subject: [PATCH 075/109] feat(serial transmitter prototype): :sparkles: Prototype transmit frame error This drops a frame when the time jitter is more than two microseconds. --- .../serial_transmitter_prototype.cpp | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 8687b283..f2af1767 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -31,6 +31,7 @@ typedef struct time_s uint32_t time_us = 0; uint32_t time_us_last = 0; uint32_t time_us_delta = 0; + int32_t time_us_error = 0; } time_t; /* Time structure instance. */ @@ -99,8 +100,11 @@ void loop() time->time_us = micros(); time->time_us_delta = time->time_us - time->time_us_last; - /* Check if the time delta is greater than the time in microseconds for the selected packet rate. */ - if (time->time_us_delta >= packet_rate_us[selected_packet_rate]) + /* Calculate the time error in microseconds. */ + time->time_us_error = time->time_us - (time->time_us_last + packet_rate_us[selected_packet_rate]); + + /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than 2 microseconds. */ + if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < 2) { /* Print the time delta in microseconds. */ Serial.print("Time Delta: "); @@ -116,6 +120,24 @@ void loop() /* Increment the iteration. */ iteration++; } + + /* If the time error is greater than or equal to 2 microseconds. */ + else if (time->time_us_error >= 2) + { + /* Print an error message to the serial monitor. */ + Serial.println("Error: Time error is greater than or equal to 2 microseconds."); + + /* Print how far the time error is from the packet rate in microseconds. */ + Serial.print("Time Error: "); + Serial.print(time->time_us_error); + Serial.println(" us"); + + /* Increment the iteration. */ + iteration++; + + /* Set the last time in microseconds. */ + time->time_us_last = time->time_us; + } } else { From 9b411ce3772ba09796dd1962ca88d18794bb4fd2 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 08:59:23 +1200 Subject: [PATCH 076/109] build(`platformio.ini`): :construction_worker: Explicitly use CppCheck in development environment CppCheck is used to check for any defects during development. --- platformio.ini | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platformio.ini b/platformio.ini index c1e539a7..e6b26d32 100644 --- a/platformio.ini +++ b/platformio.ini @@ -54,6 +54,13 @@ build_src_filter = build_type = debug build_unflags = -Os +check_flags = + --enable=all + --disable=missingInclude + --disable=unusedFunction +check_severity = low, medium, high +check_skip_packages = yes +check_tool = cppcheck extends = env_common_samd51 platform_packages = platformio/toolchain-gccarmnoneeabi @ 1.120301.0 ; PlatformIO's latest GCC Compiler version From d67ae11670404657757dfb2eb329ad03cc516f46 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 09:03:47 +1200 Subject: [PATCH 077/109] chore(`platformio.ini`): :wrench: Upgrade C++11 to GNU C++23 Using the latest version of C++ keeps its security up-to-date. --- platformio.ini | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platformio.ini b/platformio.ini index e6b26d32..578557d2 100644 --- a/platformio.ini +++ b/platformio.ini @@ -33,6 +33,8 @@ test_dir = board = adafruit_metro_m4 build_flags = build_src_flags = + ; Force GNU C++ 23: + -std=c++23 ; Compile hardening flags: -O2 -Wall @@ -53,11 +55,14 @@ build_src_filter = +<*.cpp> build_type = debug build_unflags = + -c++11 -Os check_flags = --enable=all --disable=missingInclude --disable=unusedFunction + --language=c++ + --std=c++23 check_severity = low, medium, high check_skip_packages = yes check_tool = cppcheck From f47a2179a16368bbbd9af5fac7f76d0a4615c81e Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 09:21:36 +1200 Subject: [PATCH 078/109] chore(`platformio.ini`): Explicitly specify `gnu++23` --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 578557d2..25c75a8e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -34,7 +34,7 @@ board = adafruit_metro_m4 build_flags = build_src_flags = ; Force GNU C++ 23: - -std=c++23 + -std=gnu++23 ; Compile hardening flags: -O2 -Wall From 0b8f1610c9d5de9b08ba5e6868487537ba59a43b Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 09:33:33 +1200 Subject: [PATCH 079/109] refactor(serial transmitter prototype): :recycle: Use `const int32_t` for maximum allowed time error --- examples/platformio/serial_transmitter_prototype.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index f2af1767..126745b4 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -32,6 +32,7 @@ typedef struct time_s uint32_t time_us_last = 0; uint32_t time_us_delta = 0; int32_t time_us_error = 0; + const int32_t time_us_max_allowed_error = 2; } time_t; /* Time structure instance. */ @@ -103,8 +104,8 @@ void loop() /* Calculate the time error in microseconds. */ time->time_us_error = time->time_us - (time->time_us_last + packet_rate_us[selected_packet_rate]); - /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than 2 microseconds. */ - if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < 2) + /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than the maximum allowed error. */ + if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < time->time_us_max_allowed_error) { /* Print the time delta in microseconds. */ Serial.print("Time Delta: "); @@ -121,8 +122,8 @@ void loop() iteration++; } - /* If the time error is greater than or equal to 2 microseconds. */ - else if (time->time_us_error >= 2) + /* If the time error is greater than or equal to the maximum allowed error. */ + else if (time->time_us_error >= time->time_us_max_allowed_error) { /* Print an error message to the serial monitor. */ Serial.println("Error: Time error is greater than or equal to 2 microseconds."); From 79a10422449cadc4a909b3e8bbfc823cf0928bc6 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 10:16:14 +1200 Subject: [PATCH 080/109] refactor(serial transmitter prototype): :recycle: Replace `serial_buffer` placeholder with `crsf_tx_frame` --- .../serial_transmitter_prototype.cpp | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 126745b4..fca73777 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -35,11 +35,28 @@ typedef struct time_s const int32_t time_us_max_allowed_error = 2; } time_t; +/* CRSF Frame structure and union. */ +typedef struct crsf_frame_s +{ + uint8_t sync; + uint8_t length; + uint8_t type; + uint8_t payload[60]; + uint8_t crc; +} crsf_frame_t; + +const size_t crsf_frame_size = sizeof(crsf_frame_t); + +typedef union crsf_tx_frame_u +{ + crsf_frame_t frame; + uint8_t buffer[crsf_frame_size]; +} crsf_tx_frame_t; + /* Time structure instance. */ time_t *time = nullptr; -const size_t serial_buffer_size = 64; -uint8_t serial_buffer[serial_buffer_size] = { 0 }; +crsf_tx_frame_t crsf_tx_frame; /* Exit handler. */ void exitHandler() @@ -80,7 +97,7 @@ void setup() /* Initialise Serial1 with 1.87M baud rate. */ Serial1.begin(1875000); - memset(serial_buffer, 0, serial_buffer_size); + memset(&crsf_tx_frame, 0, crsf_frame_size); /* Set the time in microseconds. */ time->time_us = micros(); @@ -116,7 +133,7 @@ void loop() time->time_us_last = time->time_us; /* Write 64 bytes to Serial1. */ - Serial1.write(serial_buffer, serial_buffer_size); + Serial1.write(crsf_tx_frame.buffer, crsf_frame_size); /* Increment the iteration. */ iteration++; From a616237dee56dc7a2a004f7ec5a79999d471b807 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 10:36:48 +1200 Subject: [PATCH 081/109] refactor(serial transmitter prototype): :recycle: Improve error handling Instead of spamming the time delta in the Terminal, a simple notification is sent; and the prototyp test now halts when the `time_us_max_allowed_error` is exceeded. --- .../serial_transmitter_prototype.cpp | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index fca73777..38461423 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -58,15 +58,31 @@ time_t *time = nullptr; crsf_tx_frame_t crsf_tx_frame; -/* Exit handler. */ -void exitHandler() +/* Exit handlers. */ +void exit_success_handler() { /* Clean up and stop. */ delete[] packet_rate_us; delete time; /* Print a message to the serial monitor. */ - Serial.println("Done!"); + Serial.println("Program has ended successfully."); +} + +void exit_time_max_allowed_error_handler() +{ + /* Print a message to the serial monitor. */ + Serial.print("Program has ended with an error: "); + Serial.println("Time error is greater than the maximum allowed error."); + + /* Print how far the time error is from the packet rate in microseconds. */ + Serial.print("Time Error: "); + Serial.print(time->time_us_error); + Serial.println(" us"); + + /* Clean up and stop. */ + delete[] packet_rate_us; + delete time; } #if ARDUINO_IS_INCLUDED == 1 @@ -99,6 +115,9 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); + /* Print a message to the serial monitor. */ + Serial.println("Testing CRSF Serial Transmitter Prototype..."); + /* Set the time in microseconds. */ time->time_us = micros(); time->time_us_last = time->time_us; @@ -124,11 +143,6 @@ void loop() /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than the maximum allowed error. */ if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < time->time_us_max_allowed_error) { - /* Print the time delta in microseconds. */ - Serial.print("Time Delta: "); - Serial.print(time->time_us_delta); - Serial.println(" us"); - /* Set the last time in microseconds. */ time->time_us_last = time->time_us; @@ -142,25 +156,15 @@ void loop() /* If the time error is greater than or equal to the maximum allowed error. */ else if (time->time_us_error >= time->time_us_max_allowed_error) { - /* Print an error message to the serial monitor. */ - Serial.println("Error: Time error is greater than or equal to 2 microseconds."); - - /* Print how far the time error is from the packet rate in microseconds. */ - Serial.print("Time Error: "); - Serial.print(time->time_us_error); - Serial.println(" us"); - - /* Increment the iteration. */ - iteration++; - - /* Set the last time in microseconds. */ - time->time_us_last = time->time_us; + /* Exit the program. */ + atexit(exit_time_max_allowed_error_handler); + exit(EXIT_FAILURE); } } else { /* Exit the program. */ - atexit(exitHandler); + atexit(exit_success_handler); exit(EXIT_SUCCESS); } } From 11b52d75c4a1a842b1471252fb2d048ff991d1ae Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:37:39 +1200 Subject: [PATCH 082/109] refactor(serial transmitter prototype): :construction: Introduce CRC8-DVB-S2 functions These will be used to calculate the CRC to be appended to the CRSF RC Channels data packet. --- .../serial_transmitter_prototype.cpp | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 38461423..69da9263 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -58,6 +58,37 @@ time_t *time = nullptr; crsf_tx_frame_t crsf_tx_frame; +/* CRC8-DVB-S2. */ +uint8_t crc8_dvb_s2(uint8_t crc, const uint8_t data) +{ + crc ^= data; + for (uint8_t i = 0; i < 8; i++) + { + if (crc & 0x80) + { + crc = (crc << 1) ^ 0xD5; + } + else + { + crc <<= 1; + } + } + return crc; +} + +/* This function calculates the CRC for the CRSF frame +from the type to the end of the payload. */ +uint8_t calculate_crc(const crsf_tx_frame_t *crsf_tx_frame) +{ + uint8_t crc = 0; + crc = crc8_dvb_s2(crc, crsf_tx_frame->frame.type); + for (uint8_t i = 0; i < crsf_tx_frame->frame.length - 2; i++) + { + crc = crc8_dvb_s2(crc, crsf_tx_frame->frame.payload[i]); + } + return crc; +} + /* Exit handlers. */ void exit_success_handler() { From 1c10e1cba2a9f4d057f5e2c089087e182fefebf3 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:39:58 +1200 Subject: [PATCH 083/109] refactor(serial transmitter prototype): :construction: Flesh out packed RC Channels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All RC Channels are 'centred' except for `ch5` which is initialised to `1000 µS`. --- .../serial_transmitter_prototype.cpp | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 69da9263..7f9b3240 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -35,6 +35,29 @@ typedef struct time_s const int32_t time_us_max_allowed_error = 2; } time_t; +/* Packed 11-bit RC Channels. */ +struct rc_channels_packed_s +{ + uint16_t ch1 : 11; + uint16_t ch2 : 11; + uint16_t ch3 : 11; + uint16_t ch4 : 11; + uint16_t ch5 : 11; + uint16_t ch6 : 11; + uint16_t ch7 : 11; + uint16_t ch8 : 11; + uint16_t ch9 : 11; + uint16_t ch10 : 11; + uint16_t ch11 : 11; + uint16_t ch12 : 11; + uint16_t ch13 : 11; + uint16_t ch14 : 11; + uint16_t ch15 : 11; + uint16_t ch16 : 11; +} __attribute__((packed)); + +typedef struct rc_channels_packed_s rc_channels_packed_t; + /* CRSF Frame structure and union. */ typedef struct crsf_frame_s { @@ -146,6 +169,26 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); + /* Initialise the RC Channels structure. */ + rc_channels_packed_t rc_channels_packed; + rc_channels_packed.ch1 = 992; + rc_channels_packed.ch2 = 992; + rc_channels_packed.ch3 = 992; + rc_channels_packed.ch4 = 992; + rc_channels_packed.ch5 = 178; + rc_channels_packed.ch6 = 992; + rc_channels_packed.ch7 = 992; + rc_channels_packed.ch8 = 992; + rc_channels_packed.ch9 = 992; + rc_channels_packed.ch10 = 992; + rc_channels_packed.ch11 = 992; + rc_channels_packed.ch12 = 992; + rc_channels_packed.ch13 = 992; + rc_channels_packed.ch14 = 992; + rc_channels_packed.ch15 = 992; + rc_channels_packed.ch16 = 992; + + /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); From ef32a79b590df23a4781a51ace293b93759ad009 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:40:57 +1200 Subject: [PATCH 084/109] refactor(serial transmitter prototype): :recycle: Prepare CRSF RC Channels Packed data... ...and send it at the selected packet rate. --- examples/platformio/serial_transmitter_prototype.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 7f9b3240..f283db9d 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -188,6 +188,12 @@ void setup() rc_channels_packed.ch15 = 992; rc_channels_packed.ch16 = 992; + /* Prepare the CRSF RC Channels Packed frame. */ + crsf_tx_frame.frame.sync = 0xC8; // NB: EdgeTX uses 0xEE which is incorrect. + crsf_tx_frame.frame.length = 24; + crsf_tx_frame.frame.type = 0x16; + memcpy(crsf_tx_frame.frame.payload, &rc_channels_packed, sizeof(rc_channels_packed)); + crsf_tx_frame.frame.crc = calculate_crc(&crsf_tx_frame); /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); @@ -221,7 +227,7 @@ void loop() time->time_us_last = time->time_us; /* Write 64 bytes to Serial1. */ - Serial1.write(crsf_tx_frame.buffer, crsf_frame_size); + Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); /* Increment the iteration. */ iteration++; From 9125bedb1722def075033a07e8b8566a2b7b3ca9 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 27 Apr 2024 09:04:51 +1200 Subject: [PATCH 085/109] fix(serial transmitter prototype): :rotating_light: Rename time structure to avoid naming conflicts --- .../serial_transmitter_prototype.cpp | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index f283db9d..ae003278 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -26,14 +26,14 @@ const packet_rate_index_t selected_packet_rate = PACKET_RATE_50HZ; uint32_t *packet_rate_us = nullptr; /* Time structure for the packet rate. */ -typedef struct time_s +typedef struct software_realtime_counter_s { uint32_t time_us = 0; uint32_t time_us_last = 0; uint32_t time_us_delta = 0; int32_t time_us_error = 0; const int32_t time_us_max_allowed_error = 2; -} time_t; +} software_realtime_counter_t; /* Packed 11-bit RC Channels. */ struct rc_channels_packed_s @@ -77,7 +77,7 @@ typedef union crsf_tx_frame_u } crsf_tx_frame_t; /* Time structure instance. */ -time_t *time = nullptr; +software_realtime_counter_t *sw_timer = nullptr; crsf_tx_frame_t crsf_tx_frame; @@ -117,7 +117,7 @@ void exit_success_handler() { /* Clean up and stop. */ delete[] packet_rate_us; - delete time; + delete sw_timer; /* Print a message to the serial monitor. */ Serial.println("Program has ended successfully."); @@ -129,14 +129,14 @@ void exit_time_max_allowed_error_handler() Serial.print("Program has ended with an error: "); Serial.println("Time error is greater than the maximum allowed error."); - /* Print how far the time error is from the packet rate in microseconds. */ + /* Print how far the sw_timer error is from the packet rate in microseconds. */ Serial.print("Time Error: "); - Serial.print(time->time_us_error); + Serial.print(sw_timer->time_us_error); Serial.println(" us"); /* Clean up and stop. */ delete[] packet_rate_us; - delete time; + delete sw_timer; } #if ARDUINO_IS_INCLUDED == 1 @@ -149,7 +149,7 @@ void setup() } /* Dynamically allocate memory for the packet rate, - and calculate the time in microseconds for each packet rate. */ + and calculate the sw_timer in microseconds for each packet rate. */ packet_rate_us = new uint32_t[PACKET_RATE_COUNT]; packet_rate_us[PACKET_RATE_4HZ] = (1000000UL / 4UL); packet_rate_us[PACKET_RATE_25HZ] = (1000000UL / 25UL); @@ -162,8 +162,8 @@ void setup() packet_rate_us[PACKET_RATE_500HZ] = (1000000UL / 500UL); packet_rate_us[PACKET_RATE_1000HZ] = (1000000UL / 1000UL); - /* Initialize the time structure. */ - time = new time_t; + /* Initialize the sw_timer structure. */ + sw_timer = new software_realtime_counter_t; /* Initialise Serial1 with 1.87M baud rate. */ Serial1.begin(1875000); @@ -199,8 +199,8 @@ void setup() Serial.println("Testing CRSF Serial Transmitter Prototype..."); /* Set the time in microseconds. */ - time->time_us = micros(); - time->time_us_last = time->time_us; + sw_timer->time_us = micros(); + sw_timer->time_us_last = sw_timer->time_us; } void loop() @@ -214,17 +214,17 @@ void loop() if (iteration < iterations) { /* Calculate the time delta in microseconds. */ - time->time_us = micros(); - time->time_us_delta = time->time_us - time->time_us_last; + sw_timer->time_us = micros(); + sw_timer->time_us_delta = sw_timer->time_us - sw_timer->time_us_last; /* Calculate the time error in microseconds. */ - time->time_us_error = time->time_us - (time->time_us_last + packet_rate_us[selected_packet_rate]); + sw_timer->time_us_error = sw_timer->time_us - (sw_timer->time_us_last + packet_rate_us[selected_packet_rate]); /* If the time delta is greater than or equal to the packet rate in microseconds and the time error is less than the maximum allowed error. */ - if (time->time_us_delta >= packet_rate_us[selected_packet_rate] && time->time_us_error < time->time_us_max_allowed_error) + if (sw_timer->time_us_delta >= packet_rate_us[selected_packet_rate] && sw_timer->time_us_error < sw_timer->time_us_max_allowed_error) { /* Set the last time in microseconds. */ - time->time_us_last = time->time_us; + sw_timer->time_us_last = sw_timer->time_us; /* Write 64 bytes to Serial1. */ Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); @@ -234,7 +234,7 @@ void loop() } /* If the time error is greater than or equal to the maximum allowed error. */ - else if (time->time_us_error >= time->time_us_max_allowed_error) + else if (sw_timer->time_us_error >= sw_timer->time_us_max_allowed_error) { /* Exit the program. */ atexit(exit_time_max_allowed_error_handler); From 2178d28701cd3541d90a495a48d9339bbecd51ec Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sun, 28 Apr 2024 10:04:34 +1200 Subject: [PATCH 086/109] chore(library): :truck: Move CRC source and header files to `common` subfolder `CRC.cpp` and `CRC.hpp` will be shared across the Serial Receiver Interface and the Serial Transmitter Interface. --- src/SerialReceiver/CRSF/CRSF.hpp | 2 +- src/SerialReceiver/Telemetry/Telemetry.hpp | 2 +- src/{SerialReceiver => common}/CRC/CRC.cpp | 0 src/{SerialReceiver => common}/CRC/CRC.hpp | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename src/{SerialReceiver => common}/CRC/CRC.cpp (100%) rename src/{SerialReceiver => common}/CRC/CRC.hpp (100%) diff --git a/src/SerialReceiver/CRSF/CRSF.hpp b/src/SerialReceiver/CRSF/CRSF.hpp index 4805c523..17ae4ecf 100644 --- a/src/SerialReceiver/CRSF/CRSF.hpp +++ b/src/SerialReceiver/CRSF/CRSF.hpp @@ -24,7 +24,7 @@ #pragma once -#include "../CRC/CRC.hpp" +#include "../common/CRC/CRC.hpp" #include "CRSFProtocol.hpp" namespace serialReceiverLayer diff --git a/src/SerialReceiver/Telemetry/Telemetry.hpp b/src/SerialReceiver/Telemetry/Telemetry.hpp index e12b5a40..e56f82e5 100644 --- a/src/SerialReceiver/Telemetry/Telemetry.hpp +++ b/src/SerialReceiver/Telemetry/Telemetry.hpp @@ -26,7 +26,7 @@ #include "Arduino.h" -#include "../CRC/CRC.hpp" +#include "../common/CRC/CRC.hpp" #include "../CRSF/CRSFProtocol.hpp" #include "../SerialBuffer/SerialBuffer.hpp" diff --git a/src/SerialReceiver/CRC/CRC.cpp b/src/common/CRC/CRC.cpp similarity index 100% rename from src/SerialReceiver/CRC/CRC.cpp rename to src/common/CRC/CRC.cpp diff --git a/src/SerialReceiver/CRC/CRC.hpp b/src/common/CRC/CRC.hpp similarity index 100% rename from src/SerialReceiver/CRC/CRC.hpp rename to src/common/CRC/CRC.hpp From 26b3c970c80818a34f9dc8065775b1667d998501 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Mon, 20 May 2024 08:52:52 +1200 Subject: [PATCH 087/109] chore(library): Bump version date to `2024-5-20` --- src/CFA_Config.hpp | 2 +- src/SerialTransmitter/SerialTransmitter.cpp | 2 +- src/SerialTransmitter/SerialTransmitter.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 3effa45e..e6d5ea81 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-4-20" +#define CRSFFORARDUINO_VERSION_DATE "2024-5-20" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index 09bf7181..9a31dc5d 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index ffb80960..64fe6da9 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-4-20 + * @date 2024-5-20 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From b1df92b342eb38c807547e5ec3ac1a1ed862381c Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Mon, 1 Jul 2024 09:49:58 +1200 Subject: [PATCH 088/109] chore(library): Bump verion date to 2024-7-2 Setting the version date to tomorrow's date, because that's when I'm picking development up on CRSF for Arduino again... after a nealry two-month long quiet hiatus. --- src/CFA_Config.hpp | 2 +- src/SerialTransmitter/SerialTransmitter.cpp | 2 +- src/SerialTransmitter/SerialTransmitter.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index e6d5ea81..967e7120 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-5-20" +#define CRSFFORARDUINO_VERSION_DATE "2024-7-2" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index 9a31dc5d..b45c0c96 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index 64fe6da9..e2805936 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -3,7 +3,7 @@ * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. * @version 1.1.0 - * @date 2024-5-20 + * @date 2024-7-2 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From ce2763eb5659fba0a3f568978fe0202d9102f166 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 20:21:45 +1200 Subject: [PATCH 089/109] feat(serial transmitter prototype): :sparkles: Write 64 bytes of data with `Serial1` at the selected packet rate This sets the stage for CRSF packets. --- examples/platformio/serial_transmitter_prototype.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index ae003278..47cec23a 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -198,6 +198,10 @@ void setup() /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); + /* Initialise Serial1 with 1.87M baud rate. */ + Serial1.begin(1875000); + memset(serial_buffer, 0, serial_buffer_size); + /* Set the time in microseconds. */ sw_timer->time_us = micros(); sw_timer->time_us_last = sw_timer->time_us; @@ -229,6 +233,9 @@ void loop() /* Write 64 bytes to Serial1. */ Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); + /* Write 64 bytes to Serial1. */ + Serial1.write(serial_buffer, serial_buffer_size); + /* Increment the iteration. */ iteration++; } From a7b1fc259a265ea9ab501436e1ba4b7a5707a770 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 10:16:14 +1200 Subject: [PATCH 090/109] refactor(serial transmitter prototype): :recycle: Replace `serial_buffer` placeholder with `crsf_tx_frame` --- .../serial_transmitter_prototype.cpp | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 47cec23a..16d9c97d 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -76,6 +76,24 @@ typedef union crsf_tx_frame_u uint8_t buffer[crsf_frame_size]; } crsf_tx_frame_t; +/* CRSF Frame structure and union. */ +typedef struct crsf_frame_s +{ + uint8_t sync; + uint8_t length; + uint8_t type; + uint8_t payload[60]; + uint8_t crc; +} crsf_frame_t; + +const size_t crsf_frame_size = sizeof(crsf_frame_t); + +typedef union crsf_tx_frame_u +{ + crsf_frame_t frame; + uint8_t buffer[crsf_frame_size]; +} crsf_tx_frame_t; + /* Time structure instance. */ software_realtime_counter_t *sw_timer = nullptr; @@ -200,7 +218,7 @@ void setup() /* Initialise Serial1 with 1.87M baud rate. */ Serial1.begin(1875000); - memset(serial_buffer, 0, serial_buffer_size); + memset(&crsf_tx_frame, 0, crsf_frame_size); /* Set the time in microseconds. */ sw_timer->time_us = micros(); @@ -234,7 +252,7 @@ void loop() Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); /* Write 64 bytes to Serial1. */ - Serial1.write(serial_buffer, serial_buffer_size); + Serial1.write(crsf_tx_frame.buffer, crsf_frame_size); /* Increment the iteration. */ iteration++; From 53a3ee80610a1a48c5da81c187a698f112771584 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 10:36:48 +1200 Subject: [PATCH 091/109] refactor(serial transmitter prototype): :recycle: Improve error handling Instead of spamming the time delta in the Terminal, a simple notification is sent; and the prototyp test now halts when the `time_us_max_allowed_error` is exceeded. --- examples/platformio/serial_transmitter_prototype.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 16d9c97d..c5d7e7a5 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -220,6 +220,9 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); + /* Print a message to the serial monitor. */ + Serial.println("Testing CRSF Serial Transmitter Prototype..."); + /* Set the time in microseconds. */ sw_timer->time_us = micros(); sw_timer->time_us_last = sw_timer->time_us; From c2971373a0528490d5734f83e4ba5906b605ca42 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:39:58 +1200 Subject: [PATCH 092/109] refactor(serial transmitter prototype): :construction: Flesh out packed RC Channels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All RC Channels are 'centred' except for `ch5` which is initialised to `1000 µS`. --- .../serial_transmitter_prototype.cpp | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index c5d7e7a5..c812e407 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -76,6 +76,29 @@ typedef union crsf_tx_frame_u uint8_t buffer[crsf_frame_size]; } crsf_tx_frame_t; +/* Packed 11-bit RC Channels. */ +struct rc_channels_packed_s +{ + uint16_t ch1 : 11; + uint16_t ch2 : 11; + uint16_t ch3 : 11; + uint16_t ch4 : 11; + uint16_t ch5 : 11; + uint16_t ch6 : 11; + uint16_t ch7 : 11; + uint16_t ch8 : 11; + uint16_t ch9 : 11; + uint16_t ch10 : 11; + uint16_t ch11 : 11; + uint16_t ch12 : 11; + uint16_t ch13 : 11; + uint16_t ch14 : 11; + uint16_t ch15 : 11; + uint16_t ch16 : 11; +} __attribute__((packed)); + +typedef struct rc_channels_packed_s rc_channels_packed_t; + /* CRSF Frame structure and union. */ typedef struct crsf_frame_s { @@ -220,6 +243,26 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); + /* Initialise the RC Channels structure. */ + rc_channels_packed_t rc_channels_packed; + rc_channels_packed.ch1 = 992; + rc_channels_packed.ch2 = 992; + rc_channels_packed.ch3 = 992; + rc_channels_packed.ch4 = 992; + rc_channels_packed.ch5 = 178; + rc_channels_packed.ch6 = 992; + rc_channels_packed.ch7 = 992; + rc_channels_packed.ch8 = 992; + rc_channels_packed.ch9 = 992; + rc_channels_packed.ch10 = 992; + rc_channels_packed.ch11 = 992; + rc_channels_packed.ch12 = 992; + rc_channels_packed.ch13 = 992; + rc_channels_packed.ch14 = 992; + rc_channels_packed.ch15 = 992; + rc_channels_packed.ch16 = 992; + + /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); From e544c5ae2715e266f8cb15d554a4440117f56e6d Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:40:57 +1200 Subject: [PATCH 093/109] refactor(serial transmitter prototype): :recycle: Prepare CRSF RC Channels Packed data... ...and send it at the selected packet rate. --- examples/platformio/serial_transmitter_prototype.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index c812e407..698b3fb0 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -262,6 +262,12 @@ void setup() rc_channels_packed.ch15 = 992; rc_channels_packed.ch16 = 992; + /* Prepare the CRSF RC Channels Packed frame. */ + crsf_tx_frame.frame.sync = 0xC8; // NB: EdgeTX uses 0xEE which is incorrect. + crsf_tx_frame.frame.length = 24; + crsf_tx_frame.frame.type = 0x16; + memcpy(crsf_tx_frame.frame.payload, &rc_channels_packed, sizeof(rc_channels_packed)); + crsf_tx_frame.frame.crc = calculate_crc(&crsf_tx_frame); /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); @@ -298,7 +304,7 @@ void loop() Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); /* Write 64 bytes to Serial1. */ - Serial1.write(crsf_tx_frame.buffer, crsf_frame_size); + Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); /* Increment the iteration. */ iteration++; From b061733340a00d6c533ae075a4d9785f60c3fc5c Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sun, 21 Jul 2024 10:22:24 +1200 Subject: [PATCH 094/109] chore(library): Fix Semantic Versioning inconsistencies --- src/CFA_Config.hpp | 2 +- src/SerialTransmitter/SerialTransmitter.cpp | 4 ++-- src/SerialTransmitter/SerialTransmitter.hpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 967e7120..2c6425f9 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-7-2" +#define CRSFFORARDUINO_VERSION_DATE "2024-7-21" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index b45c0c96..25cee4ac 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -2,8 +2,8 @@ * @file SerialReceiver.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index e2805936..2301cd90 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -2,8 +2,8 @@ * @file SerialTransmitter.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. - * @version 1.1.0 - * @date 2024-7-2 + * @version 1.1.0-1.0.0 + * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From 78c393865ddc16b4a0573408ba2f402a0f5f776e Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 9 Apr 2024 09:40:32 +1200 Subject: [PATCH 095/109] chore(library): Bump version date to `2024-4-9` --- src/CFA_Config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 2c6425f9..935c9ece 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-7-21" +#define CRSFFORARDUINO_VERSION_DATE "2024-4-9" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 From ac1c1896329d7850f486cc1cd9caa038835ac7d1 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sat, 20 Apr 2024 11:19:46 +1200 Subject: [PATCH 096/109] chore(library): Bump version date to `2024-4-20` --- src/CFA_Config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 935c9ece..3effa45e 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-4-9" +#define CRSFFORARDUINO_VERSION_DATE "2024-4-20" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 From adc7599e5b06b24e6c510871737ddff990d58301 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Mon, 20 May 2024 08:52:52 +1200 Subject: [PATCH 097/109] chore(library): Bump version date to `2024-5-20` --- src/CFA_Config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 3effa45e..e6d5ea81 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-4-20" +#define CRSFFORARDUINO_VERSION_DATE "2024-5-20" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 From 46c24ea59c2ccdc385b4635a8479ff636b3f4bb2 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Mon, 1 Jul 2024 09:49:58 +1200 Subject: [PATCH 098/109] chore(library): Bump verion date to 2024-7-2 Setting the version date to tomorrow's date, because that's when I'm picking development up on CRSF for Arduino again... after a nealry two-month long quiet hiatus. --- src/CFA_Config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index e6d5ea81..967e7120 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-5-20" +#define CRSFFORARDUINO_VERSION_DATE "2024-7-2" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 From d7b7e73d40740f36437e390b7cfcc2216a854be6 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Thu, 25 Apr 2024 20:21:45 +1200 Subject: [PATCH 099/109] feat(serial transmitter prototype): :sparkles: Write 64 bytes of data with `Serial1` at the selected packet rate This sets the stage for CRSF packets. --- .../serial_transmitter_prototype.cpp | 31 +------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 698b3fb0..48661444 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -241,36 +241,7 @@ void setup() /* Initialise Serial1 with 1.87M baud rate. */ Serial1.begin(1875000); - memset(&crsf_tx_frame, 0, crsf_frame_size); - - /* Initialise the RC Channels structure. */ - rc_channels_packed_t rc_channels_packed; - rc_channels_packed.ch1 = 992; - rc_channels_packed.ch2 = 992; - rc_channels_packed.ch3 = 992; - rc_channels_packed.ch4 = 992; - rc_channels_packed.ch5 = 178; - rc_channels_packed.ch6 = 992; - rc_channels_packed.ch7 = 992; - rc_channels_packed.ch8 = 992; - rc_channels_packed.ch9 = 992; - rc_channels_packed.ch10 = 992; - rc_channels_packed.ch11 = 992; - rc_channels_packed.ch12 = 992; - rc_channels_packed.ch13 = 992; - rc_channels_packed.ch14 = 992; - rc_channels_packed.ch15 = 992; - rc_channels_packed.ch16 = 992; - - /* Prepare the CRSF RC Channels Packed frame. */ - crsf_tx_frame.frame.sync = 0xC8; // NB: EdgeTX uses 0xEE which is incorrect. - crsf_tx_frame.frame.length = 24; - crsf_tx_frame.frame.type = 0x16; - memcpy(crsf_tx_frame.frame.payload, &rc_channels_packed, sizeof(rc_channels_packed)); - crsf_tx_frame.frame.crc = calculate_crc(&crsf_tx_frame); - - /* Print a message to the serial monitor. */ - Serial.println("Testing CRSF Serial Transmitter Prototype..."); + memset(serial_buffer, 0, serial_buffer_size); /* Set the time in microseconds. */ sw_timer->time_us = micros(); From 468ad75a33a0c14ab874c688be0bec2f7f63c878 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 10:16:14 +1200 Subject: [PATCH 100/109] refactor(serial transmitter prototype): :recycle: Replace `serial_buffer` placeholder with `crsf_tx_frame` --- .../serial_transmitter_prototype.cpp | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 48661444..fc1746e1 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -76,29 +76,6 @@ typedef union crsf_tx_frame_u uint8_t buffer[crsf_frame_size]; } crsf_tx_frame_t; -/* Packed 11-bit RC Channels. */ -struct rc_channels_packed_s -{ - uint16_t ch1 : 11; - uint16_t ch2 : 11; - uint16_t ch3 : 11; - uint16_t ch4 : 11; - uint16_t ch5 : 11; - uint16_t ch6 : 11; - uint16_t ch7 : 11; - uint16_t ch8 : 11; - uint16_t ch9 : 11; - uint16_t ch10 : 11; - uint16_t ch11 : 11; - uint16_t ch12 : 11; - uint16_t ch13 : 11; - uint16_t ch14 : 11; - uint16_t ch15 : 11; - uint16_t ch16 : 11; -} __attribute__((packed)); - -typedef struct rc_channels_packed_s rc_channels_packed_t; - /* CRSF Frame structure and union. */ typedef struct crsf_frame_s { @@ -241,7 +218,7 @@ void setup() /* Initialise Serial1 with 1.87M baud rate. */ Serial1.begin(1875000); - memset(serial_buffer, 0, serial_buffer_size); + memset(&crsf_tx_frame, 0, crsf_frame_size); /* Set the time in microseconds. */ sw_timer->time_us = micros(); From 2b809babe9cff4efa647d578fd66b37f4aa8751d Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 10:36:48 +1200 Subject: [PATCH 101/109] refactor(serial transmitter prototype): :recycle: Improve error handling Instead of spamming the time delta in the Terminal, a simple notification is sent; and the prototyp test now halts when the `time_us_max_allowed_error` is exceeded. --- examples/platformio/serial_transmitter_prototype.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index fc1746e1..88db7145 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -220,6 +220,9 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); + /* Print a message to the serial monitor. */ + Serial.println("Testing CRSF Serial Transmitter Prototype..."); + /* Set the time in microseconds. */ sw_timer->time_us = micros(); sw_timer->time_us_last = sw_timer->time_us; From bb9cf3675795fb24aa895358b4e2a85ff1a48533 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:39:58 +1200 Subject: [PATCH 102/109] refactor(serial transmitter prototype): :construction: Flesh out packed RC Channels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All RC Channels are 'centred' except for `ch5` which is initialised to `1000 µS`. --- .../serial_transmitter_prototype.cpp | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 88db7145..1330c7e2 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -76,6 +76,29 @@ typedef union crsf_tx_frame_u uint8_t buffer[crsf_frame_size]; } crsf_tx_frame_t; +/* Packed 11-bit RC Channels. */ +struct rc_channels_packed_s +{ + uint16_t ch1 : 11; + uint16_t ch2 : 11; + uint16_t ch3 : 11; + uint16_t ch4 : 11; + uint16_t ch5 : 11; + uint16_t ch6 : 11; + uint16_t ch7 : 11; + uint16_t ch8 : 11; + uint16_t ch9 : 11; + uint16_t ch10 : 11; + uint16_t ch11 : 11; + uint16_t ch12 : 11; + uint16_t ch13 : 11; + uint16_t ch14 : 11; + uint16_t ch15 : 11; + uint16_t ch16 : 11; +} __attribute__((packed)); + +typedef struct rc_channels_packed_s rc_channels_packed_t; + /* CRSF Frame structure and union. */ typedef struct crsf_frame_s { @@ -220,6 +243,26 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); + /* Initialise the RC Channels structure. */ + rc_channels_packed_t rc_channels_packed; + rc_channels_packed.ch1 = 992; + rc_channels_packed.ch2 = 992; + rc_channels_packed.ch3 = 992; + rc_channels_packed.ch4 = 992; + rc_channels_packed.ch5 = 178; + rc_channels_packed.ch6 = 992; + rc_channels_packed.ch7 = 992; + rc_channels_packed.ch8 = 992; + rc_channels_packed.ch9 = 992; + rc_channels_packed.ch10 = 992; + rc_channels_packed.ch11 = 992; + rc_channels_packed.ch12 = 992; + rc_channels_packed.ch13 = 992; + rc_channels_packed.ch14 = 992; + rc_channels_packed.ch15 = 992; + rc_channels_packed.ch16 = 992; + + /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); From 64ce2269f869fd3db88d6ff9fe70cd3b7f3fdd46 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Fri, 26 Apr 2024 19:40:57 +1200 Subject: [PATCH 103/109] refactor(serial transmitter prototype): :recycle: Prepare CRSF RC Channels Packed data... ...and send it at the selected packet rate. --- examples/platformio/serial_transmitter_prototype.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 1330c7e2..698b3fb0 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -262,6 +262,12 @@ void setup() rc_channels_packed.ch15 = 992; rc_channels_packed.ch16 = 992; + /* Prepare the CRSF RC Channels Packed frame. */ + crsf_tx_frame.frame.sync = 0xC8; // NB: EdgeTX uses 0xEE which is incorrect. + crsf_tx_frame.frame.length = 24; + crsf_tx_frame.frame.type = 0x16; + memcpy(crsf_tx_frame.frame.payload, &rc_channels_packed, sizeof(rc_channels_packed)); + crsf_tx_frame.frame.crc = calculate_crc(&crsf_tx_frame); /* Print a message to the serial monitor. */ Serial.println("Testing CRSF Serial Transmitter Prototype..."); From 12056532048744ef231f2049c4a429349fc00496 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sun, 21 Jul 2024 10:22:24 +1200 Subject: [PATCH 104/109] chore(library): Fix Semantic Versioning inconsistencies --- src/CFA_Config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 967e7120..2c6425f9 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -35,7 +35,7 @@ namespace crsfForArduinoConfig Versioning is done using Semantic Versioning 2.0.0. See https://semver.org/ for more information. */ #define CRSFFORARDUINO_VERSION "1.1.0" -#define CRSFFORARDUINO_VERSION_DATE "2024-7-2" +#define CRSFFORARDUINO_VERSION_DATE "2024-7-21" #define CRSFFORARDUINO_VERSION_MAJOR 1 #define CRSFFORARDUINO_VERSION_MINOR 1 #define CRSFFORARDUINO_VERSION_PATCH 0 From 7e3c516fe371ce461bf301d5a68a0b8fbfb6acf8 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Sun, 1 Sep 2024 11:02:55 +1200 Subject: [PATCH 105/109] chore(library): :fire: Remove obsolete Semantic Version tracking from the Serial Transmitter Interface's boiler plate --- src/SerialTransmitter/SerialTransmitter.cpp | 2 -- src/SerialTransmitter/SerialTransmitter.hpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/SerialTransmitter/SerialTransmitter.cpp b/src/SerialTransmitter/SerialTransmitter.cpp index 25cee4ac..b147a58b 100644 --- a/src/SerialTransmitter/SerialTransmitter.cpp +++ b/src/SerialTransmitter/SerialTransmitter.cpp @@ -2,8 +2,6 @@ * @file SerialReceiver.cpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * diff --git a/src/SerialTransmitter/SerialTransmitter.hpp b/src/SerialTransmitter/SerialTransmitter.hpp index 2301cd90..4e8b69d7 100644 --- a/src/SerialTransmitter/SerialTransmitter.hpp +++ b/src/SerialTransmitter/SerialTransmitter.hpp @@ -2,8 +2,6 @@ * @file SerialTransmitter.hpp * @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com) * @brief The Serial Transmitter layer for the CRSF for Arduino library. - * @version 1.1.0-1.0.0 - * @date 2024-7-21 * * @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved. * From 859d8aad7e7aa3c44c6dcea200068d2ab24ea976 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 3 Sep 2024 10:21:35 +1200 Subject: [PATCH 106/109] refactor(cfa config): :recycle: Use build date for Pre-Release versioning --- src/CFA_Config.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 2c6425f9..0f7a26a6 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -46,11 +46,10 @@ See https://semver.org/ for more information. */ // These are the pre-release version details which are only used if CRSFFORARDUINO_VERSION_IS_PRERELEASE is set to 1. // NOTE: Pre-release versions are not recommended for production use. #if CRSFFORARDUINO_VERSION_IS_PRERELEASE == 1 -#define CRSFFORARDUINO_VERSION_PRE "1.0.0" -#define CRSFFORARDUINO_VERSION_BUILD_DATE "2024-7-21" -#define CRSFFORARDUINO_VERSION_BUILD_MAJOR 1 -#define CRSFFORARDUINO_VERSION_BUILD_MINOR 0 -#define CRSFFORARDUINO_VERSION_BUILD_PATCH 0 +#define CRSFFORARDUINO_VERSION_PRE "2024.9.3" +#define CRSFFORARDUINO_VERSION_BUILD_YEAR 2024 +#define CRSFFORARDUINO_VERSION_BUILD_MONTH 9 +#define CRSFFORARDUINO_VERSION_BUILD_DAY 3 #endif /* Failsafe Options From ee0d4c1f790869082e59fbd46b884cd50d52a99f Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 3 Sep 2024 10:30:32 +1200 Subject: [PATCH 107/109] refactor(serial receiver interface): :recycle: Show pre-release version, if `CRSF_VERSION_IS_PRERELEASE` is set --- src/CFA_Config.hpp | 1 + src/SerialReceiver/SerialReceiver.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/CFA_Config.hpp b/src/CFA_Config.hpp index 0f7a26a6..d52d0c24 100644 --- a/src/CFA_Config.hpp +++ b/src/CFA_Config.hpp @@ -47,6 +47,7 @@ See https://semver.org/ for more information. */ // NOTE: Pre-release versions are not recommended for production use. #if CRSFFORARDUINO_VERSION_IS_PRERELEASE == 1 #define CRSFFORARDUINO_VERSION_PRE "2024.9.3" +#define CRSFFORARDUINO_VERSION_BUILD_DATE "2024-9-3" #define CRSFFORARDUINO_VERSION_BUILD_YEAR 2024 #define CRSFFORARDUINO_VERSION_BUILD_MONTH 9 #define CRSFFORARDUINO_VERSION_BUILD_DAY 3 diff --git a/src/SerialReceiver/SerialReceiver.cpp b/src/SerialReceiver/SerialReceiver.cpp index 2a279a30..483be571 100644 --- a/src/SerialReceiver/SerialReceiver.cpp +++ b/src/SerialReceiver/SerialReceiver.cpp @@ -233,12 +233,22 @@ namespace serialReceiverLayer CRSF_DEBUG_SERIAL_PORT.println(); CRSF_DEBUG_SERIAL_PORT.flush(); +#if CRSF_DEBUG_ENABLE_VERSION_OUTPUT > 0 CRSF_DEBUG_SERIAL_PORT.print("Version: "); +#if CRSF_VERSION_IS_PRERELEASE > 0 + CRSF_DEBUG_SERIAL_PORT.print(CRSFFORARDUINO_VERSION); + CRSF_DEBUG_SERIAL_PORT.print("-"); + CRSF_DEBUG_SERIAL_PORT.println(CRSFFORARDUINO_VERSION_PRERELEASE); + CRSF_DEBUG_SERIAL_PORT.print("Build date: "); + CRSF_DEBUG_SERIAL_PORT.println(CRSFFORARDUINO_VERSION_BUILD_DATE); +#else CRSF_DEBUG_SERIAL_PORT.println(CRSFFORARDUINO_VERSION); CRSF_DEBUG_SERIAL_PORT.print("Build date: "); CRSF_DEBUG_SERIAL_PORT.println(CRSFFORARDUINO_VERSION_DATE); +#endif CRSF_DEBUG_SERIAL_PORT.println(); CRSF_DEBUG_SERIAL_PORT.flush(); +#endif for (int i = 0; i < 93; i++) { From 85f9304639c5f0e441a1195d85f7a1df03e8c3e3 Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 3 Sep 2024 10:31:31 +1200 Subject: [PATCH 108/109] style(serial transmitter prototype): :fire: Remove duplicate code lines This is something I missed during the last re-base. So, cleaning it up here. --- .../serial_transmitter_prototype.cpp | 73 ------------------- 1 file changed, 73 deletions(-) diff --git a/examples/platformio/serial_transmitter_prototype.cpp b/examples/platformio/serial_transmitter_prototype.cpp index 698b3fb0..69e2cfc0 100644 --- a/examples/platformio/serial_transmitter_prototype.cpp +++ b/examples/platformio/serial_transmitter_prototype.cpp @@ -76,47 +76,6 @@ typedef union crsf_tx_frame_u uint8_t buffer[crsf_frame_size]; } crsf_tx_frame_t; -/* Packed 11-bit RC Channels. */ -struct rc_channels_packed_s -{ - uint16_t ch1 : 11; - uint16_t ch2 : 11; - uint16_t ch3 : 11; - uint16_t ch4 : 11; - uint16_t ch5 : 11; - uint16_t ch6 : 11; - uint16_t ch7 : 11; - uint16_t ch8 : 11; - uint16_t ch9 : 11; - uint16_t ch10 : 11; - uint16_t ch11 : 11; - uint16_t ch12 : 11; - uint16_t ch13 : 11; - uint16_t ch14 : 11; - uint16_t ch15 : 11; - uint16_t ch16 : 11; -} __attribute__((packed)); - -typedef struct rc_channels_packed_s rc_channels_packed_t; - -/* CRSF Frame structure and union. */ -typedef struct crsf_frame_s -{ - uint8_t sync; - uint8_t length; - uint8_t type; - uint8_t payload[60]; - uint8_t crc; -} crsf_frame_t; - -const size_t crsf_frame_size = sizeof(crsf_frame_t); - -typedef union crsf_tx_frame_u -{ - crsf_frame_t frame; - uint8_t buffer[crsf_frame_size]; -} crsf_tx_frame_t; - /* Time structure instance. */ software_realtime_counter_t *sw_timer = nullptr; @@ -243,35 +202,6 @@ void setup() Serial1.begin(1875000); memset(&crsf_tx_frame, 0, crsf_frame_size); - /* Initialise the RC Channels structure. */ - rc_channels_packed_t rc_channels_packed; - rc_channels_packed.ch1 = 992; - rc_channels_packed.ch2 = 992; - rc_channels_packed.ch3 = 992; - rc_channels_packed.ch4 = 992; - rc_channels_packed.ch5 = 178; - rc_channels_packed.ch6 = 992; - rc_channels_packed.ch7 = 992; - rc_channels_packed.ch8 = 992; - rc_channels_packed.ch9 = 992; - rc_channels_packed.ch10 = 992; - rc_channels_packed.ch11 = 992; - rc_channels_packed.ch12 = 992; - rc_channels_packed.ch13 = 992; - rc_channels_packed.ch14 = 992; - rc_channels_packed.ch15 = 992; - rc_channels_packed.ch16 = 992; - - /* Prepare the CRSF RC Channels Packed frame. */ - crsf_tx_frame.frame.sync = 0xC8; // NB: EdgeTX uses 0xEE which is incorrect. - crsf_tx_frame.frame.length = 24; - crsf_tx_frame.frame.type = 0x16; - memcpy(crsf_tx_frame.frame.payload, &rc_channels_packed, sizeof(rc_channels_packed)); - crsf_tx_frame.frame.crc = calculate_crc(&crsf_tx_frame); - - /* Print a message to the serial monitor. */ - Serial.println("Testing CRSF Serial Transmitter Prototype..."); - /* Set the time in microseconds. */ sw_timer->time_us = micros(); sw_timer->time_us_last = sw_timer->time_us; @@ -303,9 +233,6 @@ void loop() /* Write 64 bytes to Serial1. */ Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); - /* Write 64 bytes to Serial1. */ - Serial1.write(crsf_tx_frame.buffer, crsf_tx_frame.frame.length + 1); - /* Increment the iteration. */ iteration++; } From 3f22f22e33c807531f37d74b36dd26d2af55d1ad Mon Sep 17 00:00:00 2001 From: ZZ-Cat Date: Tue, 3 Sep 2024 10:37:52 +1200 Subject: [PATCH 109/109] chore(library): Bump pre-release version to `2024.9.3` This is the official version of CRSF for Arduino, version 1.1.0-2024.9.3. --- library.json | 2 +- library.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 9dfd96e2..01d379a4 100644 --- a/library.json +++ b/library.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json", "name": "CRSFforArduino", - "version": "1.1.0-1.0.0", + "version": "1.1.0-2024.9.3", "description": "An Arduino Library for communicating with ExpressLRS and TBS Crossfire receivers.", "keywords": "arduino, remote-control, arduino-library, protocols, rc, radio-control, crsf, expresslrs", "repository": diff --git a/library.properties b/library.properties index 648bedb0..bba2adef 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=CRSFforArduino -version=1.1.0-1.0.0 +version=1.1.0-2024.9.3 author=Cassandra Robinson maintainer=Cassandra Robinson sentence=CRSF for Arduino brings the Crossfire Protocol to the Arduino ecosystem.