Skip to content
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

Move enum-to-text functions to enums.h to allow removal of Global digitalInputs and batteries #1790

Merged
merged 5 commits into from
Dec 9, 2024

Conversation

blammit
Copy link
Contributor

@blammit blammit commented Dec 8, 2024

No description provided.

@@ -16,8 +16,9 @@ QtObject {
readonly property real current: _current.isValid ? _current.value : NaN
readonly property real temperature: _temperature.isValid ? _temperature.value : NaN
readonly property real timeToGo: _timeToGo.isValid ? _timeToGo.value : NaN
readonly property string icon: !!Global.batteries ? Global.batteries.batteryIcon(power) : ""
readonly property int mode: !!Global.batteries ? Global.batteries.batteryMode(power) : -1
readonly property string icon: isNaN(power) || power === 0 ? "qrc:/images/icon_battery_24.svg"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that you already have mode calculated below, can't you just have: icon: mode == Idle ? battery.svg : mode == Charging ? battery-charging.svg : battery-discharging.svg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah much nicer, updated.

Copy link
Contributor

@chriadam chriadam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nitpick, aside from that LGTM.

@blammit blammit force-pushed the blam/reduce-global-models branch from bc31ed1 to c47c72a Compare December 9, 2024 04:33
Base automatically changed from blam/reduce-global-models to main December 9, 2024 04:40
It just provides static functions that can be moved to enums.h.

Part of #1400
@blammit blammit force-pushed the blam/reduce-global-models-2 branch 2 times, most recently from ae5bda1 to 6c2e886 Compare December 9, 2024 05:27
It just provides static functions that can be moved to enums.h.

Part of #1400
This is to prepare for removing Global.pvInverters.

Part of #1400
This aligns model property names in AllDevicesModel.
This is to prepare for removing Global.solarChargers.

Part of #1400
@blammit blammit force-pushed the blam/reduce-global-models-2 branch from 6c2e886 to 2d66db1 Compare December 9, 2024 05:29
@blammit blammit merged commit 7688370 into main Dec 9, 2024
2 checks passed
@blammit blammit deleted the blam/reduce-global-models-2 branch December 9, 2024 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants