In the course of tidying up my prop file, I’ve come across a blip that I’m struggling to solve…
I have a chunk of code that removes all the save files from the SD card (restore factory defaults as it were). The system is set to play a reset.wav file and then reboot itself, but obviously I need to make provision for systems with no reset.wav file on the SD card.
My button press is four presses of POWER then hold the button down on the last press.
If a reset file is present, this works fine because as the reset sound plays, you naturally release the button while it’s playing, and the system just does its thing. But if there’s no reset sound on the SD card and it goes straight to rebooting, you end up releasing the button partway through the boot sound, which confuses the system because it receives a button release when it isn’t expecting one, which in turn cuts the boot sound off and lights the blade, which is kinda clunky.
I’ve tried the obvious which is adding a delay after the STM32.reset
command, but it just got ignored, which suggests to me that anything coded after the STM32.reset
will also get ignored.
Any suggestions for what I could try to fix this?
Here’s the code:
LOCK_SD(false);
if (SFX_reset) { // Optional confirmation sound file 'reset'.
hybrid_font.PlayCommon(&SFX_reset);
while (IsResetSoundPlaying()); // Lock system while sound finishes...
}
STM32.reset(); // ...then reboot saber.
break;
}