<div class="param_block"> | <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"> | <div class="slider"> | ||||
<input type="range" class="regler" id="range_idl_pwm" min="0" max="100" value="50"> | <input type="range" class="regler" id="range_idl_pwm" min="0" max="100" value="50"> | ||||
</div> | </div> | ||||
<label id="note">idle brightness gets controlled via LDR measurments</label> | |||||
</div> | </div> | ||||
<div class="param_block"> | <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"> | <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> | </div> | ||||
<div class="param_block"> | <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"> | <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> | </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"> | <div class="terminal"> |
rangeToOutput("range_act_pwm", "out_act_pwm"); | rangeToOutput("range_act_pwm", "out_act_pwm"); | ||||
rangeToOutput("range_idl_pwm", "out_idl_pwm"); | rangeToOutput("range_idl_pwm", "out_idl_pwm"); | ||||
rangeToOutput("range_tim_sta", "out_tim_sta"); | 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(); | let xhr = new XMLHttpRequest(); | ||||
font-weight: bold; | font-weight: bold; | ||||
} | } | ||||
.regler{ | |||||
.regler { | |||||
/* -webkit-appearance: none; */ | /* -webkit-appearance: none; */ | ||||
height: 50px; | height: 50px; | ||||
width: 100%; | width: 100%; | ||||
outline: black; | outline: black; | ||||
background-color: rgb(176, 188, 228); | background-color: rgb(176, 188, 228); | ||||
} | } | ||||
#note { | |||||
font-size: medium; | |||||
font-style: italic; | |||||
} | |||||
/* .regler::-webkit-slider-thumb{ | /* .regler::-webkit-slider-thumb{ | ||||
-webkit-appearance: none; | -webkit-appearance: none; | ||||
appearance: none; | appearance: none; | ||||
margin: 2px; | margin: 2px; | ||||
} | } | ||||
input[type="number"] { | input[type="number"] { | ||||
width: 100px; | width: 100px; | ||||
} | } |
treppe->set_idle_pwm_max(arg(i).toInt(), VORGABE_PROZENT); | treppe->set_idle_pwm_max(arg(i).toInt(), VORGABE_PROZENT); | ||||
} | } | ||||
else if (argName(i).equals("range_tim_sta")) { | 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); | |||||
} | } | ||||
} | } |
uint32_t m = micros(); | uint32_t m = micros(); | ||||
#endif | #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_pend.ldr_changed = true; | ||||
fsm_inputs.ldr_schwelle = check_ldr(); | fsm_inputs.ldr_schwelle = check_ldr(); | ||||
Serial.printf("Treppe: parameters.active_pwm=%d\n", parameters.active_pwm); | 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); | 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); | |||||
} |
#define SENSOR_UNTEN 12 | #define SENSOR_UNTEN 12 | ||||
#define OE 14 | #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 }; | enum vorgabe_typ_t { VORGABE_PROZENT = 0, VORGABE_12BIT = 1 }; | ||||
// Parameter section | // Parameter section | ||||
void set_idle_pwm_max(const uint16_t value, const vorgabe_typ_t vorgabe_typ); | 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_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 | #endif // __TREPPE_H |