Browse Source

Changed synchronization with the lua interpreter.

Wait for "%sync%" output from a print call. With this,
nodemcu-uploader can be used without connecting the reset line to
DTR. Reset is optional.
Jens Hauke 9 years ago
parent
commit
9303ab066a
1 changed files with 3 additions and 3 deletions
  1. 3 3
      nodemcu-uploader.py

+ 3 - 3
nodemcu-uploader.py

@@ -103,9 +103,9 @@ class Uploader:
         self._port.setDTR(False)
 
         # Get in sync with LUA (this assumes that NodeMCU gets reset by the previous two lines)
-        self.expect('NodeMCU ')
-        self.expect()
-        self.exchange('')
+        self.exchange(';'); # Get a defined state
+        self.writeln('print("%sync%");');
+        self.expect('%sync%\r\n> ');
 
         if baud != Uploader.BAUD:
             log.info('Changing communication to %s baud', baud)