From c1c8848b0d879d2937b3f951e29ba5c5f117bd1e Mon Sep 17 00:00:00 2001 From: whowechina Date: Sat, 4 Nov 2023 19:25:52 +0800 Subject: [PATCH] Update from cli --- firmware/src/cli.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/firmware/src/cli.c b/firmware/src/cli.c index 3b38a51..535694a 100644 --- a/firmware/src/cli.c +++ b/firmware/src/cli.c @@ -6,6 +6,7 @@ #include "pico/stdio.h" #include "pico/stdlib.h" +#include "pico/bootrom.h" #include "cli.h" #include "save.h" @@ -87,6 +88,14 @@ static void handle_fps(int argc, char *argv[]) printf("FPS: core 0: %d, core 1: %d\n", fps[0], fps[1]); } +static void handle_update(int argc, char *argv[]) +{ + printf("Boot into update mode.\n"); + fflush(stdout); + sleep_ms(100); + reset_usb_boot(0, 2); +} + int cli_extract_non_neg_int(const char *param, int len) { if (len == 0) { @@ -181,4 +190,5 @@ void cli_init(const char *prompt, const char *logo) cli_register("?", handle_help, "Display this help message."); cli_register("fps", handle_fps, "Display FPS."); + cli_register("update", handle_update, "Update firmware."); }