diff --git a/Production/Firmware/diva_pico.uf2 b/Production/Firmware/diva_pico.uf2 index 1a3d991..f506af0 100644 Binary files a/Production/Firmware/diva_pico.uf2 and b/Production/Firmware/diva_pico.uf2 differ diff --git a/firmware/src/board_defs.h b/firmware/src/board_defs.h index 1f3b4f2..5d9a1fd 100644 --- a/firmware/src/board_defs.h +++ b/firmware/src/board_defs.h @@ -13,7 +13,7 @@ #define RGB_PIN 2 #define RGB_ORDER GRB // or RGB -#define RGB_BUTTON_MAP { 2, 0, 1, 3, 4 } +#define RGB_BUTTON_MAP { 3, 2, 1, 0, 4 } #define BUTTON_DEF { 12, 11, 10, 9, 13, 1, 0} // Main * 4, Start, Aux * 2 #define NKRO_KEYMAP "awsdz2swx3dec4frv5gtb6hyn7jum8ki90olp,." diff --git a/firmware/src/commands.c b/firmware/src/commands.c index 5971953..e2f6495 100644 --- a/firmware/src/commands.c +++ b/firmware/src/commands.c @@ -17,18 +17,10 @@ #define SENSE_LIMIT_MAX 9 #define SENSE_LIMIT_MIN -9 -static void disp_colors() +static void disp_light() { - printf("[Colors]\n"); - printf(" Key on: %06lx, off: %06lx\n", - diva_cfg->colors.key_on, diva_cfg->colors.key_off); -} - -static void disp_style() -{ - printf("[Style]\n"); - printf(" Key: %d, Level: %d\n", - diva_cfg->style.key, diva_cfg->style.level); + printf("[Light]\n"); + printf(" Level: %d\n", diva_cfg->light.level); } static void disp_sense() @@ -60,32 +52,28 @@ static void disp_hid() void handle_display(int argc, char *argv[]) { - const char *usage = "Usage: display [colors|style|tof|sense|hid]\n"; + const char *usage = "Usage: display [light|sense|hid]\n"; if (argc > 1) { printf(usage); return; } if (argc == 0) { - disp_colors(); - disp_style(); + disp_light(); disp_sense(); disp_hid(); return; } - const char *choices[] = {"colors", "style", "sense", "hid"}; - switch (cli_match_prefix(choices, 5, argv[0])) { + const char *choices[] = {"light", "sense", "hid"}; + switch (cli_match_prefix(choices, count_of(choices), argv[0])) { case 0: - disp_colors(); + disp_light(); break; case 1: - disp_style(); - break; - case 2: disp_sense(); break; - case 3: + case 2: disp_hid(); break; default: @@ -125,9 +113,9 @@ static void handle_level(int argc, char *argv[]) return; } - diva_cfg->style.level = level; + diva_cfg->light.level = level; config_changed(); - disp_style(); + disp_light(); } static void handle_stat(int argc, char *argv[]) diff --git a/firmware/src/config.c b/firmware/src/config.c index 6cb0124..2209129 100644 --- a/firmware/src/config.c +++ b/firmware/src/config.c @@ -12,12 +12,7 @@ diva_cfg_t *diva_cfg; static diva_cfg_t default_cfg = { - .colors = { - .key_on = 0xff0000, - .key_off = 0x000000, - }, - .style = { - .key = 0, + .light = { .level = 127, }, .sense = { @@ -36,15 +31,6 @@ diva_runtime_t *diva_runtime; static void config_loaded() { - if (diva_cfg->style.level > 10) { - diva_cfg->style.level = default_cfg.style.level; - config_changed(); - } - if ((diva_cfg->tof.offset < 40) || - (diva_cfg->tof.pitch < 4) || (diva_cfg->tof.pitch > 50)) { - diva_cfg->tof = default_cfg.tof; - config_changed(); - } if ((diva_cfg->sense.filter & 0x0f) > 3 || ((diva_cfg->sense.filter >> 4) & 0x0f) > 3) { diva_cfg->sense.filter = default_cfg.sense.filter; diff --git a/firmware/src/config.h b/firmware/src/config.h index 59b7349..9285fae 100644 --- a/firmware/src/config.h +++ b/firmware/src/config.h @@ -11,20 +11,13 @@ typedef struct __attribute__((packed)) { struct { - uint32_t key_on; - uint32_t key_off; - uint32_t gap; + uint32_t not_used[3]; } colors; struct { - uint8_t key; - uint8_t gap; - uint8_t tof; + uint8_t not_used[3]; uint8_t level; - } style; - struct { - uint8_t offset; - uint8_t pitch; - } tof; + } light; + uint8_t not_used2[2]; struct { uint8_t filter; int8_t global; diff --git a/firmware/src/main.c b/firmware/src/main.c index b7eb0ba..ca95ee5 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -142,11 +142,11 @@ static void run_lights() { uint64_t now = time_us_64(); uint32_t button_colors[] = { - rgb32(0x70, 0x08, 0x50, false), - rgb32(0x80, 0, 0, false), - rgb32(0, 0, 0x80, false), rgb32(0, 0x80, 0, false), - rgb32(0x10, 0x10, 0x10, false) + rgb32(0x70, 0x08, 0x50, false), + rgb32(0, 0, 0x80, false), + rgb32(0x80, 0, 0, false), + rgb32(0x70, 0x70, 0x00, false) }; uint16_t buttons = button_read(); diff --git a/firmware/src/rgb.c b/firmware/src/rgb.c index 5092ad6..dd2aff4 100644 --- a/firmware/src/rgb.c +++ b/firmware/src/rgb.c @@ -116,9 +116,9 @@ static inline uint32_t apply_level(uint32_t color) unsigned g = (color >> 8) & 0xff; unsigned b = color & 0xff; - r = r * diva_cfg->style.level / 255; - g = g * diva_cfg->style.level / 255; - b = b * diva_cfg->style.level / 255; + r = r * diva_cfg->light.level / 255; + g = g * diva_cfg->light.level / 255; + b = b * diva_cfg->light.level / 255; return r << 16 | g << 8 | b; }