minor cleanup, start data collector (dummy) and rest

This commit is contained in:
Torsten Ruger
2021-06-27 21:46:11 +03:00
parent f6690fb43f
commit de0532bc93
5 changed files with 99 additions and 35 deletions

View File

@ -0,0 +1,31 @@
#include <vector>
using namespace std;
class Collector
{
protected:
float week[100];
float month[100];
float minute = 0 ;
int counter = 0;
int max = 100 ;
int bucket = 10;
public:
void add(float val)
{
minute += val;
counter++ ;
if(counter % bucket){
int at_week = counter / bucket;
week[at_week] = minute / bucket;
minute = 0;
}
if(counter % (bucket*bucket)){
int at_week = counter / bucket;
month[at_week] = minute / bucket;
counter = 0;
}
}
};

View File

@ -4,3 +4,4 @@
static ESP8266WebServer server(80);
void server_setup();
void server_loop();