Show outside temp in title bar

This commit is contained in:
Carsten Schmiemann 2022-11-13 00:41:57 +01:00
parent 6b480b1f83
commit 4fc55377db
2 changed files with 17 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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]();