]> rtime.felk.cvut.cz Git - hydro.git/blobdiff - app-stefic/sensor/hydroponie.c
Added monitoring web system. Minor changes in regulator and in control.
[hydro.git] / app-stefic / sensor / hydroponie.c
index 5a3776b2b95df6e413a34471b3d7c06e67378151..b482ffdb2ad3a9bbc222d93dc82cef51b8248254 100644 (file)
@@ -18,7 +18,7 @@
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
-//#define OS_POSIX
+// #define OS_POSIX
 
 #ifdef HAVE_CONFIG_H
     #include <config.h>
@@ -59,20 +59,19 @@ void loop(void){
 
     ltime  = current_time();
     l2time = current_time();
-    l3time = current_time();
 
     while(1){
         blink();
         ctime = current_time();
 
         if (oi_period != 0){
-            if (oi_period == 1){
-                if((ctime-ltime) > 1000){
+            if (oi_period == HEART_PERIOD){
+                if((ctime-ltime) > 1000*HEART_PERIOD){
                     send_data();
                     ltime = current_time();
                 }
             } else {
-                if((ctime-ltime) > 1000){
+                if((ctime-ltime) > 1000*HEART_PERIOD){
                     heartbeat();
                     ltime = current_time();
                 }
@@ -81,6 +80,11 @@ void loop(void){
                     l2time = current_time();
                 }
             }
+        } else {
+            if((ctime-ltime) > 1000*HEART_PERIOD){
+                heartbeat();
+                ltime = current_time();
+            }
         }
         accept_SDO();