From 6fc10a758b255028c5d2c4d9bb42c7dc77fd76db Mon Sep 17 00:00:00 2001
From: Eric Duminil <eric.duminil@gmail.com>
Date: Fri, 24 Jun 2022 17:17:02 +0200
Subject: [PATCH] Trying to remove unneeded parameters, to save some memory

---
 ampel-firmware/co2_sensor.cpp |  1 -
 ampel-firmware/util.h         |  2 +-
 ampel-firmware/web_config.cpp | 20 --------------------
 ampel-firmware/web_config.h   |  3 ---
 4 files changed, 1 insertion(+), 25 deletions(-)

diff --git a/ampel-firmware/co2_sensor.cpp b/ampel-firmware/co2_sensor.cpp
index 7e0d4d6..e676b0a 100644
--- a/ampel-firmware/co2_sensor.cpp
+++ b/ampel-firmware/co2_sensor.cpp
@@ -156,7 +156,6 @@ namespace sensor {
     Serial.print(F("Calibrating S8 now..."));
     //TODO: Apply ppm offset, e.g. +25ppm for 425ppm?
     Serial.println(F("WARNING! FORCING CALIBRATION TO 400ppm, regardless of configuration."));
-    config::co2_calibration_level = 400; //NOTE: Seems to be hard-coded in S8
     sensor_S8->manual_calibration();
     Serial.println(F(" Done!"));
     Serial.println(F("Sensor calibrated."));
diff --git a/ampel-firmware/util.h b/ampel-firmware/util.h
index e6ec49c..9ddbc52 100644
--- a/ampel-firmware/util.h
+++ b/ampel-firmware/util.h
@@ -26,7 +26,7 @@ class Ampel {
 private:
   static void showFreeSpace();
 public:
-  const char *version = "v0.3.1-S8"; // Update manually after significant changes.
+  const char *version = "v0.3.2-S8"; // Update manually after significant changes.
   const char *board;
   const char *sensorId;
   const char *macAddress;
diff --git a/ampel-firmware/web_config.cpp b/ampel-firmware/web_config.cpp
index 82b352e..cfaa614 100644
--- a/ampel-firmware/web_config.cpp
+++ b/ampel-firmware/web_config.cpp
@@ -55,17 +55,6 @@ namespace web_config {
       Builder<IntTParameter<uint16_t>>("timestep").label("Measurement timestep").defaultValue(MEASUREMENT_TIMESTEP).min(
           2).max(1800).placeholder("[s]").build();
 
-  FloatTParameter temperatureOffsetParam =
-      Builder<FloatTParameter>("temp_offset").label("Temperature offset").defaultValue(TEMPERATURE_OFFSET).placeholder(
-          "[K]").step(0.1).build();
-
-  IntTParameter<uint16_t> altitudeParam = Builder<IntTParameter<uint16_t>>("altitude").label("Altitude").defaultValue(
-  ALTITUDE_ABOVE_SEA_LEVEL).min(0).step(1).placeholder("[m]").build();
-
-  IntTParameter<uint16_t> atmosphericCO2Param = Builder<IntTParameter<uint16_t>>("atmospheric_co2").label(
-      "Atmospheric CO2 concentration").defaultValue(
-  ATMOSPHERIC_CO2_CONCENTRATION).min(400).max(2000).step(1).placeholder("ppm").build();
-
   CheckboxTParameter autoCalibrateParam = Builder<CheckboxTParameter>("asc").label("Auto-calibration?").defaultValue(
   AUTO_CALIBRATE_SENSOR).build();
 
@@ -196,12 +185,6 @@ namespace web_config {
     iotWebConf->getApTimeoutParameter()->defaultValue = STRINGIFY(ACCESS_POINT_TIMEOUT); // Defined as number in config.h but stored as string in webconf.
 
     co2Params.addItem(&timestepParam);
-    co2Params.addItem(&temperatureOffsetParam);
-    temperatureOffsetParam.visible = false; // Not needed for S8
-    co2Params.addItem(&altitudeParam);
-    altitudeParam.visible = false; // Not needed either for S8
-    co2Params.addItem(&atmosphericCO2Param);
-    atmosphericCO2Param.visible = false; // Hard coded 400ppm for S8 :-/
     co2Params.addItem(&autoCalibrateParam);
 
     ledParams.addItem(&minBrightnessParam);
@@ -342,10 +325,7 @@ namespace config {
 
   // Sensor
   uint16_t &measurement_timestep = web_config::timestepParam.value(); // [s] Measurement happen every 4s anyway on S8. How often should the values be displayed?
-  uint16_t &altitude_above_sea_level = web_config::altitudeParam.value(); // [m]
-  uint16_t &co2_calibration_level = web_config::atmosphericCO2Param.value(); // [ppm]
   bool &auto_calibrate_sensor = web_config::autoCalibrateParam.value(); // [true / false]
-  float &temperature_offset = web_config::temperatureOffsetParam.value(); // [K] Sign isn't relevant.
 
   bool &is_wifi_on = web_config::ampelWifiParam.value();
   uint16_t &wifi_timeout = web_config::wifiTimeoutParam.value();
diff --git a/ampel-firmware/web_config.h b/ampel-firmware/web_config.h
index 59e424a..fc97fd7 100644
--- a/ampel-firmware/web_config.h
+++ b/ampel-firmware/web_config.h
@@ -19,10 +19,7 @@ namespace config {
 
   // Sensor
   extern uint16_t &measurement_timestep; // [s] How often measurements are displayed
-  extern uint16_t &altitude_above_sea_level; // [m]
-  extern uint16_t &co2_calibration_level; // [ppm]
   extern bool &auto_calibrate_sensor; // [true / false]
-  extern float &temperature_offset; // [K] Sign isn't relevant.
 
   // LED
   extern uint8_t &max_brightness;
-- 
GitLab