Wiring.c with Bootloader Button combo support

I wrote a modified version of wiring.c

By adding this wiring.c file to your sketch folder or by putting it in into the Arduboy(2)\src folder, a special feature will be added to your sketch:

By pressing the UP + DOWN buttons (and no other buttons) for approxemately 1.5 seconds will exit the sketch and enter the FX Loader menu (bootloader mode)

Techy details:
interrupt service routine for timer0 is rewritten in assembly and optimized.
consumes 8 bytes of extra PROGMEM
frees 3 bytes of ram (1 byte extra ram used. But ISR uses 4 less stack pushes)

So, for games that use literally every last byte of PROGMEM. (I think, Arduventure? And a couple others?) are there any options?

Shit, also, this will probably break sound/music or if they are using delay?

The compiler and Arduboy2 library have been optimized since. (Arduventure takes 95% of PROGMEM) Shouldn’t be a problem.
But If there is then I’ve got another wiring.c up my sleeve with more optimisations as used in my homemade package (but some may concider it as unsafe)

No it doesn’t.

I’d suggest making the hold time longer; say at least 5 seconds. There could be sketches that use UP + DOWN for some action. Even if the required press or hold time for that combination in the sketch is shorter than 1.5 seconds, you wouldn’t want someone who held for a bit too long to have their current game ruined.

For instance, my ArduboyLife sketch uses UP + DOWN to toggle sound on and off. The status info, which includes whether sound is on or off, is only displayed while the buttons are held, so even though only a short press is required, you tend to hold them longer to read what’s displayed.

AFAIK there are no games that require Pressing UP+DOWN for that long and 1.5 seconds feels like ages while pressing the buttons down for that long.

As for ArduboyLife when toggling sound you press the buttons briefly there is no need hold the buttons down for that long (you actually need to press one of the up/down buttons first before you press the other one) and you don’t need to press UP+DOWN to show status info. Pressing a single button is enough.

Something else you might want to consider (which, in retrospect, I didn’t for ArduboyLife) is that with homemade systems that use a true single piece D-pad instead of individual buttons, it will be impossible to press both (and only) UP + DOWN at the same time.

Homemade Arduboy’s can be easily equiped with a reset button.

Real Arduboys can be easily reset with the power switch.

I’ve tried holding both up and down buttons at the same time and it’s almost impossible to do as an accident it’s only going to be an issue of a game actually uses that and I can’t see that there really is one except some very strange edge cases.

Ie, probably only your life sketch I’m sorry.

We will go through a beta test to see what people’s feedback is.

The dark side is a pathway to powers some might consider to be… Unnatural