Skip to content

Commit

Permalink
Fix C++ warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Roger committed Apr 17, 2016
1 parent 4a6aaa2 commit 8c57478
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/DoorSensor/DoorSensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const int PIN_DOOR = 16;

Bounce debouncer = Bounce(); // Bounce is built into Homie, so you can use it without including it first
unsigned long lastDoorValue = -1;
int lastDoorValue = -1;

HomieNode doorNode("door", "door");

Expand Down
8 changes: 6 additions & 2 deletions src/Homie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ HomieClass::HomieClass() : _setup(false) {

Helpers::generateDeviceId();

Blinker.attachInterface(&this->_interface);

this->_bootNormal.attachInterface(&this->_interface);
this->_bootOta.attachInterface(&this->_interface);
this->_bootConfig.attachInterface(&this->_interface);
Expand All @@ -43,6 +41,8 @@ void HomieClass::_checkBeforeSetup(const __FlashStringHelper* functionName) {
}

void HomieClass::setup() {
Blinker.attachInterface(&this->_interface); // here otherwise in constructor this crashes because Blinker might not be constructed

if (Logger.isEnabled()) {
Serial.begin(BAUD_RATE);
Logger.logln();
Expand All @@ -67,6 +67,10 @@ void HomieClass::setup() {
Logger.logln(F("Triggering HOMIE_OTA_MODE event..."));
this->_interface.eventHandler(HOMIE_OTA_MODE);
break;
default:
Logger.logln(F("✖ The boot mode is invalid"));
abort();
break;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/Homie.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "Homie/Blinker.hpp"
#include "Homie/Logger.hpp"
#include "Homie/Config.hpp"
#include "Homie/Constants.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/Homie/Blinker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using namespace HomieInternals;

BlinkerClass::BlinkerClass()
: _lastBlinkPace(0)
// , _interface() <-- causes exception???
: _interface(nullptr)
, _lastBlinkPace(0)
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/Homie/Boot/Boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using namespace HomieInternals;

Boot::Boot(const char* name)
: _name(name)
, _interface()
: _interface(nullptr)
, _name(name)
{
}

Expand Down

0 comments on commit 8c57478

Please sign in to comment.