@@ -19,28 +19,35 @@ | |||
<div class="param_block"> | |||
Idle Brightness: <output id="out_idl_pwm" class="val_range">50</output> % | |||
Idle Brightness Maximum: <output id="out_idl_pwm" class="val_range">50</output> % | |||
<label id="note">[100% == Active Brightness]</label> | |||
<div class="slider"> | |||
<input type="range" class="regler" id="range_idl_pwm" min="0" max="100" value="50"> | |||
</div> | |||
<label id="note">idle brightness gets controlled via LDR measurments</label> | |||
</div> | |||
<div class="param_block"> | |||
Time per stair: <output id="out_tim_sta" class="val_range">50</output> % | |||
Time per stair [ms]: <output id="out_tim_sta" class="val_range">300</output> ms | |||
<div class="slider"> | |||
<input type="range" class="regler" id="range_tim_sta" min="0" max="100" value="50"> | |||
<input type="range" class="regler" id="range_tim_sta" min="0" max="5000" value="300"> | |||
</div> | |||
</div> | |||
<div class="param_block"> | |||
On Time: <output id="out_tim_on" class="val_range">50</output> % | |||
Time LDR [ms]: <output id="out_tim_ldr" class="val_range">500</output> ms | |||
<div class="slider"> | |||
<input type="range" class="regler" id="range_tim_on" min="0" max="100" value="50"> | |||
<input type="range" class="regler" id="range_tim_ldr" min="0" max="5000" value="500"> | |||
</div> | |||
</div> | |||
<div class="param_block"> | |||
LDR Schwelle [%]: <output id="out_ldr_shw" class="val_range">50</output> % | |||
<div class="slider"> | |||
<input type="range" class="regler" id="range_ldr_shw" min="0" max="100" value="50"> | |||
</div> | |||
</div> | |||
<div class="terminal"> |
@@ -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(); | |||
@@ -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; | |||
} |
@@ -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); | |||
} | |||
} |
@@ -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); | |||
} |
@@ -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 |