-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsubscribe gpio.trig #1134
Comments
You just set the GPIO mode to other than interrupt, say input and this clears down any associated triggers. When you say "instantly reboots" I think you mean " throws a Lua error and because I haven't done a protected call, this triggers an unprotected call exception which the RTS handles by doing a PANIC restart." See #1119 |
I don't think it throws a lua error, there is no panic message, just the short sequence of garbage characters and a reboot. Looks the same as a node.restart(). Which is why I described it as an instant reboot. It looks like there is an error case in the c code that isn't handled when an unexpected word is used for what to trigger on. |
OK, I will take a look today. |
I have just put a fix in for this. See #1136 Sorry but I done want to allow "none". The problem is that the previous algo defaulted to interrupts disabled if the option was one that it did know about. Hence if you mistyped "up" say as "yp", this would fail silently and disable the trigger. The correct action is to omit the argument. |
@UncleRedz if you don't mind we're now tracking this through PR #1136 so I will close this. Rgds Terry |
See also #1141. Your comments will be appreciated. |
This may have been an undocumented feature, but with the old gpio implementation, you could unsubscribe the callback for a specific pin by writing something like this,
gpio.trig(2,"none")
As the word "none" was not recognised, the code simply removed the callback.
Running the same code on dev now after TerryE rewrite, the ESP8266 instantly reboots.
I don't see in the docs that there is any way to unsubscribe, but it would be nice if it was possible. At the very least, the instant reboot should be fixed.
(On a side note, after very brief testing, gpio trig seems more stable now.)
Thanks for your efforts with the NodeMCU firmware.
The text was updated successfully, but these errors were encountered: