bugfixes
This commit is contained in:
parent
2f6502ce20
commit
8c507083a7
@ -140,7 +140,8 @@ bool Treppe::read_sensor(int sensor)
|
|||||||
//return static_cast<bool>(pegel);
|
//return static_cast<bool>(pegel);
|
||||||
}
|
}
|
||||||
|
|
||||||
float Treppe::read_ldr(){
|
float Treppe::read_ldr()
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
Reads Illuminance in Lux
|
Reads Illuminance in Lux
|
||||||
|
|
||||||
@ -176,27 +177,28 @@ float Treppe::read_ldr(){
|
|||||||
return ldr_value;
|
return ldr_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Treppe::check_ldr()
|
bool Treppe::check_ldr()
|
||||||
{
|
{
|
||||||
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);
|
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?
|
||||||
if(read_ldr() < ldr_schwelle) active = 1;
|
float ldr = read_ldr();
|
||||||
if(read_ldr() > ldr_schwelle + LDR_HYS) active = 0;
|
if (ldr < ldr_schwelle)
|
||||||
|
active = 1;
|
||||||
|
if (ldr > ldr_schwelle + LDR_HYS)
|
||||||
|
active = 0;
|
||||||
|
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Treppe::task()
|
void Treppe::task()
|
||||||
{
|
{
|
||||||
//Serial.printf("LDR: %f\n", ((float)analogRead(A0))/1023.*3.68);
|
fsm_inputs.ldr_schwelle = check_ldr();
|
||||||
fsm_inputs.ldr_schwelle = read_ldr(); // <=== LDR implementierung !!
|
|
||||||
|
|
||||||
fsm_inputs.sensor_oben = read_sensor(SENSOR_OBEN);
|
fsm_inputs.sensor_oben = read_sensor(SENSOR_OBEN);
|
||||||
fsm_inputs.sensor_unten = read_sensor(SENSOR_UNTEN);
|
fsm_inputs.sensor_unten = read_sensor(SENSOR_UNTEN);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user