Working on migrating to using websockets for the UI
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
// Contains configuration constants:
|
||||
|
||||
#define FIRMWARE_VERSION "1.0.2"
|
||||
@@ -0,0 +1,36 @@
|
||||
#include "dashboard_state.h"
|
||||
|
||||
|
||||
void DashboardState::begin() {}
|
||||
|
||||
void DashboardState::update()
|
||||
{
|
||||
unsigned long seconds = millis() / 1000;
|
||||
|
||||
unsigned long days = seconds / 86400;
|
||||
seconds %= 86400;
|
||||
|
||||
unsigned long hours = seconds / 3600;
|
||||
seconds %= 3600;
|
||||
|
||||
unsigned long minutes = seconds / 60;
|
||||
seconds %= 60;
|
||||
|
||||
|
||||
char buffer[64];
|
||||
|
||||
snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"%lu days %02lu:%02lu:%02lu",
|
||||
days,
|
||||
hours,
|
||||
minutes,
|
||||
seconds
|
||||
);
|
||||
|
||||
|
||||
uptime = String(buffer);
|
||||
|
||||
firmwareVersion = FIRMWARE_VERSION;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "configuration.h"
|
||||
|
||||
class DashboardState
|
||||
{
|
||||
public:
|
||||
|
||||
void begin();
|
||||
void update();
|
||||
|
||||
|
||||
String uptime;
|
||||
|
||||
String firmwareVersion;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user