Remove points

This commit is contained in:
cpq committed 2026-04-21 17:00:47 +01:00
1 parent 70d45a19ae
commit 402096798a
5 files changed
+14 -16

No files matched your search

+5 -5
View File
@@ -32,7 +32,7 @@ static void sync_control(bool is_write) {
}
// Read-only device Metrics
static int s_ram = 32, s_cpu = 37, s_humidity = 59;
static int s_ram = 32, s_cpu = 7, s_humidity = 59;
static double s_temperature = 24.8;
static struct mg_field fields_metrics[] = {
@@ -45,8 +45,9 @@ static struct mg_field fields_metrics[] = {
static void sync_metrics(bool is_write) {
if (is_write) return;
// Read values from hardware into the state variables
// s_ram = calculate_current_free_ram();
s_ram = 25 + (rand() % 16); // Sumulate metric change
s_cpu = 7 + (rand() % 21);
s_temperature = 14.8 + ((double)rand() / RAND_MAX) * 20.0;
}
// Read-write device settings
@@ -127,8 +128,7 @@ void mongoose_poll(void) {
{
// Send metrics change periodically
static uint64_t timer = 0;
if (mg_timer_expired(&timer, 30000, mg_now())) {
sync_metrics(false);
if (mg_timer_expired(&timer, 300, mg_now())) {
mg_dash_send_change(&s_mgr, &s_dashboard, "metrics");
}
}
@@ -9,7 +9,7 @@
Dashboard.init({
debug: true,
data: {
points: [],
chart1: {data: ''},
controls: {
fan: true,
relay1: false,
@@ -15,6 +15,8 @@
--spacing-2: 0.5rem;
--spacing-3: 0.75rem;
--spacing-4: 1rem;
--spacing-5: 1.25rem;
--spacing-6: 1.5rem;
}
* {
@@ -46,7 +48,7 @@ body {
align-items: center;
justify-content: space-between;
gap: var(--spacing-4);
padding: var(--spacing-2) var(--spacing-3);
padding: var(--spacing-2) var(--spacing-4);
}
.header-left {
@@ -134,7 +136,7 @@ body {
.tab-stage {
max-width: var(--max-width);
margin: 0 auto;
padding: 5.5rem var(--spacing-3) var(--spacing-3);
padding: 5.5rem var(--spacing-4) var(--spacing-4);
}
.tab-panel {