micropython-rotary
micropython-rotary copied to clipboard
Locks up if a thread is run on core1: Pico Pi W
On Micropython 1.20 if you start a thread on Core1, even if that thread does nothing then when an IRQ is triggered from the rotary encoder on code running on Core0 the whole machine locks up e.g
on core 0
t = start_new_thread(EventManager.Start, (onKeyDown,onKeyUp)) and then some code after that to interact with the encoder using this library, which works perfectly if the thread isn't spawned first.
The thread on core 1 is intended as a class which would handle a touchscreen - I have commented out that code because the failure occurs without it. However the code does work fine on Core1. But then running anything on Core1 even the dummy code above, seems to cause the rotary encoder code to fail. (note: python indentation seems to get lost when I save the issue)
class EventManager: @staticmethod def Start(onKeyDown, onKeyUp): while True: a = 1
Problem occurs even if the while loop just has a call to time.sleep_ms(1000), it seems like if there is a process running on Core1 then IRQs fail.