diff --git a/firmware/Venus_Release/VenusReleaseFiles/PageChargingStrategy.qml b/firmware/Venus_Release/VenusReleaseFiles/PageChargingStrategy.qml index 7e7e1b01c..15ad32143 100644 --- a/firmware/Venus_Release/VenusReleaseFiles/PageChargingStrategy.qml +++ b/firmware/Venus_Release/VenusReleaseFiles/PageChargingStrategy.qml @@ -15,8 +15,7 @@ MbPage { property bool initialized: false property VBusItem lastEoc: VBusItem { bind: "com.victronenergy.settings/Settings/Controller/LastEOC" } - property int previousEocValue: -1 - property bool isCalibrationActive: false + property int previousEocValue: lastEoc.value title: qsTr("Charging Strategy") @@ -28,6 +27,8 @@ MbPage { id: controllerState bind: "com.victronenergy.controller/State" } + + property bool isCalibrationActive: controllerState.value == 3 ? true : false VBusItem { id: systemType @@ -117,24 +118,24 @@ MbPage { show: true onClicked: { console.log("Button clicked. Current controllerState: " + controllerState.value); + console.log("Button clicked. Current isCalibrationAction: " + isCalibrationActive); + console.log("Button clicked. Previous LastEOC: " + previousEocValue); if (controllerState.value !== 3 && controllerState.value !== 11 && !isCalibrationActive) { - console.log("Starting calibration charge..."); - if (previousEocValue === -1) { - previousEocValue = lastEoc.value; - console.log("Previous EOC Value saved: " + previousEocValue); - } + console.log("Starting manual calibration charge..."); + previousEocValue = lastEoc.value; + console.log("Previous EOC Value saved: " + previousEocValue); lastEoc.setValue(0); console.log("Set lastEoc to 0"); isCalibrationActive = true; } else if (controllerState.value === 3 && isCalibrationActive) { - console.log("Stopping calibration charge..."); - if (previousEocValue !== -1) { + console.log("Stopping manual calibration charge..."); + if(previousEocValue==0){ + console.log("Postpone automatic calibration charge to 1 day later."); + lastEoc.setValue((new Date().getTime() - 24*60*60*1000)/1000); + }else{ lastEoc.setValue(previousEocValue); console.log("Reverted lastEoc to previous value: " + previousEocValue); - previousEocValue = -1; - } else { - console.warn("No previous EOC value recorded."); } isCalibrationActive = false; } else { @@ -150,7 +151,7 @@ MbPage { if (lastEoc.value !== 0 && isCalibrationActive) { console.log("Calibration charge completed, resetting button to 'Press here'."); isCalibrationActive = false; - previousEocValue = -1; + previousEocValue = lastEoc.value; eoctime.value = qsTr("Press here"); } } diff --git a/firmware/Venus_Release/update_Venus.py b/firmware/Venus_Release/update_Venus.py index bf69c40ad..2deeaed41 100644 --- a/firmware/Venus_Release/update_Venus.py +++ b/firmware/Venus_Release/update_Venus.py @@ -42,6 +42,10 @@ async def resize(remote_host): command = "sh /opt/victronenergy/swupdate-scripts/resize2fs.sh" return await run_remote_command(remote_host, command) +async def reboot(remote_host): + command = "reboot" + return await run_remote_command(remote_host, command) + async def upload_files(remote_host): file_location_mappings = { "rc.local": "/data/", @@ -107,15 +111,13 @@ async def main(remote_host): #### 4. resize /dev/root ##### print("Resize /dev/root now!") print(await resize(remote_host)) - # ##### 5. stop battery service ###### - # print("Stop battery service!") - # print(await stop_battery_service(remote_host)) - ##### 6. run rc.local ###### - print("Run rc.local to set password, timezone and cp battery folder!") + # ##### 5. run rc.local ###### + # print("Run rc.local to set password, timezone and cp battery folder!") + # print(await run_rclocal(remote_host)) + ##### 5. reboot to run rc.local and update qml ###### + print("Reboot!") print(await run_rclocal(remote_host)) - # ##### 7. start battery service ###### - # print("Start battery service!") - # print(await start_battery_service(remote_host)) + else: sys.exit("It's not Venus GX!")