diff --git a/README.md b/README.md
index 5686efd..9b46638 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ I suspect it works well with DIY rowing machines like the [Openergo](https://ope
## Features
-Currently the feature set is pretty basic, I'll add more features in the future, check the [Development Roadmap](docs/backlog.md) if you are curious.
+The following items describe most of the current features, more functionality will be added in the future, check the [Development Roadmap](docs/backlog.md) if you are curious.
### Rowing Metrics
@@ -28,7 +28,9 @@ Open Rowing Monitor implements a physics model to simulate the typical metrics o
### Web Interface
-The web interface visualizes the rowing metrics on any device that can run a browser (i.e. a smartphone that you attach to your rowing machine while training). It uses web sockets to show the rowing status in Realtime. Besides that it does not do much (yet).
+The web interface visualizes the rowing metrics on any device that can run a web browser (i.e. a smartphone that you attach to your rowing machine while training). It uses web sockets to show the rowing status in realtime. It can also be used to reset the training metrics and to select the BLE Rower.
+
+If you connect a screen to the Raspberry Pi, then this interface can also be directly shown on the device. The installation script can set up a web browser in kiosk mode that runs on the Raspberry Pi.

diff --git a/bin/openrowingmonitor.sh b/bin/openrowingmonitor.sh
new file mode 100755
index 0000000..960fa1b
--- /dev/null
+++ b/bin/openrowingmonitor.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# Open Rowing Monitor, https://github.com/laberning/openrowingmonitor
+#
+# Start script for Open Rowing Monitor
+#
+
+# treat unset variables as an error when substituting
+set -u
+# exit when a command fails
+set -e
+
+print() {
+ echo "$@"
+}
+
+CURRENT_DIR=$(pwd)
+SCRIPT_DIR="$( cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd )"
+INSTALL_DIR="$(dirname "$SCRIPT_DIR")"
+
+cd $INSTALL_DIR
+npm start
+cd $CURRENT_DIR
diff --git a/install/update.sh b/bin/updateopenrowingmonitor.sh
similarity index 67%
rename from install/update.sh
rename to bin/updateopenrowingmonitor.sh
index d301eda..42ae584 100755
--- a/install/update.sh
+++ b/bin/updateopenrowingmonitor.sh
@@ -11,7 +11,7 @@ set -u
set -e
print() {
- printf "%s\n" "$@"
+ echo "$@"
}
cancel() {
@@ -19,8 +19,38 @@ cancel() {
exit 1
}
+ask() {
+ local prompt default reply
+
+ if [[ ${2:-} = 'Y' ]]; then
+ prompt='Y/n'
+ default='Y'
+ elif [[ ${2:-} = 'N' ]]; then
+ prompt='y/N'
+ default='N'
+ else
+ prompt='y/n'
+ default=''
+ fi
+
+ while true; do
+ echo -n "$1 [$prompt] "
+ read -r reply /dev/null && pwd )"
+INSTALL_DIR="$(dirname "$SCRIPT_DIR")"
GIT_REMOTE="https://github.com/laberning/openrowingmonitor.git"
print "Update script for Open Rowing Monitor"
@@ -35,9 +65,7 @@ REMOTE_VERSION=$(git ls-remote $GIT_REMOTE HEAD | awk '{print $1;}')
if [ "$LOCAL_VERSION" = "$REMOTE_VERSION" ]; then
print "You are using the latest version of Open Rowing Monitor."
else
- print "A new version of Open Rowing Monitor is available. Do you want to update?"
- print
- read -p "Press RETURN to continue or CTRL + C to abort"
+ if ask "A new version of Open Rowing Monitor is available. Do you want to update?" Y; then
print "Stopping Open Rowing Monitor..."
sudo systemctl stop openrowingmonitor
@@ -56,6 +84,7 @@ else
print
print "Update complete, Open Rowing Monitor now has the following exciting new features:"
git log --reverse --pretty=format:"- %s" $LOCAL_VERSION..HEAD
+ fi
fi
cd $CURRENT_DIR
diff --git a/docs/installation.md b/docs/installation.md
index 8214f58..2a48e44 100644
--- a/docs/installation.md
+++ b/docs/installation.md
@@ -36,12 +36,12 @@ Connect to the device with SSH and initiate the following command to set up all
Open Rowing Monitor does not provide proper releases (yet), but you can update to the latest development version with this command:
```zsh
-sudo /opt/openrowingmonitor/install/update.sh
+updateopenrowingmonitor.sh
```
### Running Open Rowing Monitor without root permissions
-The default installation will run Open Rowing Monitor with root permissions. If you want you can also run it as user by modifying the following system services:
+The default installation will run Open Rowing Monitor with root permissions. You can also run it as normal user by modifying the following system services:
#### To use BLE and open the Web-Server on port 80
diff --git a/install/install.sh b/install/install.sh
index d2eb098..6972295 100755
--- a/install/install.sh
+++ b/install/install.sh
@@ -11,7 +11,7 @@ set -u
set -e
print() {
- printf "%s\n" "$@"
+ echo "$@"
}
cancel() {
@@ -19,6 +19,39 @@ cancel() {
exit 1
}
+ask() {
+ local prompt default reply
+
+ if [[ ${2:-} = 'Y' ]]; then
+ prompt='Y/n'
+ default='Y'
+ elif [[ ${2:-} = 'N' ]]; then
+ prompt='y/N'
+ default='N'
+ else
+ prompt='y/n'
+ default=''
+ fi
+
+ while true; do
+ echo -n "$1 [$prompt] "
+ read -r reply > ~/.bashrc
+
# otherwise node-gyp would fail while building the system dependencies
sudo npm config set user 0
@@ -117,6 +165,29 @@ sudo systemctl daemon-reload
sudo systemctl enable openrowingmonitor
sudo systemctl restart openrowingmonitor
+if $INIT_GUI; then
+ print
+ print "Installing Graphical User Interface"
+ sudo apt-get -y install --no-install-recommends xserver-xorg xserver-xorg-legacy x11-xserver-utils xinit openbox chromium-browser
+ sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config
+ sudo cp install/webbrowserkiosk.service /lib/systemd/system/
+ sudo systemctl daemon-reload
+ sudo systemctl enable webbrowserkiosk
+ sudo systemctl restart webbrowserkiosk
+ print "sudo systemctl status webbrowserkiosk"
+ sudo systemctl status webbrowserkiosk
+ print
+ print "Installation of Graphical User Interface finished."
+ print "If the screen resolution or the screen borders are not correct, run 'sudo raspi-config' and modify the display options."
+fi
+
+cd $CURRENT_DIR
+
print
-print "Installation of Open Rowing Monitor finished"
+print "sudo systemctl status openrowingmonitor"
+sudo systemctl status openrowingmonitor
+print
+print "Installation of Open Rowing Monitor finished."
print "Open Rowing Monitor should now be up and running."
+print
+print "You should now adjust the configuration in $INSTALL_DIR/config/config.js"
diff --git a/install/openrowingmonitor.service b/install/openrowingmonitor.service
index c64b7f3..71ece09 100644
--- a/install/openrowingmonitor.service
+++ b/install/openrowingmonitor.service
@@ -10,4 +10,4 @@ WorkingDirectory=/opt/openrowingmonitor
ExecStart=npm start
[Install]
-WantedBy=multi-user.target
\ No newline at end of file
+WantedBy=multi-user.target
diff --git a/install/webbrowserkiosk.service b/install/webbrowserkiosk.service
new file mode 100644
index 0000000..de6f2a4
--- /dev/null
+++ b/install/webbrowserkiosk.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=X11 Web Browser Kiosk
+After=multi-user.target
+
+[Service]
+Type=simple
+User=pi
+Restart=on-failure
+WorkingDirectory=/opt/openrowingmonitor
+ExecStart=xinit /opt/openrowingmonitor/install/webbrowserkiosk.sh -- -nocursor
+
+[Install]
+WantedBy=multi-user.target
diff --git a/install/webbrowserkiosk.sh b/install/webbrowserkiosk.sh
new file mode 100644
index 0000000..f6819ce
--- /dev/null
+++ b/install/webbrowserkiosk.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+#
+# Open Rowing Monitor, https://github.com/laberning/openrowingmonitor
+#
+# Runs the Web Frontend in a chromium browser in fullscreen kiosk mode
+#
+xset s off
+xset s noblank
+xset -dpms
+openbox-session &
+
+# Start Chromium in kiosk mode
+sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
+sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
+chromium-browser --disable-infobars --kiosk --noerrdialogs --disable-session-crashed-bubble --check-for-update-interval=604800 --app="http://127.0.0.1/#:kiosk:"