Resolves #38: Add KC.DEBUG to toggle log spew at runtime
This commit is contained in:
		@@ -233,6 +233,7 @@
 | 
			
		||||
|Key                    |Description                                                          |
 | 
			
		||||
|-----------------------|---------------------------------------------------------------------|
 | 
			
		||||
|`KC.RESET`             |Put the keyboard into DFU mode for flashing                          |
 | 
			
		||||
|`KC.DEBUG`             |Toggle `debug_enabled`, which enables log spew to serial console     |
 | 
			
		||||
|`KC.GESC`              |Escape when tapped, <code>`</code> when pressed with Shift or GUI|
 | 
			
		||||
|`KC.LEAD`              |The [Leader key]                                                     |
 | 
			
		||||
|`KC.UC_MODE_NOOP`      |Sets UnicodeMode to NOOP                                             |
 | 
			
		||||
@@ -289,4 +290,4 @@
 | 
			
		||||
|`RCAG_T(kc)`|                                       |Right Control, Alt and GUI when held, `kc` when tapped |
 | 
			
		||||
|`ALL_T(kc)` |                                       |Left Control, Shift, Alt and GUI when held, `kc` when tapped - more info [here](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)|
 | 
			
		||||
|`SGUI_T(kc)`|`SCMD_T(kc)`, `SWIN_T(kc)`             |Left Shift and GUI when held, `kc` when tapped         |
 | 
			
		||||
|`LCA_T(kc)` |                                       |Left Control and Alt when held, `kc` when tapped       |
 | 
			
		||||
|`LCA_T(kc)` |                                       |Left Control and Alt when held, `kc` when tapped       |
 | 
			
		||||
 
 | 
			
		||||
@@ -45,6 +45,7 @@ class InternalState:
 | 
			
		||||
            RawKeycodes.KC_MACRO: self._kc_macro,
 | 
			
		||||
            Keycodes.KMK.KC_LEAD.code: self._kc_lead,
 | 
			
		||||
            Keycodes.KMK.KC_NO.code: self._kc_no,
 | 
			
		||||
            Keycodes.KMK.KC_DEBUG.code: self._kc_debug_mode,
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    def __repr__(self):
 | 
			
		||||
@@ -291,6 +292,17 @@ class InternalState:
 | 
			
		||||
    def _kc_no(self, changed_key, is_pressed):
 | 
			
		||||
        return self
 | 
			
		||||
 | 
			
		||||
    def _kc_debug_mode(self, changed_key, is_pressed):
 | 
			
		||||
        if is_pressed:
 | 
			
		||||
            if self.config.debug_enabled:
 | 
			
		||||
                print('Disabling debug mode, bye!')
 | 
			
		||||
            else:
 | 
			
		||||
                print('Enabling debug mode. Welcome to the jungle.')
 | 
			
		||||
 | 
			
		||||
            self.config.debug_enabled = not self.config.debug_enabled
 | 
			
		||||
 | 
			
		||||
        return self
 | 
			
		||||
 | 
			
		||||
    def _begin_leader_mode(self):
 | 
			
		||||
        if self.leader_mode % 2 == 0:
 | 
			
		||||
            self.keys_pressed.discard(Keycodes.KMK.KC_LEAD)
 | 
			
		||||
 
 | 
			
		||||
@@ -530,6 +530,7 @@ class KMK(KeycodeCategory):
 | 
			
		||||
    KC_LOCK = Keycode(1006)
 | 
			
		||||
    KC_NO = Keycode(1107)
 | 
			
		||||
    KC_TRANSPARENT = KC_TRNS = Keycode(1108)
 | 
			
		||||
    KC_DEBUG = KC_DBG = Keycode(1112)
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def KC_UC_MODE(mode):
 | 
			
		||||
 
 | 
			
		||||
@@ -81,7 +81,7 @@ keyboard.keymap = [
 | 
			
		||||
        [KC.GRV,  KC.EXLM, KC.AT,   KC.HASH, KC.DLR,  KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.LPRN, KC.RPRN, KC.SLSH],
 | 
			
		||||
        [KC.TAB,  xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, KC.MINS],
 | 
			
		||||
        [KC.LGUI, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx],
 | 
			
		||||
        [KC.LCTL, xxxxxxx, xxxxxxx, xxxxxxx, _______, _______, xxxxxxx, xxxxxxx, KC.MUTE, KC.VOLD, KC.VOLU, xxxxxxx],
 | 
			
		||||
        [KC.LCTL, KC.DBG,  xxxxxxx, xxxxxxx, _______, _______, xxxxxxx, xxxxxxx, KC.MUTE, KC.VOLD, KC.VOLU, xxxxxxx],
 | 
			
		||||
    ],
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user