mirror of
https://github.com/openglow-org/forgefirm.git
synced 2026-09-27 08:41:13 -07:00
grblhal.init: defer to the forgectrl supervisor
The controller lifecycle belongs to the forgectrl supervisor (it spawns the selected controller as a direct child); the init script no longer starts grblHAL and remains only as a manual emergency stop.
This commit is contained in:
@@ -8,40 +8,21 @@
|
|||||||
# Short-Description: grblHAL motion controller (Grbl over TCP:23)
|
# Short-Description: grblHAL motion controller (Grbl over TCP:23)
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
DAEMON=/usr/bin/grblHAL_glowforge
|
# The controller lifecycle belongs to the forgectrl supervisor: it
|
||||||
PIDFILE=/var/run/grblhal.pid
|
# spawns the controller selected by controller_mode as a direct child
|
||||||
LOG=/data/glowforge.log
|
# (that relationship carries the pulse-device fd and death detection).
|
||||||
CONF=/data/forgefirm.conf
|
# This script remains only as a manual emergency stop.
|
||||||
|
|
||||||
# Boot-time controller-mode dispatch: this service runs the machine in
|
|
||||||
# GRBL mode. controller_mode = cloud (once that mode exists, with its
|
|
||||||
# own service consulting the same key) keeps grblHAL down; anything
|
|
||||||
# else - grbl, unset, or no config file - starts it.
|
|
||||||
controller_mode() {
|
|
||||||
[ -r $CONF ] || { echo grbl; return; }
|
|
||||||
m=$(sed -n 's/^[ \t]*controller_mode[ \t]*=[ \t]*\([a-z]*\).*/\1/p' $CONF | tail -n 1)
|
|
||||||
echo "${m:-grbl}"
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
if [ "$(controller_mode)" = "cloud" ]; then
|
echo "grblHAL is managed by forgectrl (POST /mode to switch controllers)"
|
||||||
echo "grblHAL not started (controller_mode = cloud)"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
echo "Starting grblHAL"
|
|
||||||
start-stop-daemon -S -q -p $PIDFILE -m -b -x /bin/sh -- \
|
|
||||||
-c "cd /data && GFSINK=/dev/glowforge exec $DAEMON -p 23 -e /data/EEPROM-glowforge.DAT >> $LOG 2>&1"
|
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo "Stopping grblHAL"
|
echo "Stopping grblHAL"
|
||||||
start-stop-daemon -K -q -p $PIDFILE
|
pkill -x grblHAL_glowfor 2>/dev/null
|
||||||
rm -f $PIDFILE
|
|
||||||
;;
|
;;
|
||||||
restart)
|
restart)
|
||||||
$0 stop
|
$0 stop
|
||||||
sleep 1
|
|
||||||
$0 start
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start|stop|restart}"
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
|||||||
Reference in New Issue
Block a user