Add graph ringbuffer loop
This commit is contained in:
parent
1625019b7a
commit
595f285487
28
src/main.cpp
28
src/main.cpp
|
@ -128,6 +128,8 @@ bool lastButtonRotationState = HIGH, lastButtonSetupState = HIGH;
|
|||
bool currentButtonRotationState, currentButtonSetupState;
|
||||
static unsigned long lastDispRefreshTime = 0;
|
||||
static unsigned long lastScreenChangeTime = 0;
|
||||
static unsigned long lastGraphRecord_1h = 0;
|
||||
static unsigned long lastGraphRecord_24h = 0;
|
||||
int display_screen = 0;
|
||||
|
||||
//Display graph ringbuffer
|
||||
|
@ -615,6 +617,8 @@ void setup() {
|
|||
delay(3000);
|
||||
lastDispRefreshTime = millis();
|
||||
lastScreenChangeTime = millis();
|
||||
lastGraphRecord_1h = millis();
|
||||
lastGraphRecord_24h = millis();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
@ -685,6 +689,30 @@ void loop() {
|
|||
}
|
||||
}
|
||||
|
||||
//Graph recorder - 1h
|
||||
if (display_conf_graph_pv_present)
|
||||
{
|
||||
if(millis() - lastGraphRecord_1h >= 30000) //temporarily set to half minute
|
||||
{
|
||||
display_graph_ringbuffer_add(display_graph_ringbuffer_load_1h, grid_p);
|
||||
if (display_conf_dc_pvcharger_present)
|
||||
{
|
||||
display_graph_ringbuffer_add(display_graph_ringbuffer_pv_1h, pv_w);
|
||||
}
|
||||
lastGraphRecord_1h += 30000;
|
||||
Serial.println("Graph ringbuffer 1h - new value added");
|
||||
}
|
||||
/*if(millis() - lastGraphRecord_24h >= 864000)
|
||||
{
|
||||
display_graph_ringbuffer_add(display_graph_ringbuffer_load_24h, grid_p);
|
||||
if (display_conf_dc_pvcharger_present)
|
||||
{
|
||||
display_graph_ringbuffer_add(display_graph_ringbuffer_pv_24h, pv_w);
|
||||
}
|
||||
lastGraphRecord_24h += 864000;
|
||||
Serial.println("Graph ringbuffer 24h - new value added");
|
||||
}*/
|
||||
}
|
||||
|
||||
//Rotate screen if BUTTON_ROTATION is pressed
|
||||
currentButtonRotationState = digitalRead(BUTTON_ROTATION);
|
||||
|
|
Loading…
Reference in New Issue