ソースを参照

Remove LightTreshold.

Vladimir N. Shilov 1 年間 前
コミット
4742006f8e
6 ファイル変更5 行追加47 行削除
  1. 1 3
      app/application.cpp
  2. 3 11
      app/configuration.cpp
  3. 0 16
      app/webserver.cpp
  4. 1 1
      component.mk
  5. 0 7
      include/configuration.h
  6. 0 9
      web/config.html

+ 1 - 3
app/application.cpp

@@ -72,10 +72,8 @@ void init(void) {
 	// refresh big led
 	displayTimer.initializeMs(500, showWatch).start();
 
-	// init sensors
+	/* AHTxx Sensor */
 	AHTxx_Init();
-
-	// polling sensors - once per two seconds
 	procTimer.initializeMs(2000, GetData).start();
 }
 

+ 3 - 11
app/configuration.cpp

@@ -15,10 +15,6 @@ ClockConfig loadConfig(void)
 		JsonObject correction = doc["correction"];
 		cfg.AddTZ = correction["TZ"];
 
-		JsonObject light = doc["light"];
-		cfg.LightTrhLow = light["low"];
-		cfg.LightTrhHigh = light["high"];
-
 		JsonObject bright = doc["bright"];
 		cfg.BrightnessLow = bright["low"];
 		cfg.BrightnessMiddle = bright["mid"];
@@ -42,14 +38,10 @@ void saveConfig(ClockConfig& cfg)
 	auto correction = doc.createNestedObject("correction");
 	correction["TZ"] = cfg.AddTZ;
 
-	auto light = doc.createNestedObject("light");
-  light["low"] = cfg.LightTrhLow;
-  light["high"] = cfg.LightTrhHigh;
-
 	auto bright = doc.createNestedObject("bright");
-  bright["low"] = cfg.BrightnessLow;
-  bright["mid"] = cfg.BrightnessMiddle;
-  bright["high"] = cfg.BrightnessHigh;
+	bright["low"] = cfg.BrightnessLow;
+	bright["mid"] = cfg.BrightnessMiddle;
+	bright["high"] = cfg.BrightnessHigh;
 
 	Json::saveToFile(doc, CLOCK_CONFIG_FILE, Json::Pretty);
 }

+ 0 - 16
app/webserver.cpp

@@ -69,20 +69,6 @@ void onConfiguration(HttpRequest& request, HttpResponse& response)
 				cfg.BrightnessHigh = LedBrightMax;
 			}
 		}
-		// Low light level trh.
-		if (request.getPostParameter ("LLow").length () > 0) {
-			cfg.LightTrhLow = request.getPostParameter ("LLow").toInt ();
-			if (cfg.LightTrhLow < MinLightThreshold || cfg.LightTrhLow > MaxLightThreshold) {
-				cfg.LightTrhLow = MinLightThreshold;
-			}
-		}
-		// High light level trh.
-		if (request.getPostParameter ("LHigh").length () > 0) {
-			cfg.LightTrhHigh = request.getPostParameter ("LHigh").toInt ();
-			if (cfg.LightTrhHigh < MinLightThreshold || cfg.LightTrhHigh > MaxLightThreshold) {
-				cfg.LightTrhHigh = MaxLightThreshold;
-			}
-		}
 
 		saveConfig(cfg);
 		response.headers[HTTP_HEADER_LOCATION] = "/";
@@ -93,8 +79,6 @@ void onConfiguration(HttpRequest& request, HttpResponse& response)
 	auto& vars = tmpl->variables();
 	vars["SSID"] = cfg.NetworkSSID;
 	vars["TZ"] = String(cfg.AddTZ, 2);
-	vars["LLow"] = String(cfg.LightTrhLow);
-	vars["LHigh"] = String(cfg.LightTrhHigh);
 	vars["BLow"] = String(cfg.BrightnessLow);
 	vars["BMid"] = String(cfg.BrightnessMiddle);
 	vars["BHigh"] = String(cfg.BrightnessHigh);

+ 1 - 1
component.mk

@@ -1,4 +1,4 @@
-ARDUINO_LIBRARIES := ArduinoJson6
+ARDUINO_LIBRARIES := ArduinoJson6 DHTesp Timezone SolarCalculator
 HWCONFIG := spiffs3m
 #HWCONFIG_OPTS := spiffs
 SPIFF_FILES := web

+ 0 - 7
include/configuration.h

@@ -10,9 +10,6 @@
 #define WIFI_PWD "Heaven-32847"
 #endif
 
-#define MinLightThreshold    0
-#define MaxLightThreshold    1023
-
 #define LedBrightMin         0
 #define LedBrightMiddl       3
 #define LedBrightMax         7
@@ -23,8 +20,6 @@ struct ClockConfig {
   ClockConfig()
   {
     AddTZ = 3;
-    LightTrhLow = 341;
-    LightTrhHigh = 683;
     BrightnessLow = LedBrightMin;
     BrightnessMiddle = LedBrightMiddl;
     BrightnessHigh = LedBrightMax;
@@ -34,8 +29,6 @@ struct ClockConfig {
   String NetworkPassword;
 
   float AddTZ; // TimeZone - local time offset
-  uint16_t LightTrhLow; // Low Light level
-  uint16_t LightTrhHigh; // High Light level
   int8_t BrightnessLow; // Low LED brightness level
   int8_t BrightnessMiddle; // Middle LED brightness level
   int8_t BrightnessHigh; // High LED brightness level

+ 0 - 9
web/config.html

@@ -70,15 +70,6 @@
 				</div>
 				<div class="panel-body">
 					<form method="POST">
-						<div class="form-group">
-						<label>Low light level threshold, 0 &mdash; 1023</label>
-						<input type="number" min="0" max="1023" name="LLow" class="form-control" value="{LLow}">
-						</div>
-						<div class="form-group">
-						<label>High light level threshold, 0 &mdash; 1023</label>
-						<input type="number" min="0" max="1023" name="LHigh" class="form-control" value="{LHigh}">
-						</div>
-
 						<div class="form-group">
 						<label>Brightness Low level, 0 &mdash; 7</label>
 						<input type="number" min="0" max="7" name="BLow" class="form-control" value="{BLow}">