Skip to content

Commit

Permalink
Moved helper functions out to meteocon file
Browse files Browse the repository at this point in the history
  • Loading branch information
squix78 committed Jul 23, 2017
1 parent 7325b38 commit 6aecec6
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 78 deletions.
77 changes: 0 additions & 77 deletions esp8266-weather-station-color.ino
Original file line number Diff line number Diff line change
Expand Up @@ -575,80 +575,3 @@ void calibrationCallback(int16_t x, int16_t y) {
gfx.fillCircle(x, y, 10);
}

// Helper function, should be part of the weather station library and should disappear soon
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 == "clear") 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;
}
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;
}
// Helper function, should be part of the weather station library and should disappear soon
const String getShortText(String iconText) {

if (iconText == "chanceflurries") return "Chance of Flurries";
if (iconText == "chancerain") return "Chance of Rain";
if (iconText == "chancesleet") return "Chance of Sleet";
if (iconText == "chancesnow") return "Chance of Snow";
if (iconText == "chancetstorms") return "Chance of Storms";
if (iconText == "clear") 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 "Mostly Cloudy";
if (iconText == "mostlysunny") return "Mostly Sunny";
if (iconText == "partlycloudy") return "Partly Couldy";
if (iconText == "partlysunny") return "Partly Sunny";
if (iconText == "sleet") return "Sleet";
if (iconText == "rain") return "Rain";
if (iconText == "snow") return "Snow";
if (iconText == "sunny") return "Sunny";
if (iconText == "tstorms") return "Storms";


return "-";
}

2 changes: 1 addition & 1 deletion settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const int SLEEP_INTERVAL_SECS = 0; // Going to Sleep after idle times, set 0 f
// e.g. http://api.wunderground.com/api/808ba87ed77c4511/conditions/q/CA/SAN_FRANCISCO.json <- note that in the US you use the state instead of country code

const String DISPLAYED_CITY_NAME = "Zürich";
const String WUNDERGRROUND_API_KEY = "afe8d9c8337d73d9";
const String WUNDERGRROUND_API_KEY = "<WUNDERGRROUND_API_KEY>";
const String WUNDERGRROUND_LANGUAGE = "EN";
const String WUNDERGROUND_COUNTRY = "CH";
const String WUNDERGROUND_CITY = "Zurich";
Expand Down
81 changes: 81 additions & 0 deletions weathericons.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

const char SquixLogo[] PROGMEM = {
0x01, // Version: 1
0x02, // BitDepth: 2
Expand Down Expand Up @@ -3706,5 +3707,85 @@ const char miniunknown[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};


// Helper function, should be part of the weather station library and should disappear soon
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 == "clear") 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;
}
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;
}
// Helper function, should be part of the weather station library and should disappear soon
const String getShortText(String iconText) {

if (iconText == "chanceflurries") return "Chance of Flurries";
if (iconText == "chancerain") return "Chance of Rain";
if (iconText == "chancesleet") return "Chance of Sleet";
if (iconText == "chancesnow") return "Chance of Snow";
if (iconText == "chancetstorms") return "Chance of Storms";
if (iconText == "clear") 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 "Mostly Cloudy";
if (iconText == "mostlysunny") return "Mostly Sunny";
if (iconText == "partlycloudy") return "Partly Couldy";
if (iconText == "partlysunny") return "Partly Sunny";
if (iconText == "sleet") return "Sleet";
if (iconText == "rain") return "Rain";
if (iconText == "snow") return "Snow";
if (iconText == "sunny") return "Sunny";
if (iconText == "tstorms") return "Storms";


return "-";
}





0 comments on commit 6aecec6

Please sign in to comment.