Skip to content

Commit

Permalink
Fix l10n and WiFi connect issues
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelstoer committed Sep 16, 2018
1 parent e906365 commit ba74e3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions esp8266-weather-station-color.ino
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void connectWifi() {
Serial.print(WIFI_SSID);
Serial.print("/");
Serial.println(WIFI_PASS);
WiFi.disconnect();
WiFi.mode(WIFI_STA);
WiFi.hostname(WIFI_HOSTNAME);
WiFi.begin(WIFI_SSID,WIFI_PASS);
Expand Down Expand Up @@ -341,8 +342,7 @@ void drawTime() {
gfx.setTextAlignment(TEXT_ALIGN_CENTER);
gfx.setFont(ArialRoundedMTBold_14);
gfx.setColor(MINI_WHITE);
String date = ctime(&now);
date = date.substring(0,11) + String(1900 + timeinfo->tm_year);
String date = WDAY_NAMES[timeinfo->tm_wday] + " " + MONTH_NAMES[timeinfo->tm_mon] + " " + String(timeinfo->tm_mday) + " " + String(1900 + timeinfo->tm_year);
gfx.drawString(120, 6, date);

gfx.setFont(ArialRoundedMTBold_36);
Expand Down Expand Up @@ -443,23 +443,23 @@ void drawAstronomy() {

gfx.setTextAlignment(TEXT_ALIGN_LEFT);
gfx.setColor(MINI_YELLOW);
gfx.drawString(5, 250, "Sun");
gfx.drawString(5, 250, SUN_MOON_TEXT[0]);
gfx.setColor(MINI_WHITE);
time_t time = currentWeather.sunrise + dstOffset;
gfx.drawString(5, 276, "Rise:");
gfx.drawString(5, 276, SUN_MOON_TEXT[1] + ":");
gfx.drawString(45, 276, getTime(&time));
time = currentWeather.sunset + dstOffset;
gfx.drawString(5, 291, "Set:");
gfx.drawString(5, 291, SUN_MOON_TEXT[2] + ":");
gfx.drawString(45, 291, getTime(&time));

gfx.setTextAlignment(TEXT_ALIGN_RIGHT);
gfx.setColor(MINI_YELLOW);
gfx.drawString(235, 250, "Moon");
gfx.drawString(235, 250, SUN_MOON_TEXT[3]);
gfx.setColor(MINI_WHITE);
gfx.drawString(235, 276, String(moonAge) + "d");
gfx.drawString(235, 291, String(moonData.illumination * 100, 0) + "%");
gfx.drawString(200, 276, "Age:");
gfx.drawString(200, 291, "Illum:");
gfx.drawString(200, 276, SUN_MOON_TEXT[4] + ":");
gfx.drawString(200, 291, SUN_MOON_TEXT[5] + ":");

}

Expand Down Expand Up @@ -639,4 +639,3 @@ String getTime(time_t *timestamp) {
sprintf(buf, "%02d:%02d", timeInfo->tm_hour, timeInfo->tm_min);
return String(buf);
}

2 changes: 1 addition & 1 deletion settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const uint8_t MAX_FORECASTS = 10;
// Adjust according to your language
const String WDAY_NAMES[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
const String MONTH_NAMES[] = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
const String SUN_MOON_TEXT[] = {"Sun", "Rise", "Set", "Moon", "Age", "Illum"};
const String MOON_PHASES[] = {"New Moon", "Waxing Crescent", "First Quarter", "Waxing Gibbous",
"Full Moon", "Waning Gibbous", "Third quarter", "Waning Crescent"};

Expand Down Expand Up @@ -92,4 +93,3 @@ bool IS_STYLE_12HR = false;
/***************************
* End Settings
**************************/

0 comments on commit ba74e3c

Please sign in to comment.