update calibration charge toggle button which can now stop automatic calibration charge and relevant file
This commit is contained in:
parent
324e6f7688
commit
602470abc5
|
@ -15,8 +15,7 @@ MbPage {
|
||||||
property bool initialized: false
|
property bool initialized: false
|
||||||
|
|
||||||
property VBusItem lastEoc: VBusItem { bind: "com.victronenergy.settings/Settings/Controller/LastEOC" }
|
property VBusItem lastEoc: VBusItem { bind: "com.victronenergy.settings/Settings/Controller/LastEOC" }
|
||||||
property int previousEocValue: -1
|
property int previousEocValue: lastEoc.value
|
||||||
property bool isCalibrationActive: false
|
|
||||||
|
|
||||||
title: qsTr("Charging Strategy")
|
title: qsTr("Charging Strategy")
|
||||||
|
|
||||||
|
@ -29,6 +28,8 @@ MbPage {
|
||||||
bind: "com.victronenergy.controller/State"
|
bind: "com.victronenergy.controller/State"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property bool isCalibrationActive: controllerState.value == 3 ? true : false
|
||||||
|
|
||||||
VBusItem {
|
VBusItem {
|
||||||
id: systemType
|
id: systemType
|
||||||
bind: "com.victronenergy.system/SystemType"
|
bind: "com.victronenergy.system/SystemType"
|
||||||
|
@ -117,24 +118,24 @@ MbPage {
|
||||||
show: true
|
show: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("Button clicked. Current controllerState: " + controllerState.value);
|
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) {
|
if (controllerState.value !== 3 && controllerState.value !== 11 && !isCalibrationActive) {
|
||||||
console.log("Starting calibration charge...");
|
console.log("Starting manual calibration charge...");
|
||||||
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);
|
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 manual calibration charge...");
|
||||||
if (previousEocValue !== -1) {
|
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);
|
lastEoc.setValue(previousEocValue);
|
||||||
console.log("Reverted lastEoc to previous value: " + previousEocValue);
|
console.log("Reverted lastEoc to previous value: " + previousEocValue);
|
||||||
previousEocValue = -1;
|
|
||||||
} else {
|
|
||||||
console.warn("No previous EOC value recorded.");
|
|
||||||
}
|
}
|
||||||
isCalibrationActive = false;
|
isCalibrationActive = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -150,7 +151,7 @@ MbPage {
|
||||||
if (lastEoc.value !== 0 && isCalibrationActive) {
|
if (lastEoc.value !== 0 && isCalibrationActive) {
|
||||||
console.log("Calibration charge completed, resetting button to 'Press here'.");
|
console.log("Calibration charge completed, resetting button to 'Press here'.");
|
||||||
isCalibrationActive = false;
|
isCalibrationActive = false;
|
||||||
previousEocValue = -1;
|
previousEocValue = lastEoc.value;
|
||||||
eoctime.value = qsTr("Press here");
|
eoctime.value = qsTr("Press here");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,10 @@ async def resize(remote_host):
|
||||||
command = "sh /opt/victronenergy/swupdate-scripts/resize2fs.sh"
|
command = "sh /opt/victronenergy/swupdate-scripts/resize2fs.sh"
|
||||||
return await run_remote_command(remote_host, command)
|
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):
|
async def upload_files(remote_host):
|
||||||
file_location_mappings = {
|
file_location_mappings = {
|
||||||
"rc.local": "/data/",
|
"rc.local": "/data/",
|
||||||
|
@ -107,15 +111,13 @@ async def main(remote_host):
|
||||||
#### 4. resize /dev/root #####
|
#### 4. resize /dev/root #####
|
||||||
print("Resize /dev/root now!")
|
print("Resize /dev/root now!")
|
||||||
print(await resize(remote_host))
|
print(await resize(remote_host))
|
||||||
# ##### 5. stop battery service ######
|
# ##### 5. run rc.local ######
|
||||||
# print("Stop battery service!")
|
# print("Run rc.local to set password, timezone and cp battery folder!")
|
||||||
# print(await stop_battery_service(remote_host))
|
# print(await run_rclocal(remote_host))
|
||||||
##### 6. run rc.local ######
|
##### 5. reboot to run rc.local and update qml ######
|
||||||
print("Run rc.local to set password, timezone and cp battery folder!")
|
print("Reboot!")
|
||||||
print(await run_rclocal(remote_host))
|
print(await run_rclocal(remote_host))
|
||||||
# ##### 7. start battery service ######
|
|
||||||
# print("Start battery service!")
|
|
||||||
# print(await start_battery_service(remote_host))
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
sys.exit("It's not Venus GX!")
|
sys.exit("It's not Venus GX!")
|
||||||
|
|
Loading…
Reference in New Issue