Skip to content

Commit

Permalink
Clear pad status properly after reset
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkoPera authored May 16, 2019
1 parent b303215 commit 1a966a6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion MegaDrivePlusPlus.ino
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,15 @@ inline void setup_pad () {
interrupts (); // Enable all interrupts, probably redundant
}

/* Clear the pad button registers. This is useful because during resets the
* SELECT line is not triggered and this will keep triggering resets.
*/
void clear_pad () {
byte g_buttons_1 = 0xFF;
byte g_buttons_2 = 0xFF;
byte g_buttons_3 = 0xFF;
}

/******************************************************************************/


Expand Down Expand Up @@ -737,7 +746,7 @@ inline void handle_pad () {
if ((pad_status & RESET_COMBO) == RESET_COMBO) {
debugln (F("Reset combo detected"));
reset_console ();
pad_status = 0; // Avoid continuous reset (pad_status might keep the last value during reset!)
clear_pad (); // Avoid continuous resets
last_combo_time = millis ();
#ifdef EUR_COMBO
} else if ((pad_status & EUR_COMBO) == EUR_COMBO) {
Expand Down

0 comments on commit 1a966a6

Please sign in to comment.