updated qml file
This commit is contained in:
parent
440ba48f4e
commit
0cc1a63722
|
@ -120,21 +120,19 @@ MbPage {
|
||||||
|
|
||||||
if (controllerState.value !== 3 && controllerState.value !== 11 && !isCalibrationActive) {
|
if (controllerState.value !== 3 && controllerState.value !== 11 && !isCalibrationActive) {
|
||||||
console.log("Starting calibration charge...");
|
console.log("Starting calibration charge...");
|
||||||
// Save current lastEoc value as previousEocValue
|
|
||||||
if (previousEocValue === -1) {
|
if (previousEocValue === -1) {
|
||||||
previousEocValue = lastEoc.value;
|
previousEocValue = lastEoc.value;
|
||||||
console.log("Previous EOC Value saved: " + previousEocValue);
|
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");
|
console.log("Set lastEoc to 0");
|
||||||
isCalibrationActive = true;
|
isCalibrationActive = true;
|
||||||
} else if (controllerState.value === 3 && isCalibrationActive) {
|
} else if (controllerState.value === 3 && isCalibrationActive) {
|
||||||
console.log("Stopping calibration charge...");
|
console.log("Stopping calibration charge...");
|
||||||
// Revert lastEoc to its previous value
|
|
||||||
if (previousEocValue !== -1) {
|
if (previousEocValue !== -1) {
|
||||||
lastEoc.setValue(previousEocValue);
|
lastEoc.setValue(previousEocValue);
|
||||||
console.log("Reverted lastEoc to previous value: " + previousEocValue);
|
console.log("Reverted lastEoc to previous value: " + previousEocValue);
|
||||||
previousEocValue = -1; // Reset the previousEocValue
|
previousEocValue = -1;
|
||||||
} else {
|
} else {
|
||||||
console.warn("No previous EOC value recorded.");
|
console.warn("No previous EOC value recorded.");
|
||||||
}
|
}
|
||||||
|
@ -143,9 +141,19 @@ MbPage {
|
||||||
isCalibrationActive = false;
|
isCalibrationActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update value
|
|
||||||
eoctime.value = isCalibrationActive ? qsTr("Calibration charge started") : qsTr("Press here");
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue