Adding diagnostics
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
|
||||
#define DIAGNOSTIC_HISTORY_SIZE 60
|
||||
|
||||
|
||||
struct DiagnosticSample
|
||||
{
|
||||
uint32_t timestamp;
|
||||
uint32_t freeHeap;
|
||||
uint32_t minimumFreeHeap;
|
||||
uint32_t cpuFrequency;
|
||||
};
|
||||
|
||||
|
||||
class DiagnosticsState
|
||||
{
|
||||
public:
|
||||
|
||||
void update();
|
||||
|
||||
|
||||
DiagnosticSample getCurrent();
|
||||
DiagnosticSample getHistory(uint8_t index);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
DiagnosticSample current;
|
||||
DiagnosticSample history[DIAGNOSTIC_HISTORY_SIZE];
|
||||
uint8_t historyIndex = 0;
|
||||
};
|
||||
Reference in New Issue
Block a user