Browse Source

first real regulation errors

phyto 5 months ago
parent
commit
2e4854c411
2 changed files with 25 additions and 6 deletions
  1. 24
    5
      simulator/rdtemp/rdtemp.ino
  2. 1
    1
      ui/terminal.c

+ 24
- 5
simulator/rdtemp/rdtemp.ino View File

@@ -101,25 +101,41 @@ void sendvalues(short *ptr)
101 101
   prt('\n');
102 102
 }
103 103
 /* -------------------------------------------------- */
104
-void update_and_send(void)
104
+void update_and_send(short *pvalues)
105 105
 {
106
-  short values[NBVAL];
107 106
   
108
-  updatevalues(values);
109
-  sendvalues(values);
107
+  updatevalues(pvalues);
108
+  sendvalues(pvalues);
110 109
  
111 110
 }
112 111
 /* ================================================== */
113 112
 void loop() {
114 113
   static int foo = 0;
115 114
   int         key;
115
+  short values[NBVAL], temp_interne;
116
+
116 117
   
117
-  update_and_send();
118
+  update_and_send(values);
119
+
120
+  temp_interne = values[1];
121
+  if (temp_interne < parametres.temp_mini) {
122
+    prtln("M temp is low");
123
+    delay(500);
124
+    controle_frigo(0);
125
+    }
126
+  else if (temp_interne > parametres.temp_maxi){
127
+    prtln("M temp is hight");
128
+    delay(500);
129
+    controle_frigo(1);
130
+    }
131
+
118 132
 
119 133
   if (foo++ > 5) {
120 134
     readlight();    foo = 0;
121 135
     }
122 136
 
137
+ 
138
+
123 139
  /* check for external request */
124 140
  if (Serial.available()) {
125 141
     key = Serial.read();
@@ -146,6 +162,9 @@ void loop() {
146 162
           break;          
147 163
       }
148 164
  }
165
+
166
+
167
+ 
149 168
  delay(parametres.delai);
150 169
 
151 170
  /* ETERNAL LOOP END HERE */

+ 1
- 1
ui/terminal.c View File

@@ -46,7 +46,7 @@ wclear(glass);		wrefresh(glass);
46 46
 
47 47
 mfd = (fd_local>fd_remote ? fd_local : fd_remote) + 1;		/* XXX */
48 48
 
49
-#if DEBUG_LEVEL
49
+#if DEBUG_LEVEL > 1
50 50
 sprintf(ligne, "%s : mfd is %d\n", __func__, mfd);
51 51
 waddstr(glass, ligne); wrefresh(glass);
52 52
 #endif

Loading…
Cancel
Save