Boot: input grace period; persist high score + volume via NVS
- Ignore all input for ~1.2 s after power-up/reset (INPUT_GRACE_MS): the keyboard controller can emit stale bytes and pins can float, which used to start a game right after a restart. - High score + volume survive power cycles: Preferences (NVS, 'mc' namespace) loaded in setup(), saved on game over and on every volume key (U/V/M). arduino-esp32 commits NVS in end(), so savePrefs() does putUInt x2 + end() + begin() reopen. - SoundEngine::setVolume() restores a saved level (0 = stay muted, lastVol_ keeps unmute working). - Emulator: file-backed Preferences shim (mc-prefs.cfg, gitignored) so persistence is testable on the desktop.
This commit is contained in:
@@ -39,6 +39,7 @@ public:
|
||||
void volumeUp();
|
||||
void volumeDown();
|
||||
void toggleMute();
|
||||
void setVolume(uint8_t v); // restore a saved level (0 = muted)
|
||||
uint8_t volume() const { return vol_; }
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user