adafruit / Adafruit_IO_Arduino

Arduino library to access Adafruit IO from WiFi, cellular, and ethernet modules.
Other
208 stars 108 forks source link

AdafruitIO_Group: compare feed names case-insensitively #124

Closed phord closed 4 years ago

phord commented 4 years ago

Feeds are matched with a case-sensitive search when adding new feed data to a Group. This can cause different values to be published for the same feed in a single call to save() in a way that's not easy to see from the code.

Avoid the problem by matching feeds case-insensitively when searching for existing feeds in the Group data list.

Note: I added the new strcmp_nocase function inline in the AdafruitIO_Group.cpp module since I didn't see any clear place to put these kinds of utility functions in the library. I'm open to moving it, renaming, restructuring it or whatever. Perhaps a better option is to use the String::equalsIgnoreCase(), but constructing String temporaries for each comparison seemed excessive to me.

Fixes #123