Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(library): Serial Transmitter Interface #103

Draft
wants to merge 113 commits into
base: Version-1.1.0-Development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
d7e0e62
chore(library): Bump version date to `2024-3-19`
ZZ-Cat Mar 19, 2024
9174a6b
chore(library): Bump version date to `2024-4-9`
ZZ-Cat Apr 8, 2024
fd448be
feat(serial transmitter layer): :sparkles: Initial commit for Serial …
ZZ-Cat Apr 8, 2024
3545853
Merge branch 'Main-Trunk' into ZZ-Cat/issue88
ZZ-Cat Apr 19, 2024
580b543
chore(library): Bump version date to `2024-4-20`
ZZ-Cat Apr 19, 2024
30b620e
fix(defect): :adhesive_bandage: Class `SerialTransmitter` has a const…
ZZ-Cat Apr 19, 2024
8c434de
build(`platformio.ini`): Temporarily restrict Quality Control builds …
ZZ-Cat Apr 19, 2024
6f409e2
Merge branch 'Main-Trunk' into ZZ-Cat/issue88
ZZ-Cat Apr 24, 2024
86e9337
chore(library): :construction: Initial commit on working Serial Trans…
ZZ-Cat Apr 25, 2024
2e8b53b
build(`platformio.ini`): :wrench: Create a secure development environ…
ZZ-Cat Apr 25, 2024
8573a74
refactor(serial transmitter prototype): :construction: Print the time…
ZZ-Cat Apr 25, 2024
2a73561
fix(serial transmitter prototype): :bug: Fix `time_us` overflow on fi…
ZZ-Cat Apr 25, 2024
b8f00e6
feat(serial transmitter prototype): :sparkles: Write 64 bytes of data…
ZZ-Cat Apr 25, 2024
4419b03
feat(serial transmitter prototype): :sparkles: Prototype transmit fra…
ZZ-Cat Apr 25, 2024
f44f2c1
build(`platformio.ini`): :construction_worker: Explicitly use CppChec…
ZZ-Cat Apr 25, 2024
60a2f68
chore(`platformio.ini`): :wrench: Upgrade C++11 to GNU C++23
ZZ-Cat Apr 25, 2024
a88225d
chore(`platformio.ini`): Explicitly specify `gnu++23`
ZZ-Cat Apr 25, 2024
7dfe13c
refactor(serial transmitter prototype): :recycle: Use `const int32_t`…
ZZ-Cat Apr 25, 2024
a6a13ce
refactor(serial transmitter prototype): :recycle: Replace `serial_buf…
ZZ-Cat Apr 25, 2024
0515624
refactor(serial transmitter prototype): :recycle: Improve error handling
ZZ-Cat Apr 25, 2024
ed3de8d
refactor(serial transmitter prototype): :construction: Introduce CRC8…
ZZ-Cat Apr 26, 2024
613e803
refactor(serial transmitter prototype): :construction: Flesh out pack…
ZZ-Cat Apr 26, 2024
0252a80
refactor(serial transmitter prototype): :recycle: Prepare CRSF RC Cha…
ZZ-Cat Apr 26, 2024
f2d42ed
fix(serial transmitter prototype): :rotating_light: Rename time struc…
ZZ-Cat Apr 26, 2024
ab1e72a
chore(library): :truck: Move CRC source and header files to `common` …
ZZ-Cat Apr 27, 2024
4cf30e2
chore(library): Bump version date to `2024-5-20`
ZZ-Cat May 19, 2024
f7d5c7d
chore(library): Bump verion date to 2024-7-2
ZZ-Cat Jun 30, 2024
b88331d
chore(library): Bump version date to `2024-4-9`
ZZ-Cat Apr 8, 2024
2d3c689
feat(serial transmitter layer): :sparkles: Initial commit for Serial …
ZZ-Cat Apr 8, 2024
8b9613e
chore(library): Bump version date to `2024-4-20`
ZZ-Cat Apr 19, 2024
c697f6d
fix(defect): :adhesive_bandage: Class `SerialTransmitter` has a const…
ZZ-Cat Apr 19, 2024
460f6ab
build(`platformio.ini`): Temporarily restrict Quality Control builds …
ZZ-Cat Apr 19, 2024
dcc0e56
chore(library): :construction: Initial commit on working Serial Trans…
ZZ-Cat Apr 25, 2024
f2ffb4f
build(`platformio.ini`): :wrench: Create a secure development environ…
ZZ-Cat Apr 25, 2024
eb74067
refactor(serial transmitter prototype): :construction: Print the time…
ZZ-Cat Apr 25, 2024
daabce7
fix(serial transmitter prototype): :bug: Fix `time_us` overflow on fi…
ZZ-Cat Apr 25, 2024
aa2eeeb
feat(serial transmitter prototype): :sparkles: Write 64 bytes of data…
ZZ-Cat Apr 25, 2024
96cfa3e
feat(serial transmitter prototype): :sparkles: Prototype transmit fra…
ZZ-Cat Apr 25, 2024
b0e258b
build(`platformio.ini`): :construction_worker: Explicitly use CppChec…
ZZ-Cat Apr 25, 2024
ae6ed2d
chore(`platformio.ini`): :wrench: Upgrade C++11 to GNU C++23
ZZ-Cat Apr 25, 2024
8e05de6
chore(`platformio.ini`): Explicitly specify `gnu++23`
ZZ-Cat Apr 25, 2024
1c70a7a
refactor(serial transmitter prototype): :recycle: Use `const int32_t`…
ZZ-Cat Apr 25, 2024
0727a7b
refactor(serial transmitter prototype): :recycle: Replace `serial_buf…
ZZ-Cat Apr 25, 2024
097cfa5
refactor(serial transmitter prototype): :recycle: Improve error handling
ZZ-Cat Apr 25, 2024
2857cb5
refactor(serial transmitter prototype): :construction: Introduce CRC8…
ZZ-Cat Apr 26, 2024
0fe7a46
refactor(serial transmitter prototype): :construction: Flesh out pack…
ZZ-Cat Apr 26, 2024
f725d4d
refactor(serial transmitter prototype): :recycle: Prepare CRSF RC Cha…
ZZ-Cat Apr 26, 2024
ec32062
fix(serial transmitter prototype): :rotating_light: Rename time struc…
ZZ-Cat Apr 26, 2024
2b697cf
chore(library): :truck: Move CRC source and header files to `common` …
ZZ-Cat Apr 27, 2024
60d9268
chore(library): Bump version date to `2024-5-20`
ZZ-Cat May 19, 2024
f1fe711
chore(library): Bump verion date to 2024-7-2
ZZ-Cat Jun 30, 2024
127143e
Merge branch 'ZZ-Cat/issue88' of https://github.com/ZZ-Cat/CRSFforArd…
ZZ-Cat Jul 20, 2024
266c99a
chore(library): Fix Semantic Versioning inconsistencies
ZZ-Cat Jul 20, 2024
a33e846
chore(library): Discontinue V1.0.x-maintenance-branch (#136)
ZZ-Cat Aug 30, 2024
d53e151
chore(`CFA_Config.hpp`): :wrench: Add missing preprocessor defines
ZZ-Cat Aug 30, 2024
35c0692
feat(serial receiver interface): :sparkles: Introduce three new callb…
ddanilchenko Aug 31, 2024
0f8e1a8
chore(library): Bump version date to `2024-4-9`
ZZ-Cat Apr 8, 2024
4fb7aae
chore(library): Bump version date to `2024-4-20`
ZZ-Cat Apr 19, 2024
ba8d46f
chore(library): Bump version date to `2024-5-20`
ZZ-Cat May 19, 2024
e88628d
chore(library): Bump verion date to 2024-7-2
ZZ-Cat Jun 30, 2024
80d18d1
feat(serial transmitter prototype): :sparkles: Write 64 bytes of data…
ZZ-Cat Apr 25, 2024
56d9c24
refactor(serial transmitter prototype): :recycle: Replace `serial_buf…
ZZ-Cat Apr 25, 2024
fc2756d
refactor(serial transmitter prototype): :recycle: Improve error handling
ZZ-Cat Apr 25, 2024
c09381b
refactor(serial transmitter prototype): :construction: Flesh out pack…
ZZ-Cat Apr 26, 2024
9b67803
refactor(serial transmitter prototype): :recycle: Prepare CRSF RC Cha…
ZZ-Cat Apr 26, 2024
287fcd5
chore(library): Fix Semantic Versioning inconsistencies
ZZ-Cat Jul 20, 2024
d6e6dc7
chore(library): :fire: Remove obsolete Semantic Version tracking from…
ZZ-Cat Aug 31, 2024
44404a7
chore(library): Bump version date to `2024-4-9`
ZZ-Cat Apr 8, 2024
93b560b
feat(serial transmitter layer): :sparkles: Initial commit for Serial …
ZZ-Cat Apr 8, 2024
22a4e72
chore(library): Bump version date to `2024-4-20`
ZZ-Cat Apr 19, 2024
338fb10
fix(defect): :adhesive_bandage: Class `SerialTransmitter` has a const…
ZZ-Cat Apr 19, 2024
d44d539
build(`platformio.ini`): Temporarily restrict Quality Control builds …
ZZ-Cat Apr 19, 2024
dec792e
chore(library): :construction: Initial commit on working Serial Trans…
ZZ-Cat Apr 25, 2024
55c5ddc
build(`platformio.ini`): :wrench: Create a secure development environ…
ZZ-Cat Apr 25, 2024
e0b2179
refactor(serial transmitter prototype): :construction: Print the time…
ZZ-Cat Apr 25, 2024
c82a232
fix(serial transmitter prototype): :bug: Fix `time_us` overflow on fi…
ZZ-Cat Apr 25, 2024
100a258
feat(serial transmitter prototype): :sparkles: Write 64 bytes of data…
ZZ-Cat Apr 25, 2024
d81bbcb
feat(serial transmitter prototype): :sparkles: Prototype transmit fra…
ZZ-Cat Apr 25, 2024
9b411ce
build(`platformio.ini`): :construction_worker: Explicitly use CppChec…
ZZ-Cat Apr 25, 2024
d67ae11
chore(`platformio.ini`): :wrench: Upgrade C++11 to GNU C++23
ZZ-Cat Apr 25, 2024
f47a217
chore(`platformio.ini`): Explicitly specify `gnu++23`
ZZ-Cat Apr 25, 2024
0b8f161
refactor(serial transmitter prototype): :recycle: Use `const int32_t`…
ZZ-Cat Apr 25, 2024
79a1042
refactor(serial transmitter prototype): :recycle: Replace `serial_buf…
ZZ-Cat Apr 25, 2024
a616237
refactor(serial transmitter prototype): :recycle: Improve error handling
ZZ-Cat Apr 25, 2024
11b52d7
refactor(serial transmitter prototype): :construction: Introduce CRC8…
ZZ-Cat Apr 26, 2024
1c10e1c
refactor(serial transmitter prototype): :construction: Flesh out pack…
ZZ-Cat Apr 26, 2024
ef32a79
refactor(serial transmitter prototype): :recycle: Prepare CRSF RC Cha…
ZZ-Cat Apr 26, 2024
9125bed
fix(serial transmitter prototype): :rotating_light: Rename time struc…
ZZ-Cat Apr 26, 2024
2178d28
chore(library): :truck: Move CRC source and header files to `common` …
ZZ-Cat Apr 27, 2024
26b3c97
chore(library): Bump version date to `2024-5-20`
ZZ-Cat May 19, 2024
b1df92b
chore(library): Bump verion date to 2024-7-2
ZZ-Cat Jun 30, 2024
ce2763e
feat(serial transmitter prototype): :sparkles: Write 64 bytes of data…
ZZ-Cat Apr 25, 2024
a7b1fc2
refactor(serial transmitter prototype): :recycle: Replace `serial_buf…
ZZ-Cat Apr 25, 2024
53a3ee8
refactor(serial transmitter prototype): :recycle: Improve error handling
ZZ-Cat Apr 25, 2024
c297137
refactor(serial transmitter prototype): :construction: Flesh out pack…
ZZ-Cat Apr 26, 2024
e544c5a
refactor(serial transmitter prototype): :recycle: Prepare CRSF RC Cha…
ZZ-Cat Apr 26, 2024
b061733
chore(library): Fix Semantic Versioning inconsistencies
ZZ-Cat Jul 20, 2024
78c3938
chore(library): Bump version date to `2024-4-9`
ZZ-Cat Apr 8, 2024
ac1c189
chore(library): Bump version date to `2024-4-20`
ZZ-Cat Apr 19, 2024
adc7599
chore(library): Bump version date to `2024-5-20`
ZZ-Cat May 19, 2024
46c24ea
chore(library): Bump verion date to 2024-7-2
ZZ-Cat Jun 30, 2024
d7b7e73
feat(serial transmitter prototype): :sparkles: Write 64 bytes of data…
ZZ-Cat Apr 25, 2024
468ad75
refactor(serial transmitter prototype): :recycle: Replace `serial_buf…
ZZ-Cat Apr 25, 2024
2b809ba
refactor(serial transmitter prototype): :recycle: Improve error handling
ZZ-Cat Apr 25, 2024
bb9cf36
refactor(serial transmitter prototype): :construction: Flesh out pack…
ZZ-Cat Apr 26, 2024
64ce226
refactor(serial transmitter prototype): :recycle: Prepare CRSF RC Cha…
ZZ-Cat Apr 26, 2024
1205653
chore(library): Fix Semantic Versioning inconsistencies
ZZ-Cat Jul 20, 2024
7e3c516
chore(library): :fire: Remove obsolete Semantic Version tracking from…
ZZ-Cat Aug 31, 2024
c1f2fa0
Merge branch 'ZZ-Cat/issue88' of https://github.com/ZZ-Cat/CRSFforArd…
ZZ-Cat Sep 2, 2024
859d8aa
refactor(cfa config): :recycle: Use build date for Pre-Release versio…
ZZ-Cat Sep 2, 2024
ee0d4c1
refactor(serial receiver interface): :recycle: Show pre-release versi…
ZZ-Cat Sep 2, 2024
85f9304
style(serial transmitter prototype): :fire: Remove duplicate code lines
ZZ-Cat Sep 2, 2024
3f22f22
chore(library): Bump pre-release version to `2024.9.3`
ZZ-Cat Sep 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
255 changes: 255 additions & 0 deletions examples/platformio/serial_transmitter_prototype.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
#if __has_include("Arduino.h")
#include "Arduino.h"
#define ARDUINO_IS_INCLUDED 1
#else
#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 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;
} software_realtime_counter_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;

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()
{
/* Clean up and stop. */
delete[] packet_rate_us;
delete sw_timer;

/* Print a message to the serial monitor. */
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 sw_timer error is from the packet rate in microseconds. */
Serial.print("Time Error: ");
Serial.print(sw_timer->time_us_error);
Serial.println(" us");

/* Clean up and stop. */
delete[] packet_rate_us;
delete sw_timer;
}

#if ARDUINO_IS_INCLUDED == 1
void setup()
{
Serial.begin(115200);
while (!Serial)
{
delay(10);
}

/* Dynamically allocate memory for the 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);
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 sw_timer structure. */
sw_timer = new software_realtime_counter_t;

/* 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...");

/* Initialise Serial1 with 1.87M baud rate. */
Serial1.begin(1875000);
memset(&crsf_tx_frame, 0, crsf_frame_size);

/* Set the time in microseconds. */
sw_timer->time_us = micros();
sw_timer->time_us_last = sw_timer->time_us;
}

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. */
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. */
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 (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. */
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);

/* Increment the iteration. */
iteration++;
}

/* If the time error is greater than or equal to the maximum 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);
exit(EXIT_FAILURE);
}
}
else
{
/* Exit the program. */
atexit(exit_success_handler);
exit(EXIT_SUCCESS);
}
}
#endif
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -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":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=CRSFforArduino
version=1.1.0-1.0.0
version=1.1.0-2024.9.3
author=Cassandra Robinson <nicad.heli.flier@gmail.com>
maintainer=Cassandra Robinson <nicad.heli.flier@gmail.com>
sentence=CRSF for Arduino brings the Crossfire Protocol to the Arduino ecosystem.
Expand Down
36 changes: 34 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,9 +31,41 @@ test_dir =

[env:development]
board = adafruit_metro_m4
build_flags =
build_src_flags =
; Force GNU C++ 23:
-std=gnu++23
; 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 =
-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
extends = env_common_samd51
platform_packages =
platformio/toolchain-gccarmnoneeabi @ 1.120301.0 ; PlatformIO's latest GCC Compiler version
10 changes: 5 additions & 5 deletions src/CFA_Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ 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_DATE "2024-9-3"
#define CRSFFORARDUINO_VERSION_BUILD_YEAR 2024
#define CRSFFORARDUINO_VERSION_BUILD_MONTH 9
#define CRSFFORARDUINO_VERSION_BUILD_DAY 3
#endif

/* Failsafe Options
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/CRSF/CRSF.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#pragma once

#include "../CRC/CRC.hpp"
#include "../common/CRC/CRC.hpp"
#include "CRSFProtocol.hpp"

namespace serialReceiverLayer
Expand Down
10 changes: 10 additions & 0 deletions src/SerialReceiver/SerialReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/Telemetry/Telemetry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "Arduino.h"

#include "../CRC/CRC.hpp"
#include "../common/CRC/CRC.hpp"
#include "../CRSF/CRSFProtocol.hpp"
#include "../SerialBuffer/SerialBuffer.hpp"

Expand Down
Loading