[m] Fixed & Cleanup & env.h

This commit is contained in:
2022-05-03 20:07:39 +02:00
parent 97b0351761
commit 65e6d883d4
6 changed files with 59 additions and 16 deletions

View File

@@ -13,7 +13,7 @@ void DrawMain(bool v){
Paint_DrawIcon(89,36, ICON_LOGO, &FontIcon, BLACK, WHITE);
Paint_DrawString_EN(29, 0, "Helcel", &Font45, WHITE, BLACK);
if(v)
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 2 - Font16.Height,"WESP-v0.1", &Font16, WHITE, BLACK);
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - Font16.Height,"WESP-v0.1", &Font16, WHITE, BLACK);
}
void Display::setup(){
@@ -31,10 +31,14 @@ void Display::setup(){
EPD_2IN13_V2_DisplayPart(BlackImage);
}
void Display::clearTime(){
Paint_ClearWindows(170, EPD_2IN13_V2_WIDTH - Font24.Height+2, 170 + Font24.Width * 4.5, EPD_2IN13_V2_WIDTH, WHITE);
}
void Display::drawTime(strDateTime* dt){
Paint_ClearWindows(170, EPD_2IN13_V2_WIDTH - Font24.Height+2, 170 + Font24.Width * 4.5, EPD_2IN13_V2_WIDTH, WHITE);
clearTime();
if (!dt->valid) return;
Paint_DrawTime(170, 98, dt, &Font24, WHITE, BLACK);
Paint_DrawTime(170, EPD_2IN13_V2_WIDTH - Font24.Height+2, dt, &Font24, WHITE, BLACK);
EPD_2IN13_V2_DisplayPart(BlackImage);
};
@@ -92,7 +96,7 @@ void WeatherDisplay::drawDisplay() {
JsonObject weather_sys = cowm->weather["sys"];
if(!weather_0 || !weather_main || !weather_sys || !weather_wind) return;
Paint_DrawIcon(0,8, getWeatherIcon(weather_0["id"]), &FontIcon, BLACK, WHITE);
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 2 - Font16.Height,weather_0["main"], &Font16, WHITE, BLACK);
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - Font16.Height,weather_0["main"], &Font16, WHITE, BLACK);
Paint_DrawFltUnit(76,0,weather_main["temp"], "C", &Font24, BLACK, WHITE);
Paint_DrawFltUnit(186,6,weather_main["feels_like"], "C", &Font12, BLACK, WHITE);
Paint_DrawIntUnit(76,24,weather_main["pressure"], "hPa", &Font24, BLACK, WHITE);
@@ -111,7 +115,7 @@ void TempDisplay::drawDisplay() {
Paint_DrawFltUnit(76,24,sensor->pres, "hPa", &Font24, BLACK, WHITE);
Paint_DrawFltUnit(76,48,sensor->hum, "%", &Font24, BLACK, WHITE);
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 2 - Font16.Height,"Nominal", &Font16, WHITE, BLACK);
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - Font16.Height,"Nominal", &Font16, WHITE, BLACK);
}
void AirDisplay::drawDisplay() {
@@ -134,7 +138,7 @@ void AirDisplay::drawDisplay() {
// particles_50um, ///< 5.0um Particle Count
// particles_100um; ///< 10.0um Particle Count
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 2 - Font16.Height,"Nominal", &Font16, WHITE, BLACK);
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - Font16.Height,"Nominal", &Font16, WHITE, BLACK);
}
@@ -147,7 +151,7 @@ void LightDisplay::drawDisplay() {
Paint_DrawFltUnit(76,24*2,sensor->light, "l", &Font24, BLACK, WHITE);
Paint_DrawIntUnit(76,24*3,sensor->light_vis, "vl", &Font24, BLACK, WHITE);
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 2 - Font16.Height,"Nominal", &Font16, WHITE, BLACK);
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - Font16.Height,"Nominal", &Font16, WHITE, BLACK);
}

View File

@@ -24,6 +24,7 @@ class DisplayWrapper {
class Display {
public:
static void setup();
static void clearTime();
static void drawTime(strDateTime* dt);
static void refresh();
static void update();