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

troubles after updating to 3.5.1 [SBC mode expression eval]

Scheduled Pinned Locked Moved
Firmware installation
3
9
267
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.
  • undefined
    Tinchus
    last edited by dc42 22 May 2024, 13:14

    Hi. here are many nice features on 3.5 version, for me many new scripting options and menu creation options etc.So I decided to upgrade a printer to it, from 3.4.6 version
    I Have a duet3, SBC mode, and the printer was working perfect, configuration was ok for the last months, just to make a picture. I have read the releases notes of V3.5.1 and for sure there are things missing to me 😞 but I cant find the errors.

    The first problem: Im using a script to configure a variable mesh, I got it from forum actually. I was working perfect on 3.4.6 . Now Im getting errors:

    Error: in file macro line 59: M557: unknown variable 'meshX'
    Error: in file variablemesh.g line 43: in file macro line 0: Expression nesting too deep
    Error: in file variablemesh.g line 44: in file macro line 0: Expression nesting too deep
    Error: in file variablemesh.g line 57: unknown variable 'var.meshX'
    Error: in file variablemesh.g line 58: unknown variable 'var.meshY'

    The sc ript is this one:

    ; This command will only create a mesh of the print area
    ; This will reduce the printing time considerably by only probing what is needed
    var deviationFromOriginal = 20
    var probeGridMinX = move.compensation.probeGrid.mins[0]
    var probeGridMaxX = move.compensation.probeGrid.maxs[0]
    var probeGridMinY = move.compensation.probeGrid.mins[1]
    var probeGridMaxY = move.compensation.probeGrid.maxs[1]
    var pamMinX = {var.probeGridMinX} ; Default the pamMinX value to the min x that is set for the mesh in M557. Originally coming from sys/printer_size_config.g
    var pamMaxX = {var.probeGridMaxX} ; Default the pamMaxX value to the min x that is set for the mesh in M557. Originally coming from sys/printer_size_config.g
    var pamMinY = {var.probeGridMinY} ; Default the pamMinY value to the min x that is set for the mesh in M557. Originally coming from sys/printer_size_config.g
    var pamMaxY = {var.probeGridMaxY} ; Default the pamMaxY value to the min x that is set for the mesh in M557. Originally coming from sys/printer_size_config.g
    var meshSpacing = {move.compensation.probeGrid.spacings[0]} ; Grabbing the spacing of the current M557 settings
    var minMeshPoints = 3 ; The minimal amount of probing points for both X & Y.
    var maxMeshPoints = 10 ; The max amount of probing points for both X & Y
    if exists(param.A)
    set var.pamMinX = {param.A} ; The min X position of the print job
    if exists(param.B)
    set var.pamMaxX = {param.B} ; The max X position of the print job
    if exists(param.C)
    set var.pamMinY = {param.C} ; The min Y position of the print job
    if exists(param.D)
    set var.pamMaxY = {param.D} ; The max Y position of the print job
    if (var.probeGridMinX + var.deviationFromOriginal) >= var.pamMinX ; Check if the difference between the min X and the print job min X is smaller than the set deviation
    set var.pamMinX = {var.probeGridMinX} ; The difference is smaller than the set deviation so set minX to the minimal of the printer's X
    if (var.probeGridMaxX - var.deviationFromOriginal) <= var.pamMaxX ; Check if the difference between the max X and the print job max X is smaller than the set devation
    set var.pamMaxX = {var.probeGridMaxX} ; The difference is smaller than the set devation so set maxX to the max of the printer's X
    if (var.probeGridMinY + var.deviationFromOriginal) >= var.pamMinY ; Check if the difference between the min Y and the print job min Y is smaller than the set devation
    set var.pamMinY = {var.probeGridMinY} ; the difference is smaller than the set devation so set minY to the minimal of the printer's Y
    if (var.probeGridMaxY - var.deviationFromOriginal) <= var.pamMaxY ; Check if the difference between the max X and the print job max X is smaller than the set devation
    set var.pamMaxY = {var.probeGridMaxY} ; The difference is smaller than the set devation so set maxY to the max of the printer's Y
    var meshX = floor(min(var.maxMeshPoints - 1, (max(var.minMeshPoints - 1, (var.pamMaxX - var.pamMinX) / var.meshSpacing) + 1))) ; Get the number of probes for X taking minMeshPoints and maxMeshPoints into account
    var meshY = floor(min(var.maxMeshPoints - 1, (max(var.minMeshPoints - 1, (var.pamMaxY - var.pamMinY) / var.meshSpacing) + 1))) ; Get the number of probes for Y taking minMeshPoints and maxMeshPoints into account
    var consoleMessage = "Set probe grid to use X-min: " ^ var.pamMinX ^ "; X-max: " ^ var.pamMaxX ^ "; Y-min: " ^ var.pamMinY ^ "; Y-max: " ^ var.pamMaxY "; Probing points: " ^ var.meshX ^ ";" ^ var.meshY ; Set the console message
    ; M118 P2 S{var.consoleMessage} ; send used probe grid to paneldue not necesary at the moment
    M118 P3 S{var.consoleMessage} ; send average to DWC console
    M557 X{var.pamMinX, var.pamMaxX} Y{var.pamMinY, var.pamMaxY} P{var.meshX, var.meshY} ; Set the probing mesh
    G0 X{var.pamMinX + ((var.pamMaxX - var.pamMinX)/2) - sensors.probes[0].offsets[0]} Y{var.pamMinY + ((var.pamMaxY - var.pamMinY)/2) - sensors.probes[0].offsets[1]} ; Move to the center of the print area
    G30 ; Set the z height for the center of the print area
    G29 ; Probe the print area
    ; Restore the probing mesh to the original settings
    set var.meshX = floor((var.probeGridMaxX - var.probeGridMinX) / var.meshSpacing + 1)
    set var.meshY = floor((var.probeGridMaxY - var.probeGridMinY) / var.meshSpacing + 1)
    M557 X{var.probeGridMinX, var.probeGridMaxX} Y{var.probeGridMinY, var.probeGridMaxY} P{var.meshX, var.meshY}

    This would be the first problem from upgrading, thank in advance for the help

    undefined undefined 2 Replies Last reply 22 May 2024, 16:17 Reply Quote 0
    • undefined
      droftarts administrators @Tinchus
      last edited by 22 May 2024, 16:17

      @Tinchus said in troubles after updateing to 3.5.1:

      The problem is caused by these two line initially, on line 43 and 44:

      var meshX = floor(min(var.maxMeshPoints - 1, (max(var.minMeshPoints - 1, (var.pamMaxX - var.pamMinX) / var.meshSpacing) + 1))) ; Get the number of probes for X taking minMeshPoints and maxMeshPoints into account
      var meshY = floor(min(var.maxMeshPoints - 1, (max(var.minMeshPoints - 1, (var.pamMaxY - var.pamMinY) / var.meshSpacing) + 1))) ; Get the number of probes for Y taking minMeshPoints and maxMeshPoints into account

      This causes the "Error: in file variablemesh.g line 43: in file macro line 0: Expression nesting too deep" and "Error: in file variablemesh.g line 44: in file macro line 0: Expression nesting too deep" errors, so then no meshX and meshY are created, so can't be set in lines 57 and 58, or used in 59.

      "Expression nesting too deep" means you are doing too much calculation in one step, with all the bits in brackets. There was new code to handle arrays that increased the stack space used in one of the commonly-used functions by quite a lot even when arrays are not used. This error was noticed in the 3.5 release candidates, and @dc42 said that it should have been fixed in 3.5.0 (and so 3.5.1).

      Are you definitely on 3.5.1? Please post the beginning of M122. I'll highlight this to @dc42 for him to test if this is still a problem.

      Ian

      Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

      undefined 1 Reply Last reply 22 May 2024, 16:43 Reply Quote 0
      • undefined
        Tinchus @droftarts
        last edited by 22 May 2024, 16:43

        @droftarts Thanks for the help. Yes, im sure Im on 3.5.1, in DWC section I can see all updated to 3.5.1, and comman M122 is:

        M122
        === Diagnostics ===
        RepRapFirmware for Duet 3 MB6HC version 3.5.1 (2024-04-19 14:30:55) running on Duet 3 MB6HC v1.01 (SBC mode)
        Board ID: 08DJM-956L2-G43S8-6J9DL-3S46J-1S2QD
        Used output buffers: 1 of 40 (18 max)
        Error in macro line 4 while starting up: in file macro line 4: M307: value must be greater than zero

        undefined 1 Reply Last reply 22 May 2024, 16:48 Reply Quote 0
        • undefined
          droftarts administrators @Tinchus
          last edited by 22 May 2024, 16:48

          @Tinchus you’ve got an M307 error in your config.g, too!

          Error in macro line 4 while starting up: in file macro line 4: M307: value must be greater than zero

          Ian

          Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

          undefined 1 Reply Last reply 22 May 2024, 19:04 Reply Quote 0
          • undefined
            Tinchus @droftarts
            last edited by 22 May 2024, 19:04

            @droftarts Yes. In the upgrade that error arised too, but I consider it not importaqnt yet. I have to take some time to see if there has been any change regarding how to tune a heated chamber, in the previous versions, I have never been able to PID tune the heated chamber, I always get error, of if I finish the tunning, the reported values never worke when launching a print. So I went to the bang bang mode, and in 3.5 I get this error

            1 Reply Last reply Reply Quote 0
            • undefined
              dc42 administrators @Tinchus
              last edited by 22 May 2024, 20:39

              @Tinchus I've created a macro containing the following, based on the failing lines in the one you published:

              var maxMeshPoints = 20
              var minMeshPoints = 10
              var meshSpacing = 10
              var pamMaxX = 100.0
              var pamMinX = 20.3
              var pamMaxY = 201.5
              var pamMinY = 30.3
              var meshX = floor(min(var.maxMeshPoints - 1, (max(var.minMeshPoints - 1, (var.pamMaxX - var.pamMinX) / var.meshSpacing) + 1))) ; Get the number of probes for X taking minMeshPoints and maxMeshPoints into account
              var meshY = floor(min(var.maxMeshPoints - 1, (max(var.minMeshPoints - 1, (var.pamMaxY - var.pamMinY) / var.meshSpacing) + 1))) ; Get the number of probes for Y taking minMeshPoints and maxMeshPoints into account
              echo var.meshX, var.meshY

              It runs OK for me, on a Duet 3 Mini in standalone mode. Does it run on your machine?

              Duet WiFi hardware designer and firmware engineer
              Please do not ask me for Duet support via PM or email, use the forum
              http://www.escher3d.com, https://miscsolutions.wordpress.com

              undefined 1 Reply Last reply 23 May 2024, 11:37 Reply Quote 0
              • undefined
                Tinchus @dc42
                last edited by 23 May 2024, 11:37

                @dc42 created that macro and executed, and I get the error:

                5/23/2024, 8:35:52 AM Error: in file testmacro.g line 12: in file macro line 0: unknown variable 'meshX'
                5/23/2024, 8:35:52 AM Error: in file testmacro.g line 10: in file macro line 0: Expression nesting too deep
                5/23/2024, 8:35:52 AM Error: in file testmacro.g line 9: in file macro line 0: Expression nesting too deep

                undefined 1 Reply Last reply 23 May 2024, 12:30 Reply Quote 0
                • undefined
                  droftarts administrators @Tinchus
                  last edited by droftarts 23 May 2024, 12:30

                  @Tinchus Can you check what line it fails at in this macro? It's likely to be line 3:

                  var x0=1
                  var x1=max(max(max(var.x0,2),3),4)
                  var x2=max(max(max(max(var.x0,2),3),4),5)
                  var x3=max(max(max(max(max(var.x0,2),3),4),5),6)
                  var x4=max(max(max(max(max(max(var.x0,2),3),4),5),6),7)
                  var x5=max(max(max(max(max(max(max(var.x0,2),3),4),5),6),7),8)
                  var x6=max(max(max(max(max(max(max(max(var.x0,2),3),4),5),6),7),8),9)
                  echo var.x6

                  It looks like this is a bug in SBC mode, related to the same issue that was resolved in standalone mode before 3.5 was released, ie more stack space is required per function nesting level. SBC mode can cope with 4 nested levels, your variable mesh script uses 6. Stack memory in standalone mode was increased in 3.5.1 to support 7 nested levels. I think @chrishamm will increase the SBC stack space in the next release.

                  You will be able to get around this issue for now by editing the original macro to use less nesting. @gloomyandy rewrote it to replace lines 43 and 44 when fixing the problem in standalone mode, with:

                  var tempX = max(var.minMeshPoints - 1, (var.pamMaxX - var.pamMinX) / var.meshSpacing)
                  var tempY = max(var.minMeshPoints - 1, (var.pamMaxY - var.pamMinY) / var.meshSpacing)
                  var meshX = floor(min(var.maxMeshPoints - 1, (var.tempX + 1))) ; Get the number of probes for X taking minMeshPoints and maxMeshPoints into account
                  var meshY = floor(min(var.maxMeshPoints - 1, (var.tempY + 1))) ; Get the number of probes for Y taking minMeshPoints and maxMeshPoints into account

                  Ian

                  Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                  undefined 1 Reply Last reply 23 May 2024, 12:35 Reply Quote 0
                  • undefined
                    Tinchus @droftarts
                    last edited by 23 May 2024, 12:35

                    @droftarts sure, here is the result

                    /23/2024, 9:34:32 AM Error: in file testmacro.g line 8: in file macro line 0: unknown variable 'x6'
                    5/23/2024, 9:34:32 AM Error: in file testmacro.g line 7: in file macro line 0: Expression nesting too deep
                    5/23/2024, 9:34:32 AM Error: in file testmacro.g line 6: in file macro line 0: Expression nesting too deep
                    5/23/2024, 9:34:31 AM Error: in file testmacro.g line 5: in file macro line 0: Expression nesting too deep
                    5/23/2024, 9:34:31 AM Error: in file testmacro.g line 4: in file macro line 0: Expression nesting too deep
                    5/23/2024, 9:34:31 AM Error: in file testmacro.g line 3: in file macro line 0: Expression nesting too deep

                    1 Reply Last reply Reply Quote 1
                    3 out of 9
                    • First post
                      3/9
                      Last post
                    Unless otherwise noted, all forum content is licensed under CC-BY-SA