Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    Echo output to file - expected expression

    Gcode meta commands
    2
    3
    58
    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.
    • thomas.weiss
      thomas.weiss last edited by

      Hey,

      I am trying to programmaticlly store a command in a macro file (from a macro file), but I'm having problems with both ways of achieving this:
      The goal is to write a G10 L20 Z{variable} into a macro file.

      Option A - M28

      var z_offset = move.axes[2].machinePosition * -1
      echo "G10 L20 Z"{var.z_offset}
      M30 "0:/macros/Experimental/apply_z_offset" ; First delete the old file
      M28 "0:/macros/Experimental/apply_z_offset" ; Create a new one
      G10 L20 Z{var.z_offset}
      M29
      

      The first echo outputs exactly what I want to be written into the apply_z_offset file: "G10 L20 Z5.000"
      The file itself now holds this line - it doesn't write the variables content:

      G10 L20 Z{var.z_offset}
      

      Option B - echo>
      I've seen people having similar problems that got solved by writing to the file via echo ><filename> <expression>

      var z_offset = move.axes[2].machinePosition * -1
      echo >"0:/macros/Experimental/apply_z_offset" "G10 L20 Z"^{var.z_offset}
      

      This gives me a "Error: meta command: expected an expression"

      I tried the echo to file alone in different variations, but I am still getting the same error:

      • echo >"0:/testfile.g" "Hello World"
      • echo >"0:/testfile.g" {"Hello World"}
      • echo >"0:/testfile.g" 1
      • echo >"0:/testfile.g" {move.axes[2].machinePosition}

      What am I doing wrong here? Any ideas?

      Firmware: RepRapFirmware for Duet 3 Mini 5+ 3.3RC2 (2021-05-11)
      
      jay_s_uk 1 Reply Last reply Reply Quote 0
      • jay_s_uk
        jay_s_uk @thomas.weiss last edited by

        @thomas-weiss i would update your firmware to 3.4RC2 and try again

        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

        1 Reply Last reply Reply Quote 0
        • thomas.weiss
          thomas.weiss last edited by

          @jay_s_uk I see - you are right. Echo to file was added in 3.4, an update should solve this. Thank you!

          Sadly, we'll need our prototype for a presentation in the upcoming days and I don't want to risk that a firmware update changes or breaks any functionality that we already implemented.

          Might have to go without this function for now.

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