From bc6f8dc8b0822e5e03893eacffa42a7badb4c2fa Mon Sep 17 00:00:00 2001 From: Wilba Date: Thu, 10 Nov 2022 07:46:44 +1100 Subject: VIA V3 - The Custom UI Update (#18222) --- keyboards/wilba_tech/wt_main.c | 61 ++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 26 deletions(-) (limited to 'keyboards/wilba_tech/wt_main.c') diff --git a/keyboards/wilba_tech/wt_main.c b/keyboards/wilba_tech/wt_main.c index bc1a1d3c87..3f89066a6c 100644 --- a/keyboards/wilba_tech/wt_main.c +++ b/keyboards/wilba_tech/wt_main.c @@ -132,36 +132,45 @@ void suspend_wakeup_init_kb(void) // Moving this to the bottom of this source file is a workaround // for an intermittent compiler error for Atmel compiler. #ifdef VIA_ENABLE -void raw_hid_receive_kb(uint8_t *data, uint8_t length) { - uint8_t *command_id = &(data[0]); - uint8_t *command_data = &(data[1]); - switch ( *command_id ) - { +void via_custom_value_command_kb(uint8_t *data, uint8_t length) { + uint8_t *command_id = &(data[0]); + uint8_t *channel_id = &(data[1]); + uint8_t *value_id_and_data = &(data[2]); + #if RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED - case id_lighting_set_value: - { - backlight_config_set_value(command_data); - break; - } - case id_lighting_get_value: - { - backlight_config_get_value(command_data); - break; - } - case id_lighting_save: - { - backlight_config_save(); - break; - } -#endif // RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED - default: + if ( *channel_id == id_custom_channel ) { + switch ( *command_id ) { - // Unhandled message. - *command_id = id_unhandled; - *command_data = *command_data; // force use of variable - break; + case id_custom_set_value: + { + backlight_config_set_value(value_id_and_data); + break; + } + case id_custom_get_value: + { + backlight_config_get_value(value_id_and_data); + break; + } + case id_custom_save: + { + backlight_config_save(); + break; + } + default: + { + // Unhandled message. + *command_id = id_unhandled; + break; + } } + return; } +#else + *command_id = id_unhandled; + *channel_id = *channel_id; // force use of variable + *value_id_and_data = *value_id_and_data; // force use of variable +#endif // RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED + // DO NOT call raw_hid_send(data,length) here, let caller do this } #endif // VIA_ENABLE -- cgit v1.2.3 [cgit] Unable to lock slot /tmp/cgit/86100000.lock: No such file or directory (2)