-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Super-rough structure-only per-screen refactor #219
base: dev
Are you sure you want to change the base?
Conversation
firmware/src/core/Feed.h
Outdated
|
||
struct Feed { | ||
public: | ||
virtual String& getName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the name required?
I'd say that 'id' would be enough.
and a nit: this is indented with 3 spaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need some kind of name to show in the config UI. Whether this is the best way to do it is debatable, I am open to suggestions.
(Alternately, we could have a big switch somewhere that names Ids, but that makes it easy for Orb authors to forget...)
firmware/src/core/Feed.h
Outdated
}; | ||
|
||
struct Feed { | ||
public: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public
is not needed in a struct as first item, everything in a struct is public by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forget that all the time, so I like to be explicit. If we decide it's an enforced style thing, no problem, I'll take it out.
enum OrbId | ||
{ | ||
OrbDateTimeWeekday = 1, | ||
OrbCityWeatherPrediction = 2, | ||
OrbWeatherIcon = 3, | ||
OrbTemperatureHighLow = 4, | ||
OrbWeather3DayForecast = 5 | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this allows to mix and match the orbs, which is a long-standing feature request:
enum class OrbId
{
Invalid,
Weather_DateTimeWeekday,
Weather_CityPrediction,
Weather_Icon,
Weather_TemperatureHighLow,
Weather_3DayForecast,
Stocks_1,
Stocks_2,
Stocks_3,
Stocks_4,
Stocks_5,
Clock_Hour_h,
Clock_Hour_l,
Clock_SecondsColon,
Clock_Minute_h,
Clock_Minute_l,
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's the point of it, I just started with the weather widget -- are you saying you don't like the naming of the enum members?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess so.
In cases like this, having a consistent style in naming pays off imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we need an enum? Why not a list of list-of instances? (with constuctor/factory parameters as required). Totally value pseudo-code
[
[
new Clock(mode=HourH),
new Clock(mode=HourL),
new Clock(mode=SecondsColon),
new Clock(mode=SecondsH),
new Clock(mode=SecondsL)
],
[
new Stock(symbol=whatever, currency=whatever, apikey=whateever),
...
],
[
new WeatherTemp(..., location=whatever),
new WeatherRain(..., location=whatever),
new WeatherThing(..., location=whatever),
...
]
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need something in the UI, ya
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the UI, and in the config files / web editor / whatever is used to configure this thing.
You can't really transmit class instances over the web ;)
I like the overall design direction. I have a couple logical model recommendations.
|
Gadget only needs to support configurable mix/match orb sets, because there really no longer is such a thing as a predefined widget; those are just default mix/match configurations. You'd start out with a configuration for a Gadget that has 4 instances of a ClockDigit orb, and one ClockSeconds orb. If we want to prevent users from changing the default settings, we can make them read-only -- but they will still work the exact same way. |
Sorry I broke this PR merging #218 |
No description provided.