ExtSens minimize workcycle
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#define MY_DEFAULT_ERR_LED_PIN (4) // Error led pin
|
#define MY_DEFAULT_ERR_LED_PIN (4) // Error led pin
|
||||||
#define MY_DEFAULT_RX_LED_PIN (5) // Receive led pin
|
#define MY_DEFAULT_RX_LED_PIN (5) // Receive led pin
|
||||||
#define MY_DEFAULT_TX_LED_PIN (6) // the PCB, on board LED
|
#define MY_DEFAULT_TX_LED_PIN (6) // the PCB, on board LED
|
||||||
|
#define MY_DEFAULT_LED_BLINK_PERIOD 5
|
||||||
#include <MySensors.h>
|
#include <MySensors.h>
|
||||||
#include <AHT10.h>
|
#include <AHT10.h>
|
||||||
|
|
||||||
@@ -86,8 +87,14 @@ void sendData(MyMessage msg, bool status)
|
|||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
while(send_data == false){
|
while(send_data == false){
|
||||||
count++;
|
count++;
|
||||||
|
Serial.print(millis());
|
||||||
|
Serial.println(" send before");
|
||||||
send_data = send(msg.set(status));
|
send_data = send(msg.set(status));
|
||||||
|
Serial.print(millis());
|
||||||
|
Serial.println(" send after");
|
||||||
wait(1000, C_SET, msg.type);
|
wait(1000, C_SET, msg.type);
|
||||||
|
Serial.print(millis());
|
||||||
|
Serial.println(" wait comlete");
|
||||||
if ((count == 3 )&&(send_data == 0)){ // Если сделано 3 попытки и нет подтверждения отправки
|
if ((count == 3 )&&(send_data == 0)){ // Если сделано 3 попытки и нет подтверждения отправки
|
||||||
count = 0; // Обнуляем счётчик
|
count = 0; // Обнуляем счётчик
|
||||||
send_data = 1; // Выходим из цикла
|
send_data = 1; // Выходим из цикла
|
||||||
@@ -100,8 +107,16 @@ void sendData(MyMessage msg, float status, uint8_t decm)
|
|||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
while(send_data == false){
|
while(send_data == false){
|
||||||
count++;
|
count++;
|
||||||
|
Serial.print(millis());
|
||||||
|
Serial.println(" send before");
|
||||||
send_data = send(msg.set(status, decm));
|
send_data = send(msg.set(status, decm));
|
||||||
wait(1000, C_SET, msg.type);
|
Serial.print(millis());
|
||||||
|
Serial.println(" send after");
|
||||||
|
if(!send_data){
|
||||||
|
wait(50, C_SET, msg.type);
|
||||||
|
Serial.print(millis());
|
||||||
|
Serial.println(" wait comlete");
|
||||||
|
}
|
||||||
if ((count == 3 )&&(send_data == 0)){ // Если сделано 3 попытки и нет подтверждения отправки
|
if ((count == 3 )&&(send_data == 0)){ // Если сделано 3 попытки и нет подтверждения отправки
|
||||||
count = 0; // Обнуляем счётчик
|
count = 0; // Обнуляем счётчик
|
||||||
send_data = 1; // Выходим из цикла
|
send_data = 1; // Выходим из цикла
|
||||||
@@ -115,7 +130,7 @@ void sendData(MyMessage msg, int status)
|
|||||||
while(send_data == false){
|
while(send_data == false){
|
||||||
count++;
|
count++;
|
||||||
send_data = send(msg.set(status));
|
send_data = send(msg.set(status));
|
||||||
wait(1000, C_SET, msg.type);
|
wait(50, C_SET, msg.type);
|
||||||
if ((count == 3 )&&(send_data == 0)){ // Если сделано 3 попытки и нет подтверждения отправки
|
if ((count == 3 )&&(send_data == 0)){ // Если сделано 3 попытки и нет подтверждения отправки
|
||||||
count = 0; // Обнуляем счётчик
|
count = 0; // Обнуляем счётчик
|
||||||
send_data = 1; // Выходим из цикла
|
send_data = 1; // Выходим из цикла
|
||||||
@@ -130,7 +145,11 @@ void sendData(MyMessage msg, uint32_t status)
|
|||||||
while(send_data == false){
|
while(send_data == false){
|
||||||
count++;
|
count++;
|
||||||
send_data = send(msg.set(status));
|
send_data = send(msg.set(status));
|
||||||
wait(1000, C_SET, msg.type);
|
if(!send_data){
|
||||||
|
wait(50, C_SET, msg.type);
|
||||||
|
Serial.print(millis());
|
||||||
|
Serial.println(" wait comlete");
|
||||||
|
}
|
||||||
if ((count == 3 )&&(send_data == 0)){ // Если сделано 3 попытки и нет подтверждения отправки
|
if ((count == 3 )&&(send_data == 0)){ // Если сделано 3 попытки и нет подтверждения отправки
|
||||||
count = 0; // Обнуляем счётчик
|
count = 0; // Обнуляем счётчик
|
||||||
send_data = 1; // Выходим из цикла
|
send_data = 1; // Выходим из цикла
|
||||||
|
|||||||
Reference in New Issue
Block a user