mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-21 18:22:32 +00:00
Add client notification before role based power saving (sleep) (#6759)
* Add client notification before role based power saving (sleep) * Unsigned
This commit is contained in:
@@ -370,9 +370,16 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t cha
|
|||||||
if (IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER,
|
if (IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER,
|
||||||
meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) &&
|
meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) &&
|
||||||
config.power.is_power_saving) {
|
config.power.is_power_saving) {
|
||||||
LOG_DEBUG("Start next execution in 5s, then sleep");
|
meshtastic_ClientNotification *notification = clientNotificationPool.allocZeroed();
|
||||||
|
notification->level = meshtastic_LogRecord_Level_INFO;
|
||||||
|
notification->time = getValidTime(RTCQualityFromNet);
|
||||||
|
sprintf(notification->message, "Sending position and sleeping for %us interval in a moment",
|
||||||
|
Default::getConfiguredOrDefaultMs(config.position.position_broadcast_secs, default_broadcast_interval_secs) /
|
||||||
|
1000U);
|
||||||
|
service->sendClientNotification(notification);
|
||||||
sleepOnNextExecution = true;
|
sleepOnNextExecution = true;
|
||||||
setIntervalFromNow(5000);
|
LOG_DEBUG("Start next execution in 5s, then sleep");
|
||||||
|
setIntervalFromNow(FIVE_SECONDS_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -675,9 +675,17 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
|||||||
service->sendToMesh(p, RX_SRC_LOCAL, true);
|
service->sendToMesh(p, RX_SRC_LOCAL, true);
|
||||||
|
|
||||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
|
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
|
||||||
LOG_DEBUG("Start next execution in 5s, then sleep");
|
meshtastic_ClientNotification *notification = clientNotificationPool.allocZeroed();
|
||||||
|
notification->level = meshtastic_LogRecord_Level_INFO;
|
||||||
|
notification->time = getValidTime(RTCQualityFromNet);
|
||||||
|
sprintf(notification->message, "Sending telemetry and sleeping for %us interval in a moment",
|
||||||
|
Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval,
|
||||||
|
default_telemetry_broadcast_interval_secs) /
|
||||||
|
1000U);
|
||||||
|
service->sendClientNotification(notification);
|
||||||
sleepOnNextExecution = true;
|
sleepOnNextExecution = true;
|
||||||
setIntervalFromNow(5000);
|
LOG_DEBUG("Start next execution in 5s, then sleep");
|
||||||
|
setIntervalFromNow(FIVE_SECONDS_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user