From 1160d15a6b32391178728d2df04d09fbcce791e1 Mon Sep 17 00:00:00 2001 From: Jonathan Ma Date: Tue, 24 Sep 2024 17:42:37 -0400 Subject: [PATCH 01/12] update lora parameters --- src/constants.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/constants.hpp b/src/constants.hpp index 7a512ce..e10a51d 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -13,9 +13,9 @@ namespace constants { constexpr int radio_rst_pin = 5; constexpr int radio_busy_pin = 16; - constexpr float freq = 433.0; - constexpr float bw = 125.0; - constexpr int sf = 12; + constexpr float freq = 431.5; + constexpr float bw = 62.5; + constexpr int sf = 10; constexpr int cr = 5; constexpr int sw = 18; constexpr int pwr = 20; From 5b6d2dbf70a9781a0f00e3786322174af701ef1e Mon Sep 17 00:00:00 2001 From: Jonathan Ma Date: Thu, 10 Oct 2024 17:17:12 -0400 Subject: [PATCH 02/12] Use one second slot lengths --- src/constants.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.hpp b/src/constants.hpp index e10a51d..adf60e0 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -32,7 +32,7 @@ namespace constants { constexpr uint32_t command_wait_period = 30 * constants::time::one_second; constexpr uint32_t callsign_interval = 10 * constants::time::one_minute; - constexpr uint32_t transmit_slot_length = 2 * constants::time::one_second; + constexpr uint32_t transmit_slot_length = 1 * constants::time::one_second; } // namespace radio namespace imu { From 853e8a4f6ca8be8d6cfafe0d8ac5f145821fe1a8 Mon Sep 17 00:00:00 2001 From: Jonathan Ma Date: Sat, 2 Nov 2024 18:02:47 -0400 Subject: [PATCH 03/12] Add alive signal, fix gps is valid --- src/ControlTasks/RadioControlTask.cpp | 16 ++++++++++++++-- src/Modes/radio_mode_type.enum | 1 + src/Monitors/GPSMonitor.cpp | 4 ++++ src/constants.hpp | 6 ++++-- src/sfr.cpp | 7 +++++-- src/sfr.hpp | 6 ++++-- 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/ControlTasks/RadioControlTask.cpp b/src/ControlTasks/RadioControlTask.cpp index 07418e0..60f9a48 100644 --- a/src/ControlTasks/RadioControlTask.cpp +++ b/src/ControlTasks/RadioControlTask.cpp @@ -154,6 +154,17 @@ void RadioControlTask::execute() #endif init(); if (sfr::radio::initialized) { + sfr::radio::mode = radio_mode_type::aliveSignal; + } + break; + } + case radio_mode_type::aliveSignal: { +#ifdef VERBOSE + Serial.println(F("Radio: Alive Signal State")); +#endif + normalReportDownlink(); + sfr::radio::alive_signal_dlinks++; + if (sfr::radio::alive_signal_dlinks == constants::radio::max_alive_signal_dlinks) { sfr::radio::mode = radio_mode_type::downlink; sfr::radio::listen_period_start = millis(); downlinkSettings(); @@ -243,8 +254,9 @@ bool RadioControlTask::normalReportDownlink() uint16_t alt = sfr::gps::altitude / 10; uint8_t flags = 0; - flags |= constants::radio::id << 6; - flags |= sfr::gps::valid_msg << 5; // gps valid + flags |= constants::radio::id << 7; + flags |= sfr::gps::valid_location << 6; + flags |= sfr::gps::valid_altitude << 5; // gps valid flags |= sfr::imu::initialized << 4; // imu valid flags |= sfr::gps::on << 3; // boot mode flag flags |= (sfr::radio::mode == radio_mode_type::listen) << 2; // listen flag diff --git a/src/Modes/radio_mode_type.enum b/src/Modes/radio_mode_type.enum index 6a5d100..0d42e92 100644 --- a/src/Modes/radio_mode_type.enum +++ b/src/Modes/radio_mode_type.enum @@ -4,6 +4,7 @@ enum class radio_mode_type : unsigned char { init = 0, + aliveSignal, downlink, listen }; diff --git a/src/Monitors/GPSMonitor.cpp b/src/Monitors/GPSMonitor.cpp index b2113cf..e76a3e0 100644 --- a/src/Monitors/GPSMonitor.cpp +++ b/src/Monitors/GPSMonitor.cpp @@ -33,6 +33,7 @@ void GPSMonitor::execute() gps.encode(ss.read()); serial_reads++; } + // for testing only // while (*gpsStream) { // gps.encode(*gpsStream++); // } @@ -50,6 +51,9 @@ void GPSMonitor::execute() sfr::gps::utc_time = gps.time.value(); } + sfr::gps::valid_location = gps.location.isValid(); + sfr::gps::valid_altitude = gps.altitude.isValid(); + #ifdef VERBOSE Serial.print(F("Chars=")); Serial.print(gps.charsProcessed()); diff --git a/src/constants.hpp b/src/constants.hpp index adf60e0..6ef9a94 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -22,6 +22,8 @@ namespace constants { constexpr int pl = 8; constexpr int gn = 0; + constexpr uint8_t max_alive_signal_dlinks = 3; + #ifdef CHIPSAT_ID constexpr uint8_t id = CHIPSAT_ID; #else @@ -32,7 +34,7 @@ namespace constants { constexpr uint32_t command_wait_period = 30 * constants::time::one_second; constexpr uint32_t callsign_interval = 10 * constants::time::one_minute; - constexpr uint32_t transmit_slot_length = 1 * constants::time::one_second; + constexpr uint32_t transmit_slot_length = constants::time::one_second / 5; // 200 ms } // namespace radio namespace imu { @@ -55,7 +57,7 @@ namespace constants { constexpr int reset_pin = 7; constexpr int buffer_size = 11; - constexpr uint32_t boot_time = constants::time::one_second * 30; + constexpr uint32_t boot_time = 30 * constants::time::one_second; } // namespace gps namespace opcodes { constexpr uint8_t no_op = 0x00; diff --git a/src/sfr.cpp b/src/sfr.cpp index 735c711..03d41fd 100644 --- a/src/sfr.cpp +++ b/src/sfr.cpp @@ -17,7 +17,8 @@ namespace sfr { } // namespace temperature namespace gps { float utc_time, latitude, longitude, altitude; - bool valid_msg = false; + bool valid_location = false; + bool valid_altitude = false; bool on = false; uint32_t boot_time = 0; @@ -27,8 +28,10 @@ namespace sfr { bool initialized = false; radio_mode_type mode = radio_mode_type::init; uint8_t start_progress = 0; + uint8_t alive_signal_dlinks = 0; - uint32_t downlink_window_length = 10 * constants::time::one_second; + // try to keep window 10x the slot length + uint32_t downlink_window_length = 2 * constants::time::one_second; uint32_t downlink_window_start; uint32_t listen_period_start; uint32_t command_wait_start; diff --git a/src/sfr.hpp b/src/sfr.hpp index 90d6910..dcb584b 100644 --- a/src/sfr.hpp +++ b/src/sfr.hpp @@ -26,8 +26,9 @@ namespace sfr { } // namespace temperature namespace radio { extern bool initialized; - extern uint8_t start_progress; extern radio_mode_type mode; + extern uint8_t start_progress; + extern uint8_t alive_signal_dlinks; extern uint32_t downlink_window_length; extern uint32_t downlink_window_start; @@ -49,7 +50,8 @@ namespace sfr { extern float longitude; extern float altitude; - extern bool valid_msg; + extern bool valid_location = false; + extern bool valid_altitude = false; extern bool on; extern uint32_t boot_time; From 128e38ca7f580c8e42e76e2ce0e792f70fa228eb Mon Sep 17 00:00:00 2001 From: Cameron Goddard Date: Sat, 2 Nov 2024 18:16:35 -0400 Subject: [PATCH 04/12] update LoRa params --- src/constants.hpp | 4 ++-- src/sfr.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/constants.hpp b/src/constants.hpp index 6ef9a94..704b32d 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -13,8 +13,8 @@ namespace constants { constexpr int radio_rst_pin = 5; constexpr int radio_busy_pin = 16; - constexpr float freq = 431.5; - constexpr float bw = 62.5; + constexpr float freq = 435; + constexpr float bw = 250; constexpr int sf = 10; constexpr int cr = 5; constexpr int sw = 18; diff --git a/src/sfr.hpp b/src/sfr.hpp index dcb584b..bef501f 100644 --- a/src/sfr.hpp +++ b/src/sfr.hpp @@ -50,8 +50,8 @@ namespace sfr { extern float longitude; extern float altitude; - extern bool valid_location = false; - extern bool valid_altitude = false; + extern bool valid_location; + extern bool valid_altitude; extern bool on; extern uint32_t boot_time; From e8a8ac27b6ea558dc8cc29b7bae0475026b07a8d Mon Sep 17 00:00:00 2001 From: Cameron Goddard Date: Sat, 2 Nov 2024 18:33:22 -0400 Subject: [PATCH 05/12] add LED indicators --- src/ControlTasks/RadioControlTask.cpp | 2 ++ src/MainControlLoop.cpp | 4 ++++ src/constants.hpp | 6 ++++++ src/main.cpp | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/src/ControlTasks/RadioControlTask.cpp b/src/ControlTasks/RadioControlTask.cpp index 60f9a48..fc972cf 100644 --- a/src/ControlTasks/RadioControlTask.cpp +++ b/src/ControlTasks/RadioControlTask.cpp @@ -63,9 +63,11 @@ void RadioControlTask::init() bool RadioControlTask::transmit(uint8_t *packet, uint8_t size) { + // digitalWrite(constants::led::led_pin, HIGH); uint32_t start = millis(); code = radio.transmit(packet, size); uint32_t time = millis() - start; + // digitalWrite(constants::led::led_pin, LOW); Serial.print(F("Time to transmit (ms): ")); Serial.println(time); diff --git a/src/MainControlLoop.cpp b/src/MainControlLoop.cpp index cf6b15a..1f94f26 100644 --- a/src/MainControlLoop.cpp +++ b/src/MainControlLoop.cpp @@ -71,6 +71,10 @@ void MainControlLoop::execute() gps_monitor.execute(); radio_control_task.execute(); + if (millis() - sfr::gps::boot_time > constants::led::led_on_time) { + digitalWrite(constants::led::led_pin, LOW); + } + wdt_reset(); #ifdef VERBOSE diff --git a/src/constants.hpp b/src/constants.hpp index 704b32d..5a147fc 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -64,6 +64,12 @@ namespace constants { constexpr uint8_t change_downlink_window = 0x11; } // namespace opcodes + namespace led { + constexpr int led_pin = 9; + constexpr uint32_t led_on_time = 5 * constants::time::one_second; + } + + }; // namespace constants #endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index c655380..a311d78 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,6 +11,10 @@ void setup() Serial.begin(9600); #endif + // sets ChipSat LED high for debugging + pinMode(constants::led::led_pin, OUTPUT); + digitalWrite(constants::led::led_pin, HIGH); + // cuts off power to GPS pinMode(constants::gps::reset_pin, OUTPUT); digitalWrite(constants::gps::reset_pin, HIGH); From 2e8a07c4cf40dc27b563846afd569ccdca05e0b5 Mon Sep 17 00:00:00 2001 From: Cameron Goddard Date: Sat, 16 Nov 2024 22:43:18 -0500 Subject: [PATCH 06/12] fix packet format, update transmit window and slot sizes --- src/ControlTasks/RadioControlTask.cpp | 12 ++++++------ src/constants.hpp | 4 ++-- src/sfr.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ControlTasks/RadioControlTask.cpp b/src/ControlTasks/RadioControlTask.cpp index fc972cf..56892d3 100644 --- a/src/ControlTasks/RadioControlTask.cpp +++ b/src/ControlTasks/RadioControlTask.cpp @@ -256,12 +256,12 @@ bool RadioControlTask::normalReportDownlink() uint16_t alt = sfr::gps::altitude / 10; uint8_t flags = 0; - flags |= constants::radio::id << 7; - flags |= sfr::gps::valid_location << 6; - flags |= sfr::gps::valid_altitude << 5; // gps valid - flags |= sfr::imu::initialized << 4; // imu valid - flags |= sfr::gps::on << 3; // boot mode flag - flags |= (sfr::radio::mode == radio_mode_type::listen) << 2; // listen flag + flags |= constants::radio::id << 6; + flags |= sfr::gps::valid_location << 5; + flags |= sfr::gps::valid_altitude << 4; // gps valid + flags |= sfr::imu::initialized << 3; // imu valid + flags |= sfr::gps::on << 2; // boot mode flag + flags |= (sfr::radio::mode == radio_mode_type::listen) << 1; // listen flag uint8_t dlink[] = { (uint8_t)lat, (uint8_t)(lat >> 8), diff --git a/src/constants.hpp b/src/constants.hpp index 5a147fc..f1f5f85 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -14,7 +14,7 @@ namespace constants { constexpr int radio_busy_pin = 16; constexpr float freq = 435; - constexpr float bw = 250; + constexpr float bw = 62.5; constexpr int sf = 10; constexpr int cr = 5; constexpr int sw = 18; @@ -34,7 +34,7 @@ namespace constants { constexpr uint32_t command_wait_period = 30 * constants::time::one_second; constexpr uint32_t callsign_interval = 10 * constants::time::one_minute; - constexpr uint32_t transmit_slot_length = constants::time::one_second / 5; // 200 ms + constexpr uint32_t transmit_slot_length = 700; // ms } // namespace radio namespace imu { diff --git a/src/sfr.cpp b/src/sfr.cpp index 03d41fd..5981811 100644 --- a/src/sfr.cpp +++ b/src/sfr.cpp @@ -31,7 +31,7 @@ namespace sfr { uint8_t alive_signal_dlinks = 0; // try to keep window 10x the slot length - uint32_t downlink_window_length = 2 * constants::time::one_second; + uint32_t downlink_window_length = 3500; uint32_t downlink_window_start; uint32_t listen_period_start; uint32_t command_wait_start; From b2173f153ec61cc9cf3f89b8f5f98b956094498a Mon Sep 17 00:00:00 2001 From: Cameron Goddard Date: Sat, 16 Nov 2024 22:43:59 -0500 Subject: [PATCH 07/12] format --- src/constants.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/constants.hpp b/src/constants.hpp index f1f5f85..05d9ece 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -67,8 +67,7 @@ namespace constants { namespace led { constexpr int led_pin = 9; constexpr uint32_t led_on_time = 5 * constants::time::one_second; - } - + } // namespace led }; // namespace constants From de9d26e4397ad5e2db1fb7860837ed26a2faa4a6 Mon Sep 17 00:00:00 2001 From: Jonathan Ma Date: Sun, 17 Nov 2024 22:00:34 -0500 Subject: [PATCH 08/12] Fix led blink on transmit --- src/ControlTasks/RadioControlTask.cpp | 12 ++++++++++-- src/Monitors/GPSMonitor.hpp | 8 ++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/ControlTasks/RadioControlTask.cpp b/src/ControlTasks/RadioControlTask.cpp index 56892d3..2ffc6f4 100644 --- a/src/ControlTasks/RadioControlTask.cpp +++ b/src/ControlTasks/RadioControlTask.cpp @@ -63,13 +63,21 @@ void RadioControlTask::init() bool RadioControlTask::transmit(uint8_t *packet, uint8_t size) { - // digitalWrite(constants::led::led_pin, HIGH); + if (millis() - sfr::gps::boot_time > constants::led::led_on_time) { + digitalWrite(constants::led::led_pin, HIGH); + } + uint32_t start = millis(); code = radio.transmit(packet, size); uint32_t time = millis() - start; - // digitalWrite(constants::led::led_pin, LOW); + + if (millis() - sfr::gps::boot_time > constants::led::led_on_time) { + digitalWrite(constants::led::led_pin, LOW); + } +#ifdef VERBOSE Serial.print(F("Time to transmit (ms): ")); Serial.println(time); +#endif if (code == RADIOLIB_ERR_NONE) { // the packet was successfully transmitted diff --git a/src/Monitors/GPSMonitor.hpp b/src/Monitors/GPSMonitor.hpp index 0453dc0..b53eb82 100644 --- a/src/Monitors/GPSMonitor.hpp +++ b/src/Monitors/GPSMonitor.hpp @@ -31,10 +31,10 @@ class GPSMonitor */ void init(); - // TODO: Test edge cases for lat, lon, alt - const char *gpsStream = "$GPGGA,045104.000,3014.1985,N,09749.2873,W,1,09,1.2,211.6,M,-22.5,M,,0000*62\r\n" - "$GPGGA,045201.000,3014.3864,N,09748.9411,W,1,10,1.2,200.8,M,-22.5,M,,0000*6C\r\n" - "$GPGG@,045252.000,3014.4273,S,09749.0628,W,1,09,1.3,206.9,M,-22.5,M,,0000*6F\r\n"; + // for edge case testing only + // const char *gpsStream = "$GPGGA,045104.000,3014.1985,N,09749.2873,W,1,09,1.2,211.6,M,-22.5,M,,0000*62\r\n" + // "$GPGGA,045201.000,3014.3864,N,09748.9411,W,1,10,1.2,200.8,M,-22.5,M,,0000*6C\r\n" + // "$GPGG@,045252.000,3014.4273,S,09749.0628,W,1,09,1.3,206.9,M,-22.5,M,,0000*6F\r\n"; }; #endif \ No newline at end of file From 1571de706ad5cf138ec583e62f768e7b9f489d7e Mon Sep 17 00:00:00 2001 From: Jonathan Ma Date: Tue, 19 Nov 2024 21:49:52 -0500 Subject: [PATCH 09/12] Change listen period to 30 minutes, update comments --- src/ControlTasks/RadioControlTask.cpp | 17 ++++------------- src/MainControlLoop.cpp | 1 + src/Monitors/GPSMonitor.cpp | 6 ++---- src/Monitors/GPSMonitor.hpp | 5 ----- src/constants.hpp | 2 +- src/main.cpp | 1 + src/sfr.cpp | 5 +++-- 7 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/ControlTasks/RadioControlTask.cpp b/src/ControlTasks/RadioControlTask.cpp index 2ffc6f4..859f218 100644 --- a/src/ControlTasks/RadioControlTask.cpp +++ b/src/ControlTasks/RadioControlTask.cpp @@ -63,6 +63,7 @@ void RadioControlTask::init() bool RadioControlTask::transmit(uint8_t *packet, uint8_t size) { + // blink LED during transmit if (millis() - sfr::gps::boot_time > constants::led::led_on_time) { digitalWrite(constants::led::led_pin, HIGH); } @@ -114,23 +115,13 @@ bool RadioControlTask::receive() // packet was successfully received Serial.println(F("success!")); - // print the data of the packet Serial.print(F("[SX1278] Data:\t\t\t")); - - // print the RSSI (Received Signal Strength Indicator) - // of the last received packet Serial.print(F("[SX1278] RSSI:\t\t\t")); Serial.print(radio.getRSSI()); Serial.println(F(" dBm")); - - // print the SNR (Signal-to-Noise Ratio) - // of the last received packet Serial.print(F("[SX1278] SNR:\t\t\t")); Serial.print(radio.getSNR()); Serial.println(F(" dB")); - - // print frequency error - // of the last received packet Serial.print(F("[SX1278] Frequency error:\t")); Serial.print(radio.getFrequencyError()); Serial.println(F(" Hz")); @@ -264,9 +255,9 @@ bool RadioControlTask::normalReportDownlink() uint16_t alt = sfr::gps::altitude / 10; uint8_t flags = 0; - flags |= constants::radio::id << 6; - flags |= sfr::gps::valid_location << 5; - flags |= sfr::gps::valid_altitude << 4; // gps valid + flags |= constants::radio::id << 6; // chipsat ID # + flags |= sfr::gps::valid_location << 5; // gps position valid + flags |= sfr::gps::valid_altitude << 4; // gps altiude valid flags |= sfr::imu::initialized << 3; // imu valid flags |= sfr::gps::on << 2; // boot mode flag flags |= (sfr::radio::mode == radio_mode_type::listen) << 1; // listen flag diff --git a/src/MainControlLoop.cpp b/src/MainControlLoop.cpp index 1f94f26..459aa4a 100644 --- a/src/MainControlLoop.cpp +++ b/src/MainControlLoop.cpp @@ -71,6 +71,7 @@ void MainControlLoop::execute() gps_monitor.execute(); radio_control_task.execute(); + // turn off LED 5 seconds after boot if (millis() - sfr::gps::boot_time > constants::led::led_on_time) { digitalWrite(constants::led::led_pin, LOW); } diff --git a/src/Monitors/GPSMonitor.cpp b/src/Monitors/GPSMonitor.cpp index e76a3e0..bf75605 100644 --- a/src/Monitors/GPSMonitor.cpp +++ b/src/Monitors/GPSMonitor.cpp @@ -19,6 +19,7 @@ void GPSMonitor::init() void GPSMonitor::execute() { + // turn on GPS after boot mode is over (30 seconds) if (!sfr::gps::on) { if (millis() - sfr::gps::boot_time > constants::gps::boot_time) { init(); @@ -33,11 +34,8 @@ void GPSMonitor::execute() gps.encode(ss.read()); serial_reads++; } - // for testing only - // while (*gpsStream) { - // gps.encode(*gpsStream++); - // } + // read GPS values if they are valid if (gps.location.isUpdated() && gps.location.isValid()) { sfr::gps::latitude = gps.location.lat(); sfr::gps::longitude = gps.location.lng(); diff --git a/src/Monitors/GPSMonitor.hpp b/src/Monitors/GPSMonitor.hpp index b53eb82..2e81340 100644 --- a/src/Monitors/GPSMonitor.hpp +++ b/src/Monitors/GPSMonitor.hpp @@ -30,11 +30,6 @@ class GPSMonitor * Begins the software serial instance and configures the GPS receiver */ void init(); - - // for edge case testing only - // const char *gpsStream = "$GPGGA,045104.000,3014.1985,N,09749.2873,W,1,09,1.2,211.6,M,-22.5,M,,0000*62\r\n" - // "$GPGGA,045201.000,3014.3864,N,09748.9411,W,1,10,1.2,200.8,M,-22.5,M,,0000*6C\r\n" - // "$GPGG@,045252.000,3014.4273,S,09749.0628,W,1,09,1.3,206.9,M,-22.5,M,,0000*6F\r\n"; }; #endif \ No newline at end of file diff --git a/src/constants.hpp b/src/constants.hpp index 05d9ece..f7b8eab 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -30,7 +30,7 @@ namespace constants { constexpr uint8_t id = 0; #endif - constexpr uint32_t listen_period = 30 * constants::time::one_second; + constexpr uint32_t listen_period = 30 * constants::time::one_minute; constexpr uint32_t command_wait_period = 30 * constants::time::one_second; constexpr uint32_t callsign_interval = 10 * constants::time::one_minute; diff --git a/src/main.cpp b/src/main.cpp index a311d78..1a749a7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,6 +5,7 @@ MainControlLoop mcl; void setup() { + // configure watchdog timer wdt_disable(); wdt_enable(WDTO_8S); #ifdef VERBOSE diff --git a/src/sfr.cpp b/src/sfr.cpp index 5981811..51d0e9e 100644 --- a/src/sfr.cpp +++ b/src/sfr.cpp @@ -30,8 +30,9 @@ namespace sfr { uint8_t start_progress = 0; uint8_t alive_signal_dlinks = 0; - // try to keep window 10x the slot length - uint32_t downlink_window_length = 3500; + // This must be a multiple of constants::radio::transmit_slot_length + // Ideally window should be 10x the slot length + uint32_t downlink_window_length = 3500; // ms uint32_t downlink_window_start; uint32_t listen_period_start; uint32_t command_wait_start; From d7947990e215c31fe7518fd2e37f95f3e17acdd9 Mon Sep 17 00:00:00 2001 From: Jonathan Ma Date: Sat, 14 Dec 2024 15:20:43 -0500 Subject: [PATCH 10/12] fully initialize radio in first cycle --- src/ControlTasks/RadioControlTask.cpp | 37 ++++++++++++--------------- src/MainControlLoop.cpp | 5 +++- src/main.cpp | 4 +-- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/ControlTasks/RadioControlTask.cpp b/src/ControlTasks/RadioControlTask.cpp index 859f218..02b1645 100644 --- a/src/ControlTasks/RadioControlTask.cpp +++ b/src/ControlTasks/RadioControlTask.cpp @@ -7,10 +7,9 @@ RadioControlTask::RadioControlTask() void RadioControlTask::init() { if (!sfr::radio::initialized) { - switch (sfr::radio::start_progress) { - case 0: + if (sfr::radio::start_progress == 0) { #ifdef VERBOSE - Serial.print(F("Radio: Initializing ... ")); + Serial.println(F("Radio: Initializing ... ")); #endif // initialize SX1278 with default settings code = radio.begin(constants::radio::freq, constants::radio::bw, constants::radio::sf, constants::radio::cr, @@ -23,10 +22,11 @@ void RadioControlTask::init() Serial.println(code); #endif } - break; - case 1: + } + + if (sfr::radio::start_progress == 1) { #ifdef VERBOSE - Serial.print(F("Radio: Setting CRC parameter ... ")); + Serial.println(F("Radio: Setting CRC parameter ... ")); #endif // set CRC parameter to true so it matches the CRC parameter on the TinyGS side code = radio.setCRC(true); @@ -38,25 +38,22 @@ void RadioControlTask::init() Serial.println(code); #endif } - break; - case 2: + + if (sfr::radio::start_progress == 2) { #ifdef VERBOSE - Serial.print(F("Radio: Setting forceLDRO parameter ... ")); + Serial.println(F("Radio: Setting forceLDRO parameter ... ")); #endif - // set forceLDRO parameter to true so it matches the forceLDRO parameter on the TinyGS side - code = radio.forceLDRO(true); - if (code == RADIOLIB_ERR_NONE) { - sfr::radio::start_progress++; - } else { + // set forceLDRO parameter to true so it matches the forceLDRO parameter on the TinyGS side + code = radio.forceLDRO(true); + if (code == RADIOLIB_ERR_NONE) { + sfr::radio::initialized = true; + } else { #ifdef VERBOSE - Serial.print(F("failed, code ")); - Serial.println(code); + Serial.print(F("failed, code ")); + Serial.println(code); #endif + } } - break; - case 3: // completed initialization - sfr::radio::initialized = true; - break; } } } diff --git a/src/MainControlLoop.cpp b/src/MainControlLoop.cpp index 459aa4a..fc27207 100644 --- a/src/MainControlLoop.cpp +++ b/src/MainControlLoop.cpp @@ -61,9 +61,12 @@ void MainControlLoop::execute() Serial.print(F("GPS Altitude (m): ")); Serial.println(sfr::gps::altitude); - Serial.print("Downlink Slot: "); + Serial.print(F("Downlink Slot: ")); Serial.println(sfr::radio::downlink_slot); + Serial.print(F("Alive Time: ")); + Serial.println(millis() - sfr::gps::boot_time); + #endif temp_monitor.execute(); diff --git a/src/main.cpp b/src/main.cpp index 1a749a7..a1ebf0c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,6 +12,8 @@ void setup() Serial.begin(9600); #endif + sfr::gps::boot_time = millis(); + // sets ChipSat LED high for debugging pinMode(constants::led::led_pin, OUTPUT); digitalWrite(constants::led::led_pin, HIGH); @@ -24,8 +26,6 @@ void setup() pinMode(constants::gps::tx_pin, OUTPUT); digitalWrite(constants::gps::tx_pin, LOW); - sfr::gps::boot_time = millis(); - // seed random number gen with noise from unconnected analog pin randomSeed(analogRead(A0)); } From 742b267a3c9ac35be5ab52068f48949e212446df Mon Sep 17 00:00:00 2001 From: Cameron Goddard Date: Wed, 18 Dec 2024 15:45:13 -0500 Subject: [PATCH 11/12] changes from code review --- src/ControlTasks/RadioControlTask.cpp | 6 +++++- src/ControlTasks/RadioControlTask.hpp | 4 ++-- src/Monitors/TempMonitor.cpp | 3 +-- src/constants.hpp | 8 ++++---- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/ControlTasks/RadioControlTask.cpp b/src/ControlTasks/RadioControlTask.cpp index 02b1645..a96e470 100644 --- a/src/ControlTasks/RadioControlTask.cpp +++ b/src/ControlTasks/RadioControlTask.cpp @@ -65,9 +65,13 @@ bool RadioControlTask::transmit(uint8_t *packet, uint8_t size) digitalWrite(constants::led::led_pin, HIGH); } +#ifdef VERBOSE uint32_t start = millis(); +#endif code = radio.transmit(packet, size); +#ifdef VERBOSE uint32_t time = millis() - start; +#endif if (millis() - sfr::gps::boot_time > constants::led::led_on_time) { digitalWrite(constants::led::led_pin, LOW); @@ -234,7 +238,7 @@ bool RadioControlTask::executeDownlink() if (millis() - sfr::radio::last_callsign_time < constants::radio::callsign_interval) { return normalReportDownlink(); } else { - uint8_t dlink[] = {'K', 'D', '2', 'W', 'T', 'Q'}; + uint8_t dlink[] = {'K', 'C', '3', 'V', 'A', 'T', 'K', 'D', '2', 'W', 'T', 'Q', 'K', 'E', '2', 'A', 'T', 'R'}; sfr::radio::last_callsign_time = millis(); #ifdef VERBOSE Serial.println(F("Callsign Report")); diff --git a/src/ControlTasks/RadioControlTask.hpp b/src/ControlTasks/RadioControlTask.hpp index 6f9ed03..be0be74 100644 --- a/src/ControlTasks/RadioControlTask.hpp +++ b/src/ControlTasks/RadioControlTask.hpp @@ -26,12 +26,12 @@ class RadioControlTask void downlinkSettings(); /** - * @brief Wrapper around RadioLib's transmit() to provide metadata (TODO: Redundant?) + * @brief Wrapper around RadioLib's transmit() to provide metadata */ bool transmit(uint8_t *packet, uint8_t size); /** - * @brief Attempts to receive a 3 byte command (TODO: Redundant?) + * @brief Attempts to receive a 3 byte command */ bool receive(); diff --git a/src/Monitors/TempMonitor.cpp b/src/Monitors/TempMonitor.cpp index 59144b2..2df3e1d 100644 --- a/src/Monitors/TempMonitor.cpp +++ b/src/Monitors/TempMonitor.cpp @@ -13,11 +13,10 @@ void TempMonitor::execute() // Select no hold master Wire.write(0xF3); Wire.endTransmission(); - delay(300); // TODO: Look at this delay + delay(300); // TODO: Look at this delay (for real) // Request 2 bytes of data Wire.requestFrom(constants::temperature::i2c_address, 2); - // TODO: Delay here? if (Wire.available() == 2) { data[0] = Wire.read(); diff --git a/src/constants.hpp b/src/constants.hpp index f7b8eab..7730d44 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -12,8 +12,8 @@ namespace constants { constexpr int radio_di0_pin = 2; constexpr int radio_rst_pin = 5; constexpr int radio_busy_pin = 16; - - constexpr float freq = 435; + // TODO: Document units + constexpr float freq = 437.4; constexpr float bw = 62.5; constexpr int sf = 10; constexpr int cr = 5; @@ -35,7 +35,7 @@ namespace constants { constexpr uint32_t callsign_interval = 10 * constants::time::one_minute; constexpr uint32_t transmit_slot_length = 700; // ms - + // TODO: Verify sensor data on alive signal } // namespace radio namespace imu { constexpr int gyro_min = -245; // default gyro range is +/- 245 dps @@ -57,7 +57,7 @@ namespace constants { constexpr int reset_pin = 7; constexpr int buffer_size = 11; - constexpr uint32_t boot_time = 30 * constants::time::one_second; + constexpr uint32_t boot_time = 10 * constants::time::one_second; } // namespace gps namespace opcodes { constexpr uint8_t no_op = 0x00; From 4242e18862f5780b51903f9aa003c00bc6386c81 Mon Sep 17 00:00:00 2001 From: Cameron Goddard Date: Tue, 24 Dec 2024 18:12:13 -0500 Subject: [PATCH 12/12] clean up --- src/ControlTasks/RadioControlTask.cpp | 36 +++++++++++++-------------- src/ControlTasks/RadioControlTask.hpp | 2 +- src/MainControlLoop.cpp | 2 +- src/Monitors/GPSMonitor.cpp | 6 ++--- src/Monitors/GPSMonitor.hpp | 2 +- src/Monitors/IMUMonitor.cpp | 9 +++---- src/constants.hpp | 30 +++++++++++----------- src/main.cpp | 10 ++++---- src/sfr.cpp | 9 ++----- src/sfr.hpp | 6 ++--- 10 files changed, 52 insertions(+), 60 deletions(-) diff --git a/src/ControlTasks/RadioControlTask.cpp b/src/ControlTasks/RadioControlTask.cpp index a96e470..e4bc1b2 100644 --- a/src/ControlTasks/RadioControlTask.cpp +++ b/src/ControlTasks/RadioControlTask.cpp @@ -11,7 +11,7 @@ void RadioControlTask::init() #ifdef VERBOSE Serial.println(F("Radio: Initializing ... ")); #endif - // initialize SX1278 with default settings + // Initialize SX1278 with default settings code = radio.begin(constants::radio::freq, constants::radio::bw, constants::radio::sf, constants::radio::cr, constants::radio::sw, constants::radio::pwr, constants::radio::pl, constants::radio::gn); if (code == RADIOLIB_ERR_NONE) { @@ -28,7 +28,7 @@ void RadioControlTask::init() #ifdef VERBOSE Serial.println(F("Radio: Setting CRC parameter ... ")); #endif - // set CRC parameter to true so it matches the CRC parameter on the TinyGS side + // Set CRC parameter to true so it matches the CRC parameter on the TinyGS side code = radio.setCRC(true); if (code == RADIOLIB_ERR_NONE) { sfr::radio::start_progress++; @@ -43,7 +43,7 @@ void RadioControlTask::init() #ifdef VERBOSE Serial.println(F("Radio: Setting forceLDRO parameter ... ")); #endif - // set forceLDRO parameter to true so it matches the forceLDRO parameter on the TinyGS side + // Set forceLDRO parameter to true so it matches the forceLDRO parameter on the TinyGS side code = radio.forceLDRO(true); if (code == RADIOLIB_ERR_NONE) { sfr::radio::initialized = true; @@ -60,7 +60,7 @@ void RadioControlTask::init() bool RadioControlTask::transmit(uint8_t *packet, uint8_t size) { - // blink LED during transmit + // Blink LED during transmit if (millis() - sfr::gps::boot_time > constants::led::led_on_time) { digitalWrite(constants::led::led_pin, HIGH); } @@ -82,7 +82,7 @@ bool RadioControlTask::transmit(uint8_t *packet, uint8_t size) #endif if (code == RADIOLIB_ERR_NONE) { - // the packet was successfully transmitted + // The packet was successfully transmitted #ifdef VERBOSE Serial.println(F("success!")); Serial.print(F("[SX1278] Datarate:\t")); @@ -93,10 +93,10 @@ bool RadioControlTask::transmit(uint8_t *packet, uint8_t size) } else { #ifdef VERBOSE if (code == RADIOLIB_ERR_TX_TIMEOUT) { - // timeout occurred while transmitting packet + // Timeout occurred while transmitting packet Serial.println(F("timeout!")); } else { - // some other error occurred + // Some other error occurred Serial.print(F("failed, code ")); Serial.println(code); } @@ -131,13 +131,13 @@ bool RadioControlTask::receive() } else { #ifdef VERBOSE if (code == RADIOLIB_ERR_RX_TIMEOUT) { - // timeout occurred while waiting for a packet + // Timeout occurred while waiting for a packet Serial.println(F("timeout!")); } else if (code == RADIOLIB_ERR_CRC_MISMATCH) { - // packet was received, but is malformed + // Packet was received, but is malformed Serial.println(F("CRC error!")); } else { - // some other error occurred + // Some other error occurred Serial.print(F("failed, code ")); Serial.println(code); } @@ -148,7 +148,7 @@ bool RadioControlTask::receive() void RadioControlTask::execute() { - // implements the state machine described in: https://github.com/Alpha-CubeSat/oop-chipsat-code/wiki + // Implement the state machine described in https://github.com/Alpha-CubeSat/oop-chipsat-code/wiki switch (sfr::radio::mode) { case radio_mode_type::init: { #ifdef VERBOSE @@ -177,24 +177,24 @@ void RadioControlTask::execute() #ifdef VERBOSE Serial.println(F("Radio: Downlink State")); #endif - // downlink when slot reached + // Downlink when slot reached if (!sfr::radio::downlinked_in_slot && millis() - sfr::radio::downlink_window_start >= constants::radio::transmit_slot_length * sfr::radio::downlink_slot) { executeDownlink(); sfr::radio::downlinked_in_slot = true; } - // go into listen mode if listen period reached + // Go into listen mode if listen period reached if (millis() - sfr::radio::listen_period_start >= constants::radio::listen_period) { sfr::radio::mode = radio_mode_type::listen; #ifdef VERBOSE Serial.println(F("Radio: Listen Flag Downlink")); #endif - // downlink with listen flag = true + // Downlink with listen flag = true normalReportDownlink(); sfr::radio::command_wait_start = millis(); } - // reset window and choose slot for next downlink + // Reset window and choose slot for next downlink else if (millis() - sfr::radio::downlink_window_start >= sfr::radio::downlink_window_length) { downlinkSettings(); } @@ -204,7 +204,7 @@ void RadioControlTask::execute() #ifdef VERBOSE Serial.println(F("Radio: Listen State")); #endif - // built in timeout is 100 LoRa symbols + // Built in timeout is 100 LoRa symbols bool receive_success = receive(); if (receive_success) { processUplink(); @@ -250,7 +250,7 @@ bool RadioControlTask::executeDownlink() bool RadioControlTask::normalReportDownlink() { - // see https://github.com/Alpha-CubeSat/oop-chipsat-code/wiki/2.-Telemetry for more info + // See https://github.com/Alpha-CubeSat/oop-chipsat-code/wiki/2.-Telemetry for more info uint16_t lat = sfr::gps::latitude * 100; uint16_t lon = sfr::gps::longitude * 100; uint16_t alt = sfr::gps::altitude / 10; @@ -300,7 +300,7 @@ uint8_t RadioControlTask::map_range(float value, int min_val, int max_val) void RadioControlTask::processUplink() { - // see https://github.com/Alpha-CubeSat/oop-chipsat-code/wiki/3.-Commands for more info + // See https://github.com/Alpha-CubeSat/oop-chipsat-code/wiki/3.-Commands for more info switch (received[0]) { case constants::opcodes::no_op: // No-Op #ifdef VERBOSE diff --git a/src/ControlTasks/RadioControlTask.hpp b/src/ControlTasks/RadioControlTask.hpp index be0be74..8daeb09 100644 --- a/src/ControlTasks/RadioControlTask.hpp +++ b/src/ControlTasks/RadioControlTask.hpp @@ -21,7 +21,7 @@ class RadioControlTask void init(); /** - * Resets the transmit window start time and picks a new slot + * @brief Resets the transmit window start time and picks a new slot */ void downlinkSettings(); diff --git a/src/MainControlLoop.cpp b/src/MainControlLoop.cpp index fc27207..ccf6445 100644 --- a/src/MainControlLoop.cpp +++ b/src/MainControlLoop.cpp @@ -74,7 +74,7 @@ void MainControlLoop::execute() gps_monitor.execute(); radio_control_task.execute(); - // turn off LED 5 seconds after boot + // Turn off LED 5 seconds after boot if (millis() - sfr::gps::boot_time > constants::led::led_on_time) { digitalWrite(constants::led::led_pin, LOW); } diff --git a/src/Monitors/GPSMonitor.cpp b/src/Monitors/GPSMonitor.cpp index bf75605..1241a7f 100644 --- a/src/Monitors/GPSMonitor.cpp +++ b/src/Monitors/GPSMonitor.cpp @@ -9,7 +9,7 @@ void GPSMonitor::init() digitalWrite(constants::gps::reset_pin, LOW); sfr::gps::on = true; - // writes NMEA output message type to SRAM and Flash + // Writes NMEA output message type to SRAM and Flash uint8_t SetNMEA[] = { 0xA0, 0xA1, 0x00, 0x03, 0x09, 0x01, 0x01, 0x09, 0x0D, 0x0A}; @@ -19,7 +19,7 @@ void GPSMonitor::init() void GPSMonitor::execute() { - // turn on GPS after boot mode is over (30 seconds) + // Turn on GPS after boot mode is over (10 seconds) if (!sfr::gps::on) { if (millis() - sfr::gps::boot_time > constants::gps::boot_time) { init(); @@ -35,7 +35,7 @@ void GPSMonitor::execute() serial_reads++; } - // read GPS values if they are valid + // Read GPS values if they are valid if (gps.location.isUpdated() && gps.location.isValid()) { sfr::gps::latitude = gps.location.lat(); sfr::gps::longitude = gps.location.lng(); diff --git a/src/Monitors/GPSMonitor.hpp b/src/Monitors/GPSMonitor.hpp index 2e81340..7cd8abd 100644 --- a/src/Monitors/GPSMonitor.hpp +++ b/src/Monitors/GPSMonitor.hpp @@ -27,7 +27,7 @@ class GPSMonitor SoftwareSerial ss = SoftwareSerial(constants::gps::rx_pin, constants::gps::tx_pin); /** - * Begins the software serial instance and configures the GPS receiver + * @brief Begins the software serial instance and configures the GPS receiver */ void init(); }; diff --git a/src/Monitors/IMUMonitor.cpp b/src/Monitors/IMUMonitor.cpp index 1d8b422..f6dabe4 100644 --- a/src/Monitors/IMUMonitor.cpp +++ b/src/Monitors/IMUMonitor.cpp @@ -18,7 +18,6 @@ void IMUMonitor::execute() } else { sfr::imu::initialized = true; } - } else { capture_imu_values(); } @@ -26,25 +25,25 @@ void IMUMonitor::execute() void IMUMonitor::capture_imu_values() { - // check if the gyroscope, accelerometer, or magnetometer has new data available + // Check if the gyroscope, accelerometer, or magnetometer has new data available if (IMU.gyroscopeAvailable()) { IMU.readGyroscope( sfr::imu::gyro_x, sfr::imu::gyro_y, - sfr::imu::gyro_z); // data is in degrees/s + sfr::imu::gyro_z); // Data is in degrees/s } if (IMU.accelerationAvailable()) { IMU.readAcceleration( sfr::imu::acc_x, sfr::imu::acc_y, - sfr::imu::acc_z); // data is in m/s^2 + sfr::imu::acc_z); // Data is in m/s^2 } if (IMU.magneticFieldAvailable()) { IMU.readMagneticField( sfr::imu::mag_x, sfr::imu::mag_y, - sfr::imu::mag_z); // data in uT + sfr::imu::mag_z); // Data in uT } } \ No newline at end of file diff --git a/src/constants.hpp b/src/constants.hpp index 7730d44..4cf7f89 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -12,15 +12,15 @@ namespace constants { constexpr int radio_di0_pin = 2; constexpr int radio_rst_pin = 5; constexpr int radio_busy_pin = 16; - // TODO: Document units - constexpr float freq = 437.4; - constexpr float bw = 62.5; - constexpr int sf = 10; - constexpr int cr = 5; - constexpr int sw = 18; - constexpr int pwr = 20; - constexpr int pl = 8; - constexpr int gn = 0; + + constexpr float freq = 437.4; // MHz + constexpr float bw = 62.5; // kHz + constexpr int sf = 10; // Between 7 and 12 + constexpr int cr = 5; // Between 5 and 8. 4/8 coding ratio. One redundancy bit for every data bit + constexpr int sw = 18; // Sync-word (defines network). Default is 0d18 + constexpr int pwr = 20; // Between 2 and 17, or 20 for max power + constexpr int pl = 8; // Payload length + constexpr int gn = 0; // Gain constexpr uint8_t max_alive_signal_dlinks = 3; @@ -35,14 +35,14 @@ namespace constants { constexpr uint32_t callsign_interval = 10 * constants::time::one_minute; constexpr uint32_t transmit_slot_length = 700; // ms - // TODO: Verify sensor data on alive signal + // TODO: Verify sensor data on alive signal } // namespace radio namespace imu { - constexpr int gyro_min = -245; // default gyro range is +/- 245 dps + constexpr int gyro_min = -245; // Default gyro range is +/- 245 dps constexpr int gyro_max = 245; - constexpr int acc_min = -20; // default accel range is +/- 2 G + constexpr int acc_min = -20; // Default accel range is +/- 2 G constexpr int acc_max = 20; - constexpr int mag_min = -100; // default mag range is +/- 4 guass -> 100 uT + constexpr int mag_min = -100; // Default mag range is +/- 4 guass -> 100 uT constexpr int mag_max = 100; } // namespace imu namespace temperature { @@ -63,12 +63,10 @@ namespace constants { constexpr uint8_t no_op = 0x00; constexpr uint8_t change_downlink_window = 0x11; } // namespace opcodes - namespace led { constexpr int led_pin = 9; constexpr uint32_t led_on_time = 5 * constants::time::one_second; } // namespace led - -}; // namespace constants +}; // namespace constants #endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index a1ebf0c..da9097a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,7 +5,7 @@ MainControlLoop mcl; void setup() { - // configure watchdog timer + // Set up watchdog timer wdt_disable(); wdt_enable(WDTO_8S); #ifdef VERBOSE @@ -14,19 +14,19 @@ void setup() sfr::gps::boot_time = millis(); - // sets ChipSat LED high for debugging + // Set ChipSat LED high for debugging pinMode(constants::led::led_pin, OUTPUT); digitalWrite(constants::led::led_pin, HIGH); - // cuts off power to GPS + // Cut off power to GPS pinMode(constants::gps::reset_pin, OUTPUT); digitalWrite(constants::gps::reset_pin, HIGH); - // prevents current from leaking over GPS serial line (~79mA -> ~22mA) + // Prevents current from leaking over GPS serial line (~79mA -> ~22mA) pinMode(constants::gps::tx_pin, OUTPUT); digitalWrite(constants::gps::tx_pin, LOW); - // seed random number gen with noise from unconnected analog pin + // Seed random number gen with noise from unconnected analog pin randomSeed(analogRead(A0)); } diff --git a/src/sfr.cpp b/src/sfr.cpp index 51d0e9e..210b713 100644 --- a/src/sfr.cpp +++ b/src/sfr.cpp @@ -1,17 +1,14 @@ #include "sfr.hpp" namespace sfr { - namespace imu { + bool initialized = false; float gyro_x, gyro_y, gyro_z; float acc_x, acc_y, acc_z; float mag_x, mag_y, mag_z; - bool initialized = false; - } // namespace imu - namespace temperature { float temp_c; } // namespace temperature @@ -31,7 +28,6 @@ namespace sfr { uint8_t alive_signal_dlinks = 0; // This must be a multiple of constants::radio::transmit_slot_length - // Ideally window should be 10x the slot length uint32_t downlink_window_length = 3500; // ms uint32_t downlink_window_start; uint32_t listen_period_start; @@ -45,5 +41,4 @@ namespace sfr { uint8_t invalid_uplinks = 0; } // namespace radio - -}; // namespace sfr +}; // namespace sfr diff --git a/src/sfr.hpp b/src/sfr.hpp index bef501f..2ad9c83 100644 --- a/src/sfr.hpp +++ b/src/sfr.hpp @@ -7,6 +7,8 @@ namespace sfr { namespace imu { + extern bool initialized; + extern float gyro_x; extern float gyro_y; extern float gyro_z; @@ -19,7 +21,6 @@ namespace sfr { extern float mag_y; extern float mag_z; - extern bool initialized; } // namespace imu namespace temperature { extern float temp_c; @@ -56,7 +57,6 @@ namespace sfr { extern uint32_t boot_time; } // namespace gps - -}; // namespace sfr +}; // namespace sfr #endif \ No newline at end of file