Lopy4 : lora callback issue
-
Hello,
the codefrom network import LoRa def onReceive(interface): print("LoRa RX Event") lora_Interface = LoRa(LoRa.LORA, region=LoRa.EU868, frequency = 868100000,bandwidth=LoRa.BW_125KHZ, sf=7, coding_rate=LoRa.CODING_4_5, preamble=8, power_mode=LoRa.ALWAYS_ON, public=False) lora_Interface.callback(trigger=LoRa.RX_PACKET_EVENT, handler=onReceive)works well.
But if I add at the endwhile True: passthe callback is no longer run.
If I stop using ctrl-c, the callback is called.
Is this normal?
Is the callback not an interrupt?Thanks
Thierry -
@Thierry Something similar happened to me awhile back, but not with Lora callbacks, but with threads. I remember what I ended up doing was adding a short sleep (something like
sleep_ms(10)) to the main loop. That way the loop would yield occasionally, and threads would execute correctly. Maybe try doing this?This is the thread where this was discussed: https://forum.pycom.io/topic/5805/main-thread-blocks-auxiliary-threads-_thread-module/6?_=1600903682512
-
I think @d-alvrzx is correct here. You need some 'idle' time on the CPU for the callback to be registered. I believe its not a hardware routine that is used for the callback, but merely on top of the RTOS.
-
This post is deleted!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login