loboris / MicroPython_ESP32_psRAM_LoBo

MicroPython for ESP32 with psRAM support
Other
831 stars 344 forks source link

machine Module UART how to end connection ? ( GSM USSD work around attempt ) #333

Open TravisDuck999 opened 3 years ago

TravisDuck999 commented 3 years ago

Hi.

I am trying to get around the limitation of the GSM Lib by connecting to a GSM module with UART and then finding the remaining Airtime with USSD. ( currently the GSM lib does not give the correct USSD response back, it only give s the first "ok" back. Then going back to the GSM libaray functions.

So I can get the USSD response with the manual connection through UART but when I try dissconnect from it using : uart.deinit()

I get :

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Cannot stop UART task!

Then I run uart.deinit() again and it seems happy.

But when I then try to connect to the GSM module with gsm.start() I get the error : E (958736) uart: UART driver already installed

I think it is becuase I am not cleanly breaking away from the UART connection.

Any ideas how I can do that better ?

Of course this is just a work around the real goal would be to fix the USSD function in the GSM lib.

If I could get to the source code of the GSM modual I would love to have a look at it and see if I can make a very simple delay to return the full serial response if we just make the function wait a few seconds for a longer reply, say greater than 20 chars ?

I just have no idea where to find that or how I even go about compling it into a new MicroPythoin environment.

Please let me know if I can help with this at all.

Great project by the way, I am really loving it.