[WIP] Sleep
This commit is contained in:
@@ -8,28 +8,31 @@ static int8_t view_count = -1;
|
||||
static int8_t view_curr = 0;
|
||||
static DisplayWrapper** views = 0;
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void Display::setup(){
|
||||
DEV_Module_Init();
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
EPD_2IN13_V2_Clear();
|
||||
delay(100);
|
||||
// EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
// EPD_2IN13_V2_Clear();
|
||||
|
||||
uint16_t Imagesize = ((EPD_2IN13_V2_WIDTH % 8 == 0) ? (EPD_2IN13_V2_WIDTH / 8 ) : (EPD_2IN13_V2_WIDTH / 8 + 1)) * EPD_2IN13_V2_HEIGHT;
|
||||
if ((BlackImage = (uint8_t *)malloc(Imagesize)) == NULL) exit(1);
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_V2_WIDTH, EPD_2IN13_V2_HEIGHT, 270, WHITE);
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetMirroring(MIRROR_HORIZONTAL);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
Paint_DrawIcon(89,36, ICON_LOGO, &FontIcon, BLACK, WHITE);
|
||||
Paint_DrawString_EN(29, 0, "Helcel", &Font45, WHITE, BLACK);
|
||||
Paint_SelectImage(BlackImage);
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
delay(100);
|
||||
refresh();
|
||||
DrawMain(false);
|
||||
EPD_2IN13_V2_DisplayPart(BlackImage);
|
||||
}
|
||||
|
||||
void Display::drawTime(strDateTime* dt){
|
||||
Paint_ClearWindows(170, EPD_2IN13_V2_WIDTH - Font24.Height, 170 + Font24.Width * 4.5, EPD_2IN13_V2_WIDTH, WHITE);
|
||||
Paint_ClearWindows(170, EPD_2IN13_V2_WIDTH - Font24.Height+2, 170 + Font24.Width * 4.5, EPD_2IN13_V2_WIDTH, WHITE);
|
||||
if (!dt->valid) return;
|
||||
Paint_DrawTime(170, 98, dt, &Font24, WHITE, BLACK);
|
||||
EPD_2IN13_V2_DisplayPart(BlackImage);
|
||||
@@ -89,7 +92,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 - 4 - Font16.Height,weather_0["description"], &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 2 - 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);
|
||||
@@ -108,7 +111,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 - 4 - Font16.Height,"nominal", &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 2 - Font16.Height,"Nominal", &Font16, WHITE, BLACK);
|
||||
}
|
||||
|
||||
void AirDisplay::drawDisplay() {
|
||||
@@ -131,7 +134,7 @@ void AirDisplay::drawDisplay() {
|
||||
// particles_50um, ///< 5.0um Particle Count
|
||||
// particles_100um; ///< 10.0um Particle Count
|
||||
|
||||
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 4 - Font16.Height,"nominal", &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 2 - Font16.Height,"Nominal", &Font16, WHITE, BLACK);
|
||||
|
||||
}
|
||||
|
||||
@@ -144,16 +147,14 @@ 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 - 4 - Font16.Height,"nominal", &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 2 - Font16.Height,"Nominal", &Font16, WHITE, BLACK);
|
||||
}
|
||||
|
||||
|
||||
void MainDisplay::drawDisplay() {
|
||||
Paint_DrawIcon(89,36, ICON_LOGO, &FontIcon, BLACK, WHITE);
|
||||
Paint_DrawString_EN(29, 0, "Helcel", &Font45, WHITE, BLACK);
|
||||
Paint_DrawString_EN(2,EPD_2IN13_V2_WIDTH - 4 - Font16.Height,"WESP-v0.1", &Font16, WHITE, BLACK);
|
||||
DrawMain(true);
|
||||
}
|
||||
|
||||
void CustomDisplay::drawDisplay() {
|
||||
Paint_DrawString_EN(60,0,"CUSTOM", &Font24, WHITE, BLACK);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user