mirror of
https://github.com/whowechina/diva_pico.git
synced 2026-10-02 19:58:02 +03:00
Slider debug feature
This commit is contained in:
+11
-1
@@ -22,9 +22,12 @@ static const char *commands[MAX_COMMANDS];
|
||||
static const char *helps[MAX_COMMANDS];
|
||||
static cmd_handler_t handlers[MAX_COMMANDS];
|
||||
static int max_cmd_len = 0;
|
||||
|
||||
static int num_commands = 0;
|
||||
|
||||
__attribute__((weak)) void cli_ctrl_c_cb(void)
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t board_id_64()
|
||||
{
|
||||
pico_unique_board_id_t id;
|
||||
@@ -179,6 +182,13 @@ void cli_run()
|
||||
if (c < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (c == 0x03) { /* Ctrl+C */
|
||||
cli_ctrl_c_cb();
|
||||
cmd_len = 0;
|
||||
printf("^C\n%s", cli_prompt);
|
||||
return;
|
||||
}
|
||||
|
||||
if (c == '\b' || c == 127) { // both backspace and delete
|
||||
if (cmd_len > 0) {
|
||||
|
||||
+16
-2
@@ -13,6 +13,8 @@
|
||||
#include "savedata.h"
|
||||
#include "cli.h"
|
||||
|
||||
#include "slide.h"
|
||||
|
||||
#include "usb_descriptors.h"
|
||||
|
||||
#define SENSE_LIMIT_MAX 9
|
||||
@@ -386,23 +388,35 @@ static void handle_trigger(int argc, char *argv[])
|
||||
|
||||
static void handle_debug(int argc, char *argv[])
|
||||
{
|
||||
const char *usage = "Usage: debug <sensor>\n";
|
||||
const char *usage = "Usage: debug <sensor|slider_cluster|xxxx>\n";
|
||||
if (argc != 1) {
|
||||
printf(usage);
|
||||
return;
|
||||
}
|
||||
const char *choices[] = {"sensor"};
|
||||
const char *choices[] = {"sensor", "slider_cluster"};
|
||||
switch (cli_match_prefix(choices, count_of(choices), argv[0])) {
|
||||
case 0:
|
||||
diva_runtime.debug.sensor ^= true;
|
||||
hebtn_debug(diva_runtime.debug.sensor);
|
||||
break;
|
||||
case 1:
|
||||
diva_runtime.debug.slide_cluster ^= true;
|
||||
slide_set_debug_cluster(diva_runtime.debug.slide_cluster);
|
||||
break;
|
||||
default:
|
||||
printf(usage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void cli_ctrl_c_cb(void)
|
||||
{
|
||||
diva_runtime.debug.sensor = false;
|
||||
diva_runtime.debug.slide_cluster = false;
|
||||
hebtn_debug(false);
|
||||
slide_set_debug_cluster(false);
|
||||
}
|
||||
|
||||
static void handle_save()
|
||||
{
|
||||
savedata_request(true);
|
||||
|
||||
@@ -42,6 +42,7 @@ typedef struct {
|
||||
bool hid_ps4;
|
||||
struct {
|
||||
bool sensor;
|
||||
bool slide_cluster;
|
||||
} debug;
|
||||
} diva_runtime_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user