fix: small dwc2 related fixes

This commit is contained in:
th33xitus
2021-01-21 23:47:29 +01:00
parent d958c1ba2a
commit d9e697216f
3 changed files with 26 additions and 13 deletions

View File

@@ -32,7 +32,6 @@ FLUIDD_DIR=${HOME}/fluidd
#dwc2 #dwc2
DWC2FK_DIR=${HOME}/dwc2-for-klipper-socket DWC2FK_DIR=${HOME}/dwc2-for-klipper-socket
DWC_ENV_DIR=${HOME}/dwc-env DWC_ENV_DIR=${HOME}/dwc-env
#DWC2_DIR=${HOME}/sdcard/web
DWC2_DIR=${HOME}/duetwebcontrol DWC2_DIR=${HOME}/duetwebcontrol
#octoprint #octoprint
OCTOPRINT_DIR=${HOME}/OctoPrint OCTOPRINT_DIR=${HOME}/OctoPrint

View File

@@ -239,15 +239,15 @@ create_single_dwcfk_cfg(){
/bin/sh -c "cat > $DWC_CONF_LOC/dwc2.cfg" << DWCCFG /bin/sh -c "cat > $DWC_CONF_LOC/dwc2.cfg" << DWCCFG
[webserver] [webserver]
listen_adress: 0.0.0.0 listen_adress: 0.0.0.0
web_root: ~/duetwebcontrol web_root: ${HOME}/duetwebcontrol
port: ${PORT} port: ${PORT}
[reply_filters] [reply_filters]
regex: regex:
max_accel: \d+.\d+ max_accel: \d+.\d+
max_accel_to_decel: \d+.\d+ max_accel_to_decel: \d+.\d+
square_corner_velocity: \d+.\d+ square_corner_velocity: \d+.\d+
max_velocity: \d+.\d+ max_velocity: \d+.\d+
DWCCFG DWCCFG
} }
@@ -256,15 +256,15 @@ create_multi_dwcfk_cfg(){
/bin/sh -c "cat > $DWC_CONF_LOC/printer_$INSTANCE/dwc2.cfg" << DWCCFG /bin/sh -c "cat > $DWC_CONF_LOC/printer_$INSTANCE/dwc2.cfg" << DWCCFG
[webserver] [webserver]
listen_adress: 0.0.0.0 listen_adress: 0.0.0.0
web_root: ~/duetwebcontrol web_root: ${HOME}/duetwebcontrol
port: ${PORT} port: ${PORT}
[reply_filters] [reply_filters]
regex: regex:
max_accel: \d+.\d+ max_accel: \d+.\d+
max_accel_to_decel: \d+.\d+ max_accel_to_decel: \d+.\d+
square_corner_velocity: \d+.\d+ square_corner_velocity: \d+.\d+
max_velocity: \d+.\d+ max_velocity: \d+.\d+
DWCCFG DWCCFG
} }

View File

@@ -50,10 +50,16 @@ klipper_status(){
dwc2_status(){ dwc2_status(){
dcount=0 dcount=0
dwc2_data=( dwc2_data=(
SERVICE
$DWC2_DIR
$DWC2FK_DIR $DWC2FK_DIR
$DWC_ENV_DIR $DWC_ENV_DIR
$DWC2_DIR
) )
### remove the "SERVICE" entry from the klipper_data array if a klipper service is installed
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "dwc.service")" ] || [ "$(systemctl list-units --full -all -t service --no-legend | grep -E "dwc-[[:digit:]].service")" ]; then
unset dwc2_data[0]
fi
#count+1 for each found data-item from array #count+1 for each found data-item from array
for dd in "${dwc2_data[@]}" for dd in "${dwc2_data[@]}"
do do
@@ -61,8 +67,16 @@ dwc2_status(){
dcount=$(expr $dcount + 1) dcount=$(expr $dcount + 1)
fi fi
done done
### count amount of klipper services
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "klipper.service")" ]; then
instances=1
else
instances=$(systemctl list-units --full -all -t service --no-legend | grep -E "klipper-[[:digit:]].service" | wc -l)
fi
if [ "$dcount" == "${#dwc2_data[*]}" ]; then if [ "$dcount" == "${#dwc2_data[*]}" ]; then
DWC2_STATUS="${green}Installed!${default} " DWC2_STATUS="$(printf "${green}Installed: %-5s${default}" $instances)"
elif [ "$dcount" == 0 ]; then elif [ "$dcount" == 0 ]; then
DWC2_STATUS="${red}Not installed!${default} " DWC2_STATUS="${red}Not installed!${default} "
else else