mirror of
https://github.com/paperdash/device-epd.git
synced 2024-11-13 19:12:00 +00:00
face calendar - use image service
This commit is contained in:
parent
ad77dea7aa
commit
7f735d21c6
@ -6,6 +6,7 @@
|
|||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "datetime.h"
|
#include "datetime.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
|
#include "imageService.h"
|
||||||
#include "download.h"
|
#include "download.h"
|
||||||
#include "faceWeather.h"
|
#include "faceWeather.h"
|
||||||
#include "faceWeather/icons.h"
|
#include "faceWeather/icons.h"
|
||||||
@ -15,9 +16,7 @@
|
|||||||
#include <Fonts/FreeSans24pt7b.h> // current day
|
#include <Fonts/FreeSans24pt7b.h> // current day
|
||||||
#include <Fonts/FreeSansBold24pt7b.h> // current day
|
#include <Fonts/FreeSansBold24pt7b.h> // current day
|
||||||
|
|
||||||
void showFaceCalendar();
|
|
||||||
void display_calender();
|
void display_calender();
|
||||||
void display_picture();
|
|
||||||
|
|
||||||
const char faceCalendarPicture[] = "/calendarPhoto.jpg";
|
const char faceCalendarPicture[] = "/calendarPhoto.jpg";
|
||||||
unsigned long lastCalendarDataUpdate = 0;
|
unsigned long lastCalendarDataUpdate = 0;
|
||||||
@ -45,7 +44,7 @@ void showFaceCalendar()
|
|||||||
canvas->setRotation(0);
|
canvas->setRotation(0);
|
||||||
canvas->fillScreen(COLOR_FG);
|
canvas->fillScreen(COLOR_FG);
|
||||||
|
|
||||||
display_picture();
|
imageServiceRenderFile(faceCalendarPicture, 250, 0, 0, 0, true);
|
||||||
display_calender();
|
display_calender();
|
||||||
|
|
||||||
displayFlush();
|
displayFlush();
|
||||||
@ -56,15 +55,7 @@ void showFaceCalendar()
|
|||||||
*/
|
*/
|
||||||
bool updateCalendarData()
|
bool updateCalendarData()
|
||||||
{
|
{
|
||||||
String url = NVS.getString("playlist.images");
|
return imageServiceUpdateFile("390x384.jpg", faceCalendarPicture);
|
||||||
|
|
||||||
if (!url.isEmpty())
|
|
||||||
{
|
|
||||||
url += "390x384.jpg";
|
|
||||||
return downloadFile(url, faceCalendarPicture);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_calender()
|
void display_calender()
|
||||||
@ -149,24 +140,3 @@ void display_calender()
|
|||||||
canvas->setCursor(150, 367);
|
canvas->setCursor(150, 367);
|
||||||
canvas->println(weatherData.current_temp);
|
canvas->println(weatherData.current_temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_picture()
|
|
||||||
{
|
|
||||||
File file = SPIFFS.open(faceCalendarPicture, "r");
|
|
||||||
if (!file)
|
|
||||||
{
|
|
||||||
Serial.println(" file not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageNew(250, 0, 0, 0, true);
|
|
||||||
|
|
||||||
// TODO check why a small buffer is not working correct
|
|
||||||
uint8_t buff[1280] = {0};
|
|
||||||
while (int c = file.read(buff, sizeof(buff)))
|
|
||||||
{
|
|
||||||
ImageWriteBuffer(buff, c);
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
ImageFlushBuffer();
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user