Could the OS have trouble with similar events such as:
case EVENTID(BUTTON_MODE_SELECT, FIRST_HELD_LONG, MODE_ON | BUTTON_FIRE):
and the inverse
case EVENTID(BUTTON_FIRE, FIRST_HELD_LONG, MODE_ON | BUTTON_MODE_SELECT):
like getting confused or swapped up along the way to the 2nd button reaching a “HELD_LONG”?
What’s happening:
I have another “swapped behavior” issue in my lap where these buttons in this blaster are “working” 100% as far as physical contact closure and wiring, but behaving swapped in operation… sort of. Only when trying to do these combos above.
Normal single clicks, helds, even held and Clash all work fine.
Combos that also work fine are “HOLD one then single Click the other” (either way, both work.)
It seems to just be the HOLD then HOLD that’s problematic.
I don’t have any events that “hold then hold” in my saber prop, so this is the first time I’ve stumbled upon this happening.
I can confirm that entering the combo “mods” button commands in Serial Monitor like mode fire m1
do indeed execute the expected things, just the actual buttons do not.
Longer version with examples:
// holding MODE then holding FIRE is supposed to toggle ON/OFF. But instead it does destruct
case EVENTID(BUTTON_FIRE, EVENT_FIRST_HELD_LONG, MODE_OFF | BUTTON_MODE_SELECT):
if (!hybrid_font.PlayPolyphonic(&SFX_out)) {
beeper.Beep(0.1, 1300);
}
On();
return true;
case EVENTID(BUTTON_FIRE, EVENT_FIRST_HELD_LONG, MODE_ON | BUTTON_MODE_SELECT):
if (!hybrid_font.PlayPolyphonic(&SFX_in)) {
beeper.Beep(0.1, 300);
}
Off();
return true;
// holding FIRE then holding MODE is suppopsed to do destruct, but is doing ON/OFF
case EVENTID(BUTTON_MODE_SELECT, EVENT_FIRST_HELD_LONG, MODE_ON | BUTTON_FIRE):
selfDestruct();
return true;
This log is starting from “On” state, just trying to power Off. I get destruct instead (which is supposed to be the inverse, Hold FIRE , then Hold MODE)
23:37:26.811 -> EVENT: MODE-Pressed#1 ON millis=49275
23:37:26.811 -> EVENT: MODE-Pressed ON millis=49275
23:37:27.103 -> EVENT: MODE-Held#1 ON millis=49576
23:37:27.103 -> EVENT: MODE-Held ON millis=49576
23:37:27.179 -> EVENT: FIRE-Pressed#1 mods MODE ON millis=49646
23:37:27.179 -> EVENT: FIRE-Pressed mods MODE ON millis=49646
23:37:27.468 -> EVENT: FIRE-Held#1 mods FIREMODE ON millis=49947
23:37:27.468 -> EVENT: FIRE-Held mods FIREMODE ON millis=49947
23:37:27.610 -> EVENT: MODE-HeldMedium#1 mods FIREMODE ON millis=50076
23:37:27.610 -> EVENT: MODE-HeldMedium mods FIREMODE ON millis=50076
23:37:27.978 -> EVENT: FIRE-HeldMedium#1 mods FIREMODE ON millis=50447
23:37:27.978 -> EVENT: FIRE-HeldMedium mods FIREMODE ON millis=50447
23:37:28.828 -> EVENT: MODE-HeldLong#1 mods FIREMODE ON millis=51276
23:37:28.828 -> unit = 0 vol = 0.50, Playing commonB/destruct/0001.wav
23:37:28.828 -> channels: 1 rate: 44100 bits: 16
23:37:30.370 -> EVENT: FIRE-Released#1 ON millis=52820
23:37:30.370 -> EVENT: FIRE-Released ON millis=52820
23:37:30.370 -> EVENT: MODE-Released#1 ON millis=52841
23:37:30.370 -> EVENT: MODE-Released ON millis=52841
23:37:37.555 -> Battery voltage: 4.20
23:37:38.830 -> unit = 2 vol = 0.50, Playing commonB/boom.wav
23:37:38.830 -> channels: 1 rate: 44100 bits: 16
23:37:38.830 -> No sounds found: blaster
23:37:38.830 -> unit = 0 vol = 0.04, No sounds found: hum
23:37:38.830 -> Audio underflows: 1
23:37:42.007 -> Amplifier off.
Ok, well now the blaster is Off all right, but it’s blown to smithereens.
Anyway, from that state, doing the same exact combo does actually turn it on:
23:37:46.168 -> EVENT: MODE-Pressed#1 millis=68618
23:37:46.168 -> EVENT: MODE-Pressed millis=68618
23:37:46.383 -> EVENT: FIRE-Pressed#1 mods MODE millis=68857
23:37:46.383 -> EVENT: FIRE-Pressed mods MODE millis=68857
23:37:46.458 -> EVENT: MODE-Held#1 mods FIREMODE millis=68919
23:37:46.458 -> EVENT: MODE-Held mods FIREMODE millis=68919
23:37:46.713 -> EVENT: FIRE-Held#1 mods FIREMODE millis=69158
23:37:46.713 -> EVENT: FIRE-Held mods FIREMODE millis=69158
23:37:46.957 -> EVENT: MODE-HeldMedium#1 mods FIREMODE millis=69419
23:37:46.957 -> EVENT: MODE-HeldMedium mods FIREMODE millis=69419
23:37:47.215 -> EVENT: FIRE-HeldMedium#1 mods FIREMODE millis=69658
23:37:47.215 -> EVENT: FIRE-HeldMedium mods FIREMODE millis=69658
23:37:48.150 -> EVENT: MODE-HeldLong#1 mods FIREMODE millis=70619
23:37:48.150 -> EVENT: MODE-HeldLong mods FIREMODE millis=70619
23:37:48.408 -> EVENT: FIRE-HeldLong#1 mods FIREMODE millis=70858
23:37:48.408 -> unit = 0 vol = 0.50, Playing commonB/out.wav
23:37:48.408 -> channels: 1 rate: 44100 bits: 16
23:37:48.408 -> Ignition.
23:37:48.408 -> No sounds found: hum
23:37:48.408 -> unit = 1 vol = 0.00, MAKING out killable.
23:37:48.408 -> unit = 2 vol = 0.50, Playing commonB/out.wav
23:37:48.408 -> No sounds found: hum
23:37:48.442 -> channels: 1 rate: 44100 bits: 16
23:37:48.442 -> HumDelay: 200
23:37:48.811 -> EVENT: FIRE-Released#1 ON millis=71285
23:37:48.811 -> EVENT: FIRE-Released ON millis=71285
23:37:48.849 -> EVENT: MODE-Released#1 ON millis=71322
23:37:48.849 -> EVENT: MODE-Released ON millis=71322
23:37:49.350 -> Amplifier off.
side note for later - why are out and in.wavs playing twice?
Ok now it’s ON, so to confirm. I repeated: Hold MODE, then Hold FIRE. It did Destruct again.
So now it’s Off again, so I decided from the Off state to try the opposite (the actual destruct combo, Hold FIRE, then Hold MODE) and lo and behold the blaster powered on?!
23:44:38.856 -> EVENT: FIRE-Pressed#1 millis=481292
23:44:38.856 -> EVENT: FIRE-Pressed millis=481292
23:44:39.144 -> EVENT: MODE-Pressed#1 mods FIRE millis=481588
23:44:39.144 -> EVENT: MODE-Pressed mods FIRE millis=481588
23:44:39.144 -> EVENT: FIRE-Held#1 mods FIREMODE millis=481593
23:44:39.144 -> EVENT: FIRE-Held mods FIREMODE millis=481593
23:44:39.426 -> EVENT: MODE-Held#1 mods FIREMODE millis=481889
23:44:39.426 -> EVENT: MODE-Held mods FIREMODE millis=481889
23:44:39.639 -> EVENT: FIRE-HeldMedium#1 mods FIREMODE millis=482093
23:44:39.639 -> EVENT: FIRE-HeldMedium mods FIREMODE millis=482093
23:44:39.932 -> EVENT: MODE-HeldMedium#1 mods FIREMODE millis=482389
23:44:39.932 -> EVENT: MODE-HeldMedium mods FIREMODE millis=482389
23:44:40.850 -> EVENT: FIRE-HeldLong#1 mods FIREMODE millis=483293
23:44:40.850 -> unit = 0 vol = 0.50, Playing commonB/out.wav
23:44:40.850 -> channels: 1 rate: 44100 bits: 16
23:44:40.850 -> Ignition.
23:44:40.850 -> No sounds found: hum
23:44:40.850 -> unit = 1 vol = 0.00, unit = 2 vol = 0.50, Playing commonB/out.wav
23:44:40.850 -> No sounds found: hum
23:44:40.887 -> channels: 1 rate: 44100 bits: 16
23:44:40.887 -> HumDelay: 200
23:44:41.286 -> EVENT: MODE-Released#1 ON millis=483754
23:44:41.286 -> EVENT: MODE-Released ON millis=483754
23:44:41.286 -> EVENT: FIRE-Released#1 ON millis=483757
23:44:41.324 -> EVENT: FIRE-Released ON millis=483757
23:44:41.794 -> Amplifier off.
Last test was to intentionally again do the destruct combo now that it’s On and guess what. It powered Off.
Summary: HELD and HELD mod button combos seem to get swapped. Is it me?