mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-26 09:59:01 +00:00
Air quality specific prefs (#2303)
This commit is contained in:
parent
05b1fc83bd
commit
46fa08dc33
@ -246,6 +246,7 @@ void NodeDB::initModuleConfigIntervals()
|
|||||||
{
|
{
|
||||||
moduleConfig.telemetry.device_update_interval = default_broadcast_interval_secs;
|
moduleConfig.telemetry.device_update_interval = default_broadcast_interval_secs;
|
||||||
moduleConfig.telemetry.environment_update_interval = default_broadcast_interval_secs;
|
moduleConfig.telemetry.environment_update_interval = default_broadcast_interval_secs;
|
||||||
|
moduleConfig.telemetry.air_quality_interval = default_broadcast_interval_secs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeDB::installDefaultChannels()
|
void NodeDB::installDefaultChannels()
|
||||||
|
@ -16,9 +16,9 @@ int32_t AirQualityTelemetryModule::runOnce()
|
|||||||
without having to configure it from the PythonAPI or WebUI.
|
without having to configure it from the PythonAPI or WebUI.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// moduleConfig.telemetry.environment_measurement_enabled = 1;
|
// moduleConfig.telemetry.air_quality_enabled = 1;
|
||||||
|
|
||||||
if (!(moduleConfig.telemetry.environment_measurement_enabled)) {
|
if (!(moduleConfig.telemetry.air_quality_enabled)) {
|
||||||
// If this module is not enabled, and the user doesn't want the display screen don't waste any OSThread time on it
|
// If this module is not enabled, and the user doesn't want the display screen don't waste any OSThread time on it
|
||||||
return disable();
|
return disable();
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ int32_t AirQualityTelemetryModule::runOnce()
|
|||||||
// This is the first time the OSThread library has called this function, so do some setup
|
// This is the first time the OSThread library has called this function, so do some setup
|
||||||
firstTime = 0;
|
firstTime = 0;
|
||||||
|
|
||||||
if (moduleConfig.telemetry.environment_measurement_enabled) {
|
if (moduleConfig.telemetry.air_quality_enabled) {
|
||||||
LOG_INFO("Air quality Telemetry: Initializing\n");
|
LOG_INFO("Air quality Telemetry: Initializing\n");
|
||||||
if (!aqi.begin_I2C()) {
|
if (!aqi.begin_I2C()) {
|
||||||
LOG_WARN("Could not establish i2c connection to AQI sensor\n");
|
LOG_WARN("Could not establish i2c connection to AQI sensor\n");
|
||||||
@ -38,12 +38,12 @@ int32_t AirQualityTelemetryModule::runOnce()
|
|||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
// if we somehow got to a second run of this module with measurement disabled, then just wait forever
|
// if we somehow got to a second run of this module with measurement disabled, then just wait forever
|
||||||
if (!moduleConfig.telemetry.environment_measurement_enabled)
|
if (!moduleConfig.telemetry.air_quality_enabled)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
if (((lastSentToMesh == 0) ||
|
if (((lastSentToMesh == 0) ||
|
||||||
((now - lastSentToMesh) >= getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval))) &&
|
((now - lastSentToMesh) >= getConfiguredOrDefaultMs(moduleConfig.telemetry.air_quality_interval))) &&
|
||||||
airTime->isTxAllowedAirUtil()) {
|
airTime->isTxAllowedAirUtil()) {
|
||||||
sendTelemetry();
|
sendTelemetry();
|
||||||
lastSentToMesh = now;
|
lastSentToMesh = now;
|
||||||
|
Loading…
Reference in New Issue
Block a user