Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced delay() with light sleep for ESP32 #99

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions BresserWeatherSensorLWCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
//
// 20240723 Extracted from BresserWeatherSensorLW.ino
// 20240729 Added PowerFeather specific status information
// 20240818 Replaced delay() with light sleep for ESP32
//
// ToDo:
// -
Expand Down Expand Up @@ -300,7 +301,12 @@ void sendCfgUplink(uint8_t uplinkReq, uint32_t uplinkInterval)
uint32_t delayMs = max(interval, minimumDelay); // cannot send faster than duty cycle allows

log_d("Sending configuration uplink in %u s", delayMs / 1000);
#if defined(ESP32)
esp_sleep_enable_timer_wakeup(delayMs * 1000);
esp_light_sleep_start();
#else
delay(delayMs);
#endif
log_d("Sending configuration uplink now.");
int16_t state = node.sendReceive(uplinkPayload, encoder.getLength(), port);
debug((state != RADIOLIB_LORAWAN_NO_DOWNLINK) && (state != RADIOLIB_ERR_NONE), "Error in sendReceive", state, false);
Expand Down
Loading