Преглед на файлове

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 години
родител
ревизия
9303ab066a
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  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)