fix: GPS shutdown active-level, buzzer octave-8 consistency, waypoint header read checks

- UITask::shutdown(): power GPS off using !PIN_GPS_EN_ACTIVE instead of hardcoded
  LOW, matching MicroNMEALocationProvider::stop() (still LOW on current active-high
  devices, but correct for a future active-low GPS).
- buzzer _noteFreq(): clamp octave to 8 instead of 7 so the parser's accepted range
  (4-8) is fully consumed; previously an octave-8 digit was clamped away and could
  leak into the stream as the next note's duration.
- Waypoint::readFrom(): check read() return for version/reserved/count header bytes
  so a truncated file is rejected instead of using garbage count.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekZegare4
2026-06-14 12:49:15 +02:00
parent 6c5a40a8ce
commit fcdacaa3bc
3 changed files with 9 additions and 5 deletions

View File

@@ -1523,8 +1523,12 @@ void UITask::shutdown(bool restart){
// Power off GPS before SYSTEMOFF — GPIO pins retain state in NRF52 SYSTEMOFF,
// so without this the GPS stays powered and drains the battery.
// gps_enabled is already persisted to flash; applyGpsPrefs() restores it on next boot.
// Use the same active level as MicroNMEALocationProvider::stop() (default active-high).
#ifndef PIN_GPS_EN_ACTIVE
#define PIN_GPS_EN_ACTIVE HIGH
#endif
pinMode(PIN_GPS_EN, OUTPUT);
digitalWrite(PIN_GPS_EN, LOW);
digitalWrite(PIN_GPS_EN, !PIN_GPS_EN_ACTIVE);
#endif
_board->powerOff();
}