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

    Possible bug with local variables use in config.g?

    Scheduled Pinned Locked Moved Solved
    Gcode meta commands
    solved
    3
    13
    495
    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.
    • Mr Yodundefined
      Mr Yod
      last edited by Mr Yod

      EDIT: NVM, solution: https://forum.duet3d.com/topic/34505/possible-bug-with-local-variables-use-in-config-g/13?_=1703617897322

      I'm playing a bit with variables and conditions, for now I have an Hemera with a BLTouch attached to a HevORT (CoreXY), for ease of settings I made a fake tool T5 for the BLTouch, so that I can probe at the center of the bed just by using G1 X150 Y150 (I switch to T5 with T5 P0) without having to consider the various offsets: once set in config.g I can change the probe points with no effort.

      So far so good, my BLTouch is set as

      ; Z-Probe
      M950 S0 C"io5.out"								; create servo pin 0 for BLTouch
      M558 P9 C"io5.in" H10 F500:120 T9000 A3 S0.015	; set Z probe type to bltouch and the dive height + speeds
      G31 P500 X0 Y-66 Z1.00							; set Z probe trigger value, offset and trigger height
      

      and T0 and T5 as

      ; Tools
      M563 P0 S"Hemera" D0 H1 F1				; define tool 0
      G10 P0 X-31.25 Y-34 Z0					; set tool 0 axis offsets, X-31.25 Y-14.85 in teoria...
      G10 P0 R0 S0							; set initial tool 0 active and standby temperatures to 0C
      M563 P5 S"BLTouch" F-1					; define tool 4
      G10 P5 X0 Y-66 Z0						; set tool 5 axis offsets
      G10 P5 R0 S0							; set initial tool 5 active and standby temperatures to 0C
      

      Everything works: when T5 is at X150 Y150, T0 is at X118.8 Y182, and that makes sense (it's the difference between the offsets)

      But if I want to make a better calibration and measure better the BLTouch offset I'll have to remember to change 2 settings, so why not use var instead?

      And it became

      ; Z-Probe
      var BLoffsetX = 0												; offset X BLTouch
      var BLoffsetY = -66											; offset Y BLTouch
      var BLoffsetZ = 1.00											; offset Z BLTouch
      M950 S0 C"io5.out"											; create servo pin 0 for BLTouch
      M558 P9 C"io5.in" H10 F500:120 T9000 A3 S0.015				; set Z probe type to bltouch and the dive height + speeds
      G31 P500 X{BLoffsetX} Y{BLoffsetY} Z{BLoffsetZ}					; set Z probe trigger value, offset and trigger height
      

      and

      ; Tools
      M563 P0 S"Hemera" D0 H1 F1					; define tool 0
      G10 P0 X-31.25 Y-34 Z0						; set tool 0 axis offsets, X-31.25 Y-14.85 in teoria...
      G10 P0 R0 S0								; set initial tool 0 active and standby temperatures to 0C
      M563 P5 S"BLTouch" F-1						; define tool 4
      G10 P5 X{BLoffsetX} Y{BLoffsetY} Z{BLoffsetZ}	; set tool 5 axis offsets
      G10 P5 R0 S0								; set initial tool 5 active and standby temperatures to 0C
      

      So the exact same vaues, just put in variables, but now when T5 is at X150 Y150 (it's actually not anymore), T0 is at X118.8 Y116 and that doesn't make sense: where do the 116 comes from? Even if it did ignore the negative value 66 - 34 = 32, so T0 should be at Y118 (150 - 32).

      It's like it decided that Y{BLoffsetY} is actually 0 and used Hemera's offset (so no tool coordinates), but WHY?

      BTW: BLoffsetZ seems to work.

      .

      EDIT: I forgot.
      Duet 3 6HC v1.something (the one with 5160)
      Duet Web Control 3.4.6

      gloomyandyundefined 1 Reply Last reply Reply Quote 0
      • Mr Yodundefined Mr Yod referenced this topic
      • gloomyandyundefined
        gloomyandy @Mr Yod
        last edited by

        @Mr-Yod Probably worth posting your full config.g file (the one that does not work), also have you tried running M98 p"config.g" to see if you get any error reports? Also what commands are you using to test the probing point?

        Mr Yodundefined 1 Reply Last reply Reply Quote 0
        • Mr Yodundefined
          Mr Yod @gloomyandy
          last edited by Mr Yod

          @gloomyandy
          That IS the one that does not work, while it does when not using variables.
          That's literally the only part that I modified (besides I fail to see how a, let's say, M569 P0.1 S1 D2 could affect said behavior). 🤔

          I'll try calling config.g with M98, as soon as the current print is finished. 🤔

          gloomyandyundefined 1 Reply Last reply Reply Quote 0
          • gloomyandyundefined
            gloomyandy @Mr Yod
            last edited by

            @Mr-Yod Sorry I don't see the full config.g file, just excerpts from it. There may be other parts of the file that are messing with your settings (or possibly causing the config.g to abort early), without seeing the full details it is hard to be sure. It also makes it much easier for anyone trying to reproduce a problem to have the full file.

            Also please provide the details as to what you are doing to test the probing point, again without that folks can't easily try and reproduce your problem.

            Oh and T0 being at X118.8 Y116 may be correct, that is simply 150 - 31.25 and 150 - 34 which are the tool offsets you have defined in:

            G10 P0 X-31.25 Y-34 Z0
            

            But without knowing what you are doing to test things it is hard to say.

            Mr Yodundefined 1 Reply Last reply Reply Quote 0
            • Mr Yodundefined
              Mr Yod @gloomyandy
              last edited by Mr Yod

              @gloomyandy said in Possible bug with local variables use in config.g?:

              @Mr-Yod Sorry I don't see the full config.g file, just excerpts from it. There may be other parts of the file that are messing with your settings (or possibly causing the config.g to abort early), without seeing the full details it is hard to be sure. It also makes it much easier for anyone trying to reproduce a problem to have the full file.

              It's that I usually write a WoT by myself (that few read) to describe the problem, I don't want to overwhelm with other 2 pages of unrelated WoT.

              Besides the last row initializes global variables, so I can be quite certain it doesn't abort before reaching the end. 🤔
              But, if you insist:
              Working properly

              ; General preferences
              G90															; send absolute coordinates...
              M83														; ...but relative extruder moves
              M550 P"HevORT"												; set printer name
              M669 K1													; select CoreXY mode
              
              ; Network
              M552 P192.168.1.3 S1											; enable network and set IP address
              M553 P255.255.255.0											; set netmask
              M554 P192.168.1.1											; set gateway
              M586 P0 S1													; enable HTTP
              M586 P1 S0													; disable FTP
              M586 P2 S0													; disable Telnet
              
              ; Drives
              G4 S2														; wait for expansion boards to start
              M671 X-8.86:167.349:343.558 Y-10.411:317.799:-10.411 S50		; leadscrews at front left, rear middle and front right See https://miragec79.github.io/HevORT/firmwaresettings.html#5-configure-triple-z-axis
              M569 P0.0 S1 D2												; physical drive 0.0 goes forwards Spreadcycle
              M569 P0.1 S1 D2												; physical drive 0.1 goes forwards Spreadcycle
              M569 P0.2 S1 D2												; physical drive 0.2 goes forwards Spreadcycle
              M569 P0.3 S1 D2												; physical drive 0.3 goes forwards Spreadcycle
              M569 P0.4 S1 D2												; physical drive 0.4 goes forwards Spreadcycle
              M569 P0.5 S1 D2												; physical drive 0.5 goes forwards Spreadcycle
              M569 P1.0 S1 D2												; physical drive 1.0 goes forwards Spreadcycle
              M569 P1.1 S1 D2												; physical drive 1.1 goes forwards Spreadcycle
              M569 P1.2 S1 D2												; physical drive 1.2 goes forwards Spreadcycle
              M584 X0.0 Y0.1 Z1.0:1.1:1.2 E0.5								; set drive mapping
              M350 X32 Y32 Z16 E16 I1										; configure microstepping with interpolation
              M92 X320.00 Y320.00 Z800.00 E390.00							; set steps per mm (E409 @ 16 steps, in teoria... forse E390)
              M566 X1200.00 Y1200.00 Z30.00 E120.00						; set maximum instantaneous speed changes (mm/min)
              M203 X18000.00 Y18000.00 Z1800.00 E1200.00					; set maximum speeds (mm/min)
              M201 X1600.00 Y1600.00 Z100.00 E250.00						; set accelerations (mm/s^2)
              M906 X1000 Y1000 Z1200 E800 I30								; set motor currents (mA) and motor idle factor in per cent
              M593 F34.2													; cancel ringing at 34.2Hz
              M84 S30														; Set idle timeout
              
              ; Axis Limits
              M208 X20 Y-46 Z0 S1											; set axis minima Y-113
              M208 X335 Y335 Z260 S0										; set axis maxima
              
              ; Endstops
              M574 X1 S1 P"io0.in"											; configure switch-type (e.g. microswitch) endstop for low end on X via pin io0.in
              M574 Y1 S1 P"io1.in"											; configure switch-type (e.g. microswitch) endstop for low end on Y via pin io1.in
              M574 Z1 S2													; configure Z-probe endstop for low end on Z
              
              ; Z-Probe
              M950 S0 C"io5.out"											; create servo pin 0 for BLTouch
              M558 P9 C"io5.in" H10 F500:120 T9000 A3 S0.015				; set Z probe type to bltouch and the dive height + speeds (primo test veloce + secondo lento), tre test tolleranza 0.015mm
              G31 P500 X0 Y-66 Z1.00						; set Z probe trigger value, offset and trigger height
              M557 X20:270 Y20:270 S50									; define mesh grid
              
              ; Heaters
              M308 S0 P"temp0" Y"thermistor" T100000 B4138 A"Piatto"		; configure sensor 0 as thermistor on pin temp0
              M950 H0 C"out0" T0											; create bed heater output on out0 and map it to sensor 0
              M307 H0 B0 S1.00											; disable bang-bang mode for the bed heater and set PWM limit
              M140 H0													; map heated bed to heater 0
              M143 H0 S120												; set temperature limit for heater 0 to 120C
              M308 S1 P"temp1" Y"thermistor" T100000 B4725 C7.06e-8 A"Hemera"		; configure sensor 1 as thermistor on pin temp1
              M950 H1 C"out1" T1											; create nozzle heater output on out1 and map it to sensor 1
              M307 H1 B0 S1.00											; disable bang-bang mode for heater  and set PWM limit
              M143 H1 S280												; set temperature limit for heater 1 to 280C
              
              ; Board Sensors
              M308 S10 Y"drivers" A"Drivers 6HC"							; configure sensor 10 as 6HC drivers temperature warning and overheat flags
              M308 S11 Y"mcu-temp" A"Processore 6HC"						; configure sensor 11 as 6HC on-chip MCU temperature sensor
              M308 S12 Y"drivertemp" P"1.dummy" A"Drivers 3HC"				; configure sensor 12 as 3HC drivers temperature warning and overheat flags
              M308 S13 Y"mcu-temp" P"1.dummy" A"Processore 3HC"			; configure sensor 13 as 3HC on-chip 3HC MCU temperature sensor
              M912 P0 S-3.15												; calibrate MCU sensor
              
              ; Fans
              M950 F0 C"out4" Q25000										; create fan 0 on pin out4 and set its frequency
              M106 P0 S1 H1 T45 C"Hemera"									; set fan 0 value. Thermostatic control is turned on
              M950 F1 C"out9" Q65535										; create fan 1 on pin out9 and set its frequency
              M106 P1 S0 H-1 C"CPAP" L32 X85								; set fan 1 value. Thermostatic control is turned off. L0.125 X0.3 (min 12.5% max 30%)
              
              ; Tools
              M563 P0 S"Hemera" D0 H1 F1									; define tool 0
              G10 P0 X-31.25 Y-34 Z0										; set tool 0 axis offsets, X-31.25 Y-14.85 in teoria...
              G10 P0 R0 S0												; set initial tool 0 active and standby temperatures to 0C
              M563 P2 S"Laser" H2 F-1										; define tool 2
              G10 P2 X0 Y0 Z0												; set tool 2 axis offsets
              G10 P2 R0 S0												; set initial tool 2 active and standby temperatures to 0C
              M563 P5 S"BLTouch" F-1										; define tool 4
              G10 P5 X0 Y-66 Z0						; set tool 5 axis offsets
              G10 P5 R0 S0												; set initial tool 5 active and standby temperatures to 0C
              
              ; Miscellaneous
              M501														; load saved parameters from non-volatile memory
              M911 S20 R21 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000"			; set voltage thresholds and actions to run on power loss
              T0															; select first tool
              M98 P"0:/macros/GlobalVar.g"									; inizializza le variabili globali
              
              

              Not working properly

              ; General preferences
              G90															; send absolute coordinates...
              M83														; ...but relative extruder moves
              M550 P"HevORT"												; set printer name
              M669 K1													; select CoreXY mode
              
              ; Network
              M552 P192.168.1.3 S1											; enable network and set IP address
              M553 P255.255.255.0											; set netmask
              M554 P192.168.1.1											; set gateway
              M586 P0 S1													; enable HTTP
              M586 P1 S0													; disable FTP
              M586 P2 S0													; disable Telnet
              
              ; Drives
              G4 S2														; wait for expansion boards to start
              M671 X-8.86:167.349:343.558 Y-10.411:317.799:-10.411 S50		; leadscrews at front left, rear middle and front right See https://miragec79.github.io/HevORT/firmwaresettings.html#5-configure-triple-z-axis
              M569 P0.0 S1 D2												; physical drive 0.0 goes forwards Spreadcycle
              M569 P0.1 S1 D2												; physical drive 0.1 goes forwards Spreadcycle
              M569 P0.2 S1 D2												; physical drive 0.2 goes forwards Spreadcycle
              M569 P0.3 S1 D2												; physical drive 0.3 goes forwards Spreadcycle
              M569 P0.4 S1 D2												; physical drive 0.4 goes forwards Spreadcycle
              M569 P0.5 S1 D2												; physical drive 0.5 goes forwards Spreadcycle
              M569 P1.0 S1 D2												; physical drive 1.0 goes forwards Spreadcycle
              M569 P1.1 S1 D2												; physical drive 1.1 goes forwards Spreadcycle
              M569 P1.2 S1 D2												; physical drive 1.2 goes forwards Spreadcycle
              M584 X0.0 Y0.1 Z1.0:1.1:1.2 E0.5								; set drive mapping
              M350 X32 Y32 Z16 E16 I1										; configure microstepping with interpolation
              M92 X320.00 Y320.00 Z800.00 E390.00							; set steps per mm (E409 @ 16 steps, in teoria... forse E390)
              M566 X1200.00 Y1200.00 Z30.00 E120.00						; set maximum instantaneous speed changes (mm/min)
              M203 X18000.00 Y18000.00 Z1800.00 E1200.00					; set maximum speeds (mm/min)
              M201 X1600.00 Y1600.00 Z100.00 E250.00						; set accelerations (mm/s^2)
              M906 X1000 Y1000 Z1200 E800 I30								; set motor currents (mA) and motor idle factor in per cent
              M593 F34.2													; cancel ringing at 34.2Hz
              M84 S30														; Set idle timeout
              
              ; Axis Limits
              M208 X20 Y-46 Z0 S1											; set axis minima Y-113
              M208 X335 Y335 Z260 S0										; set axis maxima
              
              ; Endstops
              M574 X1 S1 P"io0.in"											; configure switch-type (e.g. microswitch) endstop for low end on X via pin io0.in
              M574 Y1 S1 P"io1.in"											; configure switch-type (e.g. microswitch) endstop for low end on Y via pin io1.in
              M574 Z1 S2													; configure Z-probe endstop for low end on Z
              
              ; Z-Probe
              var BLoffsetX = 0												; offset X BLTouch
              var BLoffsetY = -66											; offset Y BLTouch
              var BLoffsetZ = 1.00											; offset Z BLTouch; valore basso per il piatto più distante, valore alto per piatto più vicino
              M950 S0 C"io5.out"											; create servo pin 0 for BLTouch
              M558 P9 C"io5.in" H10 F500:120 T9000 A3 S0.015				; set Z probe type to bltouch and the dive height + speeds (primo test veloce + secondo lento), tre test tolleranza 0.015mm
              G31 P500 X{BLoffsetX} Y{BLoffsetY} Z{BLoffsetZ}					; set Z probe trigger value, offset and trigger height
              M557 X20:270 Y20:270 S50									; define mesh grid
              
              ; Heaters
              M308 S0 P"temp0" Y"thermistor" T100000 B4138 A"Piatto"		; configure sensor 0 as thermistor on pin temp0
              M950 H0 C"out0" T0											; create bed heater output on out0 and map it to sensor 0
              M307 H0 B0 S1.00											; disable bang-bang mode for the bed heater and set PWM limit
              M140 H0													; map heated bed to heater 0
              M143 H0 S120												; set temperature limit for heater 0 to 120C
              M308 S1 P"temp1" Y"thermistor" T100000 B4725 C7.06e-8 A"Hemera"		; configure sensor 1 as thermistor on pin temp1
              M950 H1 C"out1" T1											; create nozzle heater output on out1 and map it to sensor 1
              M307 H1 B0 S1.00											; disable bang-bang mode for heater  and set PWM limit
              M143 H1 S280												; set temperature limit for heater 1 to 280C
              
              ; Board Sensors
              M308 S10 Y"drivers" A"Drivers 6HC"							; configure sensor 10 as 6HC drivers temperature warning and overheat flags
              M308 S11 Y"mcu-temp" A"Processore 6HC"						; configure sensor 11 as 6HC on-chip MCU temperature sensor
              M308 S12 Y"drivertemp" P"1.dummy" A"Drivers 3HC"				; configure sensor 12 as 3HC drivers temperature warning and overheat flags
              M308 S13 Y"mcu-temp" P"1.dummy" A"Processore 3HC"			; configure sensor 13 as 3HC on-chip 3HC MCU temperature sensor
              M912 P0 S-3.15												; calibrate MCU sensor
              
              ; Fans
              M950 F0 C"out4" Q25000										; create fan 0 on pin out4 and set its frequency
              M106 P0 S1 H1 T45 C"Hemera"									; set fan 0 value. Thermostatic control is turned on
              M950 F1 C"out9" Q65535										; create fan 1 on pin out9 and set its frequency
              M106 P1 S0 H-1 C"CPAP" L32 X85								; set fan 1 value. Thermostatic control is turned off. L0.125 X0.3 (min 12.5% max 30%)
              
              ; Tools
              M563 P0 S"Hemera" D0 H1 F1									; define tool 0
              G10 P0 X-31.25 Y-34 Z0										; set tool 0 axis offsets, X-31.25 Y-14.85 in teoria...
              G10 P0 R0 S0												; set initial tool 0 active and standby temperatures to 0C
              M563 P2 S"Laser" H2 F-1										; define tool 2
              G10 P2 X0 Y0 Z0												; set tool 2 axis offsets
              G10 P2 R0 S0												; set initial tool 2 active and standby temperatures to 0C
              M563 P5 S"BLTouch" F-1										; define tool 4
              G10 P5 X{BLoffsetX} Y{BLoffsetY} Z{BLoffsetZ}					; set tool 5 axis offsets
              G10 P5 R0 S0												; set initial tool 5 active and standby temperatures to 0C
              
              ; Miscellaneous
              M501														; load saved parameters from non-volatile memory
              M911 S20 R21 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000"			; set voltage thresholds and actions to run on power loss
              T0															; select first tool
              M98 P"0:/macros/GlobalVar.g"									; inizializza le variabili globali
              
              

              Also please provide the details as to what you are doing to test the probing point, again without that folks can't easily try and reproduce your problem.

              You mean "so that I can probe at the center of the bed just by using G1 X150 Y150 (I switch to T5 with T5 P0)"? 🤔

              var tool = state.currentTool	; salva il tool attivo prima di passare al BLTouch
              T0 P0							; Hemera senza attivare il ToolChange
              G1 X150 Y150
              T{var.tool} P0					; riattiva il tool attivo
              

              That's for the Hemera, for BLTouch it's the same, but with T5 P0 instead of T0 P0

              var tool = state.currentTool	; salva il tool attivo prima di passare al BLTouch
              T{global.BLTouch} P0			; attiva il BLTouch
              G1 X150 Y150
              T{var.tool} P0					; riattiva il tool attivo
              

              global.BLTouch is initialized at 5
              Both work no problem (with both config.g, what changes are the coordinates, that are wrong in the second one)

              Oh and T0 being at X118.8 Y116 may be correct, that is simply 150 - 31.25 and 150 - 34 which are the tool offsets you have defined in:

              G10 P0 X-31.25 Y-34 Z0
              

              Except it's not?
              If I go to X150 Y150 with T5, then T0 should be at the difference between the offsets of T5 and T0, not T0 and no tool.

              Everything works: when T5 is at X150 Y150, T0 is at X118.8 Y182, and that makes sense (it's the difference between the offsets)

              And there's the part "but now when T5 is at X150 Y150 (it's actually not anymore)"

              EDIT: modified a copy-paste error

              gloomyandyundefined 1 Reply Last reply Reply Quote 0
              • gloomyandyundefined
                gloomyandy @Mr Yod
                last edited by

                @Mr-Yod Looking at the file you posted this line looks different:

                G10 P5X{BLoffsetX} Y{BLoffsetY} Z{BLoffsetZ}					; set tool 5 axis offsets
                
                

                Note the lack of space between P5 and X. I'm not sure if that would cause a problem but it is different from the case in which you did not use a variable:

                G10 P5 X0 Y-66 Z0						; set tool 5 axis offsets
                

                You might want to try running

                G10 P0
                G10 P5
                

                in the console as I think that should report the details of the tool settings. Having those might provide a clue as to what is happening.

                Also are you sure that the tools are actually being selected when you think they are? For instance if the globals have not been set correctly, then you may not have the correct tool selected and so the offset you would see would simply be the tool offset for tool 0. I'd be tempted to try running your bltouch macro step by step in the console with and without the global variables to see what happens

                T5 P0
                G1 X150 Y150
                T0 P0
                

                Then maybe

                T{global.BLTouch} P0
                G1 X150 Y150
                T0 P0
                

                and see if you get different results or any errors. As above running M98 p"config.g" may also provide an insight as to what is going on.

                If none of the above helps I'll try running some tests when I get back home and have access to a printer, but that will not be for a few days.

                Mr Yodundefined 1 Reply Last reply Reply Quote 0
                • Mr Yodundefined
                  Mr Yod @gloomyandy
                  last edited by

                  @gloomyandy said in Possible bug with local variables use in config.g?:

                  @Mr-Yod Looking at the file you posted this line looks different:

                  G10 P5X{BLoffsetX} Y{BLoffsetY} Z{BLoffsetZ}					; set tool 5 axis offsets
                  
                  

                  Note the lack of space between P5 and X. I'm not sure if that would cause a problem but it is different from the case in which you did not use a variable:

                  G10 P5 X0 Y-66 Z0						; set tool 5 axis offsets
                  

                  You might want to try running

                  G10 P0
                  G10 P5
                  

                  in the console as I think that should report the details of the tool settings. Having those might provide a clue as to what is happening.

                  Sorry: that's not a problem in config.g, but rather in copy paste here (I deleted the variable parts since it didn't work so I wrote it again here; the correct formatting is in my first post, before I deleted it from config.g). 😅

                  Also are you sure that the tools are actually being selected when you think they are? For instance if the globals have not been set correctly, then you may not have the correct tool selected and so the offset you would see would simply be the tool offset for tool 0. I'd be tempted to try running your bltouch macro step by step in the console with and without the global variables to see what happens

                  T5 P0
                  G1 X150 Y150
                  T0 P0
                  

                  Then maybe

                  T{global.BLTouch} P0
                  G1 X150 Y150
                  T0 P0
                  

                  and see if you get different results or any errors. As above running M98 p"config.g" may also provide an insight as to what is going on.

                  If none of the above helps I'll try running some tests when I get back home and have access to a printer, but that will not be for a few days.

                  The tools are selected because they are highlighted in Web Control (T0 highlighted, then T5 and back to T0), the coordinates switch momentarily for the new tool and because I don't get an error for variable non existent. 🤔

                  Besides I already did that test.

                  Now: I recreated the non working config.g (still same problems) and M98 P"config.g" does a "Connection lost, attempting to reconnect..." until I cut the power and turn on again... 🤔

                  gloomyandyundefined 1 Reply Last reply Reply Quote 0
                  • gloomyandyundefined
                    gloomyandy @Mr Yod
                    last edited by

                    @Mr-Yod said in Possible bug with local variables use in config.g?:

                    Now: I recreated the non working config.g (still same problems) and M98 P"config.g" does a "Connection lost, attempting to reconnect..." until I cut the power and turn on again...

                    You might need to comment out the bits that change your network settings (though I don't see why that would leave you with a permanently lost connection) , or run the M98 p"config.g" from a USB console if you can?

                    Did you try running the G10 commands to check to see what has been set (in the case that does not work)? Can you also run G31 (with no parameters) so we can see if the variables are working correctly for that?

                    What version of RRF are you running (you can use M122 to find out)?

                    Mr Yodundefined 1 Reply Last reply Reply Quote 0
                    • Mr Yodundefined
                      Mr Yod @gloomyandy
                      last edited by Mr Yod

                      @gloomyandy said in Possible bug with local variables use in config.g?:

                      Did you try running the G10 commands to check to see what has been set (in the case that does not work)? Can you also run G31 (with no parameters) so we can see if the variables are working correctly for that?

                      Right, like I said in my first post: "It's like it decided that Y{BLoffsetY} is actually 0"
                      And in fact this confirms it: "Tool 5: offsets X0.000 Y0.000 Z0.000", same for the probe

                      Now: why variables don't work in config.g? 🤔

                      What version of RRF are you running (you can use M122 to find out)?

                      @Mr-Yod said in Possible bug with local variables use in config.g?:

                      EDIT: I forgot.
                      Duet 3 6HC v1.something (the one with 5160)
                      Duet Web Control 3.4.6

                      More detailed:
                      "RepRapFirmware for Duet 3 MB6HC version 3.4.6 (2023-07-21 14:11:38) running on Duet 3 MB6HC v1.0 or earlier (standalone mode)"

                      As for the USB console: I'll see if I can make something.
                      Scratch that: fuck micro USB (the only cable I found is either power only or doesn't fit properly in the port through the slit in the box)

                      gloomyandyundefined 1 Reply Last reply Reply Quote 0
                      • gloomyandyundefined
                        gloomyandy @Mr Yod
                        last edited by

                        @Mr-Yod That seems to be showing that no offsets have been set (your Z is also zero), though earlier you said that Z seemed to be ok. I suspect that there is actually some sort of error when trying to run the G10 command in your config.g file and so none of the offsets are being set. Did you try running the G31 command so we can see if any of those values were set?

                        Oh and the reason I asked for the M122 output is that the folk's DWC version is not always the same as the actual firmware version, in this case it is the firmware version that matters.

                        You might want to try copying and pasting the var lines and the G10 line from your config.g into a separate test.g file and running that with M98 p"test.g", maybe add a G10 P5 at the end so we can see if the values have been set. If that still fails it will be much easier for other folks to try.

                        Mr Yodundefined 1 Reply Last reply Reply Quote 0
                        • Mr Yodundefined
                          Mr Yod @gloomyandy
                          last edited by Mr Yod

                          @gloomyandy said in Possible bug with local variables use in config.g?:

                          @Mr-Yod That seems to be showing that no offsets have been set (your Z is also zero), though earlier you said that Z seemed to be ok.

                          Seems != is

                          I suspect that there is actually some sort of error when trying to run the G10 command in your config.g file and so none of the offsets are being set.

                          Yes: what, why?

                          Did you try running the G31 command so we can see if any of those values were set?

                          "Z probe 0: current reading 0, threshold 500, trigger height 0.700, offsets X0.0 Y0.0"

                          You might want to try copying and pasting the var lines and the G10 line from your config.g into a separate test.g file and running that with M98 p"test.g", maybe add a G10 P5 at the end so we can see if the values have been set. If that still fails it will be much easier for other folks to try.

                          var BLoffsetX = 0													; offset X BLTouch
                          var BLoffsetY = -66													; offset Y BLTouch
                          var BLoffsetZ = 1.00												; offset Z BLTouch; valore basso per il piatto più distante, valore alto per piatto più vicino
                          
                          G31 P500 X{BLoffsetX} Y{BLoffsetY} Z{BLoffsetZ}						; set Z probe trigger value, offset and trigger height
                          
                          G10 P5 X{BLoffsetX} Y{BLoffsetY} Z{BLoffsetZ}						; set tool 5 axis offsets
                          
                          G10 P5
                          

                          M98 P"0:/sys/test.g"
                          Error: in file macro line 5 column 12: G31: unknown value 'BLoffsetX'
                          Error: in file macro line 7 column 10: G10: unknown value 'BLoffsetX'
                          Tool 5: offsets X0.000 Y0.000 Z0.000
                          Tool 5: offsets X0.000 Y0.000 Z0.000
                          🤔

                          It's not a typo, since to avoid them I copy-pasted every variable name (so it can't be a cyrillic "o" that magically appeared in place of the latin one).

                          What is? 😬

                          fcwiltundefined 1 Reply Last reply Reply Quote 0
                          • fcwiltundefined
                            fcwilt @Mr Yod
                            last edited by fcwilt

                            @Mr-Yod

                            I've always used {var.variable_name} rather than just {variable_name}

                            Frederick

                            Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                            Mr Yodundefined 1 Reply Last reply Reply Quote 2
                            • Mr Yodundefined
                              Mr Yod @fcwilt
                              last edited by

                              @fcwilt said in Possible bug with local variables use in config.g?:

                              @Mr-Yod

                              I've always used {var.variable_name} rather than just {variable_name}

                              Frederick

                              🤦

                              You are righ... 😅

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