Space out periodic broadcasts of modules automatically (#5931)

* Space out periodic broadcasts of modules automatically

* Add warning for function usage

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
GUVWAF
2025-01-26 20:59:59 +01:00
committed by GitHub
parent 10d553087c
commit 4747e73f37
10 changed files with 37 additions and 16 deletions

View File

@@ -107,8 +107,6 @@ int32_t EnvironmentTelemetryModule::runOnce()
if (moduleConfig.telemetry.environment_measurement_enabled) {
LOG_INFO("Environment Telemetry: init");
// it's possible to have this module enabled, only for displaying values on the screen.
// therefore, we should only enable the sensor loop if measurement is also enabled
#ifdef SENSECAP_INDICATOR
result = indicatorSensor.runOnce();
#endif
@@ -171,7 +169,9 @@ int32_t EnvironmentTelemetryModule::runOnce()
#endif
#endif
}
return result;
// it's possible to have this module enabled, only for displaying values on the screen.
// therefore, we should only enable the sensor loop if measurement is also enabled
return result == UINT32_MAX ? disable() : setStartDelay();
} else {
// if we somehow got to a second run of this module with measurement disabled, then just wait forever
if (!moduleConfig.telemetry.environment_measurement_enabled) {