updates to change other parameters from http
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+25
-4
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
+6
-2
@@ -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
|
||||
Reference in New Issue
Block a user