Fixed influxDB specific code exclusion.

This commit is contained in:
Kai Lauterbach 2024-02-03 11:42:49 +01:00
parent 0294394537
commit 12aec59c20
2 changed files with 10 additions and 10 deletions

View file

@ -177,7 +177,7 @@ void initWifiBasedSW() {
void initSensors() {
// Initialize and configure the sensors
#ifdef SENSOR_APDS9930
if (sensor_apds9930_begin();
sensor_apds9930_begin();
#endif
#ifdef SENSOR_APDS9960
@ -520,8 +520,14 @@ void _fsm_loop()
/* -------------------------------------------------------------------------------- */
case FSM_STATE_5:
//debug("read sensor data check");
if ((update_sensor_cnt + (UPDATE_SENSOR_INTERVAL_S * 1000)) <= millis() or validData == false) {
if ((update_sensor_cnt + (UPDATE_SENSOR_INTERVAL_S * 1000UL)) <= millis() or validData == false) {
debug("read sensor data " + String(sensor_cnt));
/*
debug(" update_sensor_cnt = " + String(update_sensor_cnt));
debug(" (UPDATE_SENSOR_INTERVAL_S * 1000UL) = " + String((UPDATE_SENSOR_INTERVAL_S * 1000UL)));
debug(" millis() = " + String(millis()));
debug(" validData = " + String(validData));
*/
if (sensor_cnt != SENSOR_WINDSPEED) {
// read data from sensor
@ -538,9 +544,7 @@ void _fsm_loop()
if (sensor_cnt < VALUES - 1) {
sensor_cnt++;
fsm_state = FSM_STATE_5; // jump to same state again, more sensors to read
} else {
update_sensor_cnt = millis(); // reset the update interval counter
sensor_cnt = 0;
fsm_state = FSM_STATE_6; // next state
@ -565,13 +569,12 @@ void _fsm_loop()
/* -------------------------------------------------------------------------------- */
case FSM_STATE_7:
//debug("send data to influxdb if required");
#ifdef INFLUXDB_FEATURE
for (uint8_t i = 0; i < 5 and validData == false; i++) { // only check sensor data 0 to 4 -> SENSOR_TEMPERATURE, SENSOR_HUMIDITY, SENSOR_LIGHT, SENSOR_WINDSPEED, SENSOR_PRESSURE
if (currentSensorData[i] != 0 and currentSensorData[i] != nanf("no value") and (not isnan(currentSensorData[i]))) {
validData = true;
}
}
#ifdef INFLUXDB_FEATURE
if (validData == true) {
// send data only if valid data is available
pushToInfluxDB(DEVICE_NAME, currentSensorData);
@ -698,7 +701,6 @@ void _fsm_loop()
//*************************************************************************//
void _battery_mode_main() {
#ifdef SENSOR_BATTERY
@ -811,8 +813,6 @@ void http_call_send_json_data()
String response = http.getString();
debug("http response code: " + String(httpResponseCode) + " = " + response);
http.end();
digitalWrite(STATUS_LED_PIN, HIGH);
}

View file

@ -120,7 +120,7 @@ void showHTMLMain(void) {
#endif
#ifdef HOMEBRIDGE_WEBSTAT
"<br><a href=\"http://"
+ _webUpdater_ip + ":8080/hbWebstat\">homebridge websatt</a><br>"
+ _webUpdater_ip + ":8080/hbWebstat\">homebridge webstat</a><br>"
#endif
#ifdef WEB_RESET
"<br><a href=\"http://"