Skip to content

Commit

Permalink
Merge pull request #358 from brentru/register-components-first
Browse files Browse the repository at this point in the history
Initialize component classes first and rebuild with Adafruit MQTT v2.5.0
  • Loading branch information
brentru authored Nov 2, 2022
2 parents e2a8c65 + f356e59 commit 0f7d5fb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit WipperSnapper
version=1.0.0-beta.53
version=1.0.0-beta.54
author=Adafruit
maintainer=Adafruit <[email protected]>
sentence=Arduino client for Adafruit.io WipperSnapper
Expand Down
32 changes: 16 additions & 16 deletions src/Wippersnapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1874,6 +1874,22 @@ void Wippersnapper::connect() {
_status = WS_IDLE;
WS._boardStatus = WS_BOARD_DEF_IDLE;

// Initialize components and buses
WS_DEBUG_PRINTLN("Initializing component instances...");
#ifdef ARDUINO_ARCH_ESP32
WS_DEBUG_PRINT("LEDC: ");
WS._ledc = new ws_ledc();
WS_DEBUG_PRINTLN("OK!");
#endif

WS_DEBUG_PRINT("SERVO: ");
WS._servoComponent = new ws_servo();
WS_DEBUG_PRINTLN("OK!");

WS_DEBUG_PRINT("DS18x20: ");
WS._ds18x20Component = new ws_ds18x20();
WS_DEBUG_PRINTLN("OK!");

if (!validateAppCreds())
haltError("Unable to validate application credentials.");

Expand Down Expand Up @@ -1915,22 +1931,6 @@ void Wippersnapper::connect() {
publishPinConfigComplete();
WS_DEBUG_PRINTLN("Hardware configured successfully!");

// Register components
WS_DEBUG_PRINTLN("Initializing component instances...");
#ifdef ARDUINO_ARCH_ESP32
WS_DEBUG_PRINT("LEDC: ");
WS._ledc = new ws_ledc();
WS_DEBUG_PRINTLN("OK!");
#endif

WS_DEBUG_PRINT("SERVO: ");
WS._servoComponent = new ws_servo();
WS_DEBUG_PRINTLN("OK!");

WS_DEBUG_PRINT("DS18x20: ");
WS._ds18x20Component = new ws_ds18x20();
WS_DEBUG_PRINTLN("OK!");

// goto application
statusLEDFade(GREEN, 3);
WS_DEBUG_PRINTLN(
Expand Down
2 changes: 1 addition & 1 deletion src/Wippersnapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
#endif

#define WS_VERSION \
"1.0.0-beta.53" ///< WipperSnapper app. version (semver-formatted)
"1.0.0-beta.54" ///< WipperSnapper app. version (semver-formatted)

// Reserved Adafruit IO MQTT topics
#define TOPIC_IO_THROTTLE "/throttle" ///< Adafruit IO Throttle MQTT Topic
Expand Down

0 comments on commit 0f7d5fb

Please sign in to comment.