Skip to content

Commit

Permalink
fix some compile errors. (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcayi authored Jun 28, 2020
1 parent 49de1e2 commit d692bc9
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 13 deletions.
7 changes: 7 additions & 0 deletions MySensors_NodeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
// include NodeManager's constants
#include "nodemanager/Constants.h"

/***********************************
Platform dependent variation
*/
#if defined(CHIP_STM32)
#define isnan std::isnan
#endif

/***********************************
Include required third-party libraries
*/
Expand Down
2 changes: 1 addition & 1 deletion nodemanager/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum status {
};

//define Timer mode
enum timer_mode {
enum nm_timer_mode {
NOT_CONFIGURED,
TIME_INTERVAL,
IMMEDIATELY,
Expand Down
4 changes: 2 additions & 2 deletions nodemanager/InternalTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ InternalTimer::InternalTimer() {
}

// set the timer mode
void InternalTimer::setMode(timer_mode mode) {
void InternalTimer::setMode(nm_timer_mode mode) {
_mode = mode;
}

// get the timer mode
timer_mode InternalTimer::getMode() {
nm_timer_mode InternalTimer::getMode() {
return _mode;
}

Expand Down
6 changes: 3 additions & 3 deletions nodemanager/InternalTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class NodeManager;
class InternalTimer {
public:
InternalTimer();
void setMode(timer_mode mode);
timer_mode getMode();
void setMode(nm_timer_mode mode);
nm_timer_mode getMode();
void setValue(unsigned long value);
unsigned long getValue();
// start the timer
Expand All @@ -41,7 +41,7 @@ class InternalTimer {
// return true if the time is over
bool isOver();
private:
timer_mode _mode = NOT_CONFIGURED;
nm_timer_mode _mode = NOT_CONFIGURED;
unsigned long _value = 0; // s
unsigned long _target = 0; // ms
bool _is_running = false;
Expand Down
2 changes: 2 additions & 0 deletions nodemanager/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,10 @@ void NodeManager::loop() {
}
#endif
}
#if NODEMANAGER_INTERRUPTS == ON
// reset the last interrupt pin
_last_interrupt_pin = -1;
#endif
#if NODEMANAGER_POWER_MANAGER == ON
// turn off the pin powering all the sensors
powerOff();
Expand Down
4 changes: 2 additions & 2 deletions nodemanager/Sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ void Sensor::setInterruptStrict(bool value) {
}
#endif

void Sensor::setReportTimerMode(timer_mode value) {
void Sensor::setReportTimerMode(nm_timer_mode value) {
_report_timer->setMode(value);
}
void Sensor::setReportTimerValue(unsigned long value) {
_report_timer->setValue(value);
}
void Sensor::setMeasureTimerMode(timer_mode value) {
void Sensor::setMeasureTimerMode(nm_timer_mode value) {
_measure_timer->setMode(value);
}
void Sensor::setMeasureTimerValue(unsigned long value) {
Expand Down
4 changes: 2 additions & 2 deletions nodemanager/Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ class Sensor {
// [20] After how many days the sensor will report back its measure (default: 10 minutes)
void setReportIntervalDays(uint8_t value);
// [24] Set the way the timer used for reporting to the gateway should operate. It can be either TIME_INTERVAL (e.g. report every X seconds with the amount of time set with setReportTimerValue()), IMMEDIATELY (e.g. report at every cycle, useful for sensors like actuators which should report as soon as the value has changed), DO_NOT_REPORT (e.g. never report, useful for when there is no need to report, like a Display) and when NODEMANAGER_TIME is ON, EVERY_MINUTE/EVERY_HOUR/EVERY_DAY (e.g. to report the value set in the previous timeframe, useful for sensors reporting an accumulated value linked to a timeframe at regular intervals), AT_MINUTE/AT_HOUR/AT_DAY (e.g. report at a given minute/hour/day, useful if the measure is expected at a specified time, set with setReportTimerValue())
void setReportTimerMode(timer_mode value);
void setReportTimerMode(nm_timer_mode value);
// [25] Set the value for the reporting timer's mode which has been set with setReportTimerMode()
void setReportTimerValue(unsigned long value);
// [26] Set the way the timer used for taking measures should operate. Takes the same parameters as setReportTimerMode(). If not set explicitly, will be set as the reporting timer
void setMeasureTimerMode(timer_mode value);
void setMeasureTimerMode(nm_timer_mode value);
// [27] Set the value for the reporting timer's mode which has been set with setReportTimerMode() If not set explicitely, will be set with the same value as the reporting timer
void setMeasureTimerValue(unsigned long value);
// return true if it is the first execution of loop on this sensor
Expand Down
4 changes: 2 additions & 2 deletions sensors/SensorConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ class SensorConfiguration: public Sensor {
case 13: sensor->powerOn(); break;
case 14: sensor->powerOff(); break;
#endif
case 24: sensor->setReportTimerMode((timer_mode)request.getValueInt()); break;
case 24: sensor->setReportTimerMode((nm_timer_mode)request.getValueInt()); break;
case 25: sensor->setReportTimerValue(request.getValueInt()); break;
case 26: sensor->setMeasureTimerMode((timer_mode)request.getValueInt()); break;
case 26: sensor->setMeasureTimerMode((nm_timer_mode)request.getValueInt()); break;
case 27: sensor->setMeasureTimerValue(request.getValueInt()); break;
case 16: sensor->setReportIntervalMinutes(request.getValueInt()); break;
case 17: sensor->setReportIntervalSeconds(request.getValueInt()); break;
Expand Down
2 changes: 1 addition & 1 deletion sensors/SensorDHT.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SensorDHT: public Sensor {
// define what to do during setup
void onLoop(Child* child) {
nodeManager.sleepOrWait(_dht->getMinimumSamplingPeriod()+100);
_dht->readSensor(true);
// _dht->readSensor(true);
// temperature sensor
if (child->getType() == V_TEMP) {
// read the temperature
Expand Down

0 comments on commit d692bc9

Please sign in to comment.