diff --git a/components/ValueRange.qml b/components/ValueRange.qml index a7c775572..7edc58294 100644 --- a/components/ValueRange.qml +++ b/components/ValueRange.qml @@ -8,11 +8,14 @@ import "/components/Utils.js" as Utils QtObject { property real value: NaN readonly property real valueAsRatio: _valueAsRatio - property real maximumValue: NaN // if NaN, the max is dynamically adjusted to the maximum encountered value + property real maximumValue: NaN // if NaN, _max is dynamically adjusted to the maximum encountered value + readonly property real maximumSeen: isNaN(maximumValue) ? _max : _actualMaximum + readonly property real minimumSeen: _min property real _valueAsRatio: 0 property real _min: NaN property real _max: isNaN(maximumValue) ? NaN : maximumValue + property real _actualMaximum: NaN onValueChanged: { // If value=NaN, or if only one value has been received, the min/max cannot yet be @@ -27,7 +30,14 @@ QtObject { return } _min = Math.min(_min, value) - _max = isNaN(maximumValue) ? Math.max(_max, value) : maximumValue + + if (isNaN(maximumValue)) { + _max = Math.max(_max, value) + } else { + _max = maximumValue + _actualMaximum = Math.max(_actualMaximum, value) + } + if (!isNaN(_max) && value >= _max) { _valueAsRatio = 1 return diff --git a/data/mock/config/MockDataSimulator.qml b/data/mock/config/MockDataSimulator.qml index 66d991a1f..92c9d5e67 100644 --- a/data/mock/config/MockDataSimulator.qml +++ b/data/mock/config/MockDataSimulator.qml @@ -163,6 +163,18 @@ QtObject { notificationsConfig.showToastNotification(notifType) event.accepted = true break + case Qt.Key_P: + Global.dcInputs.power = 0 + Global.acInputs.generatorInput = null + if (event.modifiers & Qt.ControlModifier) { + Global.acInputs.power = 0 + } else if (event.modifiers & Qt.ShiftModifier) { + Global.acInputs.power += 200 + } else { + Global.acInputs.power -= 200 + } + event.accepted = true + break case Qt.Key_T: root.timersActive = !root.timersActive pageConfigTitle.text = "Timers on: " + root.timersActive diff --git a/pages/BriefMonitorPanel.qml b/pages/BriefMonitorPanel.qml index 43f705460..0c1bcc418 100644 --- a/pages/BriefMonitorPanel.qml +++ b/pages/BriefMonitorPanel.qml @@ -156,7 +156,7 @@ Column { Column { width: parent.width spacing: Theme.geometry.briefPage.sidePanel.generator.columnSpacing - visible: !generatorColumn.visible && (!!Global.acInputs.power || !!Global.dcInputs.power) + visible: !generatorColumn.visible && !(isNaN(Global.acInputs.power) && isNaN(Global.dcInputs.power)) Item { width: parent.width @@ -181,19 +181,123 @@ Column { LoadGraph { id: gridGraph + /* + Graph A + + 1000W 1.0 | + 0.9 | + 0.8 | + 0.7 | + 0.6 | + 0.5 | + 0.4 | ___________ + 0.3 | / \_________ (only shows imported power. 'graphShowsExportPower' is false) + 0.2 |____/ +imported power ^ 0.1 | + 0W 0.0 |--------------------------->