mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-10-09 03:06:39 +00:00
feat(ui-lvgl): power saving, review fixes, shared helpers
Power: the UI loop sleeps until something is due (never with packets queued); screen off puts the CPU at 80 MHz, the GT911 to sleep (unless a tap wakes the screen) and the LP5814 in standby. GPS off now cuts the L76K's rail and UART on the L2 (L2GpsProvider). The battery divider is powered only for a reading (measured: settles at once); readings within 2 s are reused. The SD mount is retried at most every 5 s. Fixes: WiFi left on after leaving a scan, live tiles' WiFi kept with the screen off on the map, an ADC read every second for the status bar, touch polled on every pass while dark, a scan cutting an update's WiFi, relay count not refreshing in a channel thread, raw @[nick] in room previews. Labels skip unchanged text (no redraw). Helpers: scrollList, dimOverlay, settingRow, flexBox, nvs::get/put, trailFilePath (a second save in the same minute no longer overwrites), unreadTotal. Dead code removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
ESP32RTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
MicroNMEALocationProvider gps(Serial1, &rtc_clock);
|
||||
L2GpsProvider gps(Serial1, &rtc_clock);
|
||||
EnvironmentSensorManager sensors(gps);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
@@ -22,6 +22,28 @@ EnvironmentSensorManager sensors(gps);
|
||||
void buzzerAmpPower(bool on) { board.setSpeakerAmp(on); }
|
||||
#endif
|
||||
|
||||
void L2GpsProvider::begin() {
|
||||
board.setGnssPower(true); // with the power-up reset
|
||||
if (_uart_off) { // back from stop(): the UART again
|
||||
Serial1.setRxBufferSize(1024);
|
||||
Serial1.begin(GPS_BAUD_RATE, SERIAL_8N1, PIN_GPS_TX, PIN_GPS_RX);
|
||||
_uart_off = false;
|
||||
}
|
||||
MicroNMEALocationProvider::begin();
|
||||
}
|
||||
|
||||
void L2GpsProvider::stop() {
|
||||
MicroNMEALocationProvider::stop();
|
||||
// The UART's TX idling high would feed the unpowered module through its pin.
|
||||
Serial1.end();
|
||||
pinMode(PIN_GPS_RX, INPUT); // PIN_GPS_RX: the module's RX, our TX
|
||||
_uart_off = true;
|
||||
board.setGnssPower(false);
|
||||
}
|
||||
|
||||
void L2GpsProvider::reset() { board.gnssReset(); }
|
||||
bool L2GpsProvider::isEnabled() { return board.gnssPowered(); }
|
||||
|
||||
bool radio_init() {
|
||||
MESH_DEBUG_PRINTLN("radio_init: rtc + sx1262 init");
|
||||
fallback_clock.begin();
|
||||
|
||||
Reference in New Issue
Block a user