Switch Programming-LED also via Bus/ETS

This commit is contained in:
Waldemar Porscha 2019-08-16 19:03:23 +02:00
parent 527a081c0c
commit 813150e5d9

View File

@ -17,11 +17,13 @@ Bau57B0 bau(platform);
#endif
bool _toogleProgMode = false;
bool _progLedState = false;
#ifndef __linux__
KnxFacade knx(bau);
ICACHE_RAM_ATTR void buttonUp()
{
_toogleProgMode = true;
_toogleProgMode = true;
}
#endif
@ -48,17 +50,6 @@ bool KnxFacade::progMode()
void KnxFacade::progMode(bool value)
{
if (value)
{
println("progmode on");
digitalWrite(knx.ledPin(), _ledPinActiveOn);
}
else
{
println("progmode off");
digitalWrite(knx.ledPin(), HIGH - _ledPinActiveOn);
}
_bau.deviceObject().progMode(value);
}
@ -109,11 +100,25 @@ void KnxFacade::writeMemory()
void KnxFacade::loop()
{
if(_toogleProgMode)
{
progMode(!progMode());
_toogleProgMode = false;
}
if (progMode() != _progLedState)
{
_progLedState = progMode();
if (_progLedState)
{
println("progmode on");
digitalWrite(knx.ledPin(), _ledPinActiveOn);
}
else
{
println("progmode off");
digitalWrite(knx.ledPin(), HIGH - _ledPinActiveOn);
}
}
if (_toogleProgMode)
{
progMode(!progMode());
_toogleProgMode = false;
}
_bau.loop();
}