Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    SBC-mode config shows console errors in standalone mode

    Scheduled Pinned Locked Moved Solved
    General Discussion
    2
    6
    177
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • omtekundefined
      omtek
      last edited by omtek

      While I was troubleshooting this issue, I copied my configuration to an SD card to test if I could reproduce the error in standalone mode following the instructions here.

      Upon starting a test print in standalone mode, the DWC console contained several errors while executing start.g that were not present when the same configuration and job gcode was run in SBC mode.

      74e27a79-bdca-4834-94a9-56e05a6240f5-image.png

      There is also a corresponding error that appears on the PanelDue.
      73880968-34bb-4c17-bf70-dc9f32f03acd-image.png

      It's difficult to know which commands are giving an error, but from the timestamps the errors seem to coincide with meta gcode commands in homez.g, bed.g, and mesh.g. these errors are unique to standalone mode. I don't get the same behavior in SBC mode.

      homez.g

      ; homez.g
      ; called to home the Z axis
      M98 P"0:/sys/setHomingSpeed.g"
      
      G91                     ; relative positioning
      G1 H2 Z5 F120     ; lift Z relative to current position
      
      M400 ; wait for moves to finish
      
      M561 ; clear any bed transform
      M290 R0 S0 ; clear babystepping
      
      ;check BL Touch
      ;if sensors.probes[0].value[0]=1000 ; if probe is in error state
      ;	echo "Probe in error state- resetting"
      ;	M280 P0 S160 ; reset BL Touch
      ;	G4 S0.5
      ;if state.gpOut[0].pwm=0.03
      ;	echo "Probe is already deployed - retracting"
      ;	M280 P0 S80 ; retract BLTouch
      ;	G4 S0.5
      
      ;if sensors.endstops[2].triggered
      ;	echo "Probe ia already triggered - resetting"
      ;	M280 P0 S160 ; reset BL Touch
      ;	G4 S0.5
      
      G90                     ; absolute positioning
      
      
      ; variabes set in Config.g
      M401
      G1 X150 Y150 F10000
      G1 X{global.bedCenterX - sensors.probes[0].offsets[0] } Y{global.bedCenterY - sensors.probes[0].offsets[1]} F12000
      M400 ; wait for moves to finish
      G30               ; home Z by probing the bed
      if result !=0
      	abort "Print cancelled due to probe error"
      
      M400 ; wait for moves to finish
      
      ; Uncomment the following lines to lift Z after probing
      G91                ; relative positioning
      G1 H2 Z5 F100      ; lift Z relative to current position
      G90                ; absolute positioning
      ;G1 X{global.Bed_Center_X - sensors.probes[0].offsets[0] } Y{global.Bed_Center_Y - sensors.probes[0].offsets[1]} F12000
      ;reset speeds
      M402
      M98 P"0:/sys/setMaxSpeed.g"
      

      bed.g

      ; bed.g
      ; called to perform automatic bed compensation via G32
      
      M290 R0 S0                                                                                 ;; clear baby stepping
      M561                                                                                       ;; reset all bed adjustments
      M400                                                                                       ;; flush move queue
      
      
      if !move.axes[0].homed
        echo "not all axes homed, homing axes first"                                             ;; Home XYZ, if not already
        G28
      
      M401
      
      ;=== probe sanity check commands ===;
      ;; G1 X{ 20 - sensors.probes[0].offsets[0] }  Y{ 20 - sensors.probes[0].offsets[1] }
      ;; G1 X{ 170 - sensors.probes[0].offsets[0] }  Y{ 275 - sensors.probes[0].offsets[1] }
      ;; G1 X{ 280 - sensors.probes[0].offsets[0] }  Y{ 40 - sensors.probes[0].offsets[1] }
      
      
      ;=== rough pass estimate, can skip ===;
      G30 P0 X20 Y20 Z-99999          ; probe near a leadscrew
      G30 P1 X170 Y275 Z-99999        ; probe near a leadscrew
      G30 P2 X280 Y40 Z-99999 S3      ; probe near a leadscrew and calibrate 3 motors
      echo "Current rough pass deviation: " ^ move.calibration.initial.deviation
      
      while move.calibration.initial.deviation > 0.005
          if iterations >= 10
              echo "Error: Max attempts failed. Deviation: " ^ move.calibration.initial.deviation
              break
          echo "Deviation over threshold. Executing pass" , iterations+1, "deviation", move.calibration.initial.deviation
          G30 P0 X20 Y20 Z-99999 ; probe near a leadscrew
          G30 P1 X170 Y275 Z-99999 ; probe near a leadscrew
          G30 P2 X280 Y40 Z-99999 S3 ; probe near a leadscrew and calibrate 3 motors
              echo "Current deviation: " ^ move.calibration.initial.deviation
              continue
      echo "Final deviation: " ^ move.calibration.initial.deviation
      
      G0 X150 Y150 F10000
      
      ; rehome Z as the absolute height of the z plane may have shifted
      G28 Z
      
      M402
      

      mesh.g

      ; perform mesh compensation only where printing
      
      M98 P"0:/sys/setDefaultProbePoints.g" ; reset probe points again, just in case
      
      if (exists(param.A) && exists(param.B) && exists(param.C) && exists(param.D) && exists(param.N))
          M557 X{max(move.compensation.probeGrid.mins[0],param.A),min(move.compensation.probeGrid.maxs[0],param.B)} Y{max(move.compensation.probeGrid.mins[1],param.C),min(move.compensation.probeGrid.maxs[1] ,param.D)} S{param.N}
          if result != 0
              abort "Invalid M557 parameters"
      
      G29 S0
      

      And aside from the console errors, the print completed without issue.

      Adding the rest of the configuration in next post.

      omtekundefined 1 Reply Last reply Reply Quote 0
      • omtekundefined
        omtek @omtek
        last edited by

        config.g

        
        ;=== initialize variables ===;
        M98 P"0:/sys/init_pre.g"                                  ;; set some variables that we need for configuration
        ;=== discard if necessary ===;
        
        ;=== configuration - initial networking setup ===;
        M586 P0 S1                                                ;; enable http, disable ftp, disable telnet, set printer name, wait 5s for expansion boards
        M586 P1 S0
        M586 P2 S0
        G4 S5
        M550 P"legionXY"                                          ;; in SBC mode, M550 goes in dsf-config.g, not config.g
        ;M552 S1                                                         
        G4 S5
        
        ;=== configuration -  PanelDue init ===;
        M575 P1 S1 B57600
        
        ;=== configuration - printer ===;
        G90                                                       ;; absolute coordinates, relative extruder moves
        M83
        M669 K1                                                   ;; Kinematics type: 1 = CoreXY
        
        ;=== configuration - drive ===;
        M569 P0.0 S0 D2                                           ;; Z-axis motors, 0.driver0,0.driver1,0.driver2
        M569 P0.1 S0 D2
        M569 P0.5 S0 D2
        M569 P0.3 S1 D2                                           ;; Left and right motors (X- and Y- axis), 0.driver3,0.driver4
        M569 P0.4 S1 D2
        M569 P20.0 S1 D2                                          ;; Extruder, RRF36.driver0
        
        ;=== configuration - drive - axis mapping ===;
        M584 X0.3 Y0.4 Z0.1:0.0:0.5 E20.0                         ;;  map E-axis here as toolboard will be connected
        
        ;=== configuration - drive - microstepping ===;
        M350 X16 Y16 Z16 I1
        
        ;=== configuration - drive - steps/mm, current, idle timeout ===;
        M92 X80 Y80 Z800                                          ;; set steps/mm, current (mA), idle timeout
        M84 S30                                                   ;; set idle hold 30s
        
        ;=== configuration - drive - speed, acceeleration, jerk ===;
        M98 P"0:/sys/setMaxSpeed.g"                               ;; set all the max speeds below as these are adjusted during home moves so we only want to adjust in one spot
        
        ;=== configuration - axis - min/max ===;
        M208 X0 Y0 Z0 S1
        M208 X310 Y300 Z300 S0
        
        ;=== configuration - axis - endstops ===;
        M574 X1 S1 P"20.io2.in"                                   ;; configure active high (S1) X endstop at X- (X1) on RRF36.io2.in (20.io.in)
        M574 Y2 S1 P"0.io2.in"                                    ;; configure Y active high (S1) endstop at Y+ (Y2) on duet.io2.in (0.io2.in)
        M574 Z1 S2                                                ;; configure Z-probe (S2) endstop at low end (Z1)
        
        ;=== configuration - axis - z-probe ===;
        M558 P8 C"^20.io0.in" H5:1 F300:120 T6000 A20 B0          ;; klicky pcb probe installed on RRF36.io0.in (20.io0.in)
        
        ;=== configuration - axis - mesh compensation and bed dismensions ===;
        M98 P"0:/sys/setDefaultProbePoints.g"                     ;; define mesh grid with allowance for mesh generation on printed area only
        if !exists(global.bedCenterX)                           ;; calculate bed center, insert into object model
        	global bedCenterX = floor(move.axes[0].max / 2)
        if !exists(global.bedCenterY)
        	global bedCenterY = floor(move.axes[1].max  / 2)
        
        ;=== configuration - axis - lead screw position ===;
        M671 X-4.5:150:304.5 Y-4.52:305:-4.52 S5
        
        ;=== configuration - sensor - bed heater & thermistor  ===;
        M308 S0 P"0.temp0" Y"thermistor" T100000 B3950 A"Bed"     ;; create sensor S0 on duet.temp0 named "Bed"
        M950 H0 C"0.out0" T0 Q11                                  ;; create heater (H0) for bed
        M307 H0 B0 S1.00                                          ;; on bed H0 disable bang-bang mode and set PWM limit
        M140 H0                                                   ;; map heated bed to heater 0 (H0)
        M143 H0 S120                                              ;; set heater H0 temperature limit to 120C
        
        ;=== !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ===;
        ;; run bed PID tune using code below
        ;;; ;;; H0 = heater 0, or bed
        ;;; ;;; S = temperature in C (90C)
        ;;; ; M303 H0 S90
        ;;;
        ;;; replace M307 below with results from M303
        ;;; M307 may have a Vnnn included with it
        ;;;  if you're using mains (AC) bed heater on your bed, omit it
        ;=== !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ===;
        M307 H0 R0.480 K0.256:0.000 D2.03 E1.35 S1.00 B0          ;; this is my M307, find your own
        
        ;=== configuration - sensor - accelerometer ===;
        M955 P20.0 I16 R10                                        ;; create accelerometer on RRF36
        ;;; I = accelerometer orientation, expressed as 2-digit number. see
        ;;;  https://www.dropbox.com/s/hu2w5mk57l4zqpg/Accelerometer%20Orientation.pdf
        ;;;  for all possible permutations
        
        ;=== configuration - sensor - chamber monitoring ===;
        M308 S5 P"0.io4.out+0.io4.in" Y"dht22" A"Chamber"         ;; DHT22 setup
        M308 S8 P"S5.1" Y"dht-humidity" A"Humidity[%]"
        M308 S11 Y"mcu-temp" A"MCU"                               ;; MCU temperature, with offset
        M912 P0 S-1.2
        M950 F2 C"0.out3" Q250                                                       ;; create fan 0 (F0) on pin 0.out2
        M106 P2 C"mainboard cooling" S0 H1 T155 L255                                 ;; set fan 0 (P0) to thermostatic control (45C), full-speed (L255) named "mainboard cooling"
        ;=== configuration - LEDs, chamber & toolhead ===;
        M950 P0 C"0.out5" Q1000                                   ;; configure Dayspring LEDs P0 on duet.out5 (0.out5)
        
        ;=== configuration - overrides ===;
        ;M501                                                     ;; config-override.g should remain empty      
        
        ;=== configuration - gizmo1 ===;
        M98 P"0:/sys/gizmo1.g"
        M568 P0 R0 S0 A0                                          ;; turn tool0 heater off
        M140 S-273.1                                              ;; turn bed off
        T0 P0                                                     ;; select T0, don't run any toolchange macros
        ;=== configuration ===;
        
        ;=== configuration - housekeeping ===;
        M98 P"0:/sys/init_post.g"                                 ;; set the last few variables we need that rely on loaded configuration
        M98 P"0:/sys/setBuildPlate.g"                             ;; see setBuildPlate.g for Z probe trigger value, offset, trigger height
        ;=== discard if necessary ===;
        

        init_pre.g

        if !exists(global.runDaemon)
        	global runDaemon = false 
        
        if !exists(global.bedPreheatTemp)  
        	global bedPreheatTemp = 60
        	
        if !exists(global.cancelled)  ; global variable for exiting out of loops
        	global cancelled = false 
        
        if !exists(global.filamentDistance)
        	global filamentDistance = 0
        
        if !exists(global.filamentFeedSpeed)
        	global filamentFeedSpeed = 1800
        
        if !exists(global.filamentRetractSpeed)
        	global filamentRetractSpeed = 3600
        
        if !exists(global.filamentDistance)
        	global filamentDistance = 0 ; global for use to allow filament to feed for set distance after sensor trips 
        else
        	set global.filamentDistance = 0
        

        init_post.g

        ;;;;===== global variables for preheating, review, extract, and extrapolate for filament load/preheat macros);;;;
        ; extrusion
        if !exists(global.loadedFilament) || global.loadedFilament=null; global variable to hold filament name
        	global loadedFilament="No_Filament" ; create a filament variable
        G4 P10
        
        if move.extruders[state.currentTool].filament=""
        	echo "No filament loaded.  Cold extrude & retract set to defaults"
        	M302 S190 R110 ; Allow extrusion starting from 190°C and retractions already from 110°C (defaults)
        	set global.loadedFilament="No_Filament"
        else
        	set global.loadedFilament=move.extruders[state.currentTool].filament ; set the variable to the currently loaded filament
        	echo "Loading config for " ^ global.loadedFilament ^ " filament"
        	M703 ; if a filament is loaded, set all the heats and speeds for it by loading config.g
        G4 P10
        

        setDefaultProbePoints.g

        ;setDefaultProbePoints.g
        M557 X5:275 Y5:275 P20 ; set values as you would normally do in config.g.g
        

        gizmo1.g

        ;; gizmoN.g is the comprehensive definition of a tool (extruder, hotend, heater, thermisistor, filament monitoring, input shaping, tool and part cooling fans)
        ;; includes hotend (thermistor, heater), fan (tool, part), extruder (axis, microstepping), tool assignment and offset
        
        ;=== gizmo1 - fan ===;
        M950 F1 C"!0.out4+0.out4.tach"                                                ;; create fan F1 named "4028" with duet.out4+duet.out4.tach (0.out4+0.out4.tach)
        M106 P1 C"4028" S0 H-1
        
        ;=== gizmo1 - hotend thermistor ===;
        M308 S1 P"20.temp0" Y"thermistor" T100000 B4725 C7.060000e-8 A"e3drevo"       ;; configure sensor 1 (S1) on pin RRF36.temp0 (20.temp0) as thermistor
        M950 H1 C"20.out0" T1                                                         ;; create heater output (H1) on RRF36.out0 (20.out0) and map to sensor 1 (T1)
        M307 H1 B0 S1.00                                                              ;; set PWM limit (S1.00)
        M563 P0 S"revo" D0 H1 F1                                                      ;; define tool0 (T0)
                                                                                      ;; assign fan F1, extruder drive D0 (E0) and heater H1 to tool T0 named "revo"
        G10 P0 X0 Y0 Z0                                                               ;; set axis offsets, max temperature, initial temperature
        M143 H1 S290
        G10 P0 R0 S0
        
        ;=== !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ===;
        ;; run hotend PID tune!! using code below
        ;;; T0 = PID tune tool0
        ;;; S210 = temperature in C (210C)
        ;;; F0.45 = Fan PWM value; 0.45 = 45%
        ;;; ; M303 T0 S210 F0.45
        ;;; replace M307 below with results from M303
        ;=== !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ===;
        M307 H1 R3.611 K0.702:0.541 D1.95 E1.35 S1.00 B0 V23.5                        ;; this is my M307, find your own
        
        ;=== gizmo1 - fan - hotend ===;
        M950 F0 C"20.out2" Q250                                                       ;; create fan 0 (F0) on pin RRF.out2 (20.out2)
        M106 P0 C"tool" S0 H1 T45 L255                                                ;; set fan 0 (P0) to thermostatic control (45C), full-speed (L255) named "tool"
        
        ;=== gizmo1 - extruder ===;
                                                                                      ;; Orbiter v2 with LDO motor
        M906 E1600                                                                    ;; set extruder motor current
        M350 E16 I1                                                                   ;; set microstepping to 16 with interpolation
        M92 E671.64                                                                   ;; set extruder steps per mm
        M203 E7200                                                                    ;; set max speed, jerk, acceleration
        M205 E5.0
        M201 E3000
        
        T0 P0                                                                         ;; select T0, don't run toolchange macro
        
        M703                                                                          ;; load filament specific gcode
                                                                                      ;; I keep filament-specific PID tuning, retraction, and pressure advance 
                                                                                      ;; settings here.
        
        ;=== configuration - scanning z-probe ===;
        M558 K1 P11 C"20.i2c.ldc1612" F18000 T36000
        M308 A"SZP" S4 Y"thermistor" P"20.temp1" T100000 B4092; thermistor on PCB/coil
        M558.2 K1 S16 R217324
        
        ;=== gizmo1 - options ===;
        M955 P20.0 I12                                                                ;; accelerometer on RRF36
        M950 E0 C"20.rgbled" T2 U2 Q3000000                                           ;; configure toolhead LED E0 on FLY36.rgbled (20.rgbled)
        

        setBuildPlate.g

        ;; check mesh.g and mesh.prusaslicer for setting on how to only create heightmap where printing
        
        ;=== configuration - bed - mesh compensation ===;
        ;M376 H3                                                ;; fade mesh compensation at 3mm
        
        ;=== configuration - bed - z-probe offset ===;
        ;;set in config.g, but change here // old offset: G31 K0 P500 X-27.8 Y-12.0 Z1.55
        G31 K0 P500 X-23.34 Y-20.49 Z1.84                         ;; klickyPCB with stock switch
        G31 K1 X0.0 Y-16.00 Z2.000                                      ;; Mellow SZP
        

        pause.g

        ; pause.g
        ; called when a print from SD card is paused
        ;
        ; generated by RepRapFirmware Configuration Tool v3.3.5 on Sat Nov 20 2021 00:56:13 GMT-0500 (Eastern Standard Time)
        M83            ; relative extruder moves
        G1 E-10 F3600  ; retract 10mm of filament
        G91            ; relative positioning
        G1 Z5 F360     ; lift Z by 5mm
        G90            ; absolute positioning
        G1 X150 Y280 F6000 ; go to X150 Y280
        

        resume.g

        ; resume.g
        ; called before a print from SD card is resumed
        
        G1 R1 X0 Y0 Z5 F6000 ; go to 5mm above position of the last print move
        G1 R1 X0 Y0 Z0       ; go back to the last print move
        M83                  ; relative extruder moves
        G1 E10 F3600         ; extrude 10mm of filament
        

        start.g

        T0         ; ensure the tool is selected
        
        M220 S100  ; set speed factor back to 100% in case it was changed
        M221 S100  ; set extrusion factor back to 100% in case it was changed
        M290 R0 S0 ; clear any baby-stepping
        M106 P0 S0 ; turn layer fan off if it is on
        M400       ; finish all moves, clear the buffer
        
        M98 P"0:/sys/setBuildPlate.g" ; pull in build plate parameters 
        							; heightmap, probe height, etc.
        
        ; chamber LEDs on
        M98 P"0:/macros/LEDs/led_on.g"
        		
        G32		   ; 3-point bed leveling
        
        ;M501	   ; load config-override.g
        M703	   ; load filament-specific config.g
        
        
        M98 P"0:/sys/setInputShaping.g" ; pull in input shaping parameters
        
        G90        ; absolute Positioning
        M83        ; extruder relative mode
        
        ;=== DuetLapse3 control ===;
        ;M291 P"DuetLapse3.start" S2
        ;M292
        ;G4 S10
            
        M98 P"0:/sys/setDefaultProbePoints.g" ; reset probe points, just in case
        
        ;=== slicer start code ===; 
        
        1 Reply Last reply Reply Quote 0
        • Phaedruxundefined
          Phaedrux Moderator
          last edited by

          Can you view the files in a text editor that shows hidden characters?
          Or upload the files directly so that we can check them?

          Z-Bot CoreXY Build | Thingiverse Profile

          omtekundefined 1 Reply Last reply Reply Quote 0
          • omtekundefined
            omtek @Phaedrux
            last edited by omtek

            @Phaedrux Here is a .zip file of the /sys folder. I've been using the 'Blank Operations' in Notepad++ to remove trailing spaces and converting tabs to spaces (along with 'show all characters' on), but nothing has jumped out as an invalid character so far; at least not in homez.g, bed.g, or mesh.g.

            1 Reply Last reply Reply Quote 0
            • Phaedruxundefined
              Phaedrux Moderator
              last edited by Phaedrux

              I notice a lot of tabs in the other called macros, so I'd go through all your files and give it the same treatment with NP++

              And for a sanity check you can create a basic config using the config tool and see if you get the same issues or not.

              Z-Bot CoreXY Build | Thingiverse Profile

              omtekundefined 1 Reply Last reply Reply Quote 1
              • omtekundefined
                omtek @Phaedrux
                last edited by omtek

                @Phaedrux It looks like the error was in one of the nested macros I use to lower motor current during homing as after running the blank operations I mentioned above on the files in the /sys folder, the error no longer appears. I guess SBC-mode was acting as an additional filter and caught it which was why I never encountered the errors before.

                Thanks for the help!

                1 Reply Last reply Reply Quote 1
                • Phaedruxundefined Phaedrux marked this topic as a question
                • Phaedruxundefined Phaedrux has marked this topic as solved
                • First post
                  Last post
                Unless otherwise noted, all forum content is licensed under CC-BY-SA