Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Battery level
- #if NUM_BUTTONS == 1
- // 1 button
- case EVENTID(BUTTON_POWER, EVENT_THIRD_SAVED_CLICK_SHORT, MODE_OFF):
- #else
- // 2 and 3 button
- case EVENTID(BUTTON_AUX, EVENT_FIRST_HELD_LONG, MODE_OFF):
- #endif
- talkie.SayDigit((int)floorf(battery_monitor.battery()));
- talkie.Say(spPOINT);
- talkie.SayDigit(((int)floorf(battery_monitor.battery() * 10)) % 10);
- talkie.SayDigit(((int)floorf(battery_monitor.battery() * 100)) % 10);
- talkie.Say(spVOLTS);
- return true;
- #ifdef BLADE_DETECT_PIN
- case EVENTID(BUTTON_BLADE_DETECT, EVENT_LATCH_ON, MODE_ANY_BUTTON | MODE_ON):
- case EVENTID(BUTTON_BLADE_DETECT, EVENT_LATCH_ON, MODE_ANY_BUTTON | MODE_OFF):
- // Might need to do something cleaner, but let's try this for now.
- blade_detected_ = true;
- FindBladeAgain();
- SaberBase::DoBladeDetect(true);
- return true;
- case EVENTID(BUTTON_BLADE_DETECT, EVENT_LATCH_OFF, MODE_ANY_BUTTON | MODE_ON):
- case EVENTID(BUTTON_BLADE_DETECT, EVENT_LATCH_OFF, MODE_ANY_BUTTON | MODE_OFF):
- // Might need to do something cleaner, but let's try this for now.
- blade_detected_ = false;
- FindBladeAgain();
- SaberBase::DoBladeDetect(false);
- return true;
- #endif
- // Events that needs to be handled regardless of what other buttons
- // are pressed.
- case EVENTID(BUTTON_POWER, EVENT_RELEASED, MODE_ANY_BUTTON | MODE_ON):
- case EVENTID(BUTTON_AUX, EVENT_RELEASED, MODE_ANY_BUTTON | MODE_ON):
- case EVENTID(BUTTON_AUX2, EVENT_RELEASED, MODE_ANY_BUTTON | MODE_ON):
- if (SaberBase::Lockup()) {
- SaberBase::DoEndLockup();
- SaberBase::SetLockup(SaberBase::LOCKUP_NONE);
- return true;
- }
- }
- return false;
- }
- void SB_Effect(EffectType effect, float location) override {
- switch (effect) {
- case EFFECT_POWERSAVE:
- if (SFX_dim) {
- hybrid_font.PlayCommon(&SFX_dim);
- } else {
- beeper.Beep(0.5, 3000);
- }
- return;
- case EFFECT_BATTERY_LEVEL:
- if (SFX_battery) {
- hybrid_font.PlayCommon(&SFX_battery);
- } else {
- beeper.Beep(0.5, 3000);
- }
- return;
- case EFFECT_FAST_ON:
- if (SFX_faston) {
- hybrid_font.PlayCommon(&SFX_faston);
- }
- return;
- default: break; // avoids compiler warning
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment