|
|
|
@ -34,8 +34,9 @@ static const uint8_t meshcore_logo [] PROGMEM = { |
|
|
|
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8, |
|
|
|
}; |
|
|
|
|
|
|
|
void UITask::begin(DisplayDriver* display, NodePrefs* node_prefs) { |
|
|
|
void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs) { |
|
|
|
_display = display; |
|
|
|
_sensors = sensors; |
|
|
|
_auto_off = millis() + AUTO_OFF_MILLIS; |
|
|
|
clearMsgPreview(); |
|
|
|
_node_prefs = node_prefs; |
|
|
|
@ -67,6 +68,7 @@ void UITask::begin(DisplayDriver* display, NodePrefs* node_prefs) { |
|
|
|
_userButton->onShortPress([this]() { handleButtonShortPress(); }); |
|
|
|
_userButton->onDoublePress([this]() { handleButtonDoublePress(); }); |
|
|
|
_userButton->onTriplePress([this]() { handleButtonTriplePress(); }); |
|
|
|
_userButton->onQuadruplePress([this]() { handleButtonQuadruplePress(); }); |
|
|
|
_userButton->onLongPress([this]() { handleButtonLongPress(); }); |
|
|
|
_userButton->onAnyPress([this]() { handleButtonAnyPress(); }); |
|
|
|
#endif |
|
|
|
@ -396,6 +398,25 @@ void UITask::handleButtonTriplePress() { |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
void UITask::handleButtonQuadruplePress() { |
|
|
|
MESH_DEBUG_PRINTLN("UITask: quad press triggered"); |
|
|
|
if (_sensors != NULL) { |
|
|
|
// toggle GPS onn/off
|
|
|
|
int num = _sensors->getNumSettings(); |
|
|
|
for (int i = 0; i < num; i++) { |
|
|
|
if (strcmp(_sensors->getSettingName(i), "gps") == 0) { |
|
|
|
if (strcmp(_sensors->getSettingValue(i), "1") == 0) { |
|
|
|
_sensors->setSettingValue("gps", "0"); |
|
|
|
} else { |
|
|
|
_sensors->setSettingValue("gps", "1"); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
_need_refresh = true; |
|
|
|
} |
|
|
|
|
|
|
|
void UITask::handleButtonLongPress() { |
|
|
|
MESH_DEBUG_PRINTLN("UITask: long press triggered"); |
|
|
|
if (millis() - ui_started_at < 8000) { // long press in first 8 seconds since startup -> CLI/rescue
|
|
|
|
|