-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marvin Roger
committed
Apr 14, 2016
1 parent
6fe93a5
commit 2bc6c8d
Showing
3 changed files
with
19 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,16 +252,14 @@ void BootNormal::_mqttCallback(char* topic, char* payload) { | |
} | ||
} | ||
|
||
if (homieNodePropertyIndex == -1) { | ||
if (!homieNode->getSubscribeToAll() && homieNodePropertyIndex == -1) { | ||
Logger.log(F("Node ")); | ||
Logger.log(node); | ||
Logger.log(F(" not subscribed to ")); | ||
Logger.logln(property); | ||
return; | ||
} | ||
|
||
Subscription homieNodeSubscription = homieNode->getSubscriptions()[homieNodePropertyIndex]; | ||
|
||
Logger.logln(F("Calling global input handler...")); | ||
bool handled = this->_interface->globalInputHandler(node, property, message); | ||
if (handled) return; | ||
|
@@ -270,8 +268,12 @@ void BootNormal::_mqttCallback(char* topic, char* payload) { | |
handled = homieNode->getInputHandler()(property, message); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
marvinroger
Member
|
||
if (handled) return; | ||
|
||
Logger.logln(F("Calling property input handler...")); | ||
handled = homieNodeSubscription.inputHandler(message); | ||
if (homieNodePropertyIndex != -1) { // might not if subscribed to all only | ||
Subscription homieNodeSubscription = homieNode->getSubscriptions()[homieNodePropertyIndex]; | ||
Logger.logln(F("Calling property input handler...")); | ||
handled = homieNodeSubscription.inputHandler(message); | ||
} | ||
|
||
if (!handled){ | ||
Logger.logln(F("No handlers handled the following packet:")); | ||
Logger.log(F(" • Node ID: ")); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Does this line not make the mods below unnecessary? I think the issue I had was the original code would return if the property index == -1. Now that won't happen this call will return true in which case the new code will not be called, or it returns false in which case the handler gets called twice (and will return false twice).
Maybe I'm misreading the code :)