Compare commits
2 Commits
2f19642d2c
...
4fc55377db
Author | SHA1 | Date |
---|---|---|
Carsten Schmiemann | 4fc55377db | |
Carsten Schmiemann | 6b480b1f83 |
|
@ -41,6 +41,8 @@ char* title_battery;
|
|||
char* title_grid;
|
||||
|
||||
bool pv_charging = false;
|
||||
bool show_temp_outside = false;
|
||||
float temperature_outside = 0.0;
|
||||
char* screenbuffer;
|
||||
|
||||
void display_begin() {
|
||||
|
@ -97,6 +99,10 @@ void display_header(char* TEXT) {
|
|||
display.drawStr(2,7,TEXT);
|
||||
display.drawLine(0, 8, 128, 8);
|
||||
display.drawLine(100, 0, 100, 8);
|
||||
if (show_temp_outside)
|
||||
{
|
||||
display.setCursor(50,7); display.print(temperature_outside);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -143,7 +149,7 @@ void display_screen_battery(float battery_voltage, float battery_amps, float bat
|
|||
}
|
||||
|
||||
//Grid
|
||||
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)
|
||||
void display_screen_grid(float grid_power, float inv_power, float inv_current, float pv_wattage)
|
||||
{
|
||||
logPrintlnD("Refresh Grid display values...");
|
||||
display.firstPage();
|
||||
|
@ -153,8 +159,7 @@ void display_screen_grid(float grid_power, float inv_power, float inv_current, f
|
|||
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,63); display.print(inv_current,1); display.print("A");
|
||||
float ac_load = load_ph1 + load_ph2 + load_ph3;
|
||||
display.setCursor(87,20); display.print(ac_load,0); display.print("W");
|
||||
display.setCursor(87,20); display.print(grid_power,0); display.print("W");
|
||||
display.setCursor(101,38); display.print(pv_wattage,0); display.print("W");
|
||||
int pv_chg_y_pos;
|
||||
if (pv_wattage >= 10) {
|
||||
|
|
|
@ -31,4 +31,4 @@ void display_text_fullscreen(char* TEXT1, char* TEXT2, char* TEXT3, char* TEXT4,
|
|||
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_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 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 pv_wattage);
|
||||
|
|
15
src/main.cpp
15
src/main.cpp
|
@ -64,6 +64,10 @@ char display_lang[2] = "";
|
|||
long unsigned int DISPLAY_REFRESH_INTERVAL;
|
||||
long unsigned int DISPLAY_SCREEN_INTERVAL;
|
||||
|
||||
//Display config
|
||||
extern bool show_temp_outside;
|
||||
extern float temperature_outside;
|
||||
|
||||
//MQTT connect strings
|
||||
char mqtt_pv_voltage[80];
|
||||
char mqtt_pv_power[80];
|
||||
|
@ -99,7 +103,7 @@ PubSubClient client(espClient);
|
|||
//Globals
|
||||
long lastMsg = 0;
|
||||
char msg[50];
|
||||
float pv_v = 0, pv_w = 0, pv_i = 0, pv_kwh = 0, inv_p = 0, inv_i = 0, batt_v = 0, batt_i = 0, batt_p = 0, batt_c_min = 0, batt_c_max = 0, grid_p = 0, batt_soc = 0, temp_outside = 0, load_ph1 = 0, load_ph2 = 0, load_ph3 = 0;
|
||||
float pv_v = 0, pv_w = 0, pv_i = 0, pv_kwh = 0, inv_p = 0, inv_i = 0, batt_v = 0, batt_i = 0, batt_p = 0, batt_c_min = 0, batt_c_max = 0, grid_p = 0, batt_soc = 0, load_ph1 = 0, load_ph2 = 0, load_ph3 = 0;
|
||||
bool lastButtonRotationState = HIGH, lastButtonSetupState = HIGH;
|
||||
bool currentButtonRotationState, currentButtonSetupState;
|
||||
int display_screen = 0;
|
||||
|
@ -207,7 +211,7 @@ void callback(char* topic, byte* message, unsigned int length) {
|
|||
if (String(topic) == mqtt_temp_outside) {
|
||||
DynamicJsonDocument json(512);
|
||||
deserializeJson(json, messageTemp);
|
||||
temp_outside = json["value"];
|
||||
temperature_outside = json["value"];
|
||||
}
|
||||
|
||||
//System - AC Load Phase 1
|
||||
|
@ -398,6 +402,11 @@ void setup() {
|
|||
DISPLAY_SCREEN_INTERVAL = strtol(disp_screen_interval, NULL, 10);
|
||||
set_display_language(display_lang);
|
||||
|
||||
if (strtol(address_outside_temperature, NULL, 10) != 0)
|
||||
{
|
||||
show_temp_outside = true;
|
||||
}
|
||||
|
||||
client.setServer(mqtt_server, 1883);
|
||||
client.setCallback(callback);
|
||||
char* ip_address = new char[40]();
|
||||
|
@ -505,7 +514,7 @@ void loop() {
|
|||
display_screen_battery(batt_v, batt_i, batt_p, batt_soc, batt_c_min, batt_c_max);
|
||||
}
|
||||
if (display_screen == 2) {
|
||||
display_screen_grid(grid_p, inv_p, inv_i, load_ph1, load_ph2, load_ph3, pv_w);
|
||||
display_screen_grid(grid_p, inv_p, inv_i, pv_w);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue