First graph implementation, shift needed

This commit is contained in:
Carsten Schmiemann 2022-11-14 01:06:21 +01:00
parent 1aa5c835cb
commit 165831bac6
2 changed files with 11 additions and 6 deletions

View File

@ -250,12 +250,12 @@ void display_screen_graph(float values[100])
display.firstPage();
do {
display_header((char*)"Graph");
display.drawLine(7, 60, 126, 60); //X boarder
display.drawLine(7, 60, 9, 60); //X mark
display.drawLine(9, 8, 9, 62); //Y boarder
display.drawStr(1,17, "1");
display.drawStr(1,42, "5");
display.drawStr(1,40, "5");
display.drawStr(1,63, "0");
display.drawLine(7, 38, 9, 38); //marker Y 5
display.drawLine(7, 36, 9, 36); //marker Y 5
display.drawLine(7, 13, 9, 13); //marker Y 1
for (int i = 19; i<120; i += 10)
@ -263,5 +263,10 @@ void display_screen_graph(float values[100])
display.drawLine(i, 60, i, 62); //marker X
}
for (int i = 0; i<126; i++)
{
display.drawLine((10+i), 60, (10+i), map(values[i], 0, 1000, 60, 10));
}
} while ( display.nextPage() );
}

View File

@ -94,7 +94,7 @@ bool display_conf_time_present = false;
bool display_conf_dc_pvcharger_present = false;
bool display_conf_graph_pv_present = false;
bool display_conf_statistics_present = false;
float display_graph_ringbuffer[100] = { 0 };
float display_graph_ringbuffer[126] = { 0 };
int display_graph_ringbuffer_index = 0;
int display_refresh_counter = 0;
int display_refresh_time;
@ -175,8 +175,8 @@ void callback(char* topic, byte* message, unsigned int length) {
grid_p = json["value"];
//add to ringbuffer for testing
display_graph_ringbuffer[display_graph_ringbuffer_index] = grid_p;
if (display_graph_ringbuffer_index == 100)
display_graph_ringbuffer[display_graph_ringbuffer_index++] = grid_p;
if (display_graph_ringbuffer_index == 126)
display_graph_ringbuffer_index = 0;
}