diff --git a/firmware/firmware.ino b/firmware/firmware.ino
index 02fce62..c203b83 100644
--- a/firmware/firmware.ino
+++ b/firmware/firmware.ino
@@ -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);
}
diff --git a/firmware/webUpdater.ino b/firmware/webUpdater.ino
index 1fe5748..8ef896b 100644
--- a/firmware/webUpdater.ino
+++ b/firmware/webUpdater.ino
@@ -120,7 +120,7 @@ void showHTMLMain(void) {
#endif
#ifdef HOMEBRIDGE_WEBSTAT
"
homebridge websatt
"
+ + _webUpdater_ip + ":8080/hbWebstat\">homebridge webstat
"
#endif
#ifdef WEB_RESET
"