Skip to content

Commit 1e6a66b

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 1e6a66b

File tree

4 files changed

+37
-16
lines changed

4 files changed

+37
-16
lines changed

components/CommonWords.qml

Lines changed: 20 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("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,20 @@ QtObject {
651649
: errorIndex === 3 ? qsTrId("common_words_4th_last_error")
652650
: ""
653651
}
652+
653+
function noAdjustableByBms(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+
? s + " " + go_to_redetect_system.arg(deviceName)
658+
: s
659+
}
660+
661+
function noAdjustableByDmc(serviceType, deviceName) {
662+
//% "This setting is disabled when a Digital Multi Control is connected."
663+
const s = qsTrId("common_words_setting_disabled_when_dmc_connected")
664+
return serviceType === "vebus"
665+
? s + " " + go_to_redetect_system.arg(deviceName)
666+
: s
667+
}
654668
}

components/listitems/ListCurrentLimitButton.qml

Lines changed: 8 additions & 4 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.noAdjustableByDmc(device.serviceType, device.name)
2322
} else if (bmsMode.valid) {
24-
return CommonWords.noAdjustableByBms
23+
return CommonWords.noAdjustableByBms(device.serviceType, device.name)
2524
}
2625
}
2726
//% "This current limit is fixed in the system configuration. It cannot be adjusted."
@@ -42,6 +41,11 @@ ListButton {
4241
Global.dialogLayer.open(currentLimitDialogComponent, { value: currentLimitItem.value })
4342
}
4443

44+
Device {
45+
id: device
46+
serviceUid: root.serviceUid
47+
}
48+
4549
VeQuickItem {
4650
id: currentLimitItem
4751
uid: root.serviceUid + "/Ac/In/" + root.inputNumber + "/CurrentLimit"

components/listitems/ListInverterChargerModeButton.qml

Lines changed: 8 additions & 5 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,10 +23,10 @@ ListButton {
2523
onClicked: {
2624
if (!modeAdjustable) {
2725
if (dmc.valid) {
28-
Global.showToastNotification(VenusOS.Notification_Info, CommonWords.noAdjustableByDmc,
26+
Global.showToastNotification(VenusOS.Notification_Info, CommonWords.noAdjustableByDmc(device.serviceType, device.name),
2927
Theme.animation_veBusDeviceModeNotAdjustable_toastNotication_duration)
3028
} else if (bmsMode.valid) {
31-
Global.showToastNotification(VenusOS.Notification_Info, CommonWords.noAdjustableByBms,
29+
Global.showToastNotification(VenusOS.Notification_Info, CommonWords.noAdjustableByBms(device.serviceType, device.name),
3230
Theme.animation_veBusDeviceModeNotAdjustable_toastNotication_duration)
3331
} else {
3432
//% "The mode is fixed in the system configuration. It cannot be adjusted."
@@ -41,6 +39,11 @@ ListButton {
4139
Global.dialogLayer.open(modeDialogComponent, { mode: modeItem.value })
4240
}
4341

42+
Device {
43+
id: device
44+
serviceUid: root.serviceUid
45+
}
46+
4447
VeQuickItem {
4548
id: isInverterChargerItem
4649
uid: root.serviceUid + "/IsInverterCharger"

themes/animation/Animation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@
4444
"animation_loadGraph_model_length": 12,
4545
"animation_solarHistoryErrorView_expand_duration": 100,
4646
"animation_acceptButtonBackground_expand_duration": 1200,
47-
"animation_veBusDeviceModeNotAdjustable_toastNotication_duration": 5000
47+
"animation_veBusDeviceModeNotAdjustable_toastNotication_duration": 10000
4848
}

0 commit comments

Comments
 (0)