From f484dea75f2ab42a138e9d9a36352ba5bf8240dc Mon Sep 17 00:00:00 2001 From: Stephen White Date: Sun, 1 Jul 2018 04:00:47 +1000 Subject: [PATCH] Debounce reset --- src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 612d2c9..d8cc764 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -761,6 +761,7 @@ void emulator() // const int headSoundFreq = 833; // 1200Hz = 1/1200 * 10^6; const int headSoundFreq = 1000000 / options.SoundOnGPIOFreq(); // 1200Hz = 1/1200 * 10^6; unsigned char oldHeadDir; + int resetCount = 0; unsigned numberOfImages = diskCaddy.GetNumberOfImages(); unsigned numberOfImagesMax = numberOfImages; @@ -898,7 +899,12 @@ void emulator() } bool reset = IEC_Bus::IsReset(); - if (!emulating || reset || exitEmulation) + if (reset) + resetCount++; + else + resetCount = 0; + + if (!emulating || (resetCount > 10) || exitEmulation) { // Clearing the caddy now // - will write back all changed/dirty/written to disk images now