vshymanskyy / TinyGSM

A small Arduino library for GSM modules, that just works
GNU Lesser General Public License v3.0
1.94k stars 719 forks source link

FIX TinyGsmSequansMonarch::modemGetConnected status parsing #501

Closed nvandamme closed 3 years ago

nvandamme commented 3 years ago

Hi,

Using a Sequans Monarch modem (Pycom FiPy board) with TinyGsm has been problematic because :

Only the fix related to TinyGsmSequansMonarch::modemGetConnected is included in this pull request

ffontaine commented 3 years ago

Hi,

I found several issues in the handling of Sequans Monarch GMS01Q, I'll send several PR to fix them. Especially, your second issue should be fixed by #502. If this PR is merged, I'll send additional PR to fix the registration state and to use data mode instead of text mode.

SRGDamia1 commented 3 years ago

I'm sorry, I don't understand this fix. The parseInt() function should return an int not an ASCII character.

nvandamme commented 3 years ago

@SRGDamia1 , String::parseInt() basically return a .charAt(index) that is then casted as an int resulting in an int representing the ascii code (in the parseInt implementation of the ESP32 IDF that is), for example :

String test = "2";
int converted = test.parseInt();
// converted is now equal to 50, the ascii code of "2"
// To retrieve the real int value, substract 48 to converted because the ascii code of "0" is 48
nvandamme commented 3 years ago

@ffontaine Nice catch!

nvandamme commented 3 years ago

@ffontaine It seems that your fix has solved our status parseInt problem anyhow, so we can close this PR ?

ffontaine commented 3 years ago

Good to know thanks. In case you have a registration issue with Sequans Monarch, check #503.