Simplify display library
This commit is contained in:
parent
c898af693c
commit
0b46475d74
|
@ -42,29 +42,29 @@ void display_begin() {
|
||||||
display.begin();
|
display.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_header() {
|
void display_init(char* VERSION) {
|
||||||
|
display.firstPage();
|
||||||
|
do {
|
||||||
|
display_logo();
|
||||||
|
display.drawStr(0,52,"by Carsten Schmiemann");
|
||||||
|
display.drawStr(20,60, "(C) 2022");
|
||||||
|
display.drawStr(76,60, VERSION);
|
||||||
|
} while ( display.nextPage() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void display_logo() {
|
||||||
display.setFont(u8g2_font_10x20_tr);
|
display.setFont(u8g2_font_10x20_tr);
|
||||||
display.drawStr(0,20,"PV Monitor");
|
display.drawStr(0,20,"PV Monitor");
|
||||||
display.drawStr(48,35,"Project");
|
display.drawStr(48,35,"Project");
|
||||||
display.setFont(u8g2_font_6x10_tr);
|
display.setFont(u8g2_font_6x10_tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_header_small() {
|
void display_logo_small() {
|
||||||
display.setFont(u8g2_font_6x10_tr);
|
display.setFont(u8g2_font_6x10_tr);
|
||||||
display.drawStr(10,7,"PV Monitor Project");
|
display.drawStr(10,7,"PV Monitor Project");
|
||||||
display.drawLine(0, 10, 128, 10);
|
display.drawLine(0, 10, 128, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_init(char* VERSION) {
|
|
||||||
display.firstPage();
|
|
||||||
do {
|
|
||||||
display_header();
|
|
||||||
display.drawStr(0,52,"by Carsten Schmiemann");
|
|
||||||
display.drawStr(20,60, "(C) 2022");
|
|
||||||
display.drawStr(76,60, VERSION);
|
|
||||||
} while ( display.nextPage() );
|
|
||||||
}
|
|
||||||
|
|
||||||
void display_text(char* TEXT1, char* TEXT2) {
|
void display_text(char* TEXT1, char* TEXT2) {
|
||||||
display.firstPage();
|
display.firstPage();
|
||||||
do {
|
do {
|
||||||
|
@ -87,40 +87,22 @@ void display_text_fullscreen(char* TEXT1, char* TEXT2, char* TEXT3, char* TEXT4,
|
||||||
} while ( display.nextPage() );
|
} while ( display.nextPage() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_category_0() {
|
void display_header(char* TEXT) {
|
||||||
display.setFont(u8g2_font_6x10_tr);
|
display.setFont(u8g2_font_6x10_tr);
|
||||||
display.drawStr(2,7,"PV-Module");
|
display.drawStr(2,7,TEXT);
|
||||||
display.drawLine(0, 8, 128, 8);
|
display.drawLine(0, 8, 128, 8);
|
||||||
display.drawLine(100, 0, 100, 8);
|
display.drawLine(100, 0, 100, 8);
|
||||||
display.drawXBM(0,9, Solarpanel_width, Solarpanel_height, Solarpanel_bits);
|
|
||||||
}
|
|
||||||
|
|
||||||
void display_category_1() {
|
|
||||||
display.setFont(u8g2_font_6x10_tr);
|
|
||||||
display.drawStr(2,7,"Batterie");
|
|
||||||
display.drawStr(46,45,"F");
|
|
||||||
display.drawStr(46,64,"E");
|
|
||||||
display.drawLine(0, 8, 128, 8);
|
|
||||||
display.drawLine(100, 0, 100, 8);
|
|
||||||
display.drawXBM(7,9, battery_width, battery_height, battery_bits);
|
|
||||||
display.drawFrame(5,38,40,26);
|
|
||||||
}
|
|
||||||
|
|
||||||
void display_category_2() {
|
|
||||||
display.setFont(u8g2_font_6x10_tr);
|
|
||||||
display.drawStr(2,7,"Netz");
|
|
||||||
display.drawLine(0, 8, 128, 8);
|
|
||||||
display.drawLine(100, 0, 100, 8);
|
|
||||||
display.drawXBM(0,9, grid_width, grid_height, grid_bits);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//PV Charger
|
//PV Charger
|
||||||
void display_screen_0(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)
|
||||||
{
|
{
|
||||||
logPrintlnD("Refresh PV_Charger display values...");
|
logPrintlnD("Refresh PV_Charger display values...");
|
||||||
display.firstPage();
|
display.firstPage();
|
||||||
do {
|
do {
|
||||||
display_category_0();
|
display_header(title_pv);
|
||||||
|
display.drawXBM(0,9, Solarpanel_width, Solarpanel_height, Solarpanel_bits);
|
||||||
display.setCursor(72,18); display.print(pv_voltage); display.print("V");
|
display.setCursor(72,18); display.print(pv_voltage); display.print("V");
|
||||||
display.setCursor(72,28); display.print(pv_wattage,0); display.print("W");
|
display.setCursor(72,28); display.print(pv_wattage,0); display.print("W");
|
||||||
display.setCursor(72,38); display.print(pv_kwh); display.print("kWh");
|
display.setCursor(72,38); display.print(pv_kwh); display.print("kWh");
|
||||||
|
@ -130,12 +112,16 @@ void display_screen_0(float pv_voltage, float pv_wattage, float battery_voltage,
|
||||||
}
|
}
|
||||||
|
|
||||||
//Battery
|
//Battery
|
||||||
void display_screen_1(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)
|
||||||
{
|
{
|
||||||
logPrintlnD("Refresh Battery display values...");
|
logPrintlnD("Refresh Battery display values...");
|
||||||
display.firstPage();
|
display.firstPage();
|
||||||
do {
|
do {
|
||||||
display_category_1();
|
display_header(title_battery);
|
||||||
|
display.drawXBM(7,9, battery_width, battery_height, battery_bits);
|
||||||
|
display.drawFrame(5,38,40,26);
|
||||||
|
display.drawStr(46,45,"F");
|
||||||
|
display.drawStr(46,64,"E");
|
||||||
display.setCursor(9,60); display.print(batt_cell_v_min); display.print("V");
|
display.setCursor(9,60); display.print(batt_cell_v_min); display.print("V");
|
||||||
display.setCursor(9,50); display.print(batt_cell_v_max); display.print("V");
|
display.setCursor(9,50); display.print(batt_cell_v_max); display.print("V");
|
||||||
display.setCursor(72,18); display.print(battery_voltage); display.print("V");
|
display.setCursor(72,18); display.print(battery_voltage); display.print("V");
|
||||||
|
@ -152,12 +138,13 @@ void display_screen_1(float battery_voltage, float battery_amps, float battery_w
|
||||||
}
|
}
|
||||||
|
|
||||||
//Grid
|
//Grid
|
||||||
void display_screen_2(float grid_power, float inv_power, float inv_current, float load_ph1, float load_ph2, float load_ph3, float pv_wattage)
|
void display_screen_grid(float grid_power, float inv_power, float inv_current, float load_ph1, float load_ph2, float load_ph3, float pv_wattage)
|
||||||
{
|
{
|
||||||
logPrintlnD("Refresh Grid display values...");
|
logPrintlnD("Refresh Grid display values...");
|
||||||
display.firstPage();
|
display.firstPage();
|
||||||
do {
|
do {
|
||||||
display_category_2();
|
display_header(title_grid);
|
||||||
|
display.drawXBM(0,9, grid_width, grid_height, grid_bits);
|
||||||
display.setCursor(10,45); display.print(grid_power,0); display.print("W");
|
display.setCursor(10,45); display.print(grid_power,0); display.print("W");
|
||||||
display.setCursor(40,54); display.print(inv_power,0); display.print("W");
|
display.setCursor(40,54); display.print(inv_power,0); display.print("W");
|
||||||
display.setCursor(40,63); display.print(inv_current,1); display.print("A");
|
display.setCursor(40,63); display.print(inv_current,1); display.print("A");
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
; THE SOFTWARE.
|
; THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
void display_begin();
|
void display_begin();
|
||||||
void display_header();
|
|
||||||
void display_header_small();
|
|
||||||
void display_init(char* VERSION);
|
void display_init(char* VERSION);
|
||||||
|
void display_logo();
|
||||||
|
void display_logo_small();
|
||||||
void display_text(char* TEXT1, char* TEXT2);
|
void display_text(char* TEXT1, char* TEXT2);
|
||||||
void display_text_fullscreen(char* TEXT1, char* TEXT2, char* TEXT3, char* TEXT4, char* TEXT5, char* TEXT6);
|
void display_text_fullscreen(char* TEXT1, char* TEXT2, char* TEXT3, char* TEXT4, char* TEXT5, char* TEXT6);
|
||||||
void display_category_0();
|
void display_header(char* TEXT)
|
||||||
void display_screen_0(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_1(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_2(float grid_power, float inv_power, float inv_current, float load_ph1, float load_ph2, float load_ph3, float pv_wattage);
|
void display_screen_grid(float grid_power, float inv_power, float inv_current, float load_ph1, float load_ph2, float load_ph3, float pv_wattage);
|
||||||
|
|
Loading…
Reference in a new issue