From 53ca46e7bdb0a2b43a96a19c8538d15d3b214a59 Mon Sep 17 00:00:00 2001 From: Kai Lauterbach Date: Fri, 11 Nov 2022 14:34:42 +0100 Subject: [PATCH] Fixed wrong temperature value. --- firmware/config_user.h.example | 4 ++++ firmware/firmware.ino | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/firmware/config_user.h.example b/firmware/config_user.h.example index 62716dd..67f0fc2 100755 --- a/firmware/config_user.h.example +++ b/firmware/config_user.h.example @@ -51,6 +51,7 @@ String DEVICE_NAME = "weatherstation"; // for debugging windspeed measurement only, trigger and results are handled by webupdater //#define DEBUG_WINDSPEED_MEASUREMENT //#define HTTP_CALL_ON_WINDSPEED_EXCEED +//#define HTTP_CALL_SEND_JSON_DATA const float HUMIDITY_FACTOR = 1.0; const float LIGHT_FACTOR = 1.0; @@ -76,6 +77,9 @@ const char *INFLUXDB_TOKEN = "your api token"; #define HTTP_CALL_ON_WINDSPEED_INTERVAL_S 60 // it's required to be bigger than WIND_SENSOR_MEAS_TIME_S #define HTTP_CALL_ON_WINDSPEED_URL "http://192.168.178.100:3001/button-windspeedexceed?event=click" +#define HTTP_CALL_SEND_JSON_DATA_INTERVAL_S 300 +#define HTTP_CALL_SEND_JSON_DATA_URL "http://192.168.178.123:80/html/index.html?json_weather_data=" + // anemometer settings // thingiverse anemometer settings: https://www.thingiverse.com/thing:2559929/files #define ROTOR_LENGTH_CM 8.25 diff --git a/firmware/firmware.ino b/firmware/firmware.ino index b87ff8f..fb0a739 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -556,8 +556,8 @@ void _fsm_loop() /* -------------------------------------------------------------------------------- */ case FSM_STATE_10: #ifdef SENSOR_WIND - currentSensorData[sensor_cnt] = measure_wind_result(); - debug("wind sensor " + String(currentSensorData[sensor_cnt])); + currentSensorData[SENSOR_WINDSPEED] = measure_wind_result(); + debug("wind sensor " + String(currentSensorData[SENSOR_WINDSPEED])); #endif // step into read of next sensor read sensor_cnt++; @@ -584,8 +584,8 @@ void _fsm_loop() /* -------------------------------------------------------------------------------- */ case FSM_STATE_12: #ifdef HTTP_CALL_ON_WINDSPEED_EXCEED - currentSensorData[sensor_cnt] = measure_wind_result(); - debug("wind sensor value " + String(currentSensorData[sensor_cnt])); + currentSensorData[SENSOR_WINDSPEED] = measure_wind_result(); + debug("wind sensor value " + String(currentSensorData[SENSOR_WINDSPEED])); if (currentSensorData[SENSOR_WINDSPEED] >= HTTP_CALL_ON_WINDSPEED_EXCEED_MPS) { // windspeed exceeded send http call @@ -688,6 +688,7 @@ void logToSerial(float sensorValues[]) { String getJsonData() { + debug(String(SENSOR_TEMPERATURE) + "=" + String(currentSensorData[SENSOR_TEMPERATURE])); String msg = hb_ws_msg_start + hb_ws_msg_temp + String(currentSensorData[SENSOR_TEMPERATURE], 2) + @@ -717,7 +718,7 @@ String getJsonData() void http_call_send_json_data() { //debug("http call to " + String(HTTP_CALL_SEND_JSON_DATA_URL)); - + //debug(String(SENSOR_TEMPERATURE) + "=" + String(currentSensorData[SENSOR_TEMPERATURE])); // windspeed exceeded send http call digitalWrite(STATUS_LED_PIN, LOW);