From 0cc1a637227f0c7dbb660b758e60cee7152199af Mon Sep 17 00:00:00 2001 From: Yinyin Liu Date: Thu, 18 Jul 2024 09:16:10 +0200 Subject: [PATCH] updated qml file --- .../VenusReleaseFiles/PageChargingStrategy.qml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/firmware/Venus_Release/VenusReleaseFiles/PageChargingStrategy.qml b/firmware/Venus_Release/VenusReleaseFiles/PageChargingStrategy.qml index 9a47adfc7..7e7e1b01c 100644 --- a/firmware/Venus_Release/VenusReleaseFiles/PageChargingStrategy.qml +++ b/firmware/Venus_Release/VenusReleaseFiles/PageChargingStrategy.qml @@ -120,21 +120,19 @@ MbPage { if (controllerState.value !== 3 && controllerState.value !== 11 && !isCalibrationActive) { console.log("Starting calibration charge..."); - // Save current lastEoc value as previousEocValue if (previousEocValue === -1) { previousEocValue = lastEoc.value; console.log("Previous EOC Value saved: " + previousEocValue); } - lastEoc.setValue(0); // Set lastEoc to 0 to start the calibration charge + lastEoc.setValue(0); console.log("Set lastEoc to 0"); isCalibrationActive = true; } else if (controllerState.value === 3 && isCalibrationActive) { console.log("Stopping calibration charge..."); - // Revert lastEoc to its previous value if (previousEocValue !== -1) { lastEoc.setValue(previousEocValue); console.log("Reverted lastEoc to previous value: " + previousEocValue); - previousEocValue = -1; // Reset the previousEocValue + previousEocValue = -1; } else { console.warn("No previous EOC value recorded."); } @@ -143,9 +141,19 @@ MbPage { isCalibrationActive = false; } - // Update value eoctime.value = isCalibrationActive ? qsTr("Calibration charge started") : qsTr("Press here"); + } + Connections { + target: lastEoc + onValueChanged: { + if (lastEoc.value !== 0 && isCalibrationActive) { + console.log("Calibration charge completed, resetting button to 'Press here'."); + isCalibrationActive = false; + previousEocValue = -1; + eoctime.value = qsTr("Press here"); + } + } } }