Fixed influxDB specific code exclusion.
This commit is contained in:
parent
0294394537
commit
12aec59c20
2 changed files with 10 additions and 10 deletions
|
@ -177,7 +177,7 @@ void initWifiBasedSW() {
|
||||||
void initSensors() {
|
void initSensors() {
|
||||||
// Initialize and configure the sensors
|
// Initialize and configure the sensors
|
||||||
#ifdef SENSOR_APDS9930
|
#ifdef SENSOR_APDS9930
|
||||||
if (sensor_apds9930_begin();
|
sensor_apds9930_begin();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SENSOR_APDS9960
|
#ifdef SENSOR_APDS9960
|
||||||
|
@ -520,8 +520,14 @@ void _fsm_loop()
|
||||||
/* -------------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------------- */
|
||||||
case FSM_STATE_5:
|
case FSM_STATE_5:
|
||||||
//debug("read sensor data check");
|
//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("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) {
|
if (sensor_cnt != SENSOR_WINDSPEED) {
|
||||||
// read data from sensor
|
// read data from sensor
|
||||||
|
@ -538,9 +544,7 @@ void _fsm_loop()
|
||||||
if (sensor_cnt < VALUES - 1) {
|
if (sensor_cnt < VALUES - 1) {
|
||||||
sensor_cnt++;
|
sensor_cnt++;
|
||||||
fsm_state = FSM_STATE_5; // jump to same state again, more sensors to read
|
fsm_state = FSM_STATE_5; // jump to same state again, more sensors to read
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
update_sensor_cnt = millis(); // reset the update interval counter
|
update_sensor_cnt = millis(); // reset the update interval counter
|
||||||
sensor_cnt = 0;
|
sensor_cnt = 0;
|
||||||
fsm_state = FSM_STATE_6; // next state
|
fsm_state = FSM_STATE_6; // next state
|
||||||
|
@ -565,13 +569,12 @@ void _fsm_loop()
|
||||||
/* -------------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------------- */
|
||||||
case FSM_STATE_7:
|
case FSM_STATE_7:
|
||||||
//debug("send data to influxdb if required");
|
//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
|
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]))) {
|
if (currentSensorData[i] != 0 and currentSensorData[i] != nanf("no value") and (not isnan(currentSensorData[i]))) {
|
||||||
validData = true;
|
validData = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef INFLUXDB_FEATURE
|
||||||
if (validData == true) {
|
if (validData == true) {
|
||||||
// send data only if valid data is available
|
// send data only if valid data is available
|
||||||
pushToInfluxDB(DEVICE_NAME, currentSensorData);
|
pushToInfluxDB(DEVICE_NAME, currentSensorData);
|
||||||
|
@ -698,7 +701,6 @@ void _fsm_loop()
|
||||||
|
|
||||||
//*************************************************************************//
|
//*************************************************************************//
|
||||||
|
|
||||||
|
|
||||||
void _battery_mode_main() {
|
void _battery_mode_main() {
|
||||||
|
|
||||||
#ifdef SENSOR_BATTERY
|
#ifdef SENSOR_BATTERY
|
||||||
|
@ -811,8 +813,6 @@ void http_call_send_json_data()
|
||||||
String response = http.getString();
|
String response = http.getString();
|
||||||
debug("http response code: " + String(httpResponseCode) + " = " + response);
|
debug("http response code: " + String(httpResponseCode) + " = " + response);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
http.end();
|
http.end();
|
||||||
digitalWrite(STATUS_LED_PIN, HIGH);
|
digitalWrite(STATUS_LED_PIN, HIGH);
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ void showHTMLMain(void) {
|
||||||
#endif
|
#endif
|
||||||
#ifdef HOMEBRIDGE_WEBSTAT
|
#ifdef HOMEBRIDGE_WEBSTAT
|
||||||
"<br><a href=\"http://"
|
"<br><a href=\"http://"
|
||||||
+ _webUpdater_ip + ":8080/hbWebstat\">homebridge websatt</a><br>"
|
+ _webUpdater_ip + ":8080/hbWebstat\">homebridge webstat</a><br>"
|
||||||
#endif
|
#endif
|
||||||
#ifdef WEB_RESET
|
#ifdef WEB_RESET
|
||||||
"<br><a href=\"http://"
|
"<br><a href=\"http://"
|
||||||
|
|
Loading…
Reference in a new issue