I would like to modify detonator.h for my personal use.
-
Is there a reason for detonator.h to use
BUTTON_POWER
&BUTTON_AUX2
instead ofBUTTON_POWER
&BUTTON_AUX
? -
I am trying to change the latching power button to non-latching power button:
- One click on & armed
- Next click off & disarmed
case EVENTID(BUTTON_POWER, EVENT_FIRST_CLICK_SHORT, MODE_OFF):
armed_ = false;
SetPower(true);
On();
return true;
case EVENTID(BUTTON_POWER, EVENT_FIRST_CLICK_SHORT, MODE_ON):
SetPower(false);
Off();
return true;
instead of:
switch (EVENTID(button, event, modifiers)) {
case EVENTID(BUTTON_POWER, EVENT_LATCH_ON, MODE_OFF):
armed_ = false;
SetPower(true);
On();
return true;
case EVENTID(BUTTON_POWER, EVENT_LATCH_OFF, MODE_ON):
case EVENTID(BUTTON_POWER, EVENT_LATCH_OFF, MODE_OFF):
SetPower(false);
Off();
return true;
Will this work ?
case EVENTID(BUTTON_AUX2, EVENT_PRESSED, MODE_ON):
beginArm();
break;
case EVENTID(BUTTON_AUX2, EVENT_RELEASED, MODE_ON):
blast();
return armed_;
When I press and keep pressing AUX2, I get the sound for bgnarm followed by the sound for armhum looping for as long as AUX2 is pressed (so far so good, but it doesn’t matter how long I keep it pressed, armhum just keeps on going. Isn’t it supposed to be on a timer and if timer expires, “boom”? How long is the time delay?
But then when I release AUX2, I get the sound for endarm followed by boom. Shouldn’t this be endarm OR boom ?
Thanks for any help understanding.
Cheers