Fix Generic_ESPNOW_* builds on boards without a LoRa radio
Compile out code when the corresponding macro defines are missing. Failing builds: comp_radio_usb, repeatr, room_svr, terminal_chat Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bd4be350c5
commit
180c22ba79
2 files changed
+8
No files matched your search
@@ -63,11 +63,13 @@ void ESP32Board::enterDeepSleep(uint32_t secs) {
|
|||||||
radio_driver.powerOff();
|
radio_driver.powerOff();
|
||||||
|
|
||||||
// Keep LoRa inactive during deepsleep
|
// Keep LoRa inactive during deepsleep
|
||||||
|
#ifdef P_LORA_NSS
|
||||||
digitalWrite(P_LORA_NSS, HIGH);
|
digitalWrite(P_LORA_NSS, HIGH);
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6)
|
#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||||
gpio_hold_en((gpio_num_t)P_LORA_NSS);
|
gpio_hold_en((gpio_num_t)P_LORA_NSS);
|
||||||
#else
|
#else
|
||||||
rtc_gpio_hold_en((gpio_num_t)P_LORA_NSS);
|
rtc_gpio_hold_en((gpio_num_t)P_LORA_NSS);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Power off GPS if any
|
// Power off GPS if any
|
||||||
|
|||||||
@@ -69,9 +69,11 @@ public:
|
|||||||
virtual void powerOff() override;
|
virtual void powerOff() override;
|
||||||
void enterDeepSleep(uint32_t secs);
|
void enterDeepSleep(uint32_t secs);
|
||||||
|
|
||||||
|
#ifdef P_LORA_DIO_1
|
||||||
uint32_t getIRQGpio() override {
|
uint32_t getIRQGpio() override {
|
||||||
return P_LORA_DIO_1; // default for SX1262
|
return P_LORA_DIO_1; // default for SX1262
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void sleep(uint32_t secs) override {
|
void sleep(uint32_t secs) override {
|
||||||
// Skip if not allow to sleep
|
// Skip if not allow to sleep
|
||||||
@@ -82,6 +84,10 @@ public:
|
|||||||
|
|
||||||
// Set GPIO wakeup
|
// Set GPIO wakeup
|
||||||
gpio_num_t wakeupPin = (gpio_num_t)getIRQGpio();
|
gpio_num_t wakeupPin = (gpio_num_t)getIRQGpio();
|
||||||
|
if (wakeupPin == GPIO_NUM_NC) { // no radio IRQ pin to wake on
|
||||||
|
delay(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Configure timer wakeup
|
// Configure timer wakeup
|
||||||
if (secs > 0) {
|
if (secs > 0) {
|
||||||
|
|||||||
Reference in new issue
Block a user