diff --git a/components/CommonWords.qml b/components/CommonWords.qml index ea921750a..f6b35d345 100644 --- a/components/CommonWords.qml +++ b/components/CommonWords.qml @@ -338,6 +338,9 @@ QtObject { //% "Overall history" readonly property string overall_history: qsTrId("common_words_overall_history") + //% "Pending" + readonly property string pending: qsTrId("common_words_pending") + //% "Password" readonly property string password: qsTrId("common_words_password") diff --git a/data/common/Battery.qml b/data/common/Battery.qml index b974f2d8e..db4846c66 100644 --- a/data/common/Battery.qml +++ b/data/common/Battery.qml @@ -17,6 +17,9 @@ Device { readonly property real timeToGo: _timeToGo.value === undefined ? NaN : _timeToGo.value // in seconds readonly property string icon: !!Global.batteries ? Global.batteries.batteryIcon(battery) : "" readonly property int mode: !!Global.batteries ? Global.batteries.batteryMode(battery) : -1 + readonly property string numberOfBmses: _numberOfBmses.isValid ? _numberOfBmses.value : "" // eg. "1/2" + readonly property bool isParallelBms: _numberOfBmses.isValid + readonly property int state: _state.isValid ? _state.value : NaN readonly property VeQuickItem _stateOfCharge: VeQuickItem { uid: battery.serviceUid + "/Soc" @@ -41,4 +44,12 @@ Device { readonly property VeQuickItem _timeToGo: VeQuickItem { uid: battery.serviceUid + "/TimeToGo" } + + property VeQuickItem _numberOfBmses: VeQuickItem { + uid: battery.serviceUid + "/NumberOfBmses" + } + + property VeQuickItem _state: VeQuickItem { + uid: battery.serviceUid + "/State" + } } diff --git a/pages/settings/devicelist/DeviceListPage.qml b/pages/settings/devicelist/DeviceListPage.qml index a4e894da2..e631db0bf 100644 --- a/pages/settings/devicelist/DeviceListPage.qml +++ b/pages/settings/devicelist/DeviceListPage.qml @@ -51,11 +51,17 @@ Page { case "battery": url = "/pages/settings/devicelist/battery/PageBattery.qml" params = { "battery" : device } - summary = [ - Units.getCombinedDisplayText(VenusOS.Units_Percentage, device.stateOfCharge), - Units.getCombinedDisplayText(VenusOS.Units_Volt_DC, device.voltage), - Units.getCombinedDisplayText(VenusOS.Units_Amp, device.current), - ] + summary = (!device.isParallelBms && device.state === VenusOS.Battery_State_Pending) + ? [ + CommonWords.pending, + Units.getCombinedDisplayText(VenusOS.Units_Volt_DC, device.voltage), + Units.getCombinedDisplayText(VenusOS.Units_Percentage, device.stateOfCharge) + ] + : [ + Units.getCombinedDisplayText(VenusOS.Units_Percentage, device.stateOfCharge), + Units.getCombinedDisplayText(VenusOS.Units_Volt_DC, device.voltage), + Units.getCombinedDisplayText(VenusOS.Units_Amp, device.current), + ] break; case "solarcharger": diff --git a/pages/settings/devicelist/battery/PageBattery.qml b/pages/settings/devicelist/battery/PageBattery.qml index dbe6f1b1b..895d709e9 100644 --- a/pages/settings/devicelist/battery/PageBattery.qml +++ b/pages/settings/devicelist/battery/PageBattery.qml @@ -42,33 +42,35 @@ Page { return qsTrId("devicelist_battery_initializing") } switch (dataItem.value) { - case 9: + case VenusOS.Battery_State_Running: return CommonWords.running_status - case 10: + case VenusOS.Battery_State_Error: return CommonWords.error - // case 11 (Unknown) is omitted - case 12: + // case Battery_State_Unknown is omitted + case VenusOS.Battery_State_Shutdown: //: Status is 'Shutdown' //% "Shutdown" return qsTrId("devicelist_battery_shutdown") - case 13: + case VenusOS.Battery_State_Updating: //: Status is 'Updating' //% "Updating" return qsTrId("devicelist_battery_updating") - case 14: + case VenusOS.Battery_State_Standby: return CommonWords.standby - case 15: + case VenusOS.Battery_State_GoingToRun: //: Status is 'Going to run' //% "Going to run" return qsTrId("devicelist_battery_going_to_run") - case 16: + case VenusOS.Battery_State_Precharging: //: Status is 'Pre-Charging' //% "Pre-Charging" return qsTrId("devicelist_battery_pre_charging") - case 17: + case VenusOS.Battery_State_ContactorCheck: //: Status is 'Contactor check' //% "Contactor check" return qsTrId("devicelist_battery_contactor_check") + case VenusOS.Battery_State_Pending: + return CommonWords.pending default: return "" } @@ -128,6 +130,18 @@ Page { unit: VenusOS.Units_AmpHour } + ListQuantityItem { + readonly property VeQuickItem _n2kDeviceInstance: VeQuickItem { + uid: battery.serviceUid + "/N2kDeviceInstance" + } + + //% "System voltage" + text: qsTrId("devicelist_battery_system_voltage") + dataItem.uid: BackendConnection.serviceUidForType("battery.lynxparallel") + _n2kDeviceInstance.value + "/Dc/0/Voltage" + allowed: defaultAllowed && _n2kDeviceInstance.isValid && root.battery.state === VenusOS.Battery_State_Pending + unit: VenusOS.Units_Volt_DC + } + ListTextItem { id: numberOfBms //% "Number of BMSes" diff --git a/src/enums.h b/src/enums.h index 57bbe06e5..a2a63f1ac 100644 --- a/src/enums.h +++ b/src/enums.h @@ -192,6 +192,20 @@ class Enums : public QObject }; Q_ENUM(Battery_Mode) + enum Battery_State { + Battery_State_Running = 9, + Battery_State_Error = 10, + Battery_State_Unknown = 11, + Battery_State_Shutdown = 12, + Battery_State_Updating = 13, + Battery_State_Standby = 14, + Battery_State_GoingToRun = 15, + Battery_State_Precharging = 16, + Battery_State_ContactorCheck = 17, + Battery_State_Pending = 18 + }; + Q_ENUM(Battery_State) + enum Battery_TimeToGo_Format { Battery_TimeToGo_ShortFormat, Battery_TimeToGo_LongFormat