yozik04 / nextion

Nextion serial client
GNU Lesser General Public License v3.0
25 stars 10 forks source link

Variable name invalid for command: usup=1 #11

Closed dwjbosman closed 3 years ago

dwjbosman commented 3 years ago

Nextion editor 1.61.1

Display: Nextion enhanced NX3224K024

After using pip to install the library I got some errors regarding the "sleep" command. This was resolved after updating: #10

Now I am getting a different error when uploading. Please see the log below:

pi@raspberrypi:~/nextion $ nextion-fw-upload -v /dev/ttyS0 first.tft 2020-08-08 10:24:15,113 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 2400 2020-08-08 10:24:15,114 INFO nextion.nextion.protocol Connected to serial 2020-08-08 10:24:15,115 DEBUG nextion.nextion.protocol sent: b'DRAKJHSUYDGBNCJHGJKSHBDN' 2020-08-08 10:24:16,011 DEBUG nextion.nextion.protocol sent: b'connect' 2020-08-08 10:24:16,460 DEBUG nextion.nextion.protocol sent: b'\xff\xffconnect' 2020-08-08 10:24:16,908 WARNING nextion.nextion.client No valid reply on 2400 baud. Closing connection 2020-08-08 10:24:16,909 ERROR nextion.nextion.protocol Connection lost 2020-08-08 10:24:16,910 WARNING nextion.nextion.client Baud 2400 did not work 2020-08-08 10:24:16,910 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 4800 2020-08-08 10:24:16,912 INFO nextion.nextion.protocol Connected to serial 2020-08-08 10:24:16,913 DEBUG nextion.nextion.protocol sent: b'DRAKJHSUYDGBNCJHGJKSHBDN' 2020-08-08 10:24:17,395 DEBUG nextion.nextion.protocol sent: b'connect' 2020-08-08 10:24:17,636 DEBUG nextion.nextion.protocol sent: b'\xff\xffconnect' 2020-08-08 10:24:17,878 WARNING nextion.nextion.client No valid reply on 4800 baud. Closing connection 2020-08-08 10:24:17,878 ERROR nextion.nextion.protocol Connection lost 2020-08-08 10:24:17,879 WARNING nextion.nextion.client Baud 4800 did not work 2020-08-08 10:24:17,879 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 9600 2020-08-08 10:24:17,881 INFO nextion.nextion.protocol Connected to serial 2020-08-08 10:24:17,882 DEBUG nextion.nextion.protocol sent: b'DRAKJHSUYDGBNCJHGJKSHBDN' 2020-08-08 10:24:17,915 DEBUG nextion.nextion.protocol received: b'1a' 2020-08-08 10:24:18,051 DEBUG nextion.nextion.protocol sent: b'connect' 2020-08-08 10:24:18,132 DEBUG nextion.nextion.protocol received: b'636f6d6f6b20312c33303630312c4e58333232344b3032345f303131522c37382c36313438392c453436393938443139463131323433312c3136373737323136' 2020-08-08 10:24:18,133 INFO nextion.nextion.client Address: 30601 2020-08-08 10:24:18,134 INFO nextion.nextion.client Detected model: NX3224K024_011R 2020-08-08 10:24:18,134 INFO nextion.nextion.client Firmware version: 78 2020-08-08 10:24:18,134 INFO nextion.nextion.client Serial number: E46998D19F112431 2020-08-08 10:24:18,134 INFO nextion.nextion.client Flash size: 16777216 2020-08-08 10:24:18,135 DEBUG nextion.nextion.protocol sent: b'bkcmd=3' 2020-08-08 10:24:18,150 DEBUG nextion.nextion.protocol received: b'01' 2020-08-08 10:24:18,151 DEBUG nextion.nextion.protocol sent: b'get sleep' 2020-08-08 10:24:18,172 DEBUG nextion.nextion.protocol received: b'7100000000' 2020-08-08 10:24:18,172 INFO nextion.nextion.client Successfully connected to the device 2020-08-08 10:24:18,173 INFO nextion.nextion.client About to upload 265960 bytes 2020-08-08 10:24:18,173 DEBUG nextion.nextion.protocol sent: b'sleep=0' 2020-08-08 10:24:18,188 DEBUG nextion.nextion.protocol received: b'01' 2020-08-08 10:24:18,339 DEBUG nextion.nextion.protocol sent: b'usup=1' 2020-08-08 10:24:18,353 DEBUG nextion.nextion.protocol received: b'1a' 2020-08-08 10:24:18,354 ERROR root Failed to upload firmware Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/nextion/console_scripts/upload_firmware.py", line 14, in upload await nextion.upload_firmware(args.file, args.upload_baud) File "/home/pi/.local/lib/python3.7/site-packages/nextion/client.py", line 358, in upload_firmware await self.set("usup", 1) File "/home/pi/.local/lib/python3.7/site-packages/nextion/client.py", line 239, in set return await self.command("%s=%s" % (key, out_value), timeout=timeout) File "/home/pi/.local/lib/python3.7/site-packages/nextion/client.py", line 325, in command return await self._command(command, timeout=timeout, attempts=attempts) File "/home/pi/.local/lib/python3.7/site-packages/nextion/client.py", line 288, in _command raise CommandFailed(command, response_code) nextion.exceptions.CommandFailed: Variable name invalid for command: usup=1

dwjbosman commented 3 years ago

If I comment out the usup commands in the library, the uploading continues

yozik04 commented 3 years ago

Very strange. usup is built in variable name in Nextion protocol. https://nextion.tech/instruction-set/ Why does device send an error 1a -> Variable name invalid

yozik04 commented 3 years ago

Pushed a commit. Please verify.

yozik04 commented 3 years ago

Did it solve your problem? I want to make a release.