The timeout works for the readline().
I am also seeing some strange behaviour on the write().
I am sending commands to a Nextion display like this:
Code: Select all
def send(self, command):
write_buffer = bytearray(len(command) + 3)
write_buffer[0: len(command)] = bytes(command, 'ASCII')
write_buffer[-3:] = b'\xff\xff\xff'
Before this worked flawlessly but now starnge things happen on the display. This is extra weird because the display usually just ignores any command it doesn't understand.
I am repeatedly sending commands like this:
on a loop with a sleep(0.1)
Every other second (more or less) the display apears to receive messages like:
the same occurs for other fields. I have tried changing the timeouts but that doesn't change anything.
I can't get my head around how the numbers get duplicated At first I thought it was just the last digit that is repeated but that makes no sense since that is not the last character sent, there is always the appended b'\xff\xff\xff' to end the command.
Then I also noticed larger numbers getting doubled up occasionally.
occasionally results in the display showing 812812