Reduce sender power draw (RX windows + CPU/WiFi/ADC/pins)
- Add LoRa idle/sleep/receive-window helpers and use short RX windows for ACK/time sync - Schedule sender time-sync windows (fast/slow) and track RX vs sleep time in debug - Lower sender power (80 MHz CPU, WiFi/BT off, reduced ADC sampling, unused pins pulldown) - Make SERIAL_DEBUG_MODE a build flag, add prod envs with debug off, and document changes
This commit is contained in:
@@ -60,6 +60,9 @@ constexpr uint32_t SENDER_WAKE_INTERVAL_SEC = 30;
|
||||
constexpr uint32_t TIME_SYNC_INTERVAL_SEC = 60;
|
||||
constexpr uint32_t TIME_SYNC_SLOW_INTERVAL_SEC = 3600;
|
||||
constexpr uint32_t TIME_SYNC_FAST_WINDOW_MS = 10UL * 60UL * 1000UL;
|
||||
constexpr uint32_t SENDER_TIMESYNC_WINDOW_MS = 300;
|
||||
constexpr uint32_t SENDER_TIMESYNC_CHECK_SEC_FAST = 60;
|
||||
constexpr uint32_t SENDER_TIMESYNC_CHECK_SEC_SLOW = 3600;
|
||||
constexpr bool ENABLE_DS3231 = true;
|
||||
constexpr uint32_t OLED_PAGE_INTERVAL_MS = 4000;
|
||||
constexpr uint32_t OLED_AUTO_OFF_MS = 10UL * 60UL * 1000UL;
|
||||
@@ -73,7 +76,10 @@ constexpr uint8_t BATCH_QUEUE_DEPTH = 10;
|
||||
constexpr BatchRetryPolicy BATCH_RETRY_POLICY = BatchRetryPolicy::Keep;
|
||||
constexpr uint32_t WATCHDOG_TIMEOUT_SEC = 120;
|
||||
constexpr bool ENABLE_HA_DISCOVERY = true;
|
||||
constexpr bool SERIAL_DEBUG_MODE = true;
|
||||
#ifndef SERIAL_DEBUG_MODE_FLAG
|
||||
#define SERIAL_DEBUG_MODE_FLAG 0
|
||||
#endif
|
||||
constexpr bool SERIAL_DEBUG_MODE = SERIAL_DEBUG_MODE_FLAG != 0;
|
||||
constexpr bool SERIAL_DEBUG_DUMP_JSON = false;
|
||||
constexpr bool LORA_SEND_BYPASS = false;
|
||||
constexpr bool ENABLE_SD_LOGGING = true;
|
||||
|
||||
@@ -19,5 +19,7 @@ struct LoraPacket {
|
||||
void lora_init();
|
||||
bool lora_send(const LoraPacket &pkt);
|
||||
bool lora_receive(LoraPacket &pkt, uint32_t timeout_ms);
|
||||
void lora_idle();
|
||||
void lora_sleep();
|
||||
bool lora_receive_window(LoraPacket &pkt, uint32_t timeout_ms);
|
||||
uint32_t lora_airtime_ms(size_t packet_len);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
void power_sender_init();
|
||||
void power_receiver_init();
|
||||
void power_configure_unused_pins_sender();
|
||||
void read_battery(MeterData &data);
|
||||
uint8_t battery_percent_from_voltage(float voltage_v);
|
||||
void light_sleep_ms(uint32_t ms);
|
||||
|
||||
Reference in New Issue
Block a user