8000 sleep_time_based_on_baud leads to incomplete response.. · Issue #8 · veeso/ATtila · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

sleep_time_based_on_baud leads to incomplete response.. #8

Open
rdagher opened this issue Oct 9, 2023 · 1 comment
Open

sleep_time_based_on_baud leads to incomplete response.. #8

rdagher opened this issue Oct 9, 2023 · 1 comment

Comments

@rdagher
Copy link
rdagher commented Oct 9, 2023

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:

while (
self._device.in_waiting == 0
and sleep_time_based_on_baud > t_waiting_elapsed
):
sleep(mini_sleep_time) # 1ms
t_waiting_elapsed += mini_sleep_time
# Check if there are still data available
if self._device.in_waiting > 0:
data_still_available = True
else:
data_still_available = False
data += read_bytes

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

sleep_time_based_on_baud = 100 / self.baud_rate # Milliseconds

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

@Cloolalang
Copy link

To allow enough time to capture long responses, adjust;

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0