Fix esp crash, graph layout
This commit is contained in:
parent
595f285487
commit
3231d46994
|
@ -245,19 +245,19 @@ void display_screen_grid(float grid_power, float consum, float inv_power, float
|
||||||
}
|
}
|
||||||
|
|
||||||
//Graph last 100 values
|
//Graph last 100 values
|
||||||
void display_screen_graph(float values[100], char* key, int buffersize)
|
void display_screen_graph(float *values, char* key, int buffersize)
|
||||||
{
|
{
|
||||||
logPrintD("Display graph...");
|
logPrintD("Display graph...");
|
||||||
display.firstPage();
|
display.firstPage();
|
||||||
do {
|
do {
|
||||||
display_header(title_graph);
|
display_header(title_graph);
|
||||||
display.drawLine(7, 60, 9, 60); //X mark
|
display.drawLine(15, 60, 9, 60); //X mark
|
||||||
display.drawLine(9, 8, 9, 62); //Y boarder
|
display.drawLine(15, 8, 15, 62); //Y boarder
|
||||||
display.drawStr(1,63, "0");
|
display.drawStr(7,63, "0");
|
||||||
display.drawLine(7, 36, 9, 36); //marker Y 5
|
display.drawLine(13, 36, 15, 36); //marker Y 5
|
||||||
display.drawLine(7, 13, 9, 13); //marker Y 1
|
display.drawLine(13, 13, 15, 13); //marker Y 1
|
||||||
|
|
||||||
for (int i = 19; i<120; i += 10)
|
for (int i = 25; i<120; i += 10)
|
||||||
{
|
{
|
||||||
display.drawLine(i, 60, i, 62); //marker X
|
display.drawLine(i, 60, i, 62); //marker X
|
||||||
}
|
}
|
||||||
|
@ -273,28 +273,29 @@ void display_screen_graph(float values[100], char* key, int buffersize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int graph_max_kW = 1000;
|
int graph_max_kW = 1000;
|
||||||
if (max > 2000) { graph_max_kW = 2000; }
|
if (max > 1000) { graph_max_kW = 2000; }
|
||||||
else if (max > 3000) { graph_max_kW = 3000; }
|
if (max > 2000) { graph_max_kW = 3000; }
|
||||||
else if (max > 4000) { graph_max_kW = 4000; }
|
if (max > 3000) { graph_max_kW = 4000; }
|
||||||
else if (max > 4000) { graph_max_kW = 4000; }
|
if (max > 4000) { graph_max_kW = 5000; }
|
||||||
else if (max > 5000) { graph_max_kW = 5000; }
|
if (max > 5000) { graph_max_kW = 6000; }
|
||||||
else if (max > 6000) { graph_max_kW = 6000; }
|
if (max > 6000) { graph_max_kW = 7000; }
|
||||||
else if (max > 7000) { graph_max_kW = 7000; }
|
if (max > 7000) { graph_max_kW = 8000; }
|
||||||
else if (max > 8000) { graph_max_kW = 8000; }
|
if (max > 8000) { graph_max_kW = 9000; }
|
||||||
else if (max > 9000) { graph_max_kW = 9000; }
|
if (max > 9000) { graph_max_kW = 10000; }
|
||||||
else if (max > 10000) { graph_max_kW = 10000; }
|
if (max > 10000) { graph_max_kW = 11000; }
|
||||||
else if (max > 11000) { graph_max_kW = 11000; }
|
if (max > 11000) { graph_max_kW = 12000; }
|
||||||
else if (max > 12000) { graph_max_kW = 12000; }
|
if (max > 12000) { graph_max_kW = 13000; }
|
||||||
else if (max > 13000) { graph_max_kW = 13000; }
|
if (max > 13000) { graph_max_kW = 14000; }
|
||||||
else if (max > 14000) { graph_max_kW = 14000; }
|
if (max > 14000) { graph_max_kW = 15000; }
|
||||||
else if (max > 15000) { graph_max_kW = 15000; }
|
if (max > 15000) { graph_max_kW = 16000; }
|
||||||
else if (max > 16000) { graph_max_kW = 16000; }
|
if (max > 16000) { graph_max_kW = 17000; }
|
||||||
display.drawStr(1,17, (char*)(graph_max_kW/1000));
|
display.setCursor(7,17);
|
||||||
|
display.print(graph_max_kW/1000);
|
||||||
|
|
||||||
for (int i = 0; i<buffersize; i++)
|
for (int i = 0; i<buffersize; i++)
|
||||||
{
|
{
|
||||||
display.drawLine((10+i), 60, (10+i), map(values[i], 0, graph_max_kW, 60, 10));
|
display.drawLine((15+i), 60, (15+i), map(values[i], 0, graph_max_kW, 60, 13));
|
||||||
}
|
}
|
||||||
display.drawStr(120, 10, key);
|
display.drawStr(117, 17, key);
|
||||||
} while ( display.nextPage() );
|
} while ( display.nextPage() );
|
||||||
}
|
}
|
|
@ -35,4 +35,4 @@ void display_header(char* TEXT);
|
||||||
void display_screen_pv(float pv_voltage, float pv_wattage, float battery_voltage, float pv_amps, float pv_kwh);
|
void display_screen_pv(float pv_voltage, float pv_wattage, float battery_voltage, float pv_amps, float pv_kwh);
|
||||||
void display_screen_battery(float battery_voltage, float battery_amps, float battery_wattage, float battery_soc, float batt_cell_v_min, float batt_cell_v_max);
|
void display_screen_battery(float battery_voltage, float battery_amps, float battery_wattage, float battery_soc, float batt_cell_v_min, float batt_cell_v_max);
|
||||||
void display_screen_grid(float grid_power, float consum, float inv_power, float inv_current, float pv_wattage);
|
void display_screen_grid(float grid_power, float consum, float inv_power, float inv_current, float pv_wattage);
|
||||||
void display_screen_graph(float values[100], char* key, int buffersize);
|
void display_screen_graph(float *values, char* key, int buffersize);
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
#include <lang.h>
|
#include <lang.h>
|
||||||
#include <display.h>
|
#include <display.h>
|
||||||
|
|
||||||
char VERSION[6] = "v0.9a";
|
char VERSION[6] = "v0.9d";
|
||||||
|
|
||||||
//Defaults
|
//Defaults
|
||||||
char mqtt_server[15] = "";
|
char mqtt_server[15] = "";
|
||||||
|
|
Loading…
Reference in a new issue