feature/http_call_send_json #3

Merged
f merged 56 commits from feature/http_call_send_json into master 2022-11-27 11:02:22 +01:00
Showing only changes of commit ed3a956dc6 - Show all commits

View file

@ -32,14 +32,14 @@ float currentSensorData[VALUES] = { nanf("no value"), nanf("no value"), nanf("no
nanf("no value"), nanf("no value") };
float (*sensors[VALUES])() = {};
uint8_t sensor_value[] = { SENSOR_TEMPERATURE,
SENSOR_HUMIDITY,
SENSOR_LIGHT,
SENSOR_WINDSPEED,
SENSOR_PRESSURE,
SENSOR_BAT_VOLTAGE,
SENSOR_ESAVEMODE,
SENSOR_BATCHARGESTATE };
uint8_t sensor_ids[] = { SENSOR_TEMPERATURE,
SENSOR_HUMIDITY,
SENSOR_LIGHT,
SENSOR_WINDSPEED,
SENSOR_PRESSURE,
SENSOR_BAT_VOLTAGE,
SENSOR_ESAVEMODE,
SENSOR_BATCHARGESTATE };
uint32_t update_sensor_cnt = 0;
uint32_t update_webserver_cnt = 0;
@ -294,7 +294,7 @@ void _loop()
break;
case FSM_STATE_WSE:
debug("wind speed exceeded check if required");
//debug("wind speed exceeded check if required");
#ifdef HTTP_CALL_ON_WINDSPEED_EXCEED
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));
if (sensors[sensor_cnt])
{
debug("sensors[sensor_value[" + String(sensor_cnt) + " ]]=" + String((int)sensors[sensor_value[sensor_cnt]]) + ":" + String(sensor_value[sensor_cnt]));
//currentSensorData[sensor_cnt] = sensors[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_ids[sensor_cnt]]();
currentSensorData[sensor_cnt] = sensor_cnt;
} else {
debug("sensors[sensor_value[" + String(sensor_cnt) + "]]=nan");
debug("sensors[sensor_ids[" + String(sensor_cnt) + "]]=nan");
currentSensorData[sensor_cnt] = nan("no value");
}
@ -375,13 +375,13 @@ void _loop()
} else {
debug("skip read sensor data");
//debug("skip read sensor data");
fsm_state = FSM_STATE_WU; // no new data, reset FSM
}
break;
case FSM_STATE_SC:
debug("log to serial if required");
//debug("log to serial if required");
#ifdef SERIAL_FEATURE
logToSerial(currentSensorData);
#endif
@ -389,7 +389,7 @@ void _loop()
break;
case FSM_STATE_ID:
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++)
{
@ -409,7 +409,7 @@ void _loop()
break;
case FSM_STATE_SD:
debug("set sensor data in webupdater if required");
//debug("set sensor data in webupdater if required");
#ifdef WEBUPDATER_FEATURE
setSensorData(currentSensorData);
#endif