From d235ecc2806d1328db63bd8fb1c3c71e405e2e77 Mon Sep 17 00:00:00 2001 From: cpq Date: Tue, 21 Apr 2026 14:45:51 +0100 Subject: [PATCH] Add dropdown --- tutorials/device-dashboard/mongoose_app.c | 4 ++++ .../device-dashboard/web_root/index.html | 20 ++++++++++++++----- tutorials/device-dashboard/web_root/style.css | 8 ++++---- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/tutorials/device-dashboard/mongoose_app.c b/tutorials/device-dashboard/mongoose_app.c index 9e47d141..f493fac8 100644 --- a/tutorials/device-dashboard/mongoose_app.c +++ b/tutorials/device-dashboard/mongoose_app.c @@ -51,17 +51,21 @@ static void sync_metrics(bool is_write) { // Read-write device settings static double s_volume = 17.2; +static int s_log_level = MG_LL_DEBUG; static char s_name[20] = "Dublin"; static struct mg_field fields_settings[] = { {"volume", MG_VAL_DBL, &s_volume, sizeof(s_volume)}, {"name", MG_VAL_STR, &s_name, sizeof(s_name)}, + {"log_level", MG_VAL_INT, &s_log_level, sizeof(s_log_level)}, {NULL, 0, NULL, 0}, }; static void sync_settings(bool is_write) { if (is_write) { + mg_log_level = s_log_level; } else { + s_log_level = mg_log_level; } } diff --git a/tutorials/device-dashboard/web_root/index.html b/tutorials/device-dashboard/web_root/index.html index f626872a..84a32ea8 100644 --- a/tutorials/device-dashboard/web_root/index.html +++ b/tutorials/device-dashboard/web_root/index.html @@ -17,7 +17,7 @@ }, settings: { volume: 12, - motor: false, + log_level: 3, name: 'Galway', }, metrics: { @@ -211,12 +211,22 @@
Device settings
- - + +
- - + + +
+
+ +