M261.2: UART read output findings
-
Just an Fyi re the new M260.2/M261.2 commands in RRF 3.6. I was stuck for a couple days trying to leverage the 6HC Aux comm port to get/set parameters of a foc motor and report them back to Openpnp via the Main comm port.
Im sending/receiving data on the Aux port as;
M260.2 P1 B{0x52, 0x5A, 0x0D} G4 10 M261.2 P1 B6
The expected Rx data on the Main port is simply a byte array;
{0x5a, 0x65, 0x72, 0x6f,0x3a, 0x5a}
M261.2 indeed reports the data to the Main comm port, but is prepended with" Received (hex) " and the rx bytes are space seperated; ' ' ;
2024-11-25 22:38:29.200 GcodeDriver$ReaderThread TRACE: [GcodeAsyncDriver:COM13] << Received (hex) 5a 65 72 6f 3a 5a
This needs to be understood, but not explicitly stared in M261.2 if anyone is planning to parse the rx data as one would using regex. For my application the regex
^.*( [0-9a-f]{2}){5} (?<Value>[0-9a-f]{2})
Groups the correct Value for me.
Any rate the new commands work great now that I understand the output.
-
@wayneosdias one for @droftarts to document
-
@wayneosdias we don't guarantee that the response format will never change. If you need to feed the result back to another program then you should use the V parameter to save the response into a variable, then use M118 or an echo command to format it as you wish.