NoSloppy

multiblast-timer-v1_NG

Oct 28th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. // Blaster Deflection // BC attempt swing timer
  2. #if NUM_BUTTONS == 1
  3. // 1 button
  4. case EVENTID(BUTTON_POWER, EVENT_FIRST_SAVED_CLICK_SHORT, MODE_ON):
  5. case EVENTID(BUTTON_POWER, EVENT_SECOND_CLICK_SHORT, MODE_ON):
  6. case EVENTID(BUTTON_POWER, EVENT_THIRD_CLICK_SHORT, MODE_ON):
  7. #else
  8. // 2 and 3 button
  9. case EVENTID(BUTTON_AUX, EVENT_FIRST_SAVED_CLICK_SHORT, MODE_ON):
  10. case EVENTID(BUTTON_AUX, EVENT_SECOND_SAVED_CLICK_SHORT, MODE_ON):
  11. case EVENTID(BUTTON_AUX, EVENT_THIRD_CLICK_SHORT, MODE_ON): // single, double, or triple click all trigger blast and enter Multi-Blast mode
  12. #endif
  13. swing_blast_ = true;
  14. SaberBase::DoBlast();
  15. return true;
  16. time_t startTime; //mark the startTime
  17. do{ //time checking loop
  18. time_t currentTime; //get the current time
  19. if(currentTime - startTime >= 2){
  20. swing_blast_ = false;
  21. STDOUT.println("Exiting Multi-blast mode");
  22. break;
  23. } //if not...
  24. case EVENTID(BUTTON_NONE, EVENT_SWING, MODE_ON):
  25. if (swing_blast_) {
  26. SaberBase::DoBlast();
  27. return true;
  28. }
  29. } //stay in Multi-blast mode and check time again
  30. while (swing_blast_);
  31. return true;
Advertisement
Add Comment
Please, Sign In to add comment