pulkin / micropython

MicroPython implementation on Ai-Thinker GPRS module A9 (RDA8955)
https://micropython.org
MIT License
103 stars 30 forks source link

Make it possible to pass an timeout argument to sms send #66

Closed bokolob closed 3 years ago

bokolob commented 3 years ago

This line WAIT_UNTIL(sms_send_flag, TIMEOUT_SMS_SEND, 100, mp_warning(NULL, "Failed to send SMS. The module will continue attempting sending it"));

blocks code for 10 seconds, but it's not the desired behavior sometimes

pulkin commented 3 years ago

Yep, its #15. There is even a guide there.

bokolob commented 3 years ago

Ok , I will try to do it.

By the way, why not to pass events to python level and rewrite Cellular in python? Make a thin wrapper for C api. The only problem - handling events in repl. But it seems to be more convenient and “debuggable”

pulkin commented 3 years ago

There is already 'on_sms' handler. Otherwise the code is as thin as it could be. Debugging event-driven or async python code is even more difficult, especially for the port where no testing is performed. Timeout implementation similar to 'cellular.GPRS' will cover most use cases.