Skip to content
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

Closed
UncleRedz opened this issue Mar 8, 2016 · 6 comments
Closed

Unsubscribe gpio.trig #1134

UncleRedz opened this issue Mar 8, 2016 · 6 comments

Comments

@UncleRedz
Copy link
Contributor

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.

@TerryE
Copy link
Collaborator

TerryE commented Mar 8, 2016

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

@UncleRedz
Copy link
Contributor Author

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.

@TerryE
Copy link
Collaborator

TerryE commented Mar 8, 2016

OK, I will take a look today.

@TerryE
Copy link
Collaborator

TerryE commented Mar 8, 2016

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.

@TerryE
Copy link
Collaborator

TerryE commented Mar 8, 2016

@UncleRedz if you don't mind we're now tracking this through PR #1136 so I will close this. Rgds Terry

@TerryE TerryE closed this as completed Mar 8, 2016
@TerryE
Copy link
Collaborator

TerryE commented Mar 9, 2016

See also #1141. Your comments will be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants