@@ -34,8 +34,9 @@ static const uint8_t meshcore_logo [] PROGMEM = {
3434 0xe3 , 0xe3 , 0x8f , 0xff , 0x1f , 0xfc , 0x3c , 0x0e , 0x1f , 0xf8 , 0xff , 0xf8 , 0x70 , 0x3c , 0x7f , 0xf8 ,
3535};
3636
37- void UITask::begin (DisplayDriver* display, NodePrefs* node_prefs) {
37+ void UITask::begin (DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs) {
3838 _display = display;
39+ _sensors = sensors;
3940 _auto_off = millis () + AUTO_OFF_MILLIS;
4041 clearMsgPreview ();
4142 _node_prefs = node_prefs;
@@ -67,6 +68,7 @@ void UITask::begin(DisplayDriver* display, NodePrefs* node_prefs) {
6768 _userButton->onShortPress ([this ]() { handleButtonShortPress (); });
6869 _userButton->onDoublePress ([this ]() { handleButtonDoublePress (); });
6970 _userButton->onTriplePress ([this ]() { handleButtonTriplePress (); });
71+ _userButton->onQuadruplePress ([this ]() { handleButtonQuadruplePress (); });
7072 _userButton->onLongPress ([this ]() { handleButtonLongPress (); });
7173 _userButton->onAnyPress ([this ]() { handleButtonAnyPress (); });
7274#endif
@@ -396,6 +398,25 @@ void UITask::handleButtonTriplePress() {
396398 #endif
397399}
398400
401+ void UITask::handleButtonQuadruplePress () {
402+ MESH_DEBUG_PRINTLN (" UITask: quad press triggered" );
403+ if (_sensors != NULL ) {
404+ // toggle GPS onn/off
405+ int num = _sensors->getNumSettings ();
406+ for (int i = 0 ; i < num; i++) {
407+ if (strcmp (_sensors->getSettingName (i), " gps" ) == 0 ) {
408+ if (strcmp (_sensors->getSettingValue (i), " 1" ) == 0 ) {
409+ _sensors->setSettingValue (" gps" , " 0" );
410+ } else {
411+ _sensors->setSettingValue (" gps" , " 1" );
412+ }
413+ break ;
414+ }
415+ }
416+ }
417+ _need_refresh = true ;
418+ }
419+
399420void UITask::handleButtonLongPress () {
400421 MESH_DEBUG_PRINTLN (" UITask: long press triggered" );
401422 if (millis () - ui_started_at < 8000 ) { // long press in first 8 seconds since startup -> CLI/rescue
0 commit comments