35 lines
477 B
C++
35 lines
477 B
C++
#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;
|
|
};
|