Add OA temp display

This commit is contained in:
Carsten Schmiemann 2022-11-13 02:47:22 +01:00
parent 3c599b5e42
commit 0c0020547b
3 changed files with 21 additions and 11 deletions

View File

@ -41,10 +41,19 @@ char* title_battery;
char* title_grid;
bool pv_charging = false;
bool show_temp_outside = false;
float temperature_outside = 0.0;
bool show_temp_outside;
float temperature_outside;
char* screenbuffer;
void display_setup(bool set_show_temp_outside, char lang[2]) {
show_temp_outside = set_show_temp_outside;
set_display_language(lang);
}
void display_globals(float temperature_outside) {
temperature_outside = temperature_outside;
}
void display_begin() {
display.begin();
}
@ -101,7 +110,7 @@ void display_header(char* TEXT) {
display.drawLine(100, 0, 100, 8);
if (show_temp_outside)
{
display.setCursor(50,7); display.print(temperature_outside);
display.setCursor(70,7); display.print(temperature_outside,1);
}
}

View File

@ -22,6 +22,8 @@
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
; THE SOFTWARE.
*/
void display_setup(bool set_show_temp_outside,char lang[2]);
void display_globals(float temperature_outside);
void display_begin();
void display_init(char* VERSION);
void display_logo();

View File

@ -48,7 +48,7 @@
#include <lang.h>
#include <display.h>
char VERSION[6] = "v0.5b";
char VERSION[6] = "v0.7b";
//Defaults
char mqtt_server[15] = "";
@ -64,10 +64,6 @@ 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];
@ -211,7 +207,7 @@ void callback(char* topic, byte* message, unsigned int length) {
if (String(topic) == mqtt_temp_outside) {
DynamicJsonDocument json(512);
deserializeJson(json, messageTemp);
temperature_outside = json["value"];
display_globals(json["value"]);
}
//System - AC Load Phase 1
@ -400,11 +396,14 @@ void setup() {
DISPLAY_REFRESH_INTERVAL = strtol(disp_refresh_interval, NULL, 10);
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;
display_setup(true, display_lang);
}
else
{
display_setup(false, display_lang);
}
client.setServer(mqtt_server, 1883);