joopert / nad_receiver

python api to connect to NAD receivers
MIT License
12 stars 18 forks source link

Commands on rs232 running slowly #46

Closed joopert closed 3 years ago

joopert commented 3 years ago

I noticed that commands were taking a long time by adding some logging ... the time between written and completing the read was 1 second.

2020-12-25 13:29:16 DEBUG (SyncWorker_53) [nad_receiver] before executing command ...2020-12-25 13:29:16.016777
2020-12-25 13:29:16 DEBUG (SyncWorker_53) [nad_receiver.transport] communicate ...2020-12-25 13:29:16.017031
2020-12-25 13:29:16 DEBUG (SyncWorker_53) [nad_receiver.transport] open connection...2020-12-25 13:29:16.017288
2020-12-25 13:29:16 DEBUG (SyncWorker_53) [nad_receiver.transport] connection open ...2020-12-25 13:29:16.017543
2020-12-25 13:29:16 DEBUG (SyncWorker_53) [nad_receiver.transport] written command to nad ...2020-12-25 13:29:16.018813
2020-12-25 13:29:17 DEBUG (SyncWorker_53) [nad_receiver.transport] read complete msg ... 2020-12-25 13:29:17.052926
2020-12-25 13:29:17 DEBUG (SyncWorker_53) [nad_receiver] sent: 'Main.Volume?' reply: 'Main.Volume=-48' 2020-12-25 13:29:17.053688
2020-12-25 13:29:17 DEBUG (SyncWorker_53) [nad_receiver] before executing command ... 2020-12-25 13:29:17.054050
2020-12-25 13:29:17 DEBUG (SyncWorker_53) [nad_receiver.transport] communicate ...2020-12-25 13:29:17.054306
2020-12-25 13:29:17 DEBUG (SyncWorker_53) [nad_receiver.transport] open connection...2020-12-25 13:29:17.054568
2020-12-25 13:29:17 DEBUG (SyncWorker_53) [nad_receiver.transport] connection open ...2020-12-25 13:29:17.054825
2020-12-25 13:29:17 DEBUG (SyncWorker_53) [nad_receiver.transport] written command to nad ...2020-12-25 13:29:17.056137
2020-12-25 13:29:18 DEBUG (SyncWorker_53) [nad_receiver.transport] read complete msg ... 2020-12-25 13:29:18.095805
2020-12-25 13:29:18 DEBUG (SyncWorker_53) [nad_receiver] sent: 'Main.Source?' reply: 'Main.Source=6'2020-12-25 13:29:18.096561

We are using the read_until method, and we send the string "\r" to it, it is unable to find that in the return value of nad, and gets into the timeout (1 second). "\r" should not be a string but bytes. Using the serial.CR variable helps.