Merge remote-tracking branch 'origin/develop'
This commit is contained in:
@@ -100,13 +100,28 @@ void InputBroker::processInputEventQueue()
|
|||||||
|
|
||||||
int InputBroker::handleInputEvent(const InputEvent *event)
|
int InputBroker::handleInputEvent(const InputEvent *event)
|
||||||
{
|
{
|
||||||
powerFSM.trigger(EVENT_INPUT); // todo: not every input should wake, like long hold release
|
#if HAS_SCREEN
|
||||||
|
bool screenWasOff = false;
|
||||||
|
if (screen) {
|
||||||
|
screenWasOff = !screen->isScreenOn();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
powerFSM.trigger(EVENT_INPUT);
|
||||||
|
|
||||||
if (event && event->inputEvent != INPUT_BROKER_NONE && externalNotificationModule &&
|
if (event && event->inputEvent != INPUT_BROKER_NONE && externalNotificationModule &&
|
||||||
moduleConfig.external_notification.enabled && externalNotificationModule->nagging()) {
|
moduleConfig.external_notification.enabled && externalNotificationModule->nagging()) {
|
||||||
externalNotificationModule->stopNow();
|
externalNotificationModule->stopNow();
|
||||||
|
// If this turns off a notification, don't further process the event
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAS_SCREEN
|
||||||
|
if (screen && screenWasOff) {
|
||||||
|
// If the screen was off, it is in the process of turning on, and we just drop the event
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
this->notifyObservers(event);
|
this->notifyObservers(event);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-3
@@ -53,6 +53,9 @@ static uint8_t bytes[meshtastic_MqttClientProxyMessage_size + 30]; // 12 for cha
|
|||||||
static bool isMqttServerAddressPrivate = false;
|
static bool isMqttServerAddressPrivate = false;
|
||||||
static bool isConnected = false;
|
static bool isConnected = false;
|
||||||
|
|
||||||
|
static uint32_t lastPositionUnavailableWarning = 0;
|
||||||
|
static const uint32_t POSITION_UNAVAILABLE_WARNING_INTERVAL_MS = 15000; // 15 seconds
|
||||||
|
|
||||||
inline void onReceiveProto(char *topic, byte *payload, size_t length)
|
inline void onReceiveProto(char *topic, byte *payload, size_t length)
|
||||||
{
|
{
|
||||||
const DecodedServiceEnvelope e(payload, length);
|
const DecodedServiceEnvelope e(payload, length);
|
||||||
@@ -847,12 +850,14 @@ void MQTT::perhapsReportToMap()
|
|||||||
map_position_precision = default_map_position_precision;
|
map_position_precision = default_map_position_precision;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Throttle::isWithinTimespanMs(last_report_to_map, map_publish_interval_msecs))
|
if (Throttle::isWithinTimespanMs(last_report_to_map, map_publish_interval_msecs) && last_report_to_map != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (localPosition.latitude_i == 0 && localPosition.longitude_i == 0) {
|
if (localPosition.latitude_i == 0 && localPosition.longitude_i == 0) {
|
||||||
last_report_to_map = millis();
|
if (Throttle::isWithinTimespanMs(lastPositionUnavailableWarning, POSITION_UNAVAILABLE_WARNING_INTERVAL_MS) == false) {
|
||||||
LOG_WARN("MQTT Map report enabled, but no position available");
|
LOG_WARN("MQTT Map report enabled, but no position available");
|
||||||
|
lastPositionUnavailableWarning = millis();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user