|
@@ -47,32 +47,60 @@ void onConfiguration(HttpRequest &request, HttpResponse &response)
|
|
|
|
|
|
if (request.getPostParameter("TZ").length() > 0) // Correction
|
|
if (request.getPostParameter("TZ").length() > 0) // Correction
|
|
{
|
|
{
|
|
- cfg.AddTZ = request.getPostParameter("TZ").toFloat();
|
|
|
|
|
|
+ float tz = request.getPostParameter("TZ").toFloat();
|
|
|
|
+ if (cfg.AddTZ != tz)
|
|
|
|
+ {
|
|
|
|
+ cfg.AddTZ = tz;
|
|
|
|
+ SystemClock.setTimeZone(cfg.AddTZ);
|
|
|
|
+ if (cfg.AddTZ<0 || cfg.AddTZ>23)
|
|
|
|
+ {
|
|
|
|
+ cfg.AddTZ = 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (request.getPostParameter("BLow").length() > 0) // Low brightness level.
|
|
if (request.getPostParameter("BLow").length() > 0) // Low brightness level.
|
|
{
|
|
{
|
|
cfg.BrightnessLow = request.getPostParameter("BLow").toInt();
|
|
cfg.BrightnessLow = request.getPostParameter("BLow").toInt();
|
|
|
|
+ if (cfg.BrightnessLow<0 || cfg.BrightnessLow>15)
|
|
|
|
+ {
|
|
|
|
+ cfg.BrightnessLow = 0;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (request.getPostParameter("BMid").length() > 0) // Middle brightness level.
|
|
if (request.getPostParameter("BMid").length() > 0) // Middle brightness level.
|
|
{
|
|
{
|
|
cfg.BrightnessMiddle = request.getPostParameter("BMid").toInt();
|
|
cfg.BrightnessMiddle = request.getPostParameter("BMid").toInt();
|
|
|
|
+ if (cfg.BrightnessMiddle<0 || cfg.BrightnessMiddle>15)
|
|
|
|
+ {
|
|
|
|
+ cfg.BrightnessMiddle = 7;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (request.getPostParameter("BHigh").length() > 0) // High brightness level.
|
|
if (request.getPostParameter("BHigh").length() > 0) // High brightness level.
|
|
{
|
|
{
|
|
cfg.BrightnessHigh = request.getPostParameter("BHigh").toInt();
|
|
cfg.BrightnessHigh = request.getPostParameter("BHigh").toInt();
|
|
|
|
+ if (cfg.BrightnessHigh<0 || cfg.BrightnessHigh>15)
|
|
|
|
+ {
|
|
|
|
+ cfg.BrightnessHigh = 15;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (request.getPostParameter("LLow").length() > 0) // Low light level trh.
|
|
if (request.getPostParameter("LLow").length() > 0) // Low light level trh.
|
|
{
|
|
{
|
|
cfg.LightTrhLow = request.getPostParameter("LLow").toInt();
|
|
cfg.LightTrhLow = request.getPostParameter("LLow").toInt();
|
|
|
|
+ if (cfg.LightTrhLow<0 || cfg.LightTrhLow>1023)
|
|
|
|
+ {
|
|
|
|
+ cfg.LightTrhLow = 0;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (request.getPostParameter("LHigh").length() > 0) // High light level trh.
|
|
if (request.getPostParameter("LHigh").length() > 0) // High light level trh.
|
|
{
|
|
{
|
|
cfg.LightTrhHigh = request.getPostParameter("LHigh").toInt();
|
|
cfg.LightTrhHigh = request.getPostParameter("LHigh").toInt();
|
|
|
|
+ if (cfg.LightTrhHigh<0 || cfg.LightTrhHigh>1023)
|
|
|
|
+ {
|
|
|
|
+ cfg.LightTrhHigh = 1023;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
saveConfig(cfg);
|
|
saveConfig(cfg);
|
|
- SystemClock.setTimeZone(cfg.AddTZ);
|
|
|
|
response.redirect();
|
|
response.redirect();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -119,7 +147,7 @@ void onApiDoc(HttpRequest &request, HttpResponse &response)
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- * Gt json data
|
|
|
|
|
|
+ * Get json data
|
|
* äàííûå ñ äàò÷èêîâ âûäà¸ì ñ ìàêñèìàëüíûì ðàçðåøåíèåì.
|
|
* äàííûå ñ äàò÷èêîâ âûäà¸ì ñ ìàêñèìàëüíûì ðàçðåøåíèåì.
|
|
*/
|
|
*/
|
|
void onApiSensors(HttpRequest &request, HttpResponse &response)
|
|
void onApiSensors(HttpRequest &request, HttpResponse &response)
|