Skip to content

Commit

Permalink
Merge pull request #115 from brentru/fix-groups
Browse files Browse the repository at this point in the history
Fix ESP32 Groups Crash
  • Loading branch information
brentru authored Apr 21, 2020
2 parents e2b69fd + fe89b5b commit ce83ba9
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
17 changes: 17 additions & 0 deletions examples/adafruitio_11_group_pub/adafruitio_11_group_pub.ino
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ void setup() {
Serial.print("Connecting to Adafruit IO");
io.connect();

group->onMessage("count-1", one);
group->onMessage("count-2", two);

// wait for a connection
while(io.status() < AIO_CONNECTED) {
Serial.print(".");
Expand Down Expand Up @@ -74,3 +77,17 @@ void loop() {
// wait four seconds (1000 milliseconds == 1 second)
delay(4000);
}

// this function is called whenever a 'counter-1' message
// is received from Adafruit IO. it was attached to
// the counter-1 feed in the setup() function above.
void one(AdafruitIO_Data *data) {
// do nothing!
}

// this function is called whenever a 'counter-2' message
// is received from Adafruit IO. it was attached to
// the counter-2 feed in the setup() function above.
void two(AdafruitIO_Data *data) {
// do nothing!
}
4 changes: 2 additions & 2 deletions examples/adafruitio_12_group_sub/adafruitio_12_group_sub.ino
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ void setup() {
Serial.print("Connecting to Adafruit IO");
io.connect();

group->onMessage("example.count-1", one);
group->onMessage("example.count-2", two);
group->onMessage("count-1", one);
group->onMessage("count-2", two);

// wait for a connection
while(io.status() < AIO_CONNECTED) {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit IO Arduino
version=3.4.0
version=3.5.0
author=Adafruit
maintainer=Adafruit <adafruitio@adafruit.com>
sentence=Arduino library to access Adafruit IO.
Expand Down
2 changes: 1 addition & 1 deletion src/AdafruitIO_Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define ADAFRUITIO_DEFINITIONS_H_

#define ADAFRUITIO_VERSION_MAJOR 3 ///< Adafruit IO Arduino Major Semvar
#define ADAFRUITIO_VERSION_MINOR 2 ///< Adafruit IO Arduino Minor Semvar
#define ADAFRUITIO_VERSION_MINOR 5 ///< Adafruit IO Arduino Minor Semvar
#define ADAFRUITIO_VERSION_PATCH 0 ///< Adafruit IO Arduino Patch Semvar

// forward declaration
Expand Down
6 changes: 3 additions & 3 deletions src/AdafruitIO_Group.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ class AdafruitIO_Group : public AdafruitIO_MQTT {
Adafruit_MQTT_Publish *_get_pub; /*!< MQTT publish to _get_topic. */

AdafruitIO *_io; /*!< An instance of AdafruitIO. */
AdafruitIOGroupCallback
*_groupCallback; /*!< An instance of AdafruitIOGroupCallback */
AdafruitIOGroupCallback *_groupCallback =
NULL; /*!< An instance of AdafruitIOGroupCallback */

double _lat, _lon, _ele; /*!< latitude, longitude, elevation metadata. */
};

#endif // ADAFRUITIO_GROUP_H
#endif // ADAFRUITIO_GROUP_H

0 comments on commit ce83ba9

Please sign in to comment.