Hi all,
I have searched high and low using my google skills but I fail to come up with a working solution. I need to turn off the keyboard interrupt on the RX0 pin. Today 03h will break the program. How is this done?
I am using a Nodemcu with a ESP8266 module. The solution passing -3 to the interrupt handler does nothing as far as I can tell. I am using Tera Term to verify this behaviour and Ctr C kills the execution of the main loop every time.
Any input in this is highly appreciated.
Stop Crtl C keyboard interrupts?
Re: Stop Crtl C keyboard interrupts?
micropython.kbd_intr(chr) will do that. micropython.kbd_intr(chr) sets the interrupt to the character chr. micropython.kbd_intr(-1) disables keyboard interrupt, micropython.kbd_intr(3) sets it back to Ctrl-C
See also: http://docs.micropython.org/en/latest/l ... ython.html
See also: http://docs.micropython.org/en/latest/l ... ython.html
Re: Stop Crtl C keyboard interrupts?
That's exactly what I have tried, both in the boot file and main as first row but it doesn't make any difference from what I can see. -1 or 3 or any other number, tera term break will still break the running program and kick me out to repl. But ok if that's the magic bullet I will try more tomorrow. Thank you for verifiering that the method should give this result.
Re: Stop Crtl C keyboard interrupts?
It does only work in scripts, not in the REPL loop. During REPL mode, keyboard interrupt will always be reset to Ctrl-C. So if you make a short script like:
You can cause a keyboard interupt with the letter q.
P.S.: I hope the code works. I have no pyboard here for testing.
Code: Select all
import micropython
import time
micropython.kbd_intr(ord('q'))
while True:
print('.', end='')
time.sleep(0.5)
P.S.: I hope the code works. I have no pyboard here for testing.