mirror of
https://github.com/thelsing/knx.git
synced 2025-08-13 13:46:20 +02:00
Switch Programming-LED also via Bus/ETS
This commit is contained in:
parent
527a081c0c
commit
813150e5d9
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user