diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index 2484ca9ba5..a556062881 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -209,5 +209,8 @@ void loop() { board.sleep(30); // Sleep. Wake up after a while or when receiving a LoRa packet } #endif + } else { + // Small delay to prevent busy loop on platforms without power saving + delay(1); } } diff --git a/variants/linux/LinuxBoard.h b/variants/linux/LinuxBoard.h index 81b481400c..9aabb09156 100644 --- a/variants/linux/LinuxBoard.h +++ b/variants/linux/LinuxBoard.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -79,6 +80,14 @@ class LinuxBoard : public mesh::MainBoard { // is a no-op, matching ESP32Board/NRF52Board/STM32Board. void attachDynamicPrefs(KeyValueStore* prefs) { } + void sleep(uint32_t secs) override { + if (secs > 0) { + ::sleep(secs); + } else { + usleep(10000); // 10ms delay to prevent busy loop + } + } + LinuxConfig config; };