mirror of
https://github.com/whowechina/chu_pico.git
synced 2025-01-31 12:03:43 +01:00
Tweak option to skip splitter LED
This commit is contained in:
parent
5447fb843a
commit
25fd7475ae
Binary file not shown.
@ -97,9 +97,15 @@ static void disp_aime()
|
|||||||
printf(" Mode: %d\n", chu_cfg->aime.mode);
|
printf(" Mode: %d\n", chu_cfg->aime.mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void disp_tweak()
|
||||||
|
{
|
||||||
|
printf("[Tweak]\n");
|
||||||
|
printf(" Skip Splitter LED: %s\n", chu_cfg->tweak.skip_split_led ? "ON" : "OFF");
|
||||||
|
}
|
||||||
|
|
||||||
void handle_display(int argc, char *argv[])
|
void handle_display(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
const char *usage = "Usage: display [colors|style|tof|ir|sense|hid|aime]\n";
|
const char *usage = "Usage: display [colors|style|tof|ir|sense|hid|aime|tweak]\n";
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
printf(usage);
|
printf(usage);
|
||||||
return;
|
return;
|
||||||
@ -113,10 +119,11 @@ void handle_display(int argc, char *argv[])
|
|||||||
disp_sense();
|
disp_sense();
|
||||||
disp_hid();
|
disp_hid();
|
||||||
disp_aime();
|
disp_aime();
|
||||||
|
disp_tweak();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *choices[] = {"colors", "style", "tof", "ir", "sense", "hid", "aime"};
|
const char *choices[] = {"colors", "style", "tof", "ir", "sense", "hid", "aime", "tweak"};
|
||||||
switch (cli_match_prefix(choices, count_of(choices), argv[0])) {
|
switch (cli_match_prefix(choices, count_of(choices), argv[0])) {
|
||||||
case 0:
|
case 0:
|
||||||
disp_colors();
|
disp_colors();
|
||||||
@ -139,6 +146,9 @@ void handle_display(int argc, char *argv[])
|
|||||||
case 6:
|
case 6:
|
||||||
disp_aime();
|
disp_aime();
|
||||||
break;
|
break;
|
||||||
|
case 7:
|
||||||
|
disp_tweak();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printf(usage);
|
printf(usage);
|
||||||
break;
|
break;
|
||||||
@ -552,6 +562,36 @@ static void handle_aime(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_tweak(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
const char *usage = "Usage: tweak skip_split <on|off>\n";
|
||||||
|
if (argc < 1) {
|
||||||
|
printf("%s", usage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const char *options[] = { "skip_split" };
|
||||||
|
int match = cli_match_prefix(options, count_of(options), argv[0]);
|
||||||
|
if (match < 0) {
|
||||||
|
printf("%s", usage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match == 0) {
|
||||||
|
if (argc != 2) {
|
||||||
|
printf("%s", usage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const char *on_off[] = { "off", "on" };
|
||||||
|
int on = cli_match_prefix(on_off, count_of(on_off), argv[1]);
|
||||||
|
if (on < 0) {
|
||||||
|
printf("%s", usage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
chu_cfg->tweak.skip_split_led = (on > 0);
|
||||||
|
}
|
||||||
|
config_changed();
|
||||||
|
}
|
||||||
|
|
||||||
void commands_init()
|
void commands_init()
|
||||||
{
|
{
|
||||||
cli_register("display", handle_display, "Display all config.");
|
cli_register("display", handle_display, "Display all config.");
|
||||||
@ -564,6 +604,7 @@ void commands_init()
|
|||||||
cli_register("sense", handle_sense, "Set sensitivity config.");
|
cli_register("sense", handle_sense, "Set sensitivity config.");
|
||||||
cli_register("debounce", handle_debounce, "Set debounce config.");
|
cli_register("debounce", handle_debounce, "Set debounce config.");
|
||||||
cli_register("raw", handle_raw, "Show key raw readings.");
|
cli_register("raw", handle_raw, "Show key raw readings.");
|
||||||
|
cli_register("tweak", handle_tweak, "Tweak options.");
|
||||||
cli_register("save", handle_save, "Save config to flash.");
|
cli_register("save", handle_save, "Save config to flash.");
|
||||||
cli_register("factory", handle_factory_reset, "Reset everything to default.");
|
cli_register("factory", handle_factory_reset, "Reset everything to default.");
|
||||||
cli_register("nfc", handle_nfc, "NFC debug.");
|
cli_register("nfc", handle_nfc, "NFC debug.");
|
||||||
|
@ -47,6 +47,9 @@ static chu_cfg_t default_cfg = {
|
|||||||
.base = { 3800, 3800, 3800, 3800, 3800, 3800 },
|
.base = { 3800, 3800, 3800, 3800, 3800, 3800 },
|
||||||
.trigger = { 20, 20, 20, 20, 20, 20 },
|
.trigger = { 20, 20, 20, 20, 20, 20 },
|
||||||
},
|
},
|
||||||
|
.tweak = {
|
||||||
|
.skip_split_led = false,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
chu_runtime_t chu_runtime = {0};
|
chu_runtime_t chu_runtime = {0};
|
||||||
|
@ -47,6 +47,10 @@ typedef struct __attribute__((packed)) {
|
|||||||
uint16_t base[6];
|
uint16_t base[6];
|
||||||
uint8_t trigger[6];
|
uint8_t trigger[6];
|
||||||
} ir;
|
} ir;
|
||||||
|
struct {
|
||||||
|
bool skip_split_led;
|
||||||
|
uint8_t reserved[7];
|
||||||
|
} tweak;
|
||||||
} chu_cfg_t;
|
} chu_cfg_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -91,6 +91,9 @@ static void drive_led()
|
|||||||
last = now;
|
last = now;
|
||||||
|
|
||||||
for (int i = 30; i >= 0; i--) {
|
for (int i = 30; i >= 0; i--) {
|
||||||
|
if (chu_cfg->tweak.skip_split_led && (i % 2 == 1)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
pio_sm_put_blocking(pio0, 0, buf_main[i] << 8u);
|
pio_sm_put_blocking(pio0, 0, buf_main[i] << 8u);
|
||||||
}
|
}
|
||||||
for (int i = 31; i < count_of(buf_main); i++) {
|
for (int i = 31; i < count_of(buf_main); i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user