Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix M260 not being able to return received data to calling macro #604

Open
wants to merge 1 commit into
base: 3.5-dev
Choose a base branch
from

Conversation

ArkadyYudakov
Copy link

@ArkadyYudakov ArkadyYudakov commented Mar 23, 2023

In gcode M260 (i2c exchange) a parameter was added to specify the name
of local variable in which received bytes will be stored. This fixes the
disadvantage of not being able to return data received over the bus to
the macro that invokes the M260 gcode command. Letter "V" is recommended for additional axis, so I chose the universal "S" for the name parameter. If variable name parameter is missing, the behavior remains unchanged. If variable name parameter is set, data is received and there are no errors, received data is stored in specified 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:

  • total transfer length exceeds MaxI2cBytes
  • variable not found
  • wrong type of variable (requires an array of integers)
  • insufficient array length

The test was performed on a Duet 2 WiFi board in connection with i2c sensor BME280 and eeprom m24c04.

In gcode M260 (i2c exchange) a parameter was added to specify the name
of local variable in which received bytes will be stored. This fixes the
disadvantage of not being able to return data received over the bus to
the macro that invokes the gcode command.
@dc42
Copy link
Collaborator

dc42 commented Aug 11, 2023

I was looking to merge your changes in. However it might be better to add a new readi2c function instead, similar to the new fileread function, see https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands#functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants