From b319e2b0e8c6ad4e835bbbd6eeb542885fa048e8 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sun, 26 Dec 2021 11:27:32 +0100 Subject: [PATCH] Added boot diagnostics --- Config.h | 8 +++++++- RNode_Firmware.ino | 33 +++++++++++++++++++++++++-------- Utilities.h | 18 ++++++++++++++++++ 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/Config.h b/Config.h index 179ead6..af7dff8 100644 --- a/Config.h +++ b/Config.h @@ -4,7 +4,7 @@ #define CONFIG_H #define MAJ_VERS 0x01 - #define MIN_VERS 0x11 + #define MIN_VERS 0x12 #define MCU_1284P 0x91 @@ -107,4 +107,10 @@ const uint8_t SIG_SYNCED = 0x02; const uint8_t RX_ONGOING = 0x04; + // Boot flags + #define START_FROM_BOOTLOADER 0x01 + #define START_FROM_POWERON 0x02 + #define START_FROM_BROWNOUT 0x03 + #define START_FROM_JTAG 0x04 + #endif \ No newline at end of file diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino index d7a562e..dfcaae4 100644 --- a/RNode_Firmware.ino +++ b/RNode_Firmware.ino @@ -562,22 +562,39 @@ void checkModemStatus() { } void validateStatus() { - if (eeprom_lock_set()) { - if (eeprom_product_valid() && eeprom_model_valid() && eeprom_hwrev_valid()) { - if (eeprom_checksum_valid()) { - hw_ready = true; + if (OPTIBOOT_MCUSR & (1<