]> git.tnoah.ca Git - lora-radio.git/commitdiff
Fixed intermittent init failure on AVR
authorMark Qvist <mark@unsigned.io>
Sat, 18 Feb 2023 11:14:15 +0000 (12:14 +0100)
committerMark Qvist <mark@unsigned.io>
Sat, 18 Feb 2023 11:14:15 +0000 (12:14 +0100)
Config.h
RNode_Firmware.ino

index 719e6d813fc0f75a2909fa50ffb993c56fbc53ea..3d5c83484e732758be430c52c98fac243a2fa27c 100644 (file)
--- a/Config.h
+++ b/Config.h
@@ -19,7 +19,7 @@
        #define CONFIG_H
 
        #define MAJ_VERS  0x01
-       #define MIN_VERS  0x39
+       #define MIN_VERS  0x3A
 
        #define PLATFORM_AVR   0x90
     #define PLATFORM_ESP32 0x80
index 929a7cfe25fc7305b0db25e9507fff5201b44182..b48e4c3be2a08ae8019de5a70672c99c16fd62fd 100644 (file)
@@ -88,25 +88,33 @@ void setup() {
   // pins for the LoRa module
   LoRa.setPins(pin_cs, pin_reset, pin_dio);
   
-  if (LoRa.preInit()) {
-    sx1276_installed = true;
-    uint32_t lfr = LoRa.getFrequency();
-    if (lfr == 0) {
-      // Normal boot
-    } else if (lfr == M_FRQ_R) {
-      // Quick reboot
-      #if HAS_CONSOLE
-        if (rtc_get_reset_reason(0) == POWERON_RESET) {
-          console_active = true;
-        }
-      #endif
+  #if MCU_VARIANT == MCU_ESP32
+    // Check installed transceiver chip and
+    // probe boot parameters.
+    if (LoRa.preInit()) {
+      sx1276_installed = true;
+      uint32_t lfr = LoRa.getFrequency();
+      if (lfr == 0) {
+        // Normal boot
+      } else if (lfr == M_FRQ_R) {
+        // Quick reboot
+        #if HAS_CONSOLE
+          if (rtc_get_reset_reason(0) == POWERON_RESET) {
+            console_active = true;
+          }
+        #endif
+      } else {
+        // Unknown boot
+      }
+      LoRa.setFrequency(M_FRQ_S);
     } else {
-      // Unknown boot
+      sx1276_installed = false;
     }
-    LoRa.setFrequency(M_FRQ_S);
-  } else {
-    sx1276_installed = false;
-  }
+  #else
+    // Older variants only came with SX1276/78 chips,
+    // so assume that to be the case for now.
+    sx1276_installed = true;
+  #endif
 
   #if HAS_DISPLAY
     disp_ready = display_init();