ldr schwelle [lx], parameter change when inactive
This commit is contained in:
parent
0d6f0b28e2
commit
767df957cc
@ -49,7 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="param_block">
|
<div class="param_block">
|
||||||
LDR Schwelle [%]: <output id="out_ldr_shw" class="val_range">50</output> %
|
LDR Schwelle [lx]: <output id="out_ldr_shw" class="val_range">50</output> lx
|
||||||
<div class="slider">
|
<div class="slider">
|
||||||
<input type="range" class="regler" id="range_ldr_shw" data-output="out_ldr_shw" min="0" max="100" value="50">
|
<input type="range" class="regler" id="range_ldr_shw" data-output="out_ldr_shw" min="0" max="100" value="50">
|
||||||
</div>
|
</div>
|
||||||
|
@ -76,7 +76,7 @@ void HTTPServer::start_apps() {
|
|||||||
logt("set_time_ldr = %d\n", arg(i).toInt());
|
logt("set_time_ldr = %d\n", arg(i).toInt());
|
||||||
}
|
}
|
||||||
else if (argName(i).equals("range_ldr_shw")) {
|
else if (argName(i).equals("range_ldr_shw")) {
|
||||||
treppe->set_ldr_schwelle(arg(i).toInt(), VORGABE_PROZENT);
|
treppe->set_ldr_schwelle(arg(i).toInt(), VORGABE_12BIT);
|
||||||
logt("set_ldr_schwelle = %d %\n", arg(i).toInt());
|
logt("set_ldr_schwelle = %d %\n", arg(i).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ float Treppe::read_ldr() {
|
|||||||
float ldr_ohm = 40.57*(3.3-voltage)/voltage;
|
float ldr_ohm = 40.57*(3.3-voltage)/voltage;
|
||||||
float ldr_value = 6526.6 / (ldr_ohm * ldr_ohm);
|
float ldr_value = 6526.6 / (ldr_ohm * ldr_ohm);
|
||||||
#ifdef LDRDEBUG
|
#ifdef LDRDEBUG
|
||||||
Serial.printf("Ohm: %f lux: %f\n", ldr_ohm,ldr_value);
|
Serial.printf("Ohm: %f lux: %f Comp: %d\n", ldr_ohm,ldr_value, param.ldr_schwelle);
|
||||||
#endif
|
#endif
|
||||||
return ldr_value;
|
return ldr_value;
|
||||||
}
|
}
|
||||||
@ -186,8 +186,7 @@ bool Treppe::check_ldr() {
|
|||||||
static uint8_t active = 0;
|
static uint8_t active = 0;
|
||||||
|
|
||||||
#ifdef LDRDEBUG
|
#ifdef LDRDEBUG
|
||||||
Serial.printf("R(LDR) = %f kOhm %f lux\n", ldr_value, lux);
|
//return true;
|
||||||
return true;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// follow up: averaging over many samples?
|
// follow up: averaging over many samples?
|
||||||
@ -273,11 +272,16 @@ void Treppe::task() {
|
|||||||
fsm_pend.anim_beendet = dimmer_tick(&dimmer_ldr, DIM_LDR);
|
fsm_pend.anim_beendet = dimmer_tick(&dimmer_ldr, DIM_LDR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param_changed) {
|
}
|
||||||
param_changed = false;
|
|
||||||
param = param_pend;
|
if (fsm_outputs.status == ST_RUHEZUSTAND ||
|
||||||
save_param_to_eeprom();
|
fsm_outputs.status == ST_INAKTIV_LDR){
|
||||||
}
|
if (param_changed) {
|
||||||
|
param_changed = false;
|
||||||
|
param = param_pend;
|
||||||
|
save_param_to_eeprom();
|
||||||
|
Serial.printf("Parameter Change applied!\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_TIMING
|
#ifdef DEBUG_TIMING
|
||||||
@ -378,7 +382,7 @@ void Treppe::set_ldr_schwelle(const uint16_t value,
|
|||||||
// ?!
|
// ?!
|
||||||
param_pend.ldr_schwelle = 10 * value / 100;
|
param_pend.ldr_schwelle = 10 * value / 100;
|
||||||
} else if (vorgabe_typ == VORGABE_12BIT) {
|
} else if (vorgabe_typ == VORGABE_12BIT) {
|
||||||
// param_pend.ldr_schwelle = value;
|
param_pend.ldr_schwelle = value;
|
||||||
}
|
}
|
||||||
param_changed = true;
|
param_changed = true;
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#include "PCA9685.h"
|
#include "PCA9685.h"
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
|
|
||||||
// #define LDRDEBUG // comment in to override LDR measurement
|
//#define LDRDEBUG // comment in to override LDR measurement
|
||||||
#define LDR_HYS 5 // Hysteresis for switching off FSM [lux]
|
#define LDR_HYS 8 // Hysteresis for switching off FSM [lux]
|
||||||
|
|
||||||
#define SENSOR_OBEN 16
|
#define SENSOR_OBEN 16
|
||||||
#define SENSOR_UNTEN 12
|
#define SENSOR_UNTEN 12
|
||||||
@ -28,7 +28,7 @@ private:
|
|||||||
uint16_t time_per_stair = 300; // dimmtime per stair [ms]
|
uint16_t time_per_stair = 300; // dimmtime per stair [ms]
|
||||||
uint16_t idle_pwm_max = 100;
|
uint16_t idle_pwm_max = 100;
|
||||||
uint16_t active_pwm = 2000;
|
uint16_t active_pwm = 2000;
|
||||||
uint16_t ldr_schwelle = 2; // activation value for FSM [lx]
|
uint16_t ldr_schwelle = 30; // activation value for FSM [lx]
|
||||||
};
|
};
|
||||||
stairway_param_t param;
|
stairway_param_t param;
|
||||||
stairway_param_t param_pend; // zwischenspeicher änderungen
|
stairway_param_t param_pend; // zwischenspeicher änderungen
|
||||||
|
Loading…
x
Reference in New Issue
Block a user