Minigrafx simple - updated to new graphics library (#18)

* Cleaning up code

* Cleaning up sample code

* Adjusted settings
This commit is contained in:
Daniel Eichhorn
2017-06-25 13:46:00 +02:00
committed by GitHub
parent d89f55d755
commit 31a282da44
13 changed files with 5168 additions and 1949 deletions

View File

@@ -1,5 +1,5 @@
/**The MIT License (MIT)
Copyright (c) 2015 by Daniel Eichhorn
Copyright (c) 2017 by Daniel Eichhorn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@@ -15,129 +15,140 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
See more at http://blog.squix.ch
See more at https://blog.squix.org
*/
#include <Arduino.h>
#include <Adafruit_GFX.h> // Core graphics library
#include "ILI9341.h" // Hardware-specific library
#include <SPI.h>
// Additional UI functions
#include "GfxUi.h"
// Fonts created by http://oleddisplay.squix.ch/
#include "ArialRoundedMTBold_14.h"
#include "ArialRoundedMTBold_36.h"
// Download helper
#include "WebResource.h"
#include <ESP8266WiFi.h>
#include <ArduinoOTA.h>
#include <ESP8266mDNS.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
// Helps with connecting to internet
#include <WiFiManager.h>
/***
* Install the following libraries through Arduino Library Manager
* - Mini Grafx by Daniel Eichhorn
* - ESP8266 WeatherStation by Daniel Eichhorn
* - Json Streaming Parser by Daniel Eichhorn
* - simpleDSTadjust by neptune2
***/
// check settings.h for adapting to your needs
#include "settings.h"
#include <JsonListener.h>
#include <WundergroundClient.h>
#include "TimeClient.h"
#include <WundergroundConditions.h>
#include <WundergroundForecast.h>
#include <WundergroundAstronomy.h>
#include <MiniGrafx.h>
#include <Carousel.h>
#include <ILI9341_SPI.h>
// HOSTNAME for OTA update
#define HOSTNAME "ESP8266-OTA-"
#include "ArialRounded.h"
#include "moonphases.h"
#include "weathericons.h"
/*****************************
* Important: see settings.h to configure your settings!!!
* ***************************/
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
GfxUi ui = GfxUi(&tft);
#include "settings.h"
WebResource webResource;
TimeClient timeClient(UTC_OFFSET);
#define MINI_BLACK 0
#define MINI_WHITE 1
#define MINI_YELLOW 2
#define MINI_BLUE 3
// Set to false, if you prefere imperial/inches, Fahrenheit
WundergroundClient wunderground(IS_METRIC);
#define MAX_FORECASTS 12
// defines the colors usable in the paletted 16 color frame buffer
uint16_t palette[] = {ILI9341_BLACK, // 0
ILI9341_WHITE, // 1
ILI9341_YELLOW, // 2
0x7E3C/*ILI9341_BLUE*/}; //3
int SCREEN_WIDTH = 240;
int SCREEN_HEIGHT = 320;
// Limited to 4 colors due to memory constraints
int BITS_PER_PIXEL = 2; // 2^2 = 4 colors
// HOSTNAME for OTA update
#define HOSTNAME "ESP8266-OTA-"
ILI9341_SPI tft = ILI9341_SPI(TFT_CS, TFT_DC);
MiniGrafx gfx = MiniGrafx(&tft, BITS_PER_PIXEL, palette);
Carousel carousel(&gfx, 0, 0, 240, 100);
WGConditions conditions;
WGForecast forecasts[MAX_FORECASTS];
WGAstronomy astronomy;
// Setup simpleDSTadjust Library rules
simpleDSTadjust dstAdjusted(StartRule, EndRule);
//declaring prototypes
void configModeCallback (WiFiManager *myWiFiManager);
void downloadCallback(String filename, int16_t bytesDownloaded, int16_t bytesTotal);
ProgressCallback _downloadCallback = downloadCallback;
void downloadResources();
void updateData();
void drawProgress(uint8_t percentage, String text);
void drawTime();
void drawCurrentWeather();
void drawForecast();
void drawForecastDetail(uint16_t x, uint16_t y, uint8_t dayIndex);
String getMeteoconIcon(String iconText);
void drawAstronomy();
void drawSeparator(uint16_t y);
const char* getMeteoconIconFromProgmem(String iconText);
const char* getMiniMeteoconIconFromProgmem(String iconText);
void drawForecast1(MiniGrafx *display, CarouselState* state, int16_t x, int16_t y);
void drawForecast2(MiniGrafx *display, CarouselState* state, int16_t x, int16_t y);
FrameCallback frames[] = { drawForecast1, drawForecast2 };
int frameCount = 2;
long lastDownloadUpdate = millis();
void updateCalendar();
String moonAgeImage = "";
void setup() {
Serial.begin(115200);
// The LED pin needs to set HIGH
// Use this pin to save energy
pinMode(LED_PIN, D8);
digitalWrite(LED_PIN, HIGH);
// Turn on the background LED
pinMode(TFT_LED, OUTPUT);
digitalWrite(TFT_LED, HIGH);
gfx.init();
gfx.fillBuffer(MINI_BLACK);
gfx.setFont(ArialRoundedMTBold_14);
gfx.setColor(MINI_YELLOW);
gfx.setTextAlignment(TEXT_ALIGN_CENTER);
gfx.drawString(120, 160, "Connecting to WiFi");
gfx.commit();
tft.begin();
tft.fillScreen(ILI9341_BLACK);
tft.setFont(&ArialRoundedMTBold_14);
ui.setTextColor(ILI9341_ORANGE, ILI9341_BLACK);
ui.setTextAlignment(CENTER);
ui.drawString(120, 160, "Connecting to WiFi");
//WiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wifiManager;
// Uncomment for testing wifi manager
//wifiManager.resetSettings();
wifiManager.setAPCallback(configModeCallback);
//or use this for auto generated name ESP + ChipID
wifiManager.autoConnect();
carousel.setFrames(frames, frameCount);
carousel.disableAllIndicators();
//Manual Wifi
//WiFi.begin(WIFI_SSID, WIFI_PWD);
WiFi.begin("yourssid", "yourpassw0rd");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
// OTA Setup
String hostname(HOSTNAME);
hostname += String(ESP.getChipId(), HEX);
WiFi.hostname(hostname);
ArduinoOTA.setHostname((const char *)hostname.c_str());
ArduinoOTA.begin();
SPIFFS.begin();
//Uncomment if you want to update all internet resources
//SPIFFS.format();
// download images from the net. If images already exist don't download
downloadResources();
// load the weather information
// update the weather information
updateData();
}
long lastDrew = 0;
void loop() {
// Handle OTA update requests
ArduinoOTA.handle();
gfx.fillBuffer(MINI_BLACK);
drawTime();
drawCurrentWeather();
int remainingTimeBudget = carousel.update();
// Check if we should update the clock
if (millis() - lastDrew > 30000 && wunderground.getSeconds() == "00") {
drawTime();
lastDrew = millis();
if (remainingTimeBudget > 0) {
// You can do some work here
// Don't do stuff if you are below your
// time budget.
delay(remainingTimeBudget);
}
drawAstronomy();
gfx.commit();
// Check if we should update weather information
if (millis() - lastDownloadUpdate > 1000 * UPDATE_INTERVAL_SECS) {
@@ -146,204 +157,229 @@ void loop() {
}
}
// Called if WiFi has not been configured yet
void configModeCallback (WiFiManager *myWiFiManager) {
ui.setTextAlignment(CENTER);
tft.setFont(&ArialRoundedMTBold_14);
tft.setTextColor(ILI9341_ORANGE);
ui.drawString(120, 28, "Wifi Manager");
ui.drawString(120, 42, "Please connect to AP");
tft.setTextColor(ILI9341_WHITE);
ui.drawString(120, 56, myWiFiManager->getConfigPortalSSID());
tft.setTextColor(ILI9341_ORANGE);
ui.drawString(120, 70, "To setup Wifi Configuration");
}
// callback called during download of files. Updates progress bar
void downloadCallback(String filename, int16_t bytesDownloaded, int16_t bytesTotal) {
Serial.println(String(bytesDownloaded) + " / " + String(bytesTotal));
int percentage = 100 * bytesDownloaded / bytesTotal;
if (percentage == 0) {
ui.drawString(120, 160, filename);
}
if (percentage % 5 == 0) {
ui.setTextAlignment(CENTER);
ui.setTextColor(ILI9341_ORANGE, ILI9341_BLACK);
//ui.drawString(120, 160, String(percentage) + "%");
ui.drawProgressBar(10, 165, 240 - 20, 15, percentage, ILI9341_WHITE, ILI9341_BLUE);
}
}
// Download the bitmaps
void downloadResources() {
tft.fillScreen(ILI9341_BLACK);
tft.setFont(&ArialRoundedMTBold_14);
char id[5];
for (int i = 0; i < 21; i++) {
sprintf(id, "%02d", i);
tft.fillRect(0, 120, 240, 40, ILI9341_BLACK);
webResource.downloadFile("http://www.squix.org/blog/wunderground/" + wundergroundIcons[i] + ".bmp", wundergroundIcons[i] + ".bmp", _downloadCallback);
}
for (int i = 0; i < 21; i++) {
sprintf(id, "%02d", i);
tft.fillRect(0, 120, 240, 40, ILI9341_BLACK);
webResource.downloadFile("http://www.squix.org/blog/wunderground/mini/" + wundergroundIcons[i] + ".bmp", "/mini/" + wundergroundIcons[i] + ".bmp", _downloadCallback);
}
for (int i = 0; i < 24; i++) {
tft.fillRect(0, 120, 240, 40, ILI9341_BLACK);
webResource.downloadFile("http://www.squix.org/blog/moonphase_L" + String(i) + ".bmp", "/moon" + String(i) + ".bmp", _downloadCallback);
}
}
// Update the internet based information and update screen
void updateData() {
tft.fillScreen(ILI9341_BLACK);
tft.setFont(&ArialRoundedMTBold_14);
drawProgress(20, "Updating time...");
timeClient.updateTime();
gfx.fillBuffer(MINI_BLACK);
gfx.setFont(ArialRoundedMTBold_14);
drawProgress(10, "Updating time...");
configTime(UTC_OFFSET * 3600, 0, NTP_SERVERS);
drawProgress(50, "Updating conditions...");
wunderground.updateConditions(WUNDERGRROUND_API_KEY, WUNDERGRROUND_LANGUAGE, WUNDERGROUND_COUNTRY, WUNDERGROUND_CITY);
WundergroundConditions *conditionsClient = new WundergroundConditions(IS_METRIC);
conditionsClient->updateConditions(&conditions, WUNDERGRROUND_API_KEY, WUNDERGRROUND_LANGUAGE, WUNDERGROUND_COUNTRY, WUNDERGROUND_CITY);
delete conditionsClient;
conditionsClient = nullptr;
drawProgress(70, "Updating forecasts...");
wunderground.updateForecast(WUNDERGRROUND_API_KEY, WUNDERGRROUND_LANGUAGE, WUNDERGROUND_COUNTRY, WUNDERGROUND_CITY);
drawProgress(90, "Updating astronomy...");
wunderground.updateAstronomy(WUNDERGRROUND_API_KEY, WUNDERGRROUND_LANGUAGE, WUNDERGROUND_COUNTRY, WUNDERGROUND_CITY);
//lastUpdate = timeClient.getFormattedTime();
//readyForWeatherUpdate = false;
drawProgress(100, "Done...");
WundergroundForecast *forecastClient = new WundergroundForecast(IS_METRIC);
forecastClient->updateForecast(forecasts, MAX_FORECASTS, WUNDERGRROUND_API_KEY, WUNDERGRROUND_LANGUAGE, WUNDERGROUND_COUNTRY, WUNDERGROUND_CITY);
delete forecastClient;
forecastClient = nullptr;
drawProgress(80, "Updating astronomy...");
WundergroundAstronomy *astronomyClient = new WundergroundAstronomy(STYLE_12HR);
astronomyClient->updateAstronomy(&astronomy, WUNDERGRROUND_API_KEY, WUNDERGRROUND_LANGUAGE, WUNDERGROUND_COUNTRY, WUNDERGROUND_CITY);
delete astronomyClient;
astronomyClient = nullptr;
moonAgeImage = String((char) (65 + 26 * (((15 + astronomy.moonAge.toInt()) % 30) / 30.0)));
delay(1000);
tft.fillScreen(ILI9341_BLACK);
drawTime();
drawCurrentWeather();
drawForecast();
drawAstronomy();
}
// Progress bar helper
void drawProgress(uint8_t percentage, String text) {
ui.setTextAlignment(CENTER);
ui.setTextColor(ILI9341_ORANGE, ILI9341_BLACK);
tft.fillRect(0, 140, 240, 45, ILI9341_BLACK);
ui.drawString(120, 160, text);
ui.drawProgressBar(10, 165, 240 - 20, 15, percentage, ILI9341_WHITE, ILI9341_BLUE);
gfx.fillBuffer(MINI_BLACK);
gfx.setFont(ArialRoundedMTBold_14);
gfx.setTextAlignment(TEXT_ALIGN_CENTER);
gfx.setColor(MINI_YELLOW);
gfx.drawString(120, 146, text);
gfx.setColor(MINI_WHITE);
gfx.drawRect(10, 165, 240 - 20, 15);
gfx.setColor(MINI_BLUE);
gfx.fillRect(12, 167, 216 * percentage / 100, 11);
gfx.commit();
}
// draws the clock
void drawTime() {
ui.setTextAlignment(CENTER);
ui.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
tft.setFont(&ArialRoundedMTBold_14);
String date = wunderground.getDate();
ui.drawString(120, 20, date);
/*gfx.setTextAlignment(TEXT_ALIGN_CENTER);
gfx.setColor(MINI_WHITE);
gfx.setFont(ArialRoundedMTBold_14);
String date = conditions.date;
gfx.drawString(120, 6, date);
tft.setFont(&ArialRoundedMTBold_36);
String time = timeClient.getHours() + ":" + timeClient.getMinutes();
ui.drawString(120, 56, time);
drawSeparator(65);
gfx.setFont(ArialRoundedMTBold_36);
String time = timeClient.getHours() + ":" + timeClient.getMinutes() + ":" + timeClient.getSeconds();
gfx.drawString(120, 20, time);*/
char *dstAbbrev;
char time_str[11];
time_t now = dstAdjusted.time(&dstAbbrev);
struct tm * timeinfo = localtime (&now);
gfx.setTextAlignment(TEXT_ALIGN_CENTER);
gfx.setFont(ArialRoundedMTBold_14);
String date = ctime(&now);
date = date.substring(0,11) + String(1900 + timeinfo->tm_year);
gfx.drawString(120, 6, date);
gfx.setFont(ArialRoundedMTBold_36);
if (STYLE_12HR) {
int hour = (timeinfo->tm_hour+11)%12+1; // take care of noon and midnight
sprintf(time_str, "%2d:%02d:%02d\n",hour, timeinfo->tm_min, timeinfo->tm_sec);
gfx.drawString(120, 20, time_str);
} else {
sprintf(time_str, "%02d:%02d:%02d\n",timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
gfx.drawString(120, 20, time_str);
}
gfx.setTextAlignment(TEXT_ALIGN_LEFT);
gfx.setFont(ArialMT_Plain_10);
gfx.setColor(MINI_BLUE);
if (STYLE_12HR) {
sprintf(time_str, "%s\n%s", dstAbbrev, timeinfo->tm_hour>=12?"PM":"AM");
gfx.drawString(195, 27, time_str);
} else {
sprintf(time_str, "%s", dstAbbrev);
gfx.drawString(195, 27, time_str); // Known bug: Cuts off 4th character of timezone abbreviation
}
}
// draws current weather information
void drawCurrentWeather() {
// Weather Icon
String weatherIcon = getMeteoconIcon(wunderground.getTodayIcon());
ui.drawBmp(weatherIcon + ".bmp", 0, 55);
gfx.setTransparentColor(MINI_BLACK);
gfx.drawPalettedBitmapFromPgm(0, 55, getMeteoconIconFromProgmem(conditions.weatherIcon));
// Weather Text
tft.setFont(&ArialRoundedMTBold_14);
ui.setTextColor(ILI9341_ORANGE, ILI9341_BLACK);
ui.setTextAlignment(RIGHT);
ui.drawString(220, 90, wunderground.getWeatherText());
gfx.setFont(ArialRoundedMTBold_14);
gfx.setColor(MINI_YELLOW);
gfx.setTextAlignment(TEXT_ALIGN_RIGHT);
gfx.drawString(220, 76, conditions.weatherText);
tft.setFont(&ArialRoundedMTBold_36);
ui.setTextColor(ILI9341_ORANGE, ILI9341_BLACK);
ui.setTextAlignment(RIGHT);
String degreeSign = "F";
gfx.setFont(ArialRoundedMTBold_36);
gfx.setColor(MINI_WHITE);
gfx.setTextAlignment(TEXT_ALIGN_RIGHT);
String degreeSign = "°F";
if (IS_METRIC) {
degreeSign = "C";
degreeSign = "°C";
}
String temp = wunderground.getCurrentTemp() + degreeSign;
ui.drawString(220, 125, temp);
drawSeparator(135);
String temp = conditions.currentTemp + degreeSign;
gfx.drawString(220, 89, temp);
}
// draws the three forecast columns
void drawForecast() {
drawForecastDetail(10, 165, 0);
drawForecastDetail(95, 165, 2);
drawForecastDetail(180, 165, 4);
drawSeparator(165 + 65 + 10);
void drawForecast1(MiniGrafx *display, CarouselState* state, int16_t x, int16_t y) {
drawForecastDetail(x + 10, y + 165, 0);
drawForecastDetail(x + 95, y + 165, 2);
drawForecastDetail(x + 180, y + 165, 4);
}
void drawForecast2(MiniGrafx *display, CarouselState* state, int16_t x, int16_t y) {
drawForecastDetail(x + 10, y + 165, 6);
drawForecastDetail(x + 95, y + 165, 8);
drawForecastDetail(x + 180, y + 165, 10);
}
// helper for the forecast columns
void drawForecastDetail(uint16_t x, uint16_t y, uint8_t dayIndex) {
ui.setTextColor(ILI9341_ORANGE, ILI9341_BLACK);
tft.setFont(&ArialRoundedMTBold_14);
ui.setTextAlignment(CENTER);
String day = wunderground.getForecastTitle(dayIndex).substring(0, 3);
gfx.setColor(MINI_YELLOW);
gfx.setFont(ArialRoundedMTBold_14);
gfx.setTextAlignment(TEXT_ALIGN_CENTER);
String day = forecasts[dayIndex].forecastTitle.substring(0, 3);
day.toUpperCase();
ui.drawString(x + 25, y, day);
gfx.drawString(x + 25, y - 15, day);
ui.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
ui.drawString(x + 25, y + 14, wunderground.getForecastLowTemp(dayIndex) + "|" + wunderground.getForecastHighTemp(dayIndex));
String weatherIcon = getMeteoconIcon(wunderground.getForecastIcon(dayIndex));
ui.drawBmp("/mini/" + weatherIcon + ".bmp", x, y + 15);
gfx.setColor(MINI_WHITE);
gfx.drawString(x + 25, y, forecasts[dayIndex].forecastLowTemp + "|" + forecasts[dayIndex].forecastHighTemp);
gfx.drawPalettedBitmapFromPgm(x, y + 15, getMiniMeteoconIconFromProgmem(forecasts[dayIndex].forecastIcon));
gfx.setColor(MINI_BLUE);
gfx.drawString(x + 25, y + 60, forecasts[dayIndex].PoP + "%");
}
// draw moonphase and sunrise/set and moonrise/set
void drawAstronomy() {
int moonAgeImage = 24 * wunderground.getMoonAge().toInt() / 30.0;
ui.drawBmp("/moon" + String(moonAgeImage) + ".bmp", 120 - 30, 255);
ui.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
tft.setFont(&ArialRoundedMTBold_14);
ui.setTextAlignment(LEFT);
ui.setTextColor(ILI9341_ORANGE, ILI9341_BLACK);
ui.drawString(20, 270, "Sun");
ui.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
ui.drawString(20, 285, wunderground.getSunriseTime());
ui.drawString(20, 300, wunderground.getSunsetTime());
gfx.setFont(MoonPhases_Regular_36);
gfx.setColor(MINI_WHITE);
gfx.setTextAlignment(TEXT_ALIGN_CENTER);
gfx.drawString(120, 275, moonAgeImage);
gfx.setColor(MINI_WHITE);
gfx.setFont(ArialRoundedMTBold_14);
gfx.setTextAlignment(TEXT_ALIGN_CENTER);
gfx.setColor(MINI_YELLOW);
gfx.drawString(120, 250, astronomy.moonPhase);
gfx.setTextAlignment(TEXT_ALIGN_LEFT);
gfx.setColor(MINI_YELLOW);
gfx.drawString(5, 250, "Sun");
gfx.setColor(MINI_WHITE);
gfx.drawString(5, 276, astronomy.sunriseTime);
gfx.drawString(5, 291, astronomy.sunsetTime);
ui.setTextAlignment(RIGHT);
ui.setTextColor(ILI9341_ORANGE, ILI9341_BLACK);
ui.drawString(220, 270, "Moon");
ui.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
ui.drawString(220, 285, wunderground.getMoonriseTime());
ui.drawString(220, 300, wunderground.getMoonsetTime());
gfx.setTextAlignment(TEXT_ALIGN_RIGHT);
gfx.setColor(MINI_YELLOW);
gfx.drawString(235, 250, "Moon");
gfx.setColor(MINI_WHITE);
gfx.drawString(235, 276, astronomy.moonriseTime);
gfx.drawString(235, 291, astronomy.moonsetTime);
}
// Helper function, should be part of the weather station library and should disappear soon
String getMeteoconIcon(String iconText) {
if (iconText == "F") return "chanceflurries";
if (iconText == "Q") return "chancerain";
if (iconText == "W") return "chancesleet";
if (iconText == "V") return "chancesnow";
if (iconText == "S") return "chancestorms";
if (iconText == "B") return "clear";
if (iconText == "Y") return "cloudy";
if (iconText == "F") return "flurries";
if (iconText == "M") return "fog";
if (iconText == "E") return "hazy";
if (iconText == "Y") return "mostlycloudy";
if (iconText == "H") return "mostlysunny";
if (iconText == "H") return "partlycloudy";
if (iconText == "J") return "partlysunny";
if (iconText == "W") return "sleet";
if (iconText == "R") return "rain";
if (iconText == "W") return "snow";
if (iconText == "B") return "sunny";
if (iconText == "0") return "tstorms";
const char* getMeteoconIconFromProgmem(String iconText) {
if (iconText == "chanceflurries") return chanceflurries;
if (iconText == "chancerain") return chancerain;
if (iconText == "chancesleet") return chancesleet;
if (iconText == "chancesnow") return chancesnow;
if (iconText == "chancetstorms") return chancestorms;
if (iconText == "cloudy") return clear;
if (iconText == "cloudy") return cloudy;
if (iconText == "flurries") return flurries;
if (iconText == "fog") return fog;
if (iconText == "hazy") return hazy;
if (iconText == "mostlycloudy") return mostlycloudy;
if (iconText == "mostlysunny") return mostlysunny;
if (iconText == "partlycloudy") return partlycloudy;
if (iconText == "partlysunny") return partlysunny;
if (iconText == "sleet") return sleet;
if (iconText == "rain") return rain;
if (iconText == "snow") return snow;
if (iconText == "sunny") return sunny;
if (iconText == "tstorms") return tstorms;
return "unknown";
return unknown;
}
const char* getMiniMeteoconIconFromProgmem(String iconText) {
if (iconText == "chanceflurries") return minichanceflurries;
if (iconText == "chancerain") return minichancerain;
if (iconText == "chancesleet") return minichancesleet;
if (iconText == "chancesnow") return minichancesnow;
if (iconText == "chancetstorms") return minichancestorms;
if (iconText == "clear") return miniclear;
if (iconText == "cloudy") return minicloudy;
if (iconText == "flurries") return miniflurries;
if (iconText == "fog") return minifog;
if (iconText == "hazy") return minihazy;
if (iconText == "mostlycloudy") return minimostlycloudy;
if (iconText == "mostlysunny") return minimostlysunny;
if (iconText == "partlycloudy") return minipartlycloudy;
if (iconText == "partlysunny") return minipartlysunny;
if (iconText == "sleet") return minisleet;
if (iconText == "rain") return minirain;
if (iconText == "snow") return minisnow;
if (iconText == "sunny") return minisunny;
if (iconText == "tstorms") return minitstorms;
return miniunknown;
}
// if you want separators, uncomment the tft-line
void drawSeparator(uint16_t y) {
//tft.drawFastHLine(10, y, 240 - 2 * 10, 0x4228);
}