-
Notifications
You must be signed in to change notification settings - Fork 201
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
ESP-DASH v5 #246
base: dev
Are you sure you want to change the base?
ESP-DASH v5 #246
Conversation
e23cc8a
to
591562e
Compare
Let's get this re-write done & polished by Q2'25 @mathieucarbou 🚀. I see that you are miles better than me in C/C++, so I commend you for it and it's better in your hands. My focus will be on redesigning the UI to make it a proper on-device dashboard. It's going to be way better than what anybody has seen till now with dark mode support and a revamped design language similar to latest dashboards. |
Yes!
What's in dev (PR #245) could be merged if you want in 4.x, or kept for 5.x, whatever. I am already using |
This PR is marked as stale because it has been open 45 days with no activity. You can remove stale label or comment if this PR is still valid. |
7ee5269
to
7811d16
Compare
@mathieucarbou Please write a migration guide for users switching from v4 to v5 and state all the necessary changes. I'll have to add it to docs website before release. This can be in a markdown document. |
That would be a good idea that you make it while you test and see if there are some hiccups.i think this effort has to be in the pro version because the way I wrote V5, V5 is a subset of pro. Also you need to get code ownership and understanding to support it. |
That is true, It'll just take more time. Currently the UI is being rewritten in Svelte 5 so I'll check the C part once that's done. |
c15cc51
to
9020018
Compare
So V5 release and V5-Pro is imminent? If so, then I would slow down on my Dashboard integration |
@inF1704 v5 and v5 Pro are imminent but it is scheduled for release in Q2'25. |
Oh dear, I love it 💯 Will it easy to port to V5 when I already have a huge dashboard with over 100 cards? |
@inF1704 As far as I see, It should be fine. If you compare both examples, the structure of code remains the same. To help with the transition, there will also be a detailed migration guide. |
ESP-DASH v5
ESP-DASH v5 is a rewrite of ESP-DASH **OSS and Pro## Motivation versions with C++ 17.
Motivation
The rewrite has been motived by several factors including:
The rewrite uses C++ 17 inheritance, polymorphism and templating.
Now, the
website.cpp
file is 15KB, compared to the initial 36KB.The preliminary results in a big app with about 225 cards and 30 stats show a decrease in RAM usage of about 60%.
Backward compatibility
The rewrite is also backward compatible and will display deprecation compiler warnings if the old deprecated API is used.The rewrite is not backward compatible. The API changed significantly, so providing a backward compatibility layer is:
I am using v5 since months now, and I find it will be much easier to propose both v4 and v5 for download, tell people that v5 is the new version and that v4 won't be enhanced anymore.
Benchmark.ino Example
Benchmark.ino is a new example that demonstrates the new API and the new features.
Compile flags
C++ 17 is required, which is the default in new Arduino versions, otherwise, you can add to your PIO file:
-D DASH_DEBUG
: activate debug mode-D DASH_USE_STL_STRING=1
: usesstd::string
instead ofString
for the string typeESP-DASH also defines its own string
dash::string
, which points toString
orstd::string
depending on the flag-D DASH_USE_STL_STRING=1
.dash::string
can be used to avoid usingString
orstd::string
directly and write portable code or examples.New API
All Widgets
const char*
,std::string
,String
)Note: working with floating point numbers is generally slower than working with integral numbers because of the rounding step requiring to convert the number to a string representation with a fixed number of decimals.
Statistics
dash::StatisticValue
: replacesStatistic
dash::StatisticProvider
: a new kind of auto-updatable statistic: the value is sourced from a function and is automatically updated when the dashboard is refreshed.Charts
Charts have 2 axis: X and Y.
For each axis, the type can be integral or floating point.
For the X axis, strings are also supported.
For performance reasons, floating point precision is not supported for charts.
It is advised to do the rounding in the value arrays.
Cards
dash::FeedbackCard
STATUS_CARD
dash::string
typeconst char*
withdash::FeedbackCard<const char*>
dash::GenericCard
GENERIC_CARD
dash::string
typedash::HumidityCard
anddash::TemperatureCard
HUMIDITY_CARD
andTEMPERATURE_CARD
float
type with a precision of 2 decimals%
for humidity and°C
for temperature but can be changeddash::ProgressCard
PROGRESS_CARD
int
typedash::SliderCard
SLIDER_CARD
int
typedash::SwitchCard
BUTTON_CARD
bool
typeFunctions and callbacks
onChange([](<type>)){}
Listen to card changes:
value()
: get the value of a cardmin()
,max()
,step()
: get the min, max, step of a slider cardsetMin()
,setMax()
,setStep()
: set the min, max, step of a slider cardsetFeedback()
: set the feedback of a feedback cardsetValue()
: set the value of a cardOptimisations
By default, the string type that will be used to store string values is
String
orstd::string
if the flag-D DASH_USE_STL_STRING=1
is set.To avoid allocating memory and copying strings, the
const char*
type can be used when the card is sourcing its content from constant strings only.Example: