Merge pull request #2173 from meshtastic/triple-double

Double click sends ad-hoc position, triple turns off gps
This commit is contained in:
Thomas Göttgens 2023-01-19 08:20:53 +01:00 committed by GitHub
commit 111ec56028
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,8 +115,7 @@ class ButtonThread : public concurrency::OSThread
{ {
// LOG_DEBUG("press!\n"); // LOG_DEBUG("press!\n");
#ifdef BUTTON_PIN #ifdef BUTTON_PIN
if ((BUTTON_PIN != moduleConfig.canned_message.inputbroker_pin_press) || if ((BUTTON_PIN != moduleConfig.canned_message.inputbroker_pin_press) || !moduleConfig.canned_message.enabled) {
!moduleConfig.canned_message.enabled) {
powerFSM.trigger(EVENT_PRESS); powerFSM.trigger(EVENT_PRESS);
} }
#endif #endif
@ -163,13 +162,17 @@ class ButtonThread : public concurrency::OSThread
#if defined(USE_EINK) && defined(PIN_EINK_EN) #if defined(USE_EINK) && defined(PIN_EINK_EN)
digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW); digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW);
#endif #endif
#if defined(GPS_POWER_TOGGLE) screen->print("Sent ad-hoc ping\n");
if(config.position.gps_enabled) service.refreshMyNodeInfo();
{ service.sendNetworkPing(NODENUM_BROADCAST, true);
LOG_DEBUG("Flag set to false for gps power\n");
} }
else
static void userButtonMultiPressed()
{ {
#if defined(GPS_POWER_TOGGLE)
if (config.position.gps_enabled) {
LOG_DEBUG("Flag set to false for gps power\n");
} else {
LOG_DEBUG("Flag set to true to restore power\n"); LOG_DEBUG("Flag set to true to restore power\n");
} }
config.position.gps_enabled = !(config.position.gps_enabled); config.position.gps_enabled = !(config.position.gps_enabled);
@ -177,13 +180,6 @@ class ButtonThread : public concurrency::OSThread
#endif #endif
} }
static void userButtonMultiPressed()
{
screen->print("Sent ad-hoc ping\n");
service.refreshMyNodeInfo();
service.sendNetworkPing(NODENUM_BROADCAST, true);
}
static void userButtonPressedLongStart() static void userButtonPressedLongStart()
{ {
if (millis() > 30 * 1000) { if (millis() > 30 * 1000) {