Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions components/CommonWords.qml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ QtObject {
//% "Generator"
readonly property string generator: qsTrId("common_words_generator")

//: %1 = name of the device
//% "If it was recently disconnected, go to Settings → Devices → %1 → Advanced, and select 'Redetect VE.Bus system'."
readonly property string go_to_redetect_system: qsTrId("common_words_go_to_redetect_system")

//% "Grid"
readonly property string grid: qsTrId("common_words_grid")

Expand Down Expand Up @@ -351,12 +355,6 @@ QtObject {
//% "No"
readonly property string no: qsTrId("common_words_no")

//% "This setting is disabled when a Digital Multi Control is connected."
readonly property string noAdjustableByDmc: qsTrId("common_words_setting_disabled_when_dmc_connected")

//% "This setting is disabled when a VE.Bus BMS is connected."
readonly property string noAdjustableByBms: qsTrId("common_words_setting_disabled_when_bms_connected")

//% "No error"
readonly property string no_error: qsTrId("common_words_no_error")

Expand Down Expand Up @@ -651,4 +649,26 @@ QtObject {
: errorIndex === 3 ? qsTrId("common_words_4th_last_error")
: ""
}

function notAdjustableDueToBms(serviceType, deviceName) {
//% "This setting is disabled when a VE.Bus BMS is connected."
const s = qsTrId("common_words_setting_disabled_when_bms_connected")
return serviceType === "vebus"
//: %1 = the translated text of common_words_setting_disabled_when_bms_connected
//: %2 = the translated text of common_words_go_to_redetect_system
//% "%1 %2"
? qsTrId("common_words_bms_disabled_go_to_redetect").arg(s).arg(go_to_redetect_system.arg(deviceName))
: s
}

function notAdjustableDueToDmc(serviceType, deviceName) {
//% "This setting is disabled when a Digital Multi Control is connected."
const s = qsTrId("common_words_setting_disabled_when_dmc_connected")
return serviceType === "vebus"
//: %1 = the translated text of common_words_setting_disabled_when_dmc_connected
//: %2 = the translated text of common_words_go_to_redetect_system
//% "%1 %2"
? qsTrId("common_words_dmc_disabled_go_to_redetect").arg(s).arg(go_to_redetect_system.arg(deviceName))
: s
}
}
15 changes: 9 additions & 6 deletions components/listitems/ListCurrentLimitButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ ListButton {
required property int inputNumber // note this is 1-based, i.e. first AC input has inputNumber=1, not 0
required property int inputType

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

function _currentLimitNotAdjustableText() {
if (serviceType !== "acsystem") {
if (device.serviceType !== "acsystem") {
if (dmc.valid) {
return CommonWords.noAdjustableByDmc
return CommonWords.notAdjustableDueToDmc(device.serviceType, device.name)
} else if (bmsMode.valid) {
return CommonWords.noAdjustableByBms
return CommonWords.notAdjustableDueToBms(device.serviceType, device.name)
}
}
//% "This current limit is fixed in the system configuration. It cannot be adjusted."
Expand All @@ -35,13 +34,17 @@ ListButton {

onClicked: {
if (!limitAdjustable) {
Global.showToastNotification(VenusOS.Notification_Info, root._currentLimitNotAdjustableText(),
Theme.animation_veBusDeviceModeNotAdjustable_toastNotication_duration)
Global.showToastNotification(VenusOS.Notification_Info, root._currentLimitNotAdjustableText())
return
}
Global.dialogLayer.open(currentLimitDialogComponent, { value: currentLimitItem.value })
}

Device {
id: device
serviceUid: root.serviceUid
}

VeQuickItem {
id: currentLimitItem
uid: root.serviceUid + "/Ac/In/" + root.inputNumber + "/CurrentLimit"
Expand Down
18 changes: 9 additions & 9 deletions components/listitems/ListInverterChargerModeButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ ListButton {
id: root

required property string serviceUid

readonly property string serviceType: BackendConnection.serviceTypeFromUid(serviceUid)
readonly property bool modeAdjustable: modeIsAdjustable.value !== 0

text: CommonWords.mode
secondaryText: serviceType !== "inverter" || isInverterChargerItem.value === 1
secondaryText: device.serviceType !== "inverter" || isInverterChargerItem.value === 1
? Global.inverterChargers.inverterChargerModeToText(modeItem.value)
: Global.inverterChargers.inverterModeToText(modeItem.value)

Expand All @@ -25,22 +23,24 @@ ListButton {
onClicked: {
if (!modeAdjustable) {
if (dmc.valid) {
Global.showToastNotification(VenusOS.Notification_Info, CommonWords.noAdjustableByDmc,
Theme.animation_veBusDeviceModeNotAdjustable_toastNotication_duration)
Global.showToastNotification(VenusOS.Notification_Info, CommonWords.notAdjustableDueToDmc(device.serviceType, device.name))
} else if (bmsMode.valid) {
Global.showToastNotification(VenusOS.Notification_Info, CommonWords.noAdjustableByBms,
Theme.animation_veBusDeviceModeNotAdjustable_toastNotication_duration)
Global.showToastNotification(VenusOS.Notification_Info, CommonWords.notAdjustableDueToBms(device.serviceType, device.name))
} else {
//% "The mode is fixed in the system configuration. It cannot be adjusted."
Global.showToastNotification(VenusOS.Notification_Info, qsTrId("inverter_mode_not_adjustable"),
Theme.animation_veBusDeviceModeNotAdjustable_toastNotication_duration)
Global.showToastNotification(VenusOS.Notification_Info, qsTrId("inverter_mode_not_adjustable"))
}
return
}

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

Device {
id: device
serviceUid: root.serviceUid
}

VeQuickItem {
id: isInverterChargerItem
uid: root.serviceUid + "/IsInverterCharger"
Expand Down
3 changes: 1 addition & 2 deletions themes/animation/Animation.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,5 @@
"animation_settings_radioButtonPage_autoClose_duration": 600,
"animation_loadGraph_model_length": 12,
"animation_solarHistoryErrorView_expand_duration": 100,
"animation_acceptButtonBackground_expand_duration": 1200,
"animation_veBusDeviceModeNotAdjustable_toastNotication_duration": 5000
"animation_acceptButtonBackground_expand_duration": 1200
}