esp_garden git · master
Distributed ESP sensor and actuator system (garden)
C++ 70.7% Markdown 18% C 10.7%git clone https://git.christianimmanuel.de/embedded/esp_garden.gitwget https://git.christianimmanuel.de/embedded/esp_garden/archive/esp_garden.tar.gzComment
client_sensor/client_sensor.ino | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/client_sensor/client_sensor.ino b/client_sensor/client_sensor.ino index 697a77b..f5b257c 100644 --- a/client_sensor/client_sensor.ino +++ b/client_sensor/client_sensor.ino @@ -20,7 +20,6 @@ void setup() { restore_SensorConfigs(); - //all_init_configs_received = false; DBG_PRINTF("----------------------\n"); // Add all known configs to an array so we can request thoose from server @@ -37,15 +36,20 @@ void setup() { void loop() { ensure_Peers(); - DBG_PRINTF("## Unix time: %lldl\n", (long long)get_CurrentUnixMs() / 1000); + DBG_PRINTF("## Unix time: %lld\n", (long long)get_CurrentUnixMs() / 1000); for (size_t config_id = 0; config_id < SENSOR_CONFIG_COUNT; config_id++) { if ( is_TimeToReadSensor(config_id) ) { - // read sensor value - // default sensor configurations can be found in globals.cpp sensor_configs - // the struct SensorConfig_s is defined in globals.h + /* + * read sensor value + * default sensor configurations can be found in globals.cpp sensor_configs + * the struct SensorConfig_s is defined in globals.h + */ uint32_t value_to_send = fake_value_to_send; + // set last read time sensor_configs[config_id].last_sensor_read = (long long)get_CurrentUnixMs() / 1000; + + // send to server and configured peer (e.g. pump) send_DataToPeer(config_id, value_to_send); } }