diff --git a/tutorials/device-dashboard/Makefile b/tutorials/device-dashboard/Makefile index e3646848..2fffd6ce 100644 --- a/tutorials/device-dashboard/Makefile +++ b/tutorials/device-dashboard/Makefile @@ -23,6 +23,9 @@ dashboard.html.c: dashboard.html node $(MONGOOSE_DIR)/resources/pack.js dashboard.html::gzip > $@ @echo "On-flash size: `grep -oE '[0-9]+' $@ | wc -l`" +purge: + curl -s https://purge.jsdelivr.net/gh/cesanta/mongoose@master/resources/dashboard.js + # For development: rebuild and restart if any of the sources change watch: watchexec -r -w main.c -w mongoose_dashboard.c -w $(MONGOOSE_DIR)/mongoose.h -w web_root -e c,h,html,css,js,svg,png -- make diff --git a/tutorials/device-dashboard/mongoose_dashboard.c b/tutorials/device-dashboard/mongoose_dashboard.c index 3a4354d6..166502b5 100644 --- a/tutorials/device-dashboard/mongoose_dashboard.c +++ b/tutorials/device-dashboard/mongoose_dashboard.c @@ -32,13 +32,12 @@ static void sync_leds(bool is_write) { } // Read-only device Metrics -static int s_ram = 32, s_cpu = 7, s_humidity = 59; +static int s_ram = 32, s_cpu = 7; static double s_temperature = 24.8; static struct mg_field fields_metrics[] = { {"ram", MG_VAL_INT, &s_ram, sizeof(s_ram)}, {"cpu", MG_VAL_INT, &s_cpu, sizeof(s_cpu)}, - {"humidity", MG_VAL_INT, &s_humidity, sizeof(s_humidity)}, {"temperature", MG_VAL_DBL, &s_temperature, sizeof(s_temperature)}, {NULL, 0, NULL, 0}, }; diff --git a/tutorials/device-dashboard/web_root/index.html b/tutorials/device-dashboard/web_root/index.html index ac45826d..d9f45ad9 100644 --- a/tutorials/device-dashboard/web_root/index.html +++ b/tutorials/device-dashboard/web_root/index.html @@ -12,7 +12,7 @@ chart1: {data: []}, leds: { led1: true, led2: false, led3: false }, settings: { volume: 12, log_level: 3, name: 'Galway' }, - metrics: { temperature: 1.2, humidity: 3, cpu: 4, ram: 5 }, + metrics: { temperature: 1.2, cpu: 4, ram: 5 }, files: {data: [{name: 'device-log-2026-04-25.txt', size: 8625563}]}, }, }); @@ -101,16 +101,6 @@ ok -
-
Humidity
-
-
- 51 - % -
- ok -
-
CPU Load
@@ -142,6 +132,12 @@ ok
+
+
+ To tailor this dashboard to your firmware, follow + this guide +
+
@@ -161,7 +157,7 @@
-
+
LED Control
@@ -176,107 +172,150 @@
LED3
+ +
+ To attach these LED controls to your hardware, + modify mongoose_dashboard.c :: sync_leds() function. +
+
+ diff --git a/tutorials/device-dashboard/web_root/style.css b/tutorials/device-dashboard/web_root/style.css index 487d659b..05d28b03 100644 --- a/tutorials/device-dashboard/web_root/style.css +++ b/tutorials/device-dashboard/web_root/style.css @@ -33,6 +33,8 @@ body { color: var(--color-text-strong); } +a, a:visited, a:link { text-decoration: none; } + .header { z-index: 50; } @@ -311,7 +313,7 @@ body { } .field-input.edited, .select.edited, .slider.edited>* { - border-color: #00502040; + border-color: #00500040 !important; background: #00ff0020; } @@ -405,7 +407,25 @@ body { transform: none; } -/* ── Detail row (chart + controls) ─────────────────────────────── */ +.note { + color: #075985; + background: #e0f2fe; + border: 1px solid #7dd3fc; + border-radius: 0.5rem; + padding: 0.75rem 0.9rem; + font-size: 0.86rem; + line-height: 1.55; + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75); + display: flex; + flex-direction: column; + gap: 0.5rem; +} + +.row { + display: flex; + flex-wrap: wrap; + gap: 1rem; +} .detail-row { display: grid;