feature/http_call_send_json #3
1 changed files with 16 additions and 16 deletions
|
@ -32,7 +32,7 @@ float currentSensorData[VALUES] = { nanf("no value"), nanf("no value"), nanf("no
|
||||||
nanf("no value"), nanf("no value") };
|
nanf("no value"), nanf("no value") };
|
||||||
float (*sensors[VALUES])() = {};
|
float (*sensors[VALUES])() = {};
|
||||||
|
|
||||||
uint8_t sensor_value[] = { SENSOR_TEMPERATURE,
|
uint8_t sensor_ids[] = { SENSOR_TEMPERATURE,
|
||||||
SENSOR_HUMIDITY,
|
SENSOR_HUMIDITY,
|
||||||
SENSOR_LIGHT,
|
SENSOR_LIGHT,
|
||||||
SENSOR_WINDSPEED,
|
SENSOR_WINDSPEED,
|
||||||
|
@ -294,7 +294,7 @@ void _loop()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FSM_STATE_WSE:
|
case FSM_STATE_WSE:
|
||||||
debug("wind speed exceeded check if required");
|
//debug("wind speed exceeded check if required");
|
||||||
#ifdef HTTP_CALL_ON_WINDSPEED_EXCEED
|
#ifdef HTTP_CALL_ON_WINDSPEED_EXCEED
|
||||||
if ((update_windspeed_exceed_cnt + (HTTP_CALL_ON_WINDSPEED_INTERVAL_S * 1000)) <= millis())
|
if ((update_windspeed_exceed_cnt + (HTTP_CALL_ON_WINDSPEED_INTERVAL_S * 1000)) <= millis())
|
||||||
{
|
{
|
||||||
|
@ -351,13 +351,13 @@ void _loop()
|
||||||
debug("read sensor data " + String(sensor_cnt));
|
debug("read sensor data " + String(sensor_cnt));
|
||||||
if (sensors[sensor_cnt])
|
if (sensors[sensor_cnt])
|
||||||
{
|
{
|
||||||
debug("sensors[sensor_value[" + String(sensor_cnt) + " ]]=" + String((int)sensors[sensor_value[sensor_cnt]]) + ":" + String(sensor_value[sensor_cnt]));
|
debug("sensors[sensor_ids[" + String(sensor_cnt) + " ]]=" + String((int)sensors[sensor_cnt]) + ":" + String((int)sensors[sensor_ids[sensor_cnt]]) + ":" + String(sensor_ids[sensor_cnt]));
|
||||||
//currentSensorData[sensor_cnt] = sensors[sensor_value[sensor_cnt]]();
|
//currentSensorData[sensor_cnt] = sensors[sensor_ids[sensor_cnt]]();
|
||||||
currentSensorData[sensor_cnt] = sensor_cnt;
|
currentSensorData[sensor_cnt] = sensor_cnt;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
debug("sensors[sensor_value[" + String(sensor_cnt) + "]]=nan");
|
debug("sensors[sensor_ids[" + String(sensor_cnt) + "]]=nan");
|
||||||
currentSensorData[sensor_cnt] = nan("no value");
|
currentSensorData[sensor_cnt] = nan("no value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,13 +375,13 @@ void _loop()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
debug("skip read sensor data");
|
//debug("skip read sensor data");
|
||||||
fsm_state = FSM_STATE_WU; // no new data, reset FSM
|
fsm_state = FSM_STATE_WU; // no new data, reset FSM
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FSM_STATE_SC:
|
case FSM_STATE_SC:
|
||||||
debug("log to serial if required");
|
//debug("log to serial if required");
|
||||||
#ifdef SERIAL_FEATURE
|
#ifdef SERIAL_FEATURE
|
||||||
logToSerial(currentSensorData);
|
logToSerial(currentSensorData);
|
||||||
#endif
|
#endif
|
||||||
|
@ -389,7 +389,7 @@ void _loop()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FSM_STATE_ID:
|
case FSM_STATE_ID:
|
||||||
debug("send data to influxdb if required");
|
//debug("send data to influxdb if required");
|
||||||
#ifdef INFLUXDB_FEATURE
|
#ifdef INFLUXDB_FEATURE
|
||||||
for (uint8_t i = 0; i < 5 and validData == false; i++)
|
for (uint8_t i = 0; i < 5 and validData == false; i++)
|
||||||
{
|
{
|
||||||
|
@ -409,7 +409,7 @@ void _loop()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FSM_STATE_SD:
|
case FSM_STATE_SD:
|
||||||
debug("set sensor data in webupdater if required");
|
//debug("set sensor data in webupdater if required");
|
||||||
#ifdef WEBUPDATER_FEATURE
|
#ifdef WEBUPDATER_FEATURE
|
||||||
setSensorData(currentSensorData);
|
setSensorData(currentSensorData);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue