Improve print check
This commit is contained in:
parent
8069eb2573
commit
c6a64a01db
1 changed files with 16 additions and 6 deletions
22
bambu.sh
22
bambu.sh
|
@ -287,12 +287,7 @@ function bambu_print() {
|
|||
mqtt_command '{"print": { "sequence_id": 1, "command": "resume", "param": ""}}'
|
||||
;;
|
||||
check)
|
||||
local err="$(FROM_INTERNAL=true bambu_status | jq -r '.print.print_error')"
|
||||
if [ -z "$err" ] || [ "$err" == "0" ]; then
|
||||
echo "No errors"
|
||||
else
|
||||
printf "Error: 0x%x\n" "$err"
|
||||
fi
|
||||
bambu_print_check
|
||||
;;
|
||||
*)
|
||||
die "Unknown subcommand: $subcommand"
|
||||
|
@ -300,6 +295,21 @@ function bambu_print() {
|
|||
esac
|
||||
}
|
||||
|
||||
function bambu_print_check() {
|
||||
local status="$(FROM_INTERNAL=true bambu_status)"
|
||||
local err="$(echo "$status" | jq -r '.print.print_error')"
|
||||
if [ -z "$err" ] || [ "$err" == "0" ]; then
|
||||
local gcode_state="$(echo "$status" | jq -r '.print.gcode_state')"
|
||||
if [ "$gcode_state" == "RUNNING" ]; then
|
||||
echo "Now printing: $(echo "$status" | jq -r '.print.subtask_name')"
|
||||
echo "Progress: $(echo "$status" | jq -r '.print.mc_percent')%"
|
||||
fi
|
||||
echo "No errors"
|
||||
else
|
||||
printf "Error: 0x%x\n" "$err"
|
||||
fi
|
||||
}
|
||||
|
||||
function bambu_print_start() {
|
||||
local file=""
|
||||
local timelapse="false"
|
||||
|
|
Loading…
Add table
Reference in a new issue