bug in I2C_Anything.zip

Posted by Brian J. Murrell on Fri 26 Jan 2018 05:42 PM — 5 posts, 27,305 views.

#0
Hi. I was most interested in your I2C_Anything implementation.

There does seem to be a meaningful discrepancy between what you wrote in your forum post at http://www.gammon.com.au/forum/?id=10896&reply=8#reply8 and what is in the library download you provide at the bottom of that post.

In the post, I2C_writeAnything() writes using:


Wire.write((byte *) &value, sizeof (value));


and in the library it writes using:


for (i = 0; i < sizeof value; i++)
      Wire.write(*p++);


Of course, you cannot use Wire.write() more than once in an
Wire.onRequest() event handler. The post reflects that but the library download needs updating to reflect that particularly since the download is likely what a significant number of people are going to use to get your templates.

Great work on those. Really happy to see your PR to the official project to get them included as part of the official Wire library.
Amended on Fri 26 Jan 2018 05:54 PM by Brian J. Murrell
Australia Forum Administrator #1
I've pushed the library to Github:


https://github.com/nickgammon/I2C_Anything

I suggest you open an issue there.
#2
Ahh. Great. I looked for the library there before posting here but saw that it was not on your GitHub account.

And I see that you've already fixed the problem there but not in the copy that's at the link that is in the Forum post:

http://www.gammon.com.au/forum/?id=10896&reply=8#reply8

which is still going to lead people to installing a broken version of the library.
Australia Forum Administrator #3
Brian Murrell said:

There does seem to be a meaningful discrepancy between what you wrote in your forum post at http://www.gammon.com.au/forum/?id=10896&reply=8#reply8 and what is in the library download you provide at the bottom of that post.


Ah I see what you mean. The post was correct but the download was wrong. I've changed the download link to be the GitHub page which was the correct code (you can see the history in the commit history).
Australia Forum Administrator #4
Thanks for the heads-up. :)