]> granicus.if.org Git - esp-idf/commitdiff
idf_monitor: Exit with CTRL+X in menu
authorPer-Olov Jernberg <possan@possan.se>
Sun, 6 Oct 2019 13:03:23 +0000 (15:03 +0200)
committerbot <bot@espressif.com>
Tue, 8 Oct 2019 08:15:51 +0000 (08:15 +0000)
Currently, the only way of exiting the idf_monitor program is to hit the CTRL+] button, if your keyboard doesn't have that key unless you hit another modifier key, it's not super trivial to exit.

This change adds the option to exit with CTRL+T (for menu) then hitting X (or CTRL+X) for exiting.

Closes https://github.com/espressif/esp-idf/pull/4167
Closes https://github.com/espressif/esp-idf/issues/4129

docs/en/api-guides/tools/idf-monitor.rst
tools/idf_monitor.py

index c7da5f1e08bb285465300e7d76702bcd2e1e6d58..c93b31f2f218de405e10b3b9b05ea8261db63954 100644 (file)
@@ -40,6 +40,8 @@ For easy interaction with IDF Monitor, use the keyboard shortcuts given in the t
 +-------------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 |  - Ctrl+H (or H)  | Display all keyboard shortcuts                         |                                                                                                                                                                  |
 +-------------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+|  - Ctrl+X (or X)  | Exit the program                                       |                                                                                                                                                                  |
++-------------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 
 Any keys pressed, other than ``Ctrl-]`` and ``Ctrl-T``, will be sent through the serial port.
 
index 2076c012dcb73189e8e31baf1b6d14efdbbe564e..ff34019dabdc7bb288c32faed6b070d05cf3539d 100755 (executable)
@@ -65,6 +65,7 @@ CTRL_R = '\x12'
 CTRL_T = '\x14'
 CTRL_Y = '\x19'
 CTRL_P = '\x10'
+CTRL_X = '\x18'
 CTRL_L = '\x0c'
 CTRL_RBRACKET = '\x1d'  # Ctrl+]
 
@@ -272,6 +273,8 @@ class ConsoleParser(object):
             yellow_print("Pause app (enter bootloader mode), press Ctrl-T Ctrl-R to restart")
             # to fast trigger pause without press menu key
             ret = (TAG_CMD, CMD_ENTER_BOOT)
+        elif c in [CTRL_X, 'x', 'X']:  # Exiting from within the menu
+            ret = (TAG_CMD, CMD_STOP)
         else:
             red_print('--- unknown menu character {} --'.format(key_description(c)))
 
@@ -294,6 +297,7 @@ class ConsoleParser(object):
             ---    {output:14} Toggle output display
             ---    {log:14} Toggle saving output into file
             ---    {pause:14} Reset target into bootloader to pause app via RTS line
+            ---    {menuexit:14} Exit program
         """.format(version=__version__,
                    exit=key_description(self.exit_key),
                    menu=key_description(self.menu_key),
@@ -302,7 +306,8 @@ class ConsoleParser(object):
                    appmake=key_description(CTRL_A) + ' (or A)',
                    output=key_description(CTRL_Y),
                    log=key_description(CTRL_L),
-                   pause=key_description(CTRL_P))
+                   pause=key_description(CTRL_P),
+                   menuexit=key_description(CTRL_X) + ' (or X)')
         return textwrap.dedent(text)
 
     def get_next_action_text(self):