Skip to content

Commit

Permalink
0.44
Browse files Browse the repository at this point in the history
- Fixes a bug where awtrix crashs on a buttonpress when HA discovery is disabled
  • Loading branch information
Blueforcer committed Mar 30, 2023
1 parent 7bb1e5d commit 27adf23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ IPAddress gateway;
IPAddress subnet;
IPAddress primaryDNS;
IPAddress secondaryDNS;
const char *VERSION = "0.43";
const char *VERSION = "0.44";
String MQTT_HOST = "";
uint16_t MQTT_PORT = 1883;
String MQTT_USER;
Expand Down
9 changes: 6 additions & 3 deletions src/MQTTManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,15 +478,17 @@ void MQTTManager_::sendButton(byte btn, bool state)
case 0:
if (btn0State != state)
{
btnleft->setState(state, false);
if (HA_DISCOVERY)
btnleft->setState(state, false);
btn0State = state;
publish(ButtonLeftTopic, state ? State1 : State0);
}
break;
case 1:
if (btn1State != state)
{
btnmid->setState(state, false);
if (HA_DISCOVERY)
btnmid->setState(state, false);
btn1State = state;
publish(ButtonSelectTopic, state ? State1 : State0);
}
Expand All @@ -495,7 +497,8 @@ void MQTTManager_::sendButton(byte btn, bool state)
case 2:
if (btn2State != state)
{
btnright->setState(state, false);
if (HA_DISCOVERY)
btnright->setState(state, false);
btn2State = state;
publish(ButtonRightTopic, state ? State1 : State0);
}
Expand Down

0 comments on commit 27adf23

Please sign in to comment.