From 1fd631d8997f86943160ad1f51b5fc95775d6301 Mon Sep 17 00:00:00 2001 From: Thomas Ballmann Date: Sat, 26 Dec 2020 10:07:25 +0100 Subject: [PATCH] #54 refactoring faces --- lib/face/faceCalendar.cpp | 59 +++---------------- lib/face/faceCalendar.h | 2 +- lib/face/faceWeather.cpp | 4 +- lib/face/faceWeather.h | 2 +- .../icons.cpp} | 2 +- .../icons.h} | 0 6 files changed, 12 insertions(+), 57 deletions(-) rename lib/face/{faceWeatherIcons.cpp => faceWeather/icons.cpp} (92%) rename lib/face/{faceWeatherIcons.h => faceWeather/icons.h} (100%) diff --git a/lib/face/faceCalendar.cpp b/lib/face/faceCalendar.cpp index c8f1e9c..3540d5c 100644 --- a/lib/face/faceCalendar.cpp +++ b/lib/face/faceCalendar.cpp @@ -8,20 +8,18 @@ #include "image.h" #include "download.h" #include "faceWeather.h" -#include "faceWeatherIcons.h" +#include "faceWeather/icons.h" -#include // weekday - month year -#include // -#include // current day +#include // weekday - month year +#include // +#include // current day #include // current day void showFaceCalendar(); void display_calender(); void display_picture(); -void display_time(); const char faceCalendarPicture[] = "/calendarPhoto.jpg"; - unsigned long lastCalendarDataUpdate = 0; void setupFaceCalendar() @@ -40,11 +38,6 @@ void loopFaceCalendar() } } -void playlistFaceCalendar() -{ - showFaceCalendar(); -} - void showFaceCalendar() { GFXcanvas1 *canvas = displayGetCanvas(); @@ -65,7 +58,8 @@ bool updateCalendarData() { String url = NVS.getString("playlist.images"); - if (!url.isEmpty()) { + if (!url.isEmpty()) + { url += "390x384.jpg"; return downloadFile(url, faceCalendarPicture); } @@ -175,43 +169,4 @@ void display_picture() file.close(); ImageFlushBuffer(); -} - -void display_time() -{ - /* - int16_t x1, y1; - uint16_t w, h; - - //display time - canvas->setFont(&FreeMonoBold9pt7b); // LARGE_FONT - canvas->setTextSize(1); - canvas->setTextColor(COLOR_BG); - int16_t time_base_y = 60; - int16_t time_base_x = 25; - canvas->getTextBounds("03", time_base_x, time_base_y, &x1, &y1, &w, &h); // 03 is arbitrary text to get the height and width - canvas->fillRect(time_base_x - 10, time_base_y - h - 10, w + 15, time_base_y + h + 10, GxEPD_WHITE); - - canvas->setCursor(time_base_x, time_base_y); - if (now.hour < 10) - { - canvas->print("0"); - canvas->print(now.hour); - } - else - { - canvas->println(now.hour); - } - - canvas->setCursor(time_base_x, time_base_y + h + 10); - if (now.min < 10) - { - canvas->print("0"); - canvas->print(now.min); - } - else - { - canvas->println(now.min); - } - */ -} +} \ No newline at end of file diff --git a/lib/face/faceCalendar.h b/lib/face/faceCalendar.h index 7c8c353..4821d2c 100644 --- a/lib/face/faceCalendar.h +++ b/lib/face/faceCalendar.h @@ -4,7 +4,7 @@ void setupFaceCalendar(); void loopFaceCalendar(); -void playlistFaceCalendar(); +void showFaceCalendar(); bool updateCalendarData(); #endif \ No newline at end of file diff --git a/lib/face/faceWeather.cpp b/lib/face/faceWeather.cpp index 702fa4c..74cbc55 100644 --- a/lib/face/faceWeather.cpp +++ b/lib/face/faceWeather.cpp @@ -1,7 +1,7 @@ #include #include #include "faceWeather.h" -#include "faceWeatherIcons.h" +#include "faceWeather/Icons.h" #include "display.h" #include "download.h" #include "settings.h" @@ -42,7 +42,7 @@ void loopFaceWeather() } } -void playlistFaceWeather() +void showFaceWeather() { GFXcanvas1 *canvas = displayGetCanvas(); diff --git a/lib/face/faceWeather.h b/lib/face/faceWeather.h index 16807b0..dd8e83f 100644 --- a/lib/face/faceWeather.h +++ b/lib/face/faceWeather.h @@ -37,7 +37,7 @@ extern faceWeatherData weatherData; void setupFaceWeather(); void loopFaceWeather(); -void playlistFaceWeather(); +void showFaceWeather(); bool updateWeatherData(); diff --git a/lib/face/faceWeatherIcons.cpp b/lib/face/faceWeather/icons.cpp similarity index 92% rename from lib/face/faceWeatherIcons.cpp rename to lib/face/faceWeather/icons.cpp index d18f5a3..341c469 100644 --- a/lib/face/faceWeatherIcons.cpp +++ b/lib/face/faceWeather/icons.cpp @@ -1,4 +1,4 @@ -#include "faceWeatherIcons.h" +#include "Icons.h" #define NELEMENTS(array) (sizeof(array) / sizeof((array)[0])) diff --git a/lib/face/faceWeatherIcons.h b/lib/face/faceWeather/icons.h similarity index 100% rename from lib/face/faceWeatherIcons.h rename to lib/face/faceWeather/icons.h