]> granicus.if.org Git - esp-idf/commitdiff
feat(monitor): add pause feature.
authormichael <xiaoxufeng@espressif.com>
Thu, 30 Nov 2017 04:46:08 +0000 (12:46 +0800)
committermichael <xiaoxufeng@espressif.com>
Thu, 14 Dec 2017 05:48:03 +0000 (13:48 +0800)
docs/get-started/idf-monitor.rst
tools/idf_monitor.py

index 488b96abb15fef8cf1b0b3a61185f101e2c85725..e1ec23cb3dfebea25854b83fe2e209b15191e3aa 100644 (file)
@@ -89,6 +89,14 @@ Quick Reset
 The keyboard shortcut ``Ctrl-T Ctrl-R`` will reset the target board via the RTS line (if it is connected.)
 
 
+Pause the Application
+=====================
+
+The keyboard shortcut ``Ctrl-T Ctrl-P`` will reset the target into bootloader, so that the board will run nothing. This is
+useful when you want to wait for another device to startup. Then shortcut ``Ctrl-T Ctrl-R`` can be used to restart the
+application.
+
+
 Toggle Output Display
 =====================
 
index d1de35579d5d1e63845d7917700d99cc054784e9..21b59a10323bb6c80cf78536e84be3dec37d654d 100755 (executable)
@@ -56,6 +56,7 @@ CTRL_H = '\x08'
 CTRL_R = '\x12'
 CTRL_T = '\x14'
 CTRL_Y = '\x19'
+CTRL_P = '\x10'
 CTRL_RBRACKET = '\x1d'  # Ctrl+]
 
 # ANSI terminal codes
@@ -330,6 +331,16 @@ class Monitor(object):
             self.run_make("app-flash")
         elif c == CTRL_Y:  # Toggle output display
             self.output_toggle()
+        elif c == CTRL_P:
+            yellow_print("Pause app (enter bootloader mode), press Ctrl-T Ctrl-R to restart")
+            # to fast trigger pause without press menu key
+            self.serial.setDTR(False)  # IO0=HIGH
+            self.serial.setRTS(True)   # EN=LOW, chip in reset
+            time.sleep(1.3) # timeouts taken from esptool.py, includes esp32r0 workaround. defaults: 0.1
+            self.serial.setDTR(True)   # IO0=LOW
+            self.serial.setRTS(False)  # EN=HIGH, chip out of reset
+            time.sleep(0.45) # timeouts taken from esptool.py, includes esp32r0 workaround. defaults: 0.05
+            self.serial.setDTR(False)  # IO0=HIGH, done
         else:
             red_print('--- unknown menu character {} --'.format(key_description(c)))
 
@@ -347,6 +358,7 @@ class Monitor(object):
 ---    {make:7} Run 'make flash' to build & flash
 ---    {appmake:7} Run 'make app-flash to build & flash app
 ---    {output:7} Toggle output display
+---    {pause:7} Reset target into bootloader to pause app via RTS line
 """.format(version=__version__,
            exit=key_description(self.exit_key),
            menu=key_description(self.menu_key),
@@ -354,6 +366,7 @@ class Monitor(object):
            make=key_description(CTRL_F),
            appmake=key_description(CTRL_A),
            output=key_description(CTRL_Y),
+           pause=key_description(CTRL_P),
            )
 
     def __enter__(self):