Unfortunately, no one answered me. I tried to solve this problem myself. It seemed to me a good option would be to return data from the gcode to a buffer local variable, the name of which should be reported to the gcode through an additional string parameter of the gcode. For example:
var i2cReadBuffer = vector(10, 0)
M260 A80 B0 R10 S"i2cReadBuffer"
echo "buffer:", var.i2cReadBuffer
I changed the procedure of M260 gcode. If S parameter is missing, the behavior remains unchanged. If S parameter is set and there are no errors, the behavior is the same plus the received data is stored in a buffer variable. If an error is found, the result of the gcode is changed to ERROR and the reason is reported in the reply. Possible reasons -
- variable not found
- does not match the type of the variable (an array of integers)
- insufficient array length
It works at first glance. I've done a few checks with BMP280 and eeprom 24c04:
I plan to make a post in Firmware developers branch. I think this topic deserves discussion. Otherwise M260 gcode remains near useless in meta gcode.