You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// add code here/**The MIT License (MIT)Copyright (c) 2018 by Daniel Eichhorn - ThingPulsePermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, 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 THESOFTWARE.See more at https://thingpulse.com*/#include<Arduino.h>#include<ESP8266WiFi.h>#include<ESP8266HTTPClient.h>#include<Ticker.h>#include<JsonListener.h>#include<SSD1306Wire.h>#include<OLEDDisplayUi.h>#include<Wire.h>#include<WorldClockClient.h>#include"icons.h"#include"fonts.h"/*************************** * Begin Settings **************************/// WIFIconstchar*WIFI_SSID="ssid";
constchar*WIFI_PWD="pwd";
// SetupconstintUPDATE_INTERVAL_SECS=10*60; // Update every 10 minutes// Display SettingsconstintI2C_DISPLAY_ADDRESS=0x3c;
constintSDA_PIN=0; //D3;constintSDC_PIN=2; //D4;// TimeClient settings// Initialize the oled display for address 0x3c// sda-pin=14 and sdc-pin=12SSD1306Wiredisplay(I2C_DISPLAY_ADDRESS, SDA_PIN, SDC_PIN);
OLEDDisplayUiui(&display);
/*************************** * End Settings **************************/StringtimeZoneIds[] = { "America/Louisville", "Europe/London", "Europe/Prague", "Asia/Calcutta" };
//String timeZoneIds[] = {"America/New_York", "Europe/London", "Europe/Paris", "Australia/Sydney"};WorldClockClientworldClockClient("de", "CH", "E, dd. MMMMM yyyy", 4, timeZoneIds);
// flag changed in the ticker function every 10 minutesboolreadyForUpdate= false;
StringlastUpdate="--";
Tickerticker;
voidupdateData(OLEDDisplay*display) {
drawProgress(display, 50, "Updating Time...");
worldClockClient.updateTime();
drawProgress(display, 100, "Done...");
readyForUpdate= false;
delay(1000);
}
voiddrawProgress(OLEDDisplay*display, intpercentage, Stringlabel) {
display->clear();
display->setTextAlignment(TEXT_ALIGN_CENTER);
display->setFont(ArialMT_Plain_10);
display->drawString(64, 10, label);
display->drawProgressBar(10, 28, 108, 12, percentage);
display->display();
}
voiddrawClock(OLEDDisplay*display, intx, inty, inttimeZoneIndex, Stringcity, constuint8_t*icon) {
display->setTextAlignment(TEXT_ALIGN_LEFT);
display->setFont(ArialMT_Plain_10);
display->drawString(x+60, y+5, city);
display->setFont(Crushed_Plain_36);
display->drawXbm(x, y, 60, 60, icon);
display->drawString(x+60, y+15, worldClockClient.getHours(timeZoneIndex) +":"+worldClockClient.getMinutes(timeZoneIndex));
}
voiddrawFrame1(OLEDDisplay*display, OLEDDisplayUiState*state, int16_tx, int16_ty) {
drawClock(display, x, y, 0, "Mason", NULL_bits); //new_york_bits);
}
voiddrawFrame2(OLEDDisplay*display, OLEDDisplayUiState*state, int16_tx, int16_ty) {
drawClock(display, x, y, 1, "London", london_bits);
}
voiddrawFrame3(OLEDDisplay*display, OLEDDisplayUiState*state, int16_tx, int16_ty) {
drawClock(display, x, y, 2, "Brno", NULL_bits); //paris_bits);
}
voiddrawFrame4(OLEDDisplay*display, OLEDDisplayUiState*state, int16_tx, int16_ty) {
drawClock(display, x, y, 3, "Pune", NULL_bits); //sydney_bits);
}
voidsetReadyForWeatherUpdate() {
Serial.println("Setting readyForUpdate to true");
readyForUpdate= true;
}
// this array keeps function pointers to all frames// frames are the single views that slide from right to leftFrameCallbackframes[] = { drawFrame1, drawFrame2, drawFrame3, drawFrame4 };
intnumberOfFrames=4;
voidsetup() {
Serial.begin(115200);
Serial.println();
Serial.println();
// initialize dispalydisplay.init();
display.clear();
display.display();
//display.flipScreenVertically();display.setFont(ArialMT_Plain_10);
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.setContrast(255);
WiFi.begin(WIFI_SSID, WIFI_PWD);
intcounter=0;
while (WiFi.status() !=WL_CONNECTED) {
delay(500);
Serial.print(".");
display.clear();
display.drawString(64, 10, "Connecting to WiFi");
display.drawXbm(46, 30, 8, 8, counter % 3==0 ? activeSymbol : inactiveSymbol);
display.drawXbm(60, 30, 8, 8, counter % 3==1 ? activeSymbol : inactiveSymbol);
display.drawXbm(74, 30, 8, 8, counter % 3==2 ? activeSymbol : inactiveSymbol);
display.display();
counter++;
}
ui.setTargetFPS(30);
// You can change this to// TOP, LEFT, BOTTOM, RIGHTui.setIndicatorPosition(BOTTOM);
// Defines where the first frame is located in the bar.ui.setIndicatorDirection(LEFT_RIGHT);
// You can change the transition that is used// SLIDE_LEFT, SLIDE_RIGHT, SLIDE_TOP, SLIDE_DOWNui.setFrameAnimation(SLIDE_LEFT);
// Add framesui.setFrames(frames, numberOfFrames);
// Inital UI takes care of initalising the display too.ui.init();
Serial.println("");
updateData(&display);
ticker.attach(UPDATE_INTERVAL_SECS, setReadyForWeatherUpdate);
}
voidloop() {
if (readyForUpdate&&ui.getUiState()->frameState==FIXED) {
updateData(&display);
}
intremainingTimeBudget=ui.update();
if (remainingTimeBudget>0) {
// You can do some work here// Don't do stuff if you are below your// time budget.delay(remainingTimeBudget);
}
}
The text was updated successfully, but these errors were encountered:
Expected behavior
I believed if I select predefined WorldClockDemo, it would work.
video of behive:
https://youtube.com/shorts/26vH14OXqgU?feature=share
Actual behavior
But time on pages is missing
Test code
Provide a Minimal, Complete, and Verifiable example which will reproduce the problem.
The text was updated successfully, but these errors were encountered: