@@ -348,9 +348,7 @@ class HomeScreen : public UIScreen {
348348 return true ;
349349 }
350350 if (c == KEY_ENTER && _page == HomePage::ADVERT) {
351- #ifdef PIN_BUZZER
352- _task->soundBuzzer (UIEventType::ack);
353- #endif
351+ _task->notify (UIEventType::ack);
354352 if (the_mesh.advert ()) {
355353 _task->showAlert (" Advert sent!" , 1000 );
356354 } else {
@@ -501,9 +499,9 @@ void UITask::showAlert(const char* text, int duration_millis) {
501499 _alert_expiry = millis () + duration_millis;
502500}
503501
504- void UITask::soundBuzzer (UIEventType bet ) {
502+ void UITask::notify (UIEventType t ) {
505503#if defined(PIN_BUZZER)
506- switch (bet ){
504+ switch (t ){
507505 case UIEventType::contactMessage:
508506 // gemini's pick
509507 buzzer.play (" MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7" );
@@ -521,13 +519,15 @@ switch(bet){
521519 break ;
522520}
523521#endif
524- }
525522
526523#ifdef PIN_VIBRATION
527- void UITask::triggerVibration () {
528- vibration.trigger ();
529- }
524+ // Trigger vibration for all UI events except none
525+ if (t != UIEventType::none) {
526+ vibration.trigger ();
527+ }
530528#endif
529+ }
530+
531531
532532void UITask::msgRead (int msgcount) {
533533 _msgcount = msgcount;
@@ -542,9 +542,6 @@ void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, i
542542 ((MsgPreviewScreen *) msg_preview)->addPreview (path_len, from_name, text);
543543 setCurrScreen (msg_preview);
544544
545- #ifdef PIN_VIBRATION
546- triggerVibration ();
547- #endif
548545
549546 if (_display != NULL ) {
550547 if (!_display->isOn ()) _display->turnOn ();
@@ -773,11 +770,11 @@ void UITask::toggleGPS() {
773770 if (strcmp (_sensors->getSettingName (i), " gps" ) == 0 ) {
774771 if (strcmp (_sensors->getSettingValue (i), " 1" ) == 0 ) {
775772 _sensors->setSettingValue (" gps" , " 0" );
776- soundBuzzer (UIEventType::ack);
773+ notify (UIEventType::ack);
777774 showAlert (" GPS: Disabled" , 800 );
778775 } else {
779776 _sensors->setSettingValue (" gps" , " 1" );
780- soundBuzzer (UIEventType::ack);
777+ notify (UIEventType::ack);
781778 showAlert (" GPS: Enabled" , 800 );
782779 }
783780 _next_refresh = 0 ;
@@ -792,7 +789,7 @@ void UITask::toggleBuzzer() {
792789 #ifdef PIN_BUZZER
793790 if (buzzer.isQuiet ()) {
794791 buzzer.quiet (false );
795- soundBuzzer (UIEventType::ack);
792+ notify (UIEventType::ack);
796793 showAlert (" Buzzer: ON" , 800 );
797794 } else {
798795 buzzer.quiet (true );
0 commit comments