Echo output to file - expected expression
-
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)
-
@thomas-weiss i would update your firmware to 3.4RC2 and try again
-
@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.