NoSloppy

Untitled

Feb 25th, 2021
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1.  
  2. case EVENTID(BUTTON_POWER, EVENT_THIRD_SAVED_CLICK_SHORT, MODE_OFF):
  3. // accurate battery level reading every time // BC Added this because....somewhere said it was good?
  4. srand((rand() * 917823) ^ analogRead(batteryLevelPin));
  5. // needs this delay
  6. delay (500);
  7. ::CommandParser::DoParse("play", "battlevel.wav"); // BC Custom spoken Battery Level
  8. talkie.Say(spPAUSE1);
  9. talkie.Say(spPAUSE1);
  10. talkie.Say(spPAUSE1);
  11. talkie.Say(spPAUSE1);
  12. talkie.Say(spPAUSE1);
  13. talkie.Say(spPAUSE1);
  14. talkie.Say(spPAUSE1);
  15. talkie.Say(spPAUSE1);
  16. talkie.Say(spPAUSE1);
  17. talkie.SayDigit((int)floorf(battery_monitor.battery()));
  18. delay (2350);
  19. ::CommandParser::DoParse("play", "point.wav");
  20. talkie.Say(spPAUSE1);
  21. talkie.Say(spPAUSE1);
  22. talkie.SayDigit(((int)floorf(battery_monitor.battery() * 10)) % 10);
  23. talkie.SayDigit(((int)floorf(battery_monitor.battery() * 100)) % 10);
  24. delay (1400);
  25. ::CommandParser::DoParse("play", "volts.wav");
  26. return true;
  27.  
  28. // ----------------------- Vol menu section --------------------
  29.  
  30. void ChangeVolume(bool up) {
  31. if (up) {
  32. STDOUT.println("Volume up");
  33. if (dynamic_mixer.get_volume() < VOLUME) {
  34. dynamic_mixer.set_volume(std::min<int>(VOLUME + VOLUME * 0.1,
  35. dynamic_mixer.get_volume() + VOLUME * 0.10));
  36. //beeper.Beep(0.5, 2000); // BC Custom Spoken Volume menu
  37. ::CommandParser::DoParse("play", "volchangeup.wav"); // BC Custom Spoken Volume menu
  38. STDOUT.print("Current Volume: ");
  39. STDOUT.println(dynamic_mixer.get_volume());
  40. }
  41. else {
  42. //beeper.Beep(0.5, 3000); // BC Custom Spoken Volume menu
  43. ::CommandParser::DoParse("play", "volmax.wav"); // BC Custom Spoken Volume menu
  44. }
  45. } else {
  46. STDOUT.println("Volume Down");
  47. if (dynamic_mixer.get_volume() > (0.10 * VOLUME)) {
  48. dynamic_mixer.set_volume(std::max<int>(VOLUME * 0.1,
  49. dynamic_mixer.get_volume() - VOLUME * 0.10));
  50. //beeper.Beep(0.5, 2000); // BC Custom Spoken Volume menu
  51. ::CommandParser::DoParse("play", "volchangedown.wav");// BC Custom Spoken Volume menu
  52. STDOUT.print("Current Volume: ");
  53. STDOUT.println(dynamic_mixer.get_volume());
  54. }
  55. else{
  56. //beeper.Beep(0.5, 1000); // BC Custom Spoken Volume menu
  57. ::CommandParser::DoParse("play", "volmin.wav"); // BC Custom Spoken Volume menu
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment