mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-11-04 07:12:33 +01:00 
			
		
		
		
	[Keyboard] Fixes to make snes_macropad play nicer with qmk configurator (#22432)
* [Keyboard] Change default implementation for get_layer_name_user Will now show the layer number instead of "Unknown", since this is what will be shown if QMK Configurator is used to compile the firmware. * [Keyboard] Update the layout info This makes it look sort of like a macropad + gamepad rather than an 4x6 ortholinear keyboard. * [Keyboard] Fix default implementation of get_layer_name_user Based on feedback from code review the implementation was swapped in favor of using get_u8_str. This implied a change to the argument type from int to uint8_t, which cascaded into the existing keymaps. (This made sense in general, since the return type of get_highest_layer is also a uint8_t.)
This commit is contained in:
		
							parent
							
								
									0189c485b9
								
							
						
					
					
						commit
						c2326c05c0
					
				@ -45,18 +45,18 @@
 | 
				
			|||||||
                {"matrix": [2, 2], "x": 2, "y": 2},
 | 
					                {"matrix": [2, 2], "x": 2, "y": 2},
 | 
				
			||||||
                {"matrix": [2, 3], "x": 3, "y": 2},
 | 
					                {"matrix": [2, 3], "x": 3, "y": 2},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                {"matrix": [3, 0], "x": 0, "y": 3},
 | 
					                {"matrix": [3, 0], "x": 5.2, "y": 0, "w": 2, "h": 0.75},
 | 
				
			||||||
                {"matrix": [3, 1], "x": 1, "y": 3},
 | 
					                {"matrix": [3, 1], "x": 10.65, "y": 0, "w": 2, "h": 0.75},
 | 
				
			||||||
                {"matrix": [3, 2], "x": 2, "y": 3},
 | 
					                {"matrix": [3, 2], "x": 7.9, "y": 2.5, "w": 1, "h": 0.75},
 | 
				
			||||||
                {"matrix": [3, 3], "x": 3, "y": 3},
 | 
					                {"matrix": [3, 3], "x": 8.9, "y": 2.5, "w": 1, "h": 0.75},
 | 
				
			||||||
                {"matrix": [4, 0], "x": 0, "y": 4},
 | 
					                {"matrix": [4, 0], "x": 6, "y": 1, "w": 0.85, "h": 0.85},
 | 
				
			||||||
                {"matrix": [4, 1], "x": 1, "y": 4},
 | 
					                {"matrix": [4, 1], "x": 6, "y": 3, "w": 0.85, "h": 0.85},
 | 
				
			||||||
                {"matrix": [4, 2], "x": 2, "y": 4},
 | 
					                {"matrix": [4, 2], "x": 5.2, "y": 2, "w": 0.85, "h": 0.85},
 | 
				
			||||||
                {"matrix": [4, 3], "x": 3, "y": 4},
 | 
					                {"matrix": [4, 3], "x": 6.8, "y": 2, "w": 0.85, "h": 0.85},
 | 
				
			||||||
                {"matrix": [5, 0], "x": 0, "y": 5},
 | 
					                {"matrix": [5, 0], "x": 11.8, "y": 2, "w": 0.85, "h": 0.85},
 | 
				
			||||||
                {"matrix": [5, 1], "x": 1, "y": 5},
 | 
					                {"matrix": [5, 1], "x": 11, "y": 3, "w": 0.85, "h": 0.85},
 | 
				
			||||||
                {"matrix": [5, 2], "x": 2, "y": 5},
 | 
					                {"matrix": [5, 2], "x": 11, "y": 1, "w": 0.85, "h": 0.85},
 | 
				
			||||||
                {"matrix": [5, 3], "x": 3, "y": 5}
 | 
					                {"matrix": [5, 3], "x": 10.2, "y": 2, "w": 0.85, "h": 0.85}
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
				
			|||||||
@ -61,7 +61,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
// clang-format on
 | 
					// clang-format on
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char* get_layer_name_user(int layer) {
 | 
					const char* get_layer_name_user(uint8_t layer) {
 | 
				
			||||||
    switch (layer) {
 | 
					    switch (layer) {
 | 
				
			||||||
        case L_Numpad:
 | 
					        case L_Numpad:
 | 
				
			||||||
            return "Numpad";
 | 
					            return "Numpad";
 | 
				
			||||||
 | 
				
			|||||||
@ -81,7 +81,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
// clang-format on
 | 
					// clang-format on
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char * get_layer_name_user(int layer) {
 | 
					const char * get_layer_name_user(uint8_t layer) {
 | 
				
			||||||
    switch (layer) {
 | 
					    switch (layer) {
 | 
				
			||||||
        case L_Numpad:
 | 
					        case L_Numpad:
 | 
				
			||||||
            return "Numpad";
 | 
					            return "Numpad";
 | 
				
			||||||
 | 
				
			|||||||
@ -61,7 +61,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
// clang-format on
 | 
					// clang-format on
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char * get_layer_name_user(int layer) {
 | 
					const char * get_layer_name_user(uint8_t layer) {
 | 
				
			||||||
    switch (layer) {
 | 
					    switch (layer) {
 | 
				
			||||||
        case L_Numpad:
 | 
					        case L_Numpad:
 | 
				
			||||||
            return "Numpad";
 | 
					            return "Numpad";
 | 
				
			||||||
 | 
				
			|||||||
@ -57,8 +57,8 @@ static void oled_render_keylog(void) {
 | 
				
			|||||||
    oled_write_char(key_name, false);
 | 
					    oled_write_char(key_name, false);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__attribute__((weak)) const char * get_layer_name_user(int layer) {
 | 
					__attribute__((weak)) const char * get_layer_name_user(uint8_t layer) {
 | 
				
			||||||
    return "Unknown";
 | 
					    return get_u8_str(layer, ' ');
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void oled_render_layer(void) {
 | 
					static void oled_render_layer(void) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user