Skip to content
Snippets Groups Projects
Commit b77d7815 authored by user2684's avatar user2684
Browse files

Cannot compile: default argument given for parameter #30

parent 4284e9fc
Branches
Tags
No related merge requests found
...@@ -19,7 +19,7 @@ const char* WAKEUP = "WAKEUP"; ...@@ -19,7 +19,7 @@ const char* WAKEUP = "WAKEUP";
*/ */
// set the vcc and ground pin the sensor is connected to // set the vcc and ground pin the sensor is connected to
void PowerManager::setPowerPins(int ground_pin, int vcc_pin, long wait = 10) { void PowerManager::setPowerPins(int ground_pin, int vcc_pin, long wait) {
#if DEBUG == 1 #if DEBUG == 1
Serial.print("POWER G="); Serial.print("POWER G=");
Serial.print(ground_pin); Serial.print(ground_pin);
...@@ -129,7 +129,7 @@ void Sensor::setFloatPrecision(int value) { ...@@ -129,7 +129,7 @@ void Sensor::setFloatPrecision(int value) {
_float_precision = value; _float_precision = value;
} }
#if POWER_MANAGER == 1 #if POWER_MANAGER == 1
void Sensor::setPowerPins(int ground_pin, int vcc_pin, long wait = 0) { void Sensor::setPowerPins(int ground_pin, int vcc_pin, long wait) {
_powerManager.setPowerPins(ground_pin, vcc_pin, wait); _powerManager.setPowerPins(ground_pin, vcc_pin, wait);
} }
void Sensor::setAutoPowerPins(bool value) { void Sensor::setAutoPowerPins(bool value) {
...@@ -928,7 +928,7 @@ void NodeManager::setRetries(int value) { ...@@ -928,7 +928,7 @@ void NodeManager::setRetries(int value) {
_sleep_interrupt_pin = value; _sleep_interrupt_pin = value;
} }
#endif #endif
void NodeManager::setInterrupt(int pin, int mode, int pull = -1) { void NodeManager::setInterrupt(int pin, int mode, int pull) {
if (pin == INTERRUPT_PIN_1) { if (pin == INTERRUPT_PIN_1) {
_interrupt_1_mode = mode; _interrupt_1_mode = mode;
_interrupt_1_pull = pull; _interrupt_1_pull = pull;
...@@ -939,7 +939,7 @@ void NodeManager::setInterrupt(int pin, int mode, int pull = -1) { ...@@ -939,7 +939,7 @@ void NodeManager::setInterrupt(int pin, int mode, int pull = -1) {
} }
} }
#if POWER_MANAGER == 1 #if POWER_MANAGER == 1
void NodeManager::setPowerPins(int ground_pin, int vcc_pin, long wait = 10) { void NodeManager::setPowerPins(int ground_pin, int vcc_pin, long wait) {
_powerManager.setPowerPins(ground_pin, vcc_pin, wait); _powerManager.setPowerPins(ground_pin, vcc_pin, wait);
} }
void NodeManager::setAutoPowerPins(bool value) { void NodeManager::setAutoPowerPins(bool value) {
...@@ -957,7 +957,7 @@ void NodeManager::setSleepBetweenSend(int value) { ...@@ -957,7 +957,7 @@ void NodeManager::setSleepBetweenSend(int value) {
} }
// register a sensor to this manager // register a sensor to this manager
int NodeManager::registerSensor(int sensor_type, int pin = -1, int child_id = -1) { int NodeManager::registerSensor(int sensor_type, int pin, int child_id) {
#if DEBUG == 1 #if DEBUG == 1
if (_startup) { if (_startup) {
Serial.print("NodeManager v"); Serial.print("NodeManager v");
...@@ -968,7 +968,7 @@ int NodeManager::registerSensor(int sensor_type, int pin = -1, int child_id = -1 ...@@ -968,7 +968,7 @@ int NodeManager::registerSensor(int sensor_type, int pin = -1, int child_id = -1
// get a child_id if not provided by the user // get a child_id if not provided by the user
if (child_id < 0) child_id = _getAvailableChildId(); if (child_id < 0) child_id = _getAvailableChildId();
// based on the given sensor type instantiate the appropriate class // based on the given sensor type instantiate the appropriate class
if (sensor_type == 0) return; if (sensor_type == 0) return -1;
#if MODULE_ANALOG_INPUT == 1 #if MODULE_ANALOG_INPUT == 1
else if (sensor_type == SENSOR_ANALOG_INPUT) return registerSensor(new SensorAnalogInput(child_id, pin)); else if (sensor_type == SENSOR_ANALOG_INPUT) return registerSensor(new SensorAnalogInput(child_id, pin));
else if (sensor_type == SENSOR_LDR) return registerSensor(new SensorLDR(child_id, pin)); else if (sensor_type == SENSOR_LDR) return registerSensor(new SensorLDR(child_id, pin));
...@@ -988,19 +988,19 @@ int NodeManager::registerSensor(int sensor_type, int pin = -1, int child_id = -1 ...@@ -988,19 +988,19 @@ int NodeManager::registerSensor(int sensor_type, int pin = -1, int child_id = -1
int dht_type = sensor_type == SENSOR_DHT11 ? DHT11 : DHT22; int dht_type = sensor_type == SENSOR_DHT11 ? DHT11 : DHT22;
registerSensor(new SensorDHT(child_id,pin,dht,0,dht_type)); registerSensor(new SensorDHT(child_id,pin,dht,0,dht_type));
child_id = _getAvailableChildId(); child_id = _getAvailableChildId();
registerSensor(new SensorDHT(child_id,pin,dht,1,dht_type)); return registerSensor(new SensorDHT(child_id,pin,dht,1,dht_type));
} }
#endif #endif
#if MODULE_SHT21 == 1 #if MODULE_SHT21 == 1
else if (sensor_type == SENSOR_SHT21) { else if (sensor_type == SENSOR_SHT21) {
registerSensor(new SensorSHT21(child_id,0)); registerSensor(new SensorSHT21(child_id,0));
child_id = _getAvailableChildId(); child_id = _getAvailableChildId();
registerSensor(new SensorSHT21(child_id,1)); return registerSensor(new SensorSHT21(child_id,1));
} }
else if (sensor_type == SENSOR_HTU21D) { else if (sensor_type == SENSOR_HTU21D) {
registerSensor(new SensorHTU21D(child_id,0)); registerSensor(new SensorHTU21D(child_id,0));
child_id = _getAvailableChildId(); child_id = _getAvailableChildId();
registerSensor(new SensorHTU21D(child_id,1)); return registerSensor(new SensorHTU21D(child_id,1));
} }
#endif #endif
#if MODULE_SWITCH == 1 #if MODULE_SWITCH == 1
...@@ -1024,11 +1024,13 @@ int NodeManager::registerSensor(int sensor_type, int pin = -1, int child_id = -1 ...@@ -1024,11 +1024,13 @@ int NodeManager::registerSensor(int sensor_type, int pin = -1, int child_id = -1
DallasTemperature* sensors = new DallasTemperature(oneWire); DallasTemperature* sensors = new DallasTemperature(oneWire);
// initialize the sensors // initialize the sensors
sensors->begin(); sensors->begin();
int index = 0;
// register a new child for each sensor on the bus // register a new child for each sensor on the bus
for(int i = 0; i < sensors->getDeviceCount(); i++) { for(int i = 0; i < sensors->getDeviceCount(); i++) {
if (i > 0) child_id = _getAvailableChildId(); if (i > 0) child_id = _getAvailableChildId();
registerSensor(new SensorDs18b20(child_id,pin,sensors,i)); index = registerSensor(new SensorDs18b20(child_id,pin,sensors,i));
} }
return index;
} }
#endif #endif
#if MODULE_BH1750 == 1 #if MODULE_BH1750 == 1
...@@ -1044,7 +1046,7 @@ int NodeManager::registerSensor(int sensor_type, int pin = -1, int child_id = -1 ...@@ -1044,7 +1046,7 @@ int NodeManager::registerSensor(int sensor_type, int pin = -1, int child_id = -1
registerSensor(new SensorMLX90614(child_id,mlx,0)); registerSensor(new SensorMLX90614(child_id,mlx,0));
Serial.println("3"); Serial.println("3");
child_id = _getAvailableChildId(); child_id = _getAvailableChildId();
registerSensor(new SensorMLX90614(child_id,mlx,1)); return registerSensor(new SensorMLX90614(child_id,mlx,1));
} }
#endif #endif
else { else {
......
...@@ -230,7 +230,7 @@ class PowerManager { ...@@ -230,7 +230,7 @@ class PowerManager {
public: public:
PowerManager() {}; PowerManager() {};
// to save battery the sensor can be optionally connected to two pins which will act as vcc and ground and activated on demand // to save battery the sensor can be optionally connected to two pins which will act as vcc and ground and activated on demand
void setPowerPins(int ground_pin, int vcc_pin, long wait = 10); void setPowerPins(int ground_pin, int vcc_pin, long wait = 50);
void powerOn(); void powerOn();
void powerOff(); void powerOff();
private: private:
...@@ -277,7 +277,7 @@ class Sensor { ...@@ -277,7 +277,7 @@ class Sensor {
void setSleepBetweenSend(int value); void setSleepBetweenSend(int value);
#if POWER_MANAGER == 1 #if POWER_MANAGER == 1
// to save battery the sensor can be optionally connected to two pins which will act as vcc and ground and activated on demand // to save battery the sensor can be optionally connected to two pins which will act as vcc and ground and activated on demand
void setPowerPins(int ground_pin, int vcc_pin, long wait = 0); void setPowerPins(int ground_pin, int vcc_pin, long wait = 50);
// if enabled the pins will be automatically powered on while awake and off during sleeping (default: true) // if enabled the pins will be automatically powered on while awake and off during sleeping (default: true)
void setAutoPowerPins(bool value); void setAutoPowerPins(bool value);
// manually turn the power on // manually turn the power on
...@@ -614,7 +614,7 @@ class NodeManager { ...@@ -614,7 +614,7 @@ class NodeManager {
Sensor* get(int sensor_index); Sensor* get(int sensor_index);
#if POWER_MANAGER == 1 #if POWER_MANAGER == 1
// to save battery the sensor can be optionally connected to two pins which will act as vcc and ground and activated on demand // to save battery the sensor can be optionally connected to two pins which will act as vcc and ground and activated on demand
void setPowerPins(int ground_pin, int vcc_pin, long wait = 10); void setPowerPins(int ground_pin, int vcc_pin, long wait = 50);
// if enabled the pins will be automatically powered on while awake and off during sleeping (default: true) // if enabled the pins will be automatically powered on while awake and off during sleeping (default: true)
void setAutoPowerPins(bool value); void setAutoPowerPins(bool value);
// manually turn the power on // manually turn the power on
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment