diff --git a/RollerShutterNode/FW/MyRollershutter/MyNodeDefinition.h b/RollerShutterNode/FW/MyRollershutter/MyNodeDefinition.h index 462d9e8..ddf015e 100644 --- a/RollerShutterNode/FW/MyRollershutter/MyNodeDefinition.h +++ b/RollerShutterNode/FW/MyRollershutter/MyNodeDefinition.h @@ -24,6 +24,8 @@ #define MY_RFM69_ATC_LEVEL 70 // Uncomment and set RSSI target for ATC mode. Not mandatory for GW //#define MY_RFM69_LISTENMODE // Uncomment to enable ListenMode (RX duty cycle communication for sleeping node) +// set timeout for transport init (if gateway is down) +#define MY_TRANSPORT_WAIT_READY_MS 30000 //#define MY_NODE_LOCK_FEATURE //!< Enable lockdown of node if suspicious activity is detected @@ -89,7 +91,7 @@ #define TEMPERATURE_ALARM 60 // temperature threshold for alarm #define TEMP_MEASURE_INTERVAL 3000 // How many milli seconds between each measurement -#define FORCE_TRANSMIT_INTERVAL 30 // number of seconds, the sensor is forced to report all values to the controller +#define FORCE_TRANSMIT_INTERVAL 30*1000 // number of milliseconds, the sensor is forced to report all values to the controller #define TEMP_TRANSMIT_THRESHOLD 2 // how much the temperature should have changed since last time it was transmitted. // ********************* BUTTONS STATES ********************************************** diff --git a/RollerShutterNode/FW/MyRollershutter/MyRollershutter.ino b/RollerShutterNode/FW/MyRollershutter/MyRollershutter.ino index 27e5796..94a8776 100644 --- a/RollerShutterNode/FW/MyRollershutter/MyRollershutter.ino +++ b/RollerShutterNode/FW/MyRollershutter/MyRollershutter.ino @@ -66,6 +66,9 @@ float oldTemperature = 0; float hilinkTemperature = 0; OneWire ow_ds1820(DS18B20_PIN); +//Transmission time +unsigned long LastTransmission = 0; + // Authentication const int sha204Pin = ATSHA204_PIN; //atsha204Class sha204(sha204Pin); @@ -228,9 +231,13 @@ void loop() { tx = true; ShutterStop(); } - oldTemperature = hilinkTemperature; - if (tx) send(msgTemperature.set((uint8_t)hilinkTemperature), 1); // TODO problem sending float to jeedom???weird..need to check - + if (millis()-LastTransmission)>FORCE_TRANSMIT_INTERVAL) tx=true; + + if (tx) { + send(msgTemperature.set((uint8_t)hilinkTemperature), 1); // TODO problem sending float to jeedom???weird..need to check + oldTemperature = hilinkTemperature; + LastTransmission=millis(); + } } /* ====================================================================== Function: receive