"M569: expected numeric operand" error.
-
I'm trying to use the object model "move.axes[X].drivers[0]" can and driver address to use in M569.X commands to setup closed loop (1hcl) during a home without having to specifically put it in the can address into the home file. Essentially I search for the drive letter, and when I've found it I want to set a variable that has the address. Unfortunately there doesn't seem to be away to turn the string "51.0" in the object model into 51.0 (float?) in the m569.X commands. For instance.
var address = 51.0
M569.1 P{var.address} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
Will work fine.But below code gives a "M569: expected numeric operand" error.
var ind = 0
var driverAddress = 0.0while exists (move.axes[{var.ind}].letter) ;go through all axis in order till I find the correct one.
if move.axes[{var.ind}].letter == "'a"
set var.driverAddress = move.axes[{var.ind}].drivers[0]
set var.ind = var.ind +1;M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
-
@LindsayC which firmware version? SBC or standalone mode?
-
@dc42 @LindsayC I have recreated this issue in SBC and stand alone mode (3.6beta3 test build).
SBC mode:
var addr = move.axes[0].drivers[0]
then
echo var.addr
returns:
{object}
attempting to do anything numerical with that variable results in
Error: expected numeric operands
Stand alone:
var addr = move.axes[0].drivers[0]
then
echo var.addr
returns:
0.0
attempting to do anything numerical with that variable results in
Error: expected numeric operands
-
@T3P3Tony that's expected. A driver ID is not a number because it holds both the CAN address and the driver number at that address. However, it should be allowed as the P operand in a M569 command.
-
@dc42 Thanks I have tested that in Stand alone and SBC mode and confirm it works in standalone mode but not in SBC mode.
Stand alone:
M569 P{var.addr} Drive 0 runs forwards, active high enable, timing 4.0:4.0:1.3:1.3us, mode spreadCycle, ccr 0x08053, toff 3, tblank 1, thigh 200 (46.9 mm/sec), gs=32, iRun=0, iHold=0, current=25.391, hstart/hend/hdec 5/0/0, pos 8
SBC:
M569 P{var.addr} Error: M569: expected numeric operand
-
undefined T3P3Tony moved this topic from Gcode meta commands
-
The OP didn't respond to my request for the firmware version. A change was made to improve this area within the last few months, which is why I asked.
-
-
@LindsayC thanks. Please upgrade to either 3.5.4 or 3.6.0-beta.4 and test again.
-
Hi,
Upgraded to 3.6.0-rc.1.
And if I run this code:
var ind = 0 var driverAddress = 50.0 while exists (move.axes[{var.ind}].letter) if move.axes[{var.ind}].letter == "'a" set var.driverAddress = move.axes[{var.ind}].drivers[0] set var.ind = var.ind +1; M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
it fails with "Error: in file macro line 9 column 29: M569: expected numeric operand"
If I echo what the variable is. Ie this code:
var ind = 0 var driverAddress = 50.0 echo var.driverAddress while exists (move.axes[{var.ind}].letter) ;go through all axis in order till I find the correct one. if move.axes[{var.ind}].letter == "'a" set var.driverAddress = move.axes[{var.ind}].drivers[0] set var.ind = var.ind +1; echo var.driverAddress M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
I get this from the console:
50.0
51.0
Error: in file macro line 9 column 29: M569: expected numeric operandBut if I run it with just a hard set driverAddress like below.
var ind = 0 var driverAddress = 51.0 echo var.driverAddress M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
It works fine with no error.
Output from console:
51.0This is all on a duet3 in standalone mode.
-
Did a bit more digging into what the type is. If you run this code:
var ind = 0 var driverAddress = 50.0 echo var.driverAddress; echo var.driverAddress ^"1"; echo var.driverAddress * 2 while exists (move.axes[{var.ind}].letter) ;go through all axis in order till I find the correct one. if move.axes[{var.ind}].letter == "'a" set var.driverAddress = move.axes[{var.ind}].drivers[0] set var.ind = var.ind +1; echo var.driverAddress echo var.driverAddress ^"1"; echo var.driverAddress *2;
You get:
50.0
50.01
100.0
51.0
51.01
Error: in file macro line 14 column 26: meta command: expected numeric operandsSo the variable returned from the object model for the driver can address can be treated as a string but not as a float. While the original set address that does work for the P parameter can be treated as both a float and a string.
-
And finally if you run this code where you just pass a string to the P parameter.
var ind = 0 var driverAddress = "51.0" M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
You get this error message:
Error: in file macro line 3 column 27: M569: expected driver IDWhich is different to the error message you get if the variable is obtained from the object model.