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
-
This settings panel is backed by the "settings" dashboard object + see Dashboard.init call at the top of index.html - and, consequently, + by the "settings" fieldset in mongoose_dashboard.c.
+Fields are bound to the dashboard object via the data-bind attribute, + e.g. data-bind="setttings.name"
+When you save changed fields, the changes are saved to the device.
+The "NAME" field + has data-autosave="1", so it is autosaved when user types text.
+The other fields are not auto-saved, so when they are changed, + dashboard.js automatically applies CSS class "edited" to them to + indicate they were changed but not saved.
+The cancel and save buttons are attached to the settings object + via the data-cancel and data-save attributes. Those buttons + get automatically enabled or disabled based on editing status.
The two default files are fake - you can delete them
+However the manager works - you can upload new files. They + are uploaded to /tmp/ directory on the device. + This requires stdio (fopen/fread/...) implemeneted.
+The easiest way to implement it is to use a filesystem like + LittleFS on your internal or external flash + and retarget the standard library to use it.
+See this example on how LittleFS can be implemented on + Nucleo-H563ZI internal flash partition.
+