mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-29 22:20:37 +00:00
Merge branch 'master' into batt_stat
This commit is contained in:
@@ -406,7 +406,8 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
||||
LOG_INFO("Setting config: Device\n");
|
||||
config.has_device = true;
|
||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
if (config.device.double_tap_as_button_press == false && c.payload_variant.device.double_tap_as_button_press == true) {
|
||||
if (config.device.double_tap_as_button_press == false && c.payload_variant.device.double_tap_as_button_press == true &&
|
||||
accelerometerThread->enabled == false) {
|
||||
accelerometerThread->start();
|
||||
}
|
||||
#endif
|
||||
@@ -484,7 +485,8 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
||||
requiresReboot = false;
|
||||
}
|
||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
if (config.display.wake_on_tap_or_motion == false && c.payload_variant.display.wake_on_tap_or_motion == true) {
|
||||
if (config.display.wake_on_tap_or_motion == false && c.payload_variant.display.wake_on_tap_or_motion == true &&
|
||||
accelerometerThread->enabled == false) {
|
||||
accelerometerThread->start();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -190,17 +190,17 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
||||
|
||||
#if defined(T_WATCH_S3) || defined(RAK14014)
|
||||
if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT)) {
|
||||
this->payload = 0xb4;
|
||||
this->payload = INPUT_BROKER_MSG_LEFT;
|
||||
} else if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT)) {
|
||||
this->payload = 0xb7;
|
||||
this->payload = INPUT_BROKER_MSG_RIGHT;
|
||||
}
|
||||
#else
|
||||
// tweak for left/right events generated via trackball/touch with empty kbchar
|
||||
if (!event->kbchar) {
|
||||
if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT)) {
|
||||
this->payload = 0xb4;
|
||||
this->payload = INPUT_BROKER_MSG_LEFT;
|
||||
} else if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT)) {
|
||||
this->payload = 0xb7;
|
||||
this->payload = INPUT_BROKER_MSG_RIGHT;
|
||||
}
|
||||
} else {
|
||||
// pass the pressed key
|
||||
@@ -222,26 +222,26 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
||||
|
||||
// Run modifier key code below, (doesnt inturrupt typing or reset to start screen page)
|
||||
switch (event->kbchar) {
|
||||
case 0x11: // make screen brighter
|
||||
case INPUT_BROKER_MSG_BRIGHTNESS_UP: // make screen brighter
|
||||
if (screen)
|
||||
screen->increaseBrightness();
|
||||
LOG_DEBUG("increasing Screen Brightness\n");
|
||||
break;
|
||||
case 0x12: // make screen dimmer
|
||||
case INPUT_BROKER_MSG_BRIGHTNESS_DOWN: // make screen dimmer
|
||||
if (screen)
|
||||
screen->decreaseBrightness();
|
||||
LOG_DEBUG("Decreasing Screen Brightness\n");
|
||||
break;
|
||||
case 0xf1: // draw modifier (function) symbal
|
||||
case INPUT_BROKER_MSG_FN_SYMBOL_ON: // draw modifier (function) symbal
|
||||
if (screen)
|
||||
screen->setFunctionSymbal("Fn");
|
||||
break;
|
||||
case 0xf2: // remove modifier (function) symbal
|
||||
case INPUT_BROKER_MSG_FN_SYMBOL_OFF: // remove modifier (function) symbal
|
||||
if (screen)
|
||||
screen->removeFunctionSymbal("Fn");
|
||||
break;
|
||||
// mute (switch off/toggle) external notifications on fn+m
|
||||
case 0xac:
|
||||
case INPUT_BROKER_MSG_MUTE_TOGGLE:
|
||||
if (moduleConfig.external_notification.enabled == true) {
|
||||
if (externalNotificationModule->getMute()) {
|
||||
externalNotificationModule->setMute(false);
|
||||
@@ -257,7 +257,7 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x9e: // toggle GPS like triple press does
|
||||
case INPUT_BROKER_MSG_GPS_TOGGLE: // toggle GPS like triple press does
|
||||
#if !MESHTASTIC_EXCLUDE_GPS
|
||||
if (gps != nullptr) {
|
||||
gps->toggleGpsMode();
|
||||
@@ -267,7 +267,7 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
||||
showTemporaryMessage("GPS Toggled");
|
||||
#endif
|
||||
break;
|
||||
case 0xaf: // fn+space send network ping like double press does
|
||||
case INPUT_BROKER_MSG_SEND_PING: // fn+space send network ping like double press does
|
||||
service->refreshLocalMeshNode();
|
||||
if (service->trySendPosition(NODENUM_BROADCAST, true)) {
|
||||
showTemporaryMessage("Position \nUpdate Sent");
|
||||
@@ -283,7 +283,7 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
||||
validEvent = true;
|
||||
break;
|
||||
}
|
||||
if (screen && (event->kbchar != 0xf1)) {
|
||||
if (screen && (event->kbchar != INPUT_BROKER_MSG_FN_SYMBOL_ON)) {
|
||||
screen->removeFunctionSymbal("Fn"); // remove modifier (function) symbal
|
||||
}
|
||||
}
|
||||
@@ -505,7 +505,7 @@ int32_t CannedMessageModule::runOnce()
|
||||
}
|
||||
} else if (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT || this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) {
|
||||
switch (this->payload) {
|
||||
case 0xb4: // left
|
||||
case INPUT_BROKER_MSG_LEFT:
|
||||
if (this->destSelect == CANNED_MESSAGE_DESTINATION_TYPE_NODE) {
|
||||
size_t numMeshNodes = nodeDB->getNumMeshNodes();
|
||||
if (this->dest == NODENUM_BROADCAST) {
|
||||
@@ -540,7 +540,7 @@ int32_t CannedMessageModule::runOnce()
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0xb7: // right
|
||||
case INPUT_BROKER_MSG_RIGHT:
|
||||
if (this->destSelect == CANNED_MESSAGE_DESTINATION_TYPE_NODE) {
|
||||
size_t numMeshNodes = nodeDB->getNumMeshNodes();
|
||||
if (this->dest == NODENUM_BROADCAST) {
|
||||
@@ -602,19 +602,19 @@ int32_t CannedMessageModule::runOnce()
|
||||
this->destSelect = CANNED_MESSAGE_DESTINATION_TYPE_NODE;
|
||||
}
|
||||
break;
|
||||
case 0xb4: // left
|
||||
case 0xb7: // right
|
||||
case INPUT_BROKER_MSG_LEFT:
|
||||
case INPUT_BROKER_MSG_RIGHT:
|
||||
// already handled above
|
||||
break;
|
||||
// handle fn+s for shutdown
|
||||
case 0x9b:
|
||||
case INPUT_BROKER_MSG_SHUTDOWN:
|
||||
if (screen)
|
||||
screen->startAlert("Shutting down...");
|
||||
shutdownAtMsec = millis() + DEFAULT_SHUTDOWN_SECONDS * 1000;
|
||||
runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
||||
break;
|
||||
// and fn+r for reboot
|
||||
case 0x90:
|
||||
case INPUT_BROKER_MSG_REBOOT:
|
||||
if (screen)
|
||||
screen->startAlert("Rebooting...");
|
||||
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
|
||||
|
||||
@@ -223,4 +223,4 @@ class CannedMessageModule : public SinglePortModule, public Observable<const UIF
|
||||
};
|
||||
|
||||
extern CannedMessageModule *cannedMessageModule;
|
||||
#endif
|
||||
#endif
|
||||
@@ -146,7 +146,11 @@ bool PositionModule::hasQualityTimesource()
|
||||
{
|
||||
bool setFromPhoneOrNtpToday =
|
||||
lastSetFromPhoneNtpOrGps == 0 ? false : (millis() - lastSetFromPhoneNtpOrGps) <= (SEC_PER_DAY * 1000UL);
|
||||
#if MESHTASTIC_EXCLUDE_GPS
|
||||
bool hasGpsOrRtc = (rtc_found.address != ScanI2C::ADDRESS_NONE.address);
|
||||
#else
|
||||
bool hasGpsOrRtc = (gps && gps->isConnected()) || (rtc_found.address != ScanI2C::ADDRESS_NONE.address);
|
||||
#endif
|
||||
return hasGpsOrRtc || setFromPhoneOrNtpToday;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user