Commit ce0b430f authored by user2684's avatar user2684
Browse files

Added sleep_between_send also during presentation when configured

parent 702a05c7
......@@ -279,7 +279,7 @@ void Sensor::_send(MyMessage & message) {
// send the message, multiple times if requested
for (int i = 0; i < _retries; i++) {
// if configured, sleep beetween each send
if (_sleep_between_send > 0) wait(_sleep_between_send);
if (_sleep_between_send > 0) sleep(_sleep_between_send);
#if DEBUG == 1
Serial.print(F("SEND D="));
Serial.print(message.destination);
......@@ -2003,13 +2003,11 @@ void NodeManager::before() {
pinMode(_reboot_pin, OUTPUT);
digitalWrite(_reboot_pin, HIGH);
}
#if SLEEP_MANAGER == 1
// setup the sleep interrupt pin
if (_sleep_interrupt_pin > -1) {
// set the interrupt when the pin is connected to ground
setInterrupt(_sleep_interrupt_pin,FALLING,HIGH);
}
#endif
// setup the interrupt pins
if (_interrupt_1_mode != MODE_NOT_DEFINED) {
pinMode(INTERRUPT_PIN_1,INPUT);
......@@ -2064,6 +2062,7 @@ void NodeManager::presentation() {
Serial.println(F("RADIO OK"));
#endif
// Send the sketch version information to the gateway and Controller
if (_sleep_between_send > 0) sleep(_sleep_between_send);
sendSketchInfo(SKETCH_NAME,SKETCH_VERSION);
// present the service as a custom sensor to the controller
_present(CONFIGURATION_CHILD_ID, S_CUSTOM);
......@@ -2077,6 +2076,7 @@ void NodeManager::presentation() {
for (int i = 0; i < 255; i++) {
if (_sensors[i] == 0) continue;
// call each sensor's presentation()
if (_sleep_between_send > 0) sleep(_sleep_between_send);
_sensors[i]->presentation();
}
#if DEBUG == 1
......@@ -2197,7 +2197,7 @@ void NodeManager::_send(MyMessage & message) {
// send the message, multiple times if requested
for (int i = 0; i < _retries; i++) {
// if configured, sleep beetween each send
if (_sleep_between_send > 0) wait(_sleep_between_send);
if (_sleep_between_send > 0) sleep(_sleep_between_send);
#if DEBUG == 1
Serial.print(F("SEND D="));
Serial.print(message.destination);
......@@ -2422,10 +2422,8 @@ void NodeManager::_sleep() {
Serial.print(F(", M="));
Serial.println(interrupt_mode);
#endif
#if SLEEP_MANAGER == 1
// when waking up from an interrupt on the wakup pin, stop sleeping
if (_sleep_interrupt_pin == pin_number) _sleep_mode = IDLE;
#endif
}
}
// coming out of sleep
......@@ -2456,6 +2454,7 @@ void NodeManager::_present(int child_id, int type) {
Serial.print(F(", T="));
Serial.println(type);
#endif
if (_sleep_between_send > 0) sleep(_sleep_between_send);
present(child_id,type,"",_ack);
}
......
......@@ -99,7 +99,7 @@
#define PERSIST 0
// if enabled, send a SLEEPING and AWAKE service messages just before entering and just after leaving a sleep cycle and STARTED when starting/rebooting
#define SERVICE_MESSAGES 0
#define SERVICE_MESSAGES 1
// if enabled, a battery sensor will be created at BATTERY_CHILD_ID and will report vcc voltage together with the battery level percentage
#define BATTERY_SENSOR 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment