Skip to content

Commit 8669e8d

Browse files
committed
VE.Bus: mention system redetect option if mode/limit control is disabled
If the user attempts to change the VE.Bus current limit or mode, and this action is disabled because a BMS or DMC is connected, provide information about the "Redetect VE.Bus system" option in the error notification text. This aligns with the behaviour in gui-v1. Fixes #2673
1 parent 074c3c9 commit 8669e8d

File tree

4 files changed

+45
-23
lines changed

4 files changed

+45
-23
lines changed

components/CommonWords.qml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ QtObject {
216216
//% "Generator"
217217
readonly property string generator: qsTrId("common_words_generator")
218218

219+
//: %1 = name of the device
220+
//% "If it was recently disconnected, go to Settings → Devices → %1 → Advanced, and select 'Redetect VE.Bus system'."
221+
readonly property string go_to_redetect_system: qsTrId("common_words_go_to_redetect_system")
222+
219223
//% "Grid"
220224
readonly property string grid: qsTrId("common_words_grid")
221225

@@ -351,12 +355,6 @@ QtObject {
351355
//% "No"
352356
readonly property string no: qsTrId("common_words_no")
353357

354-
//% "This setting is disabled when a Digital Multi Control is connected."
355-
readonly property string noAdjustableByDmc: qsTrId("common_words_setting_disabled_when_dmc_connected")
356-
357-
//% "This setting is disabled when a VE.Bus BMS is connected."
358-
readonly property string noAdjustableByBms: qsTrId("common_words_setting_disabled_when_bms_connected")
359-
360358
//% "No error"
361359
readonly property string no_error: qsTrId("common_words_no_error")
362360

@@ -651,4 +649,26 @@ QtObject {
651649
: errorIndex === 3 ? qsTrId("common_words_4th_last_error")
652650
: ""
653651
}
652+
653+
function notAdjustableDueToBms(serviceType, deviceName) {
654+
//% "This setting is disabled when a VE.Bus BMS is connected."
655+
const s = qsTrId("common_words_setting_disabled_when_bms_connected")
656+
return serviceType === "vebus"
657+
//: %1 = the translated text of common_words_setting_disabled_when_bms_connected
658+
//: %2 = the translated text of common_words_go_to_redetect_system
659+
//% "%1 %2"
660+
? qsTrId("common_words_bms_disabled_go_to_redetect").arg(s).arg(go_to_redetect_system.arg(deviceName))
661+
: s
662+
}
663+
664+
function notAdjustableDueToDmc(serviceType, deviceName) {
665+
//% "This setting is disabled when a Digital Multi Control is connected."
666+
const s = qsTrId("common_words_setting_disabled_when_dmc_connected")
667+
return serviceType === "vebus"
668+
//: %1 = the translated text of common_words_setting_disabled_when_dmc_connected
669+
//: %2 = the translated text of common_words_go_to_redetect_system
670+
//% "%1 %2"
671+
? qsTrId("common_words_dmc_disabled_go_to_redetect").arg(s).arg(go_to_redetect_system.arg(deviceName))
672+
: s
673+
}
654674
}

components/listitems/ListCurrentLimitButton.qml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ ListButton {
1313
required property int inputNumber // note this is 1-based, i.e. first AC input has inputNumber=1, not 0
1414
required property int inputType
1515

16-
readonly property string serviceType: BackendConnection.serviceTypeFromUid(serviceUid)
1716
readonly property bool limitAdjustable: currentLimitIsAdjustable.value !== 0
1817

1918
function _currentLimitNotAdjustableText() {
20-
if (serviceType !== "acsystem") {
19+
if (device.serviceType !== "acsystem") {
2120
if (dmc.valid) {
22-
return CommonWords.noAdjustableByDmc
21+
return CommonWords.notAdjustableDueToDmc(device.serviceType, device.name)
2322
} else if (bmsMode.valid) {
24-
return CommonWords.noAdjustableByBms
23+
return CommonWords.notAdjustableDueToBms(device.serviceType, device.name)
2524
}
2625
}
2726
//% "This current limit is fixed in the system configuration. It cannot be adjusted."
@@ -35,13 +34,17 @@ ListButton {
3534

3635
onClicked: {
3736
if (!limitAdjustable) {
38-
Global.showToastNotification(VenusOS.Notification_Info, root._currentLimitNotAdjustableText(),
39-
Theme.animation_veBusDeviceModeNotAdjustable_toastNotication_duration)
37+
Global.showToastNotification(VenusOS.Notification_Info, root._currentLimitNotAdjustableText())
4038
return
4139
}
4240
Global.dialogLayer.open(currentLimitDialogComponent, { value: currentLimitItem.value })
4341
}
4442

43+
Device {
44+
id: device
45+
serviceUid: root.serviceUid
46+
}
47+
4548
VeQuickItem {
4649
id: currentLimitItem
4750
uid: root.serviceUid + "/Ac/In/" + root.inputNumber + "/CurrentLimit"

components/listitems/ListInverterChargerModeButton.qml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ ListButton {
1010
id: root
1111

1212
required property string serviceUid
13-
14-
readonly property string serviceType: BackendConnection.serviceTypeFromUid(serviceUid)
1513
readonly property bool modeAdjustable: modeIsAdjustable.value !== 0
1614

1715
text: CommonWords.mode
18-
secondaryText: serviceType !== "inverter" || isInverterChargerItem.value === 1
16+
secondaryText: device.serviceType !== "inverter" || isInverterChargerItem.value === 1
1917
? Global.inverterChargers.inverterChargerModeToText(modeItem.value)
2018
: Global.inverterChargers.inverterModeToText(modeItem.value)
2119

@@ -25,22 +23,24 @@ ListButton {
2523
onClicked: {
2624
if (!modeAdjustable) {
2725
if (dmc.valid) {
28-
Global.showToastNotification(VenusOS.Notification_Info, CommonWords.noAdjustableByDmc,
29-
Theme.animation_veBusDeviceModeNotAdjustable_toastNotication_duration)
26+
Global.showToastNotification(VenusOS.Notification_Info, CommonWords.notAdjustableDueToDmc(device.serviceType, device.name))
3027
} else if (bmsMode.valid) {
31-
Global.showToastNotification(VenusOS.Notification_Info, CommonWords.noAdjustableByBms,
32-
Theme.animation_veBusDeviceModeNotAdjustable_toastNotication_duration)
28+
Global.showToastNotification(VenusOS.Notification_Info, CommonWords.notAdjustableDueToBms(device.serviceType, device.name))
3329
} else {
3430
//% "The mode is fixed in the system configuration. It cannot be adjusted."
35-
Global.showToastNotification(VenusOS.Notification_Info, qsTrId("inverter_mode_not_adjustable"),
36-
Theme.animation_veBusDeviceModeNotAdjustable_toastNotication_duration)
31+
Global.showToastNotification(VenusOS.Notification_Info, qsTrId("inverter_mode_not_adjustable"))
3732
}
3833
return
3934
}
4035

4136
Global.dialogLayer.open(modeDialogComponent, { mode: modeItem.value })
4237
}
4338

39+
Device {
40+
id: device
41+
serviceUid: root.serviceUid
42+
}
43+
4444
VeQuickItem {
4545
id: isInverterChargerItem
4646
uid: root.serviceUid + "/IsInverterCharger"

themes/animation/Animation.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,5 @@
4343
"animation_settings_radioButtonPage_autoClose_duration": 600,
4444
"animation_loadGraph_model_length": 12,
4545
"animation_solarHistoryErrorView_expand_duration": 100,
46-
"animation_acceptButtonBackground_expand_duration": 1200,
47-
"animation_veBusDeviceModeNotAdjustable_toastNotication_duration": 5000
46+
"animation_acceptButtonBackground_expand_duration": 1200
4847
}

0 commit comments

Comments
 (0)