incorrect time shown on clock when switching widgets #296

Open
opened 2025-03-16 17:18:36 +00:00 by nconner-06 · 4 comments
nconner-06 commented 2025-03-16 17:18:36 +00:00 (Migrated from github.com)

when you change widgets, the clock widget briefly shows the old time before refreshing

This is caused because WidgetSet::switchWidget, is calling "setup" rather than "update":

void WidgetSet::switchWidget() {
m_screenManager->clearAllScreens();
getCurrent()->setup();
uint32_t start = millis();
getCurrent()->draw(true);
uint32_t end = millis();
Serial.printf("Drawing of %s took %d ms\n", getCurrent()->getName().c_str(), (end - start));
}

should be getCurrent()->update();

when you change widgets, the clock widget briefly shows the old time before refreshing This is caused because WidgetSet::switchWidget, is calling "setup" rather than "update": void WidgetSet::switchWidget() { m_screenManager->clearAllScreens(); getCurrent()->**setup**(); uint32_t start = millis(); getCurrent()->draw(true); uint32_t end = millis(); Serial.printf("Drawing of %s took %d ms\n", getCurrent()->getName().c_str(), (end - start)); } should be getCurrent()->update();
flattermann commented 2025-03-17 13:11:33 +00:00 (Migrated from github.com)

Please do not remove setup() here, because this is also used by the widgets to know that they are about to be displayed.
e.g. the ParqetWidget uses it to always start with the first screen.

(And yes, we should implement a better lifecycle management, e.g. like android (onCreate(), onResume(), onPause()...)

But adding .update() after .setup() here should work.

Please do not remove `setup()` here, because this is also used by the widgets to know that they are about to be displayed. e.g. the ParqetWidget uses it to always start with the first screen. (And yes, we should implement a better lifecycle management, e.g. like android (onCreate(), onResume(), onPause()...) But adding `.update()` after `.setup()` here should work.
nconner-06 commented 2025-03-17 13:30:04 +00:00 (Migrated from github.com)

ok, but for me, setup should only be called ONCE when the orb starts and not every time we cycle to it..

ok, but for me, setup should only be called ONCE when the orb starts and not every time we cycle to it..
flattermann commented 2025-03-17 13:37:25 +00:00 (Migrated from github.com)

Yes, that's definitely more logical.

As soon as we implement some other lifecycle hooks (e.g. onResume()/onPause() if we cycle to/from a widget) we can remove it here.

Yes, that's definitely more logical. As soon as we implement some other lifecycle hooks (e.g. onResume()/onPause() if we cycle to/from a widget) we can remove it here.
dreed47 commented 2025-03-28 15:10:08 +00:00 (Migrated from github.com)

calling getCurrent()->update(); at switchWidget is causing the clockwidget to draw with missing digits. See issue #310 . This change got moved into dev with PR #271 I submitted PR #312 to revert this in dev

calling getCurrent()->update(); at switchWidget is causing the clockwidget to draw with missing digits. See issue #310 . This change got moved into dev with PR #271 I submitted PR #312 to revert this in dev
Sign in to join this conversation.
No description provided.