From c860493e68112d83f5c3707bd4bc4401d8d681de Mon Sep 17 00:00:00 2001 From: Steven Osborn Date: Thu, 7 Mar 2024 05:11:25 -0800 Subject: [PATCH] Add delay so GPS and Radio have time to power up (#3334) * Add delay so GPS and Radio have time to power up * reduce the delay a bit * make delay more generic / configurable * remove whitespace changes --- boards/canaryone.json | 2 +- src/main.cpp | 5 +++++ variants/canaryone/variant.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/boards/canaryone.json b/boards/canaryone.json index d8f966a475..da7c0986f4 100644 --- a/boards/canaryone.json +++ b/boards/canaryone.json @@ -7,7 +7,7 @@ "cpu": "cortex-m4", "extra_flags": "-DARDUINO_NRF52840_CANARY -DNRF52840_XXAA", "f_cpu": "64000000L", - "hwids": [["0x239A", "0x4405"]], + "hwids": [["0x239A", "0x4405"], ["0x239A", "0x009F"]], "usb_product": "CanaryOne", "mcu": "nrf52840", "variant": "canaryone", diff --git a/src/main.cpp b/src/main.cpp index 3619b0053a..80706d044f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -680,6 +680,11 @@ void setup() digitalWrite(SX126X_ANT_SW, 1); #endif +#ifdef PIN_PWR_DELAY_MS + // This may be required to give the peripherals time to power up. + delay(PIN_PWR_DELAY_MS); +#endif + #ifdef ARCH_PORTDUINO if (settingsMap[use_sx1262]) { if (!rIf) { diff --git a/variants/canaryone/variant.h b/variants/canaryone/variant.h index e31ba3c58f..21aa921cec 100644 --- a/variants/canaryone/variant.h +++ b/variants/canaryone/variant.h @@ -103,6 +103,9 @@ static const uint8_t A0 = PIN_A0; #define EXTERNAL_FLASH_DEVICES MX25R1635F #define EXTERNAL_FLASH_USE_QSPI +// Add a delay on startup to allow LoRa and GPS to power up +#define PIN_PWR_DELAY_MS 100 + /* * Lora radio */