Skip to content

Commit 885ca08

Browse files
committed
improve ordering to ensure that updating message stays on the emonPi LCD
1 parent c709870 commit 885ca08

3 files changed

Lines changed: 36 additions & 17 deletions

File tree

update/emonpi.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ echo "avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:$ope
1616
avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:$openenergymonitor_dir/emonpi/firmware/compiled/latest.hex
1717

1818
sudo systemctl start emonhub
19+
20+
echo "waiting for emonpi to stop controlling LCD"
21+
sleep 3

update/emonsd.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ echo "-------------------------------------------------------------"
77
if [ -f $openenergymonitor_dir/emonpi/lcd/install.sh ]; then
88
$openenergymonitor_dir/emonpi/lcd/./install.sh
99
fi
10+
11+
echo "Stopping emonPiLCD service"
12+
sudo systemctl stop emonPiLCD
13+
echo "Display update message on LCD"
14+
sudo $openenergymonitor_dir/emonpi/lcd/./emonPiLCD_update.py

update/main.sh

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,29 @@ cd $openenergymonitor_dir/EmonScripts/update
7878

7979
# -----------------------------------------------------------------
8080

81+
if [ "$type" == "all" ] || [ "$type" == "emonhub" ]; then
82+
echo "Start emonhub update script:"
83+
$openenergymonitor_dir/EmonScripts/update/emonhub.sh
84+
echo
85+
fi
86+
87+
# -----------------------------------------------------------------
88+
89+
if [ "$type" == "all" ] || [ "$type" == "emoncms" ]; then
90+
echo "Start emoncms update:"
91+
$openenergymonitor_dir/EmonScripts/update/emoncms_core.sh
92+
$openenergymonitor_dir/EmonScripts/update/emoncms_modules.sh
93+
echo
94+
fi
95+
96+
# -----------------------------------------------------------------
97+
98+
if [ "$type" == "all" ] && [ "$emonSD_pi_env" = "1" ]; then
99+
$openenergymonitor_dir/EmonScripts/update/emonsd.sh
100+
fi
101+
102+
# -----------------------------------------------------------------
103+
81104
if [ "$type" == "all" ] || [ "$type" == "firmware" ]; then
82105

83106
if [ "$firmware" == "emonpi" ]; then
@@ -99,29 +122,17 @@ fi
99122

100123
# -----------------------------------------------------------------
101124

102-
if [ "$type" == "all" ] || [ "$type" == "emonhub" ]; then
103-
echo "Start emonhub update script:"
104-
$openenergymonitor_dir/EmonScripts/update/emonhub.sh
125+
if [ "$hardware" == "EmonPi" ]; then
105126
echo
106-
fi
107-
108-
# -----------------------------------------------------------------
109-
110-
if [ "$type" == "all" ] || [ "$type" == "emoncms" ]; then
111-
echo "Start emoncms update:"
112-
$openenergymonitor_dir/EmonScripts/update/emoncms_core.sh
113-
$openenergymonitor_dir/EmonScripts/update/emoncms_modules.sh
127+
# Wait for update to finish
128+
echo "Starting emonPi LCD service.."
129+
sleep 5
130+
sudo service emonPiLCD restart
114131
echo
115132
fi
116133

117134
# -----------------------------------------------------------------
118135

119-
if [ "$type" == "all" ] && [ "$emonSD_pi_env" = "1" ]; then
120-
$openenergymonitor_dir/EmonScripts/update/emonsd.sh
121-
fi
122-
123-
# -----------------------------------------------------------------
124-
125136
datestr=$(date)
126137

127138
echo

0 commit comments

Comments
 (0)