ATtila icon indicating copy to clipboard operation
ATtila copied to clipboard

sleep_time_based_on_baud leads to incomplete response..

Open rdagher opened this issue 2 years ago • 1 comments

Hi,

I have an AT command that returns long response (actually a json repr of a LwM2M object). When I excecute it, I get an error be cause the decoded response is incomplete: the OK line as per expected response, is not catched by the exec.

More precisely, the missed lines are due to this loop: https://github.com/veeso/ATtila/blob/0f8548d2900b4c1c68de98523006919f754cfe3d/attila/atcommunicator.py#L204-L215

Indeed, debugging shows that it did not wait "enough" for data to be ready i.e polling the condition self._device.in_waiting. So I multiplied by 10 the sleeping time in the lines https://github.com/veeso/ATtila/blob/0f8548d2900b4c1c68de98523006919f754cfe3d/attila/atcommunicator.py#L191 to become

sleep_time_based_on_baud = 1000 / self.baud_rate  # Milliseconds 

To my understanding the inverse of baudrate (units in bits/sec) is to be multiplied by 1000 to convert to ms ! @veeso, what do you think ?

This said, I did not have an issue when the response size was small...

Cheers, Roudy

rdagher avatar Oct 09 '23 08:10 rdagher

To allow enough time to capture long responses, adjust;

atcommunbicator.py line 202, mini_sleep_time = .001 ( example =9 for a 9 seconds wait)

Cloolalang avatar May 07 '24 10:05 Cloolalang