From fd84b81f4a2cd06131820e62e3c6eac4d2869f56 Mon Sep 17 00:00:00 2001
From: Eric Duminil <eric.duminil@gmail.com>
Date: Sun, 27 Dec 2020 14:43:00 +0100
Subject: [PATCH] FIXMEs

---
 util.h         | 1 +
 web_server.cpp | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/util.h b/util.h
index c1fc40a..5a46bd1 100644
--- a/util.h
+++ b/util.h
@@ -3,6 +3,7 @@
 #include <Arduino.h>
 #include "config.h"
 #include "wifi_util.h" // To get MAC
+//FIXME: Only if CSV
 #include "csv_writer.h" // To close filesystem before reset
 
 #include <WiFiUdp.h> //required for NTP
diff --git a/web_server.cpp b/web_server.cpp
index f99922f..c96b2f4 100644
--- a/web_server.cpp
+++ b/web_server.cpp
@@ -88,6 +88,7 @@ namespace web_server {
             "<tr><th colspan='2'>CSV</th></tr>\n"
             "<tr><td>Last write</td><td>%s</td></tr>\n"
             "<tr><td>Timestep</td><td>%5d s</td></tr>\n"
+            "<tr><td>Available drive space</td><td>%d kB</td></tr>\n"
 #endif
 #ifdef AMPEL_MQTT
             "<tr><th colspan='2'>MQTT</th></tr>\n"
@@ -106,7 +107,6 @@ namespace web_server {
             "<tr><td>Local address</td><td><a href='http://%s.local/'>%s.local</a></td></tr>\n"
             "<tr><td>Local IP</td><td><a href='http://%s'>%s</a></td></tr>\n"
             "<tr><td>Free heap space</td><td>%6d bytes</td></tr>\n"
-            "<tr><td>Available drive space</td><td>%d kB</td></tr>\n"
             "<tr><td>Max loop duration</td><td>%5d ms</td></tr>\n"
             "<tr><td>Board</td><td>%s</td></tr>\n"
             "<tr><td>Uptime</td><td>%4d h %02d min %02d s</td></tr>\n"
@@ -198,6 +198,7 @@ namespace web_server {
     ss -= hh * 3600;
     uint8_t mm = ss / 60;
     ss -= mm * 60;
+    //FIXME: only if AMPEL_CSV
     uint16_t available_fs_space = csv_writer::getAvailableSpace() / 1024;
 
     //NOTE: Splitting in multiple parts in order to use less RAM
@@ -215,7 +216,7 @@ namespace web_server {
     snprintf_P(content, sizeof(content), body_template, SENSOR_ID.c_str(), sensor::co2, sensor::temperature,
         sensor::humidity, sensor::timestamp.c_str(), config::measurement_timestep,
 #ifdef AMPEL_CSV
-        csv_writer::last_successful_write.c_str(), config::csv_interval,
+        csv_writer::last_successful_write.c_str(), config::csv_interval, available_fs_space,
 #endif
 #ifdef AMPEL_MQTT
         mqtt::last_successful_publish.c_str(), config::sending_interval,
@@ -225,8 +226,7 @@ namespace web_server {
         config::lorawan_sending_interval,
 #endif
         config::temperature_offset, SENSOR_ID.c_str(), SENSOR_ID.c_str(), WiFi.localIP().toString().c_str(),
-        WiFi.localIP().toString().c_str(), get_free_heap_size(), available_fs_space, max_loop_duration, BOARD, hh, mm,
-        ss);
+        WiFi.localIP().toString().c_str(), get_free_heap_size(), max_loop_duration, BOARD, hh, mm, ss);
 
     http.sendContent(content);
 
-- 
GitLab