minor cleanup, start data collector (dummy) and rest
This commit is contained in:
31
fan_control/include/collector.hpp
Normal file
31
fan_control/include/collector.hpp
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
@ -4,3 +4,4 @@
|
||||
static ESP8266WebServer server(80);
|
||||
|
||||
void server_setup();
|
||||
void server_loop();
|
||||
|
Reference in New Issue
Block a user