diff --git a/data/index.html b/data/index.html
index 4911733..6c818e6 100644
--- a/data/index.html
+++ b/data/index.html
@@ -19,28 +19,35 @@
- Idle Brightness:
%
+ Idle Brightness Maximum:
%
+
+
+
+ LDR Schwelle [%]:
%
+
+
+
+
diff --git a/data/input.js b/data/input.js
index 90f546a..f103844 100644
--- a/data/input.js
+++ b/data/input.js
@@ -48,8 +48,8 @@ function rangeToOutput(range, output) {
rangeToOutput("range_act_pwm", "out_act_pwm");
rangeToOutput("range_idl_pwm", "out_idl_pwm");
rangeToOutput("range_tim_sta", "out_tim_sta");
-rangeToOutput("range_tim_on", "out_tim_on");
-
+rangeToOutput("range_tim_ldr", "out_tim_ldr");
+rangeToOutput("range_ldr_shw", "out_ldr_shw");
let xhr = new XMLHttpRequest();
diff --git a/data/style.css b/data/style.css
index 96e0d70..5293e0b 100644
--- a/data/style.css
+++ b/data/style.css
@@ -30,7 +30,7 @@ body {
font-weight: bold;
}
-.regler{
+.regler {
/* -webkit-appearance: none; */
height: 50px;
width: 100%;
@@ -38,6 +38,12 @@ body {
outline: black;
background-color: rgb(176, 188, 228);
}
+
+#note {
+ font-size: medium;
+ font-style: italic;
+}
+
/* .regler::-webkit-slider-thumb{
-webkit-appearance: none;
appearance: none;
@@ -112,8 +118,6 @@ input:checked + .slider:before {
margin: 2px;
}
-
-
input[type="number"] {
width: 100px;
}
diff --git a/lib/httpserver/httpserver.cpp b/lib/httpserver/httpserver.cpp
index e26d499..f606a58 100644
--- a/lib/httpserver/httpserver.cpp
+++ b/lib/httpserver/httpserver.cpp
@@ -50,9 +50,13 @@ void HTTPServer::start_apps() {
treppe->set_idle_pwm_max(arg(i).toInt(), VORGABE_PROZENT);
}
else if (argName(i).equals("range_tim_sta")) {
+ treppe->set_time_per_stair(arg(i).toInt());
}
- else if (argName(i).equals("range_tim_on")) {
-
+ else if (argName(i).equals("range_tim_ldr")) {
+ treppe->set_time_ldr(arg(i).toInt());
+ }
+ else if (argName(i).equals("range_ldr_shw")) {
+ treppe->set_ldr_schwelle(arg(i).toInt(), VORGABE_PROZENT);
}
}
diff --git a/lib/treppe/treppe.cpp b/lib/treppe/treppe.cpp
index 8ba75b3..d540af4 100644
--- a/lib/treppe/treppe.cpp
+++ b/lib/treppe/treppe.cpp
@@ -199,7 +199,7 @@ void Treppe::task() {
uint32_t m = micros();
#endif
- // TODO wenn LDR geändert => idle_pwm_soll anpassen
+ // TODO wenn LDR geändert => idle_pwm_soll anpassen
// fsm_pend.ldr_changed = true;
fsm_inputs.ldr_schwelle = check_ldr();
@@ -327,7 +327,28 @@ void Treppe::set_active_pwm(const uint16_t value,
Serial.printf("Treppe: parameters.active_pwm=%d\n", parameters.active_pwm);
}
-void Treppe::set_time_per_stair(uint16_t _time_per_stair) {
- parameters.time_per_stair = _time_per_stair;
+void Treppe::set_time_ldr(const uint16_t value) {
+ parameters.time_ldr = value;
+ if (parameters.time_ldr > TIME_MS_MAX)
+ parameters.time_ldr = TIME_MS_MAX;
+ Serial.printf("Treppe: time_ldr=%d\n", parameters.time_ldr);
+}
+
+void Treppe::set_time_per_stair(const uint16_t value) {
+ parameters.time_per_stair = value;
+ if (parameters.time_per_stair > TIME_MS_MAX)
+ parameters.time_per_stair = TIME_MS_MAX;
Serial.printf("Treppe: time_per_stair=%d\n", parameters.time_per_stair);
-}
\ No newline at end of file
+}
+
+void Treppe::set_ldr_schwelle(const uint16_t value,
+ const vorgabe_typ_t vorgabe_typ) {
+ if (vorgabe_typ == VORGABE_PROZENT) {
+ // ?!
+ parameters.ldr_schwelle = 10 * value / 100;
+ } else if (vorgabe_typ == VORGABE_12BIT) {
+ // parameters.ldr_schwelle = value;
+ }
+
+ Serial.printf("Treppe: ldr_schwelle=%d\n", parameters.ldr_schwelle);
+}
diff --git a/lib/treppe/treppe.h b/lib/treppe/treppe.h
index 15d7e20..64c0aca 100644
--- a/lib/treppe/treppe.h
+++ b/lib/treppe/treppe.h
@@ -11,7 +11,8 @@
#define SENSOR_UNTEN 12
#define OE 14
-#define INT_TIME 20 // interrupt intervall [ms]
+#define INT_TIME 20 // interrupt intervall [ms]
+#define TIME_MS_MAX 5000 // maximum time for animation [ms]
enum vorgabe_typ_t { VORGABE_PROZENT = 0, VORGABE_12BIT = 1 };
@@ -96,7 +97,10 @@ public:
// Parameter section
void set_idle_pwm_max(const uint16_t value, const vorgabe_typ_t vorgabe_typ);
void set_active_pwm(const uint16_t value, const vorgabe_typ_t vorgabe_typ);
- void set_time_per_stair(uint16_t _time_per_stair);
+
+ void set_time_ldr(const uint16_t value);
+ void set_time_per_stair(const uint16_t value);
+ void set_ldr_schwelle(const uint16_t value, const vorgabe_typ_t vorgabe_typ);
};
#endif // __TREPPE_H
\ No newline at end of file