Make ClockWidget widget optional #283

Open
opened 2025-03-15 05:21:27 +00:00 by lyricnz · 5 comments
lyricnz commented 2025-03-15 05:21:27 +00:00 (Migrated from github.com)

No reason why it should be hardcoded. Maybe I don't want a clock?

No reason why it should be hardcoded. Maybe I don't want a clock?
dreed47 commented 2025-03-15 08:23:53 +00:00 (Migrated from github.com)

I Agree. I think all widgets should behave the same including the ability to turn them off

I Agree. I think all widgets should behave the same including the ability to turn them off
flattermann commented 2025-03-15 08:38:46 +00:00 (Migrated from github.com)

We can do that, we just need to make sure that something like WidgetSet::next() does not go into an infinite recursion.
At the moment, it expects at least one widget to be enabled.

github.com/brettdottech/info-orbs@f584d09f14/firmware/src/core/widget/WidgetSet.cpp (L43)

We can do that, we just need to make sure that something like `WidgetSet::next()` does not go into an infinite recursion. At the moment, it expects at least one widget to be enabled. https://github.com/brettdottech/info-orbs/blob/f584d09f14ae5186ff52b0548ba1efbe62c22908/firmware/src/core/widget/WidgetSet.cpp#L43
dreed47 commented 2025-03-15 19:49:35 +00:00 (Migrated from github.com)

WidgetSet::next() should first check the count

if (m_widgetCount == 0) {
        Log.warningln("No widgets available");
        return;
    }
WidgetSet::next() should first check the count ```cpp if (m_widgetCount == 0) { Log.warningln("No widgets available"); return; } ```
flattermann commented 2025-03-16 00:03:52 +00:00 (Migrated from github.com)

That only helps if you compile with 0 widgets (and that will probably "never" happen, but we should check for it anyway).

But we also need to check for the case that a user disables all widgets in the WebUI. That might actually happen by accident.

That only helps if you compile with 0 widgets (and that will probably "never" happen, but we should check for it anyway). But we also need to check for the case that a user **disables** all widgets in the WebUI. That might actually happen by accident.
nconner-06 commented 2025-03-17 11:19:34 +00:00 (Migrated from github.com)

don't forget WidgetSet::prev() :-(

maybe better to check m_enabled as this is what the user can change.. Once we add the ability to change it's value in the UI.

don't forget WidgetSet::prev() :-( maybe better to check m_enabled as this is what the user can change.. Once we add the ability to change it's value in the UI.
Sign in to join this conversation.
No description provided.