diff --git a/.DS_Store b/.DS_Store index 43760d9..296730c 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/FileSets/.DS_Store b/FileSets/.DS_Store index e1f69b4..ed58f52 100644 Binary files a/FileSets/.DS_Store and b/FileSets/.DS_Store differ diff --git a/FileSets/fileList b/FileSets/fileList index dffadd7..686cd0a 100644 --- a/FileSets/fileList +++ b/FileSets/fileList @@ -1 +1,2 @@ /opt/victronenergy/dbus-systemcalc-py/delegates/relaystate.py +/opt/victronenergy/gui/qml/PageSettingsGeneral.qml diff --git a/FileSets/gpio_list b/FileSets/gpio_list index 70aa4c5..0f3d904 100644 --- a/FileSets/gpio_list +++ b/FileSets/gpio_list @@ -37,3 +37,12 @@ 19 in digital_input_4 # Digital input 5 Pin 37 / GPIO 26 26 in digital_input_5 + + +#### Gracefull shutdown - connect pin 36 to pin 38 +#### Note these inputs and outputs is NOT added to the available I/O used by Venus OS !!!! +# Pin 36 / GPIO 16 +16 in digital_input_6 +# Relay 7 Pin 38 / GPIO 20 +20 out relay_7 + diff --git a/FileSets/v2.40/PageSettingsGeneral.qml b/FileSets/v2.40/PageSettingsGeneral.qml new file mode 100644 index 0000000..3bad501 --- /dev/null +++ b/FileSets/v2.40/PageSettingsGeneral.qml @@ -0,0 +1,135 @@ +//////// Modified to add Shutdown command (RPI only) + +import QtQuick 1.1 +import com.victron.velib 1.0 +import "utils.js" as Utils + +MbPage +{ + id: root + property string bindPrefix: "com.victronenergy.settings" + +//////// add for Shutdown command + property string systemBindPrefix: "com.victronenergy.system" + VBusItem { id: shutdownItem; bind: Utils.path(systemBindPrefix, "/Relay/6/State") } + VBusItem { id: shutdownItem2; bind: Utils.path(bindPrefix, "/Settings/Relay/6/InitialState") } + + model: VisualItemModel { + MbItemOptions { + id: accessLevelSelect + description: qsTr("Access level") + bind: Utils.path(bindPrefix, "/Settings/System/AccessLevel") + magicKeys: true + writeAccessLevel: User.AccessUser + possibleValues: [ + MbOption { description: qsTr("User"); value: User.AccessUser; password: "ZZZ" }, + MbOption { description: qsTr("User & Installer"); value: User.AccessInstaller; password: "ZZZ" }, + MbOption { description: qsTr("Superuser"); value: User.AccessSuperUser; readonly: true }, + MbOption { description: qsTr("Service"); value: User.AccessService; readonly: true } + ] + + // change to super user mode if the right button is pressed for a while + property int repeatCount + onFocusChanged: repeatCount = 0 + + function open() { + if (user.accessLevel >= User.AccessInstaller && ++repeatCount > 60) { + if (accessLevelSelect.value !== User.AccessSuperUser) + accessLevelSelect.item.setValue(User.AccessSuperUser) + repeatCount = 0 + } + } + } + + MbEditBox { + show: user.accessLevel >= User.AccessSuperUser + description: "Set root password" + onEditDone: { + if (newValue.length < 6) { + toast.createToast("Please enter at least 6 characters") + } else { + toast.createToast(vePlatform.setRootPassword(newValue)) + item.value = "" + } + } + } + + MbSwitch { + name: qsTr("SSH on LAN") + show: user.accessLevel >= User.AccessSuperUser + bind: "com.victronenergy.settings/Settings/System/SSHLocal" + } + + MbSwitch { + id: remoteSupportOnOff + name: qsTr("Remote support") + bind: "com.victronenergy.settings/Settings/System/RemoteSupport" + } + + MbItemValue { + description: qsTr("Remote support tunnel") + item.value: remotePort.item.valid && remotePort.item.value !== 0 ? qsTr("Online") : qsTr("Offline") + show: remoteSupportOnOff.item.value + } + + MbItemValue { + id: remotePort + description: qsTr("Remote support port") + item.bind: "com.victronenergy.settings/Settings/System/RemoteSupportPort" + show: remoteSupportOnOff.item.value + } + + MbOK { + id: reboot + description: qsTr("Reboot?") + writeAccessLevel: User.AccessUser + onClicked: { + toast.createToast(qsTr("Rebooting..."), 10000, "icon-restart-active") + vePlatform.reboot() + } + } +//////// add for Shutdown command + // shutdown uses a psudo relay output connected to a psudo digital input + // shutdownItem is the relay state in system + // shutdownItem2 is the relay innitial state in settings + // the latter must not remain set through the shutdown or the system + // will shutdown immediately on startup!!! + MbOK { + id: shutdown + description: qsTr("Shutdown?") + writeAccessLevel: User.AccessUser + onClicked: + { + toast.createToast(qsTr("Shutting down..."), 10000, "icon-restart-active") + if (shutdownItem.valid) + shutdownItem.setValue (1) + if (shutdownItem2.valid) + shutdownItem2.setValue (0) + } + } + + MbSwitch { + property VBusItem hasBuzzer: VBusItem {bind: "com.victronenergy.system/Buzzer/State"} + name: qsTr("Audible alarm") + bind: Utils.path(bindPrefix, "/Settings/Alarm/Audible") + show: hasBuzzer.valid + } + + MbItemOptions { + id: demoOnOff + description: qsTr("Demo mode") + bind: Utils.path(bindPrefix, "/Settings/Gui/DemoMode") + possibleValues: [ + MbOption { description: qsTr("Disabled"); value: 0 }, + MbOption { description: qsTr("ESS demo"); value: 1 }, + MbOption { description: qsTr("Boat/Motorhome demo 1"); value: 2 }, + MbOption { description: qsTr("Boat/Motorhome demo 2"); value: 3 } + ] + } + + MbItemText { + text: qsTr("Starting demo mode will change some settings and the user interface will be unresponsive for a moment.") + wrapMode: Text.WordWrap + } + } +} diff --git a/FileSets/v2.40/PageSettingsGeneral.qml.orig b/FileSets/v2.40/PageSettingsGeneral.qml.orig new file mode 100644 index 0000000..7f692e1 --- /dev/null +++ b/FileSets/v2.40/PageSettingsGeneral.qml.orig @@ -0,0 +1,109 @@ +import QtQuick 1.1 +import com.victron.velib 1.0 +import "utils.js" as Utils + +MbPage +{ + id: root + property string bindPrefix: "com.victronenergy.settings" + + model: VisualItemModel { + MbItemOptions { + id: accessLevelSelect + description: qsTr("Access level") + bind: Utils.path(bindPrefix, "/Settings/System/AccessLevel") + magicKeys: true + writeAccessLevel: User.AccessUser + possibleValues: [ + MbOption { description: qsTr("User"); value: User.AccessUser; password: "ZZZ" }, + MbOption { description: qsTr("User & Installer"); value: User.AccessInstaller; password: "ZZZ" }, + MbOption { description: qsTr("Superuser"); value: User.AccessSuperUser; readonly: true }, + MbOption { description: qsTr("Service"); value: User.AccessService; readonly: true } + ] + + // change to super user mode if the right button is pressed for a while + property int repeatCount + onFocusChanged: repeatCount = 0 + + function open() { + if (user.accessLevel >= User.AccessInstaller && ++repeatCount > 60) { + if (accessLevelSelect.value !== User.AccessSuperUser) + accessLevelSelect.item.setValue(User.AccessSuperUser) + repeatCount = 0 + } + } + } + + MbEditBox { + show: user.accessLevel >= User.AccessSuperUser + description: "Set root password" + onEditDone: { + if (newValue.length < 6) { + toast.createToast("Please enter at least 6 characters") + } else { + toast.createToast(vePlatform.setRootPassword(newValue)) + item.value = "" + } + } + } + + MbSwitch { + name: qsTr("SSH on LAN") + show: user.accessLevel >= User.AccessSuperUser + bind: "com.victronenergy.settings/Settings/System/SSHLocal" + } + + MbSwitch { + id: remoteSupportOnOff + name: qsTr("Remote support") + bind: "com.victronenergy.settings/Settings/System/RemoteSupport" + } + + MbItemValue { + description: qsTr("Remote support tunnel") + item.value: remotePort.item.valid && remotePort.item.value !== 0 ? qsTr("Online") : qsTr("Offline") + show: remoteSupportOnOff.item.value + } + + MbItemValue { + id: remotePort + description: qsTr("Remote support port") + item.bind: "com.victronenergy.settings/Settings/System/RemoteSupportPort" + show: remoteSupportOnOff.item.value + } + + MbOK { + id: reboot + description: qsTr("Reboot?") + writeAccessLevel: User.AccessUser + onClicked: { + toast.createToast(qsTr("Rebooting..."), 10000, "icon-restart-active") + vePlatform.reboot() + } + } + + MbSwitch { + property VBusItem hasBuzzer: VBusItem {bind: "com.victronenergy.system/Buzzer/State"} + name: qsTr("Audible alarm") + bind: Utils.path(bindPrefix, "/Settings/Alarm/Audible") + show: hasBuzzer.valid + } + + MbItemOptions { + id: demoOnOff + description: qsTr("Demo mode") + bind: Utils.path(bindPrefix, "/Settings/Gui/DemoMode") + possibleValues: [ + MbOption { description: qsTr("Disabled"); value: 0 }, + MbOption { description: qsTr("ESS demo"); value: 1 }, + MbOption { description: qsTr("Boat/Motorhome demo 1"); value: 2 }, + MbOption { description: qsTr("Boat/Motorhome demo 2"); value: 3 } + ] + } + + MbItemText { + text: qsTr("Starting demo mode will change some settings and the user interface will be unresponsive for a moment.") + wrapMode: Text.WordWrap + } + } +} diff --git a/FileSets/v2.60/.DS_Store b/FileSets/v2.60/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/FileSets/v2.60/.DS_Store differ diff --git a/FileSets/v2.60/PageSettingsGeneral.qml b/FileSets/v2.60/PageSettingsGeneral.qml new file mode 100644 index 0000000..43808bc --- /dev/null +++ b/FileSets/v2.60/PageSettingsGeneral.qml @@ -0,0 +1,143 @@ +//////// Modified to add Shutdown command (RPI only) + +import QtQuick 1.1 +import com.victron.velib 1.0 +import "utils.js" as Utils + +MbPage +{ + id: root + property string bindPrefix: "com.victronenergy.settings" + +//////// add for Shutdown command + property string systemBindPrefix: "com.victronenergy.system" + VBusItem { id: shutdownItem; bind: Utils.path(systemBindPrefix, "/Relay/6/State") } + VBusItem { id: shutdownItem2; bind: Utils.path(bindPrefix, "/Settings/Relay/6/InitialState") } + + model: VisualItemModel { + MbItemOptions { + id: accessLevelSelect + description: qsTr("Access level") + bind: Utils.path(bindPrefix, "/Settings/System/AccessLevel") + magicKeys: true + writeAccessLevel: User.AccessUser + possibleValues: [ + MbOption { description: qsTr("User"); value: User.AccessUser; password: "ZZZ" }, + MbOption { description: qsTr("User & Installer"); value: User.AccessInstaller; password: "ZZZ" }, + MbOption { description: qsTr("Superuser"); value: User.AccessSuperUser; readonly: true }, + MbOption { description: qsTr("Service"); value: User.AccessService; readonly: true } + ] + + // touch version to get super user + property bool pulledDown: listview.contentY < -60 + Timer { + running: accessLevelSelect.pulledDown + interval: 5000 + onTriggered: if (user.accessLevel >= User.AccessInstaller) accessLevelSelect.item.setValue(User.AccessSuperUser) + } + + // change to super user mode if the right button is pressed for a while + property int repeatCount + onFocusChanged: repeatCount = 0 + + function open() { + if (user.accessLevel >= User.AccessInstaller && ++repeatCount > 60) { + if (accessLevelSelect.value !== User.AccessSuperUser) + accessLevelSelect.item.setValue(User.AccessSuperUser) + repeatCount = 0 + } + } + } + + MbEditBox { + show: user.accessLevel >= User.AccessSuperUser + description: "Set root password" + onEditDone: { + if (newValue.length < 6) { + toast.createToast("Please enter at least 6 characters") + } else { + toast.createToast(vePlatform.setRootPassword(newValue)) + item.value = "" + } + } + } + + MbSwitch { + name: qsTr("SSH on LAN") + show: user.accessLevel >= User.AccessSuperUser + bind: "com.victronenergy.settings/Settings/System/SSHLocal" + } + + MbSwitch { + id: remoteSupportOnOff + name: qsTr("Remote support") + bind: "com.victronenergy.settings/Settings/System/RemoteSupport" + } + + MbItemValue { + description: qsTr("Remote support tunnel") + item.value: remotePort.item.valid && remotePort.item.value !== 0 ? qsTr("Online") : qsTr("Offline") + show: remoteSupportOnOff.item.value + } + + MbItemValue { + id: remotePort + description: qsTr("Remote support IP and port") + item.bind: "com.victronenergy.settings/Settings/System/RemoteSupportIpAndPort" + show: remoteSupportOnOff.item.value + } + + MbOK { + id: reboot + description: qsTr("Reboot?") + writeAccessLevel: User.AccessUser + onClicked: { + toast.createToast(qsTr("Rebooting..."), 10000, "icon-restart-active") + vePlatform.reboot() + } + } +//////// add for Shutdown command + // shutdown uses a psudo relay output connected to a psudo digital input + // shutdownItem is the relay state in system + // shutdownItem2 is the relay innitial state in settings + // the latter must not remain set through the shutdown or the system + // will shutdown immediately on startup!!! + MbOK { + id: shutdown + description: qsTr("Shutdown?") + writeAccessLevel: User.AccessUser + onClicked: + { + toast.createToast(qsTr("Shutting down..."), 10000, "icon-restart-active") + if (shutdownItem.valid) + shutdownItem.setValue (1) + if (shutdownItem2.valid) + shutdownItem2.setValue (0) + } + } + + MbSwitch { + property VBusItem hasBuzzer: VBusItem {bind: "com.victronenergy.system/Buzzer/State"} + name: qsTr("Audible alarm") + bind: Utils.path(bindPrefix, "/Settings/Alarm/Audible") + show: hasBuzzer.valid + } + + MbItemOptions { + id: demoOnOff + description: qsTr("Demo mode") + bind: Utils.path(bindPrefix, "/Settings/Gui/DemoMode") + possibleValues: [ + MbOption { description: qsTr("Disabled"); value: 0 }, + MbOption { description: qsTr("ESS demo"); value: 1 }, + MbOption { description: qsTr("Boat/Motorhome demo 1"); value: 2 }, + MbOption { description: qsTr("Boat/Motorhome demo 2"); value: 3 } + ] + } + + MbItemText { + text: qsTr("Starting demo mode will change some settings and the user interface will be unresponsive for a moment.") + wrapMode: Text.WordWrap + } + } +} diff --git a/FileSets/v2.60/PageSettingsGeneral.qml.orig b/FileSets/v2.60/PageSettingsGeneral.qml.orig new file mode 100644 index 0000000..21a9c82 --- /dev/null +++ b/FileSets/v2.60/PageSettingsGeneral.qml.orig @@ -0,0 +1,117 @@ +import QtQuick 1.1 +import com.victron.velib 1.0 +import "utils.js" as Utils + +MbPage +{ + id: root + property string bindPrefix: "com.victronenergy.settings" + + model: VisualItemModel { + MbItemOptions { + id: accessLevelSelect + description: qsTr("Access level") + bind: Utils.path(bindPrefix, "/Settings/System/AccessLevel") + magicKeys: true + writeAccessLevel: User.AccessUser + possibleValues: [ + MbOption { description: qsTr("User"); value: User.AccessUser; password: "ZZZ" }, + MbOption { description: qsTr("User & Installer"); value: User.AccessInstaller; password: "ZZZ" }, + MbOption { description: qsTr("Superuser"); value: User.AccessSuperUser; readonly: true }, + MbOption { description: qsTr("Service"); value: User.AccessService; readonly: true } + ] + + // touch version to get super user + property bool pulledDown: listview.contentY < -60 + Timer { + running: accessLevelSelect.pulledDown + interval: 5000 + onTriggered: if (user.accessLevel >= User.AccessInstaller) accessLevelSelect.item.setValue(User.AccessSuperUser) + } + + // change to super user mode if the right button is pressed for a while + property int repeatCount + onFocusChanged: repeatCount = 0 + + function open() { + if (user.accessLevel >= User.AccessInstaller && ++repeatCount > 60) { + if (accessLevelSelect.value !== User.AccessSuperUser) + accessLevelSelect.item.setValue(User.AccessSuperUser) + repeatCount = 0 + } + } + } + + MbEditBox { + show: user.accessLevel >= User.AccessSuperUser + description: "Set root password" + onEditDone: { + if (newValue.length < 6) { + toast.createToast("Please enter at least 6 characters") + } else { + toast.createToast(vePlatform.setRootPassword(newValue)) + item.value = "" + } + } + } + + MbSwitch { + name: qsTr("SSH on LAN") + show: user.accessLevel >= User.AccessSuperUser + bind: "com.victronenergy.settings/Settings/System/SSHLocal" + } + + MbSwitch { + id: remoteSupportOnOff + name: qsTr("Remote support") + bind: "com.victronenergy.settings/Settings/System/RemoteSupport" + } + + MbItemValue { + description: qsTr("Remote support tunnel") + item.value: remotePort.item.valid && remotePort.item.value !== 0 ? qsTr("Online") : qsTr("Offline") + show: remoteSupportOnOff.item.value + } + + MbItemValue { + id: remotePort + description: qsTr("Remote support IP and port") + item.bind: "com.victronenergy.settings/Settings/System/RemoteSupportIpAndPort" + show: remoteSupportOnOff.item.value + } + + MbOK { + id: reboot + description: qsTr("Reboot?") + writeAccessLevel: User.AccessUser + onClicked: { + toast.createToast(qsTr("Rebooting..."), 10000, "icon-restart-active") + vePlatform.reboot() + } + } + + MbSwitch { + property VBusItem hasBuzzer: VBusItem {bind: "com.victronenergy.system/Buzzer/State"} + name: qsTr("Audible alarm") + bind: Utils.path(bindPrefix, "/Settings/Alarm/Audible") + show: hasBuzzer.valid + } + + MbItemOptions { + id: demoOnOff + description: qsTr("Demo mode") + bind: Utils.path(bindPrefix, "/Settings/Gui/DemoMode") + possibleValues: [ + MbOption { description: qsTr("Disabled"); value: 0 }, + MbOption { description: qsTr("ESS demo"); value: 1 }, + MbOption { description: qsTr("Boat/Motorhome demo 1"); value: 2 }, + MbOption { description: qsTr("Boat/Motorhome demo 2"); value: 3 } + ] + } + + MbItemText { + text: qsTr("Starting demo mode will change some settings and the user interface will be unresponsive for a moment.") + wrapMode: Text.WordWrap + } + } +} diff --git a/FileSets/v2.71/.DS_Store b/FileSets/v2.71/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/FileSets/v2.71/.DS_Store differ diff --git a/FileSets/v2.71/PageSettingsGeneral.qml b/FileSets/v2.71/PageSettingsGeneral.qml new file mode 100644 index 0000000..d748614 --- /dev/null +++ b/FileSets/v2.71/PageSettingsGeneral.qml @@ -0,0 +1,143 @@ +//////// Modified to add Shutdown command (RPI only) + +import QtQuick 1.1 +import com.victron.velib 1.0 +import "utils.js" as Utils + +MbPage +{ + id: root + property string bindPrefix: "com.victronenergy.settings" + +//////// add for Shutdown command + property string systemBindPrefix: "com.victronenergy.system" + VBusItem { id: shutdownItem; bind: Utils.path(systemBindPrefix, "/Relay/6/State") } + VBusItem { id: shutdownItem2; bind: Utils.path(bindPrefix, "/Settings/Relay/6/InitialState") } + + model: VisualItemModel { + MbItemOptions { + id: accessLevelSelect + description: qsTr("Access level") + bind: Utils.path(bindPrefix, "/Settings/System/AccessLevel") + magicKeys: true + writeAccessLevel: User.AccessUser + possibleValues: [ + MbOption { description: qsTr("User"); value: User.AccessUser; password: "ZZZ" }, + MbOption { description: qsTr("User & Installer"); value: User.AccessInstaller; password: "ZZZ" }, + MbOption { description: qsTr("Superuser"); value: User.AccessSuperUser; readonly: true }, + MbOption { description: qsTr("Service"); value: User.AccessService; readonly: true } + ] + + // touch version to get super user + property bool pulledDown: listview.contentY < -60 + Timer { + running: accessLevelSelect.pulledDown + interval: 5000 + onTriggered: if (user.accessLevel >= User.AccessInstaller) accessLevelSelect.item.setValue(User.AccessSuperUser) + } + + // change to super user mode if the right button is pressed for a while + property int repeatCount + onFocusChanged: repeatCount = 0 + + function open() { + if (user.accessLevel >= User.AccessInstaller && ++repeatCount > 60) { + if (accessLevelSelect.value !== User.AccessSuperUser) + accessLevelSelect.item.setValue(User.AccessSuperUser) + repeatCount = 0 + } + } + } + + MbEditBox { + description: "Set root password" + showAccessLevel: User.AccessSuperUser + onEditDone: { + if (newValue.length < 6) { + toast.createToast("Please enter at least 6 characters") + } else { + toast.createToast(vePlatform.setRootPassword(newValue)) + item.value = "" + } + } + } + + MbSwitch { + name: qsTr("SSH on LAN") + showAccessLevel: User.AccessSuperUser + bind: "com.victronenergy.settings/Settings/System/SSHLocal" + } + + MbSwitch { + id: remoteSupportOnOff + name: qsTr("Remote support") + bind: "com.victronenergy.settings/Settings/System/RemoteSupport" + } + + MbItemValue { + description: qsTr("Remote support tunnel") + item.value: remotePort.item.valid && remotePort.item.value !== 0 ? qsTr("Online") : qsTr("Offline") + show: remoteSupportOnOff.item.value + } + + MbItemValue { + id: remotePort + description: qsTr("Remote support IP and port") + item.bind: "com.victronenergy.settings/Settings/System/RemoteSupportIpAndPort" + show: remoteSupportOnOff.item.value + } + + MbOK { + id: reboot + description: qsTr("Reboot?") + writeAccessLevel: User.AccessUser + onClicked: { + toast.createToast(qsTr("Rebooting..."), 10000, "icon-restart-active") + vePlatform.reboot() + } + } +//////// add for Shutdown command + // shutdown uses a psudo relay output connected to a psudo digital input + // shutdownItem is the relay state in system + // shutdownItem2 is the relay innitial state in settings + // the latter must not remain set through the shutdown or the system + // will shutdown immediately on startup!!! + MbOK { + id: shutdown + description: qsTr("Shutdown?") + writeAccessLevel: User.AccessUser + onClicked: + { + toast.createToast(qsTr("Shutting down..."), 10000, "icon-restart-active") + if (shutdownItem.valid) + shutdownItem.setValue (1) + if (shutdownItem2.valid) + shutdownItem2.setValue (0) + } + } + + MbSwitch { + property VBusItem hasBuzzer: VBusItem {bind: "com.victronenergy.system/Buzzer/State"} + name: qsTr("Audible alarm") + bind: Utils.path(bindPrefix, "/Settings/Alarm/Audible") + show: hasBuzzer.valid + } + + MbItemOptions { + id: demoOnOff + description: qsTr("Demo mode") + bind: Utils.path(bindPrefix, "/Settings/Gui/DemoMode") + possibleValues: [ + MbOption { description: qsTr("Disabled"); value: 0 }, + MbOption { description: qsTr("ESS demo"); value: 1 }, + MbOption { description: qsTr("Boat/Motorhome demo 1"); value: 2 }, + MbOption { description: qsTr("Boat/Motorhome demo 2"); value: 3 } + ] + } + + MbItemText { + text: qsTr("Starting demo mode will change some settings and the user interface will be unresponsive for a moment.") + wrapMode: Text.WordWrap + } + } +} diff --git a/FileSets/v2.71/PageSettingsGeneral.qml.orig b/FileSets/v2.71/PageSettingsGeneral.qml.orig new file mode 100644 index 0000000..4aa39ec --- /dev/null +++ b/FileSets/v2.71/PageSettingsGeneral.qml.orig @@ -0,0 +1,117 @@ +import QtQuick 1.1 +import com.victron.velib 1.0 +import "utils.js" as Utils + +MbPage +{ + id: root + property string bindPrefix: "com.victronenergy.settings" + + model: VisualItemModel { + MbItemOptions { + id: accessLevelSelect + description: qsTr("Access level") + bind: Utils.path(bindPrefix, "/Settings/System/AccessLevel") + magicKeys: true + writeAccessLevel: User.AccessUser + possibleValues: [ + MbOption { description: qsTr("User"); value: User.AccessUser; password: "ZZZ" }, + MbOption { description: qsTr("User & Installer"); value: User.AccessInstaller; password: "ZZZ" }, + MbOption { description: qsTr("Superuser"); value: User.AccessSuperUser; readonly: true }, + MbOption { description: qsTr("Service"); value: User.AccessService; readonly: true } + ] + + // touch version to get super user + property bool pulledDown: listview.contentY < -60 + Timer { + running: accessLevelSelect.pulledDown + interval: 5000 + onTriggered: if (user.accessLevel >= User.AccessInstaller) accessLevelSelect.item.setValue(User.AccessSuperUser) + } + + // change to super user mode if the right button is pressed for a while + property int repeatCount + onFocusChanged: repeatCount = 0 + + function open() { + if (user.accessLevel >= User.AccessInstaller && ++repeatCount > 60) { + if (accessLevelSelect.value !== User.AccessSuperUser) + accessLevelSelect.item.setValue(User.AccessSuperUser) + repeatCount = 0 + } + } + } + + MbEditBox { + description: "Set root password" + showAccessLevel: User.AccessSuperUser + onEditDone: { + if (newValue.length < 6) { + toast.createToast("Please enter at least 6 characters") + } else { + toast.createToast(vePlatform.setRootPassword(newValue)) + item.value = "" + } + } + } + + MbSwitch { + name: qsTr("SSH on LAN") + showAccessLevel: User.AccessSuperUser + bind: "com.victronenergy.settings/Settings/System/SSHLocal" + } + + MbSwitch { + id: remoteSupportOnOff + name: qsTr("Remote support") + bind: "com.victronenergy.settings/Settings/System/RemoteSupport" + } + + MbItemValue { + description: qsTr("Remote support tunnel") + item.value: remotePort.item.valid && remotePort.item.value !== 0 ? qsTr("Online") : qsTr("Offline") + show: remoteSupportOnOff.item.value + } + + MbItemValue { + id: remotePort + description: qsTr("Remote support IP and port") + item.bind: "com.victronenergy.settings/Settings/System/RemoteSupportIpAndPort" + show: remoteSupportOnOff.item.value + } + + MbOK { + id: reboot + description: qsTr("Reboot?") + writeAccessLevel: User.AccessUser + onClicked: { + toast.createToast(qsTr("Rebooting..."), 10000, "icon-restart-active") + vePlatform.reboot() + } + } + + MbSwitch { + property VBusItem hasBuzzer: VBusItem {bind: "com.victronenergy.system/Buzzer/State"} + name: qsTr("Audible alarm") + bind: Utils.path(bindPrefix, "/Settings/Alarm/Audible") + show: hasBuzzer.valid + } + + MbItemOptions { + id: demoOnOff + description: qsTr("Demo mode") + bind: Utils.path(bindPrefix, "/Settings/Gui/DemoMode") + possibleValues: [ + MbOption { description: qsTr("Disabled"); value: 0 }, + MbOption { description: qsTr("ESS demo"); value: 1 }, + MbOption { description: qsTr("Boat/Motorhome demo 1"); value: 2 }, + MbOption { description: qsTr("Boat/Motorhome demo 2"); value: 3 } + ] + } + + MbItemText { + text: qsTr("Starting demo mode will change some settings and the user interface will be unresponsive for a moment.") + wrapMode: Text.WordWrap + } + } +} diff --git a/GracefulShutdown.sh b/GracefulShutdown.sh new file mode 100755 index 0000000..0310231 --- /dev/null +++ b/GracefulShutdown.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# part of RpiGpioSetup package + +# monitors GPIO pin for shutdown signal (pulled low to shutdown) +# export GPIO pin and set to input +# gpioPin must be in /etc/venus/gpio_list + +# this script runs as a service + +gpioPin=16 + +echo "Raspberry PI gracefull shutdown script starting" + +# echo "$gpioPin" > /sys/class/gpio/export +# echo "in" > /sys/class/gpio/gpio$gpioPin/direction + +# wait for pin to go low +while [ true ] ; do + # if GPIO pin isn't set up, don't do anything + if [ ! -f /sys/class/gpio/gpio$gpioPin/value ]; then + echo "No shutdown GPIO pin defined" + sleep 600 + elif [ "$(cat /sys/class/gpio/gpio$gpioPin/value)" == '1' ] ; then + echo "Raspberry Pi Shutting Down!" + shutdown -h now + sleep 5 100 + exit 0 + fi +sleep 1 +done diff --git a/ReadMe b/ReadMe index 7fa8810..6fd0836 100644 --- a/ReadMe +++ b/ReadMe @@ -6,6 +6,10 @@ This script adds: the additional GPIO pins (5 total) to /etc/venus/gpio_list makes additional digital inputs available makes all digital inputs behave the same: pull up so they are active low + shutdown command to Device List / Settings / General + +To use the shutdown command, pins 38 and 36 of the RPI's GPIO header must be connected + If you don't want the shutdown command to function, do not jumper these pins The Raspberry PI default is for the first 8 GPIO pins to have pull UPs and the remaining have pull DOWNs. This makes some digital input pins behave differently @@ -40,16 +44,16 @@ https://github.com/kwindrem/RpiGpioSetup/archive/current.tar.gz rename the resulting .tar.gz file to venus-data.tar.gz copy the venus-data.tar.gz to a USB stick, put the stick in the Venus device and reboot. -When Venus boots, it will unarchive the file to /data/RpiGoipSetup-current +When Venus boots, it will unarchive the file to /data/RpiGpioSetup-current Move the directory into it's active locaiton: -rm -rf /data/RpiGoipSetup -mv /data/RpiGoipSetup-current /data/RpiGoipSetup +rm -rf /data/RpiGpioSetup +mv /data/RpiGpioSetup-current /data/RpiGpioSetup Repeat the above for SetupHelper if you haven't done so for another package. Finally, run the setup script to complete the installation -/data/RpiGoipSetup/setup +/data/RpiGpioSetup/setup You will need root access to the Venus device. Instructions can be found here: https://www.victronenergy.com/live/ccgx:root_access diff --git a/service/.DS_Store b/service/.DS_Store new file mode 100644 index 0000000..e32a021 Binary files /dev/null and b/service/.DS_Store differ diff --git a/service/log/run b/service/log/run new file mode 100755 index 0000000..2860bb2 --- /dev/null +++ b/service/log/run @@ -0,0 +1,3 @@ +#!/bin/sh +exec multilog t s25000 n4 /var/log/gracefulShutdown + diff --git a/service/run b/service/run new file mode 100755 index 0000000..42b2d5b --- /dev/null +++ b/service/run @@ -0,0 +1,4 @@ +#!/bin/sh +exec 2>&1 +exec /data/RpiGpioSetup/GracefulShutdown.sh + diff --git a/setup b/setup index db9514e..e8806af 100755 --- a/setup +++ b/setup @@ -19,12 +19,15 @@ # run manually initally, then called from reinstallMods # to uninstall/deactivate, call this script with "uninstall" as first parameter +# a shutdown command is added to the Settings / General +# the shutdown uses a psudo-digital input jumpered to a psudo-relay output # Note, this script DOES require a system reboot. gpioListFile="/etc/venus/gpio_list" overlayFile="/u-boot/overlays/VenusGpioOverlay.dtb" relayStateFile="/opt/victronenergy/dbus-systemcalc-py/delegates/relaystate.py" configFile="/u-boot/config.txt" +pageGeneralFile="/opt/victronenergy/gui/qml/PageSettingsGeneral.qml" # no log file for this package packageLogFile="" @@ -66,7 +69,22 @@ if [ $scriptAction == 'NONE' ] ; then echo " Activates all 5 predefined digital inputs" echo " Changes all digital inputs to have pull-ups in stead of a mix of pull up/down" - standardActionPrompt + standardActionPrompt 'MORE_PROMPTS' + + # installing (not reinstalling) - prompt for options + if [ $scriptAction == 'NONE' ]; then + echo + echo "An optional shutdown command is added to Settings / General:" + echo " to use this command, RPI GPIO pings 38 and 36 must be connected together" + echo + read -p "Do you wish to install ths shugdown command? (y/n)? " + if $yesResponse ; then + touch "$setupOptionsDir/shutdownCommand" + else + rm -f "$setupOptionsDir/shutdownCommand" + fi + scriptAction='INSTALL' + fi fi #### installing @@ -87,6 +105,15 @@ if [ $scriptAction == 'INSTALL' ] ; then echo "#### end change all digital inputs to pull ups" >> "$configFile" filesUpdated=true fi + + + if [ -f $setupOptionsDir/shutdownCommand ]; then + updateActiveFile "$pageGeneralFile" + installService $packageName + else + restoreActiveFile "$pageGeneralFile" + removeService $packageName + fi fi # uninstalling - check scriptAction again @@ -95,6 +122,8 @@ if [ $scriptAction == 'UNINSTALL' ] ; then restoreActiveFile "$gpioListFile" restoreActiveFile "$overlayFile" restoreActiveFile "$relayStateFile" + restoreActiveFile "$pageGeneralFile" + removeService $packageName # remove mods from configFile - do not use restore in case other mods were made manually if [ -f "$configFile" ]; then diff --git a/timeStamp b/timeStamp index 2ff8399..5979dcc 100644 --- a/timeStamp +++ b/timeStamp @@ -1 +1 @@ -1632614290 +1632854043 diff --git a/version b/version index d9fb9c7..8616689 100644 --- a/version +++ b/version @@ -1 +1 @@ -v3.0 +v3.1