Rev 1710 Rev 1716
Line 1... Line 1...
1 /**** IR Mrakomer 4 ****/ 1 /**** IR Mrakomer 4 ****/
2 #define VERSION "4.1" 2 #define VERSION "4.1"
3 #define ID "$Id: irmrak4.c 1710 2010-12-07 07:17:36Z kakl $" 3 #define ID "$Id: irmrak4.c 1716 2010-12-09 22:00:26Z kakl $"
4   4  
5 #include "irmrak4.h" 5 #include "irmrak4.h"
6   6  
7 #bit CREN = 0x18.4 // USART registers 7 #bit CREN = 0x18.4 // USART registers
8 #bit SPEN = 0x18.7 8 #bit SPEN = 0x18.7
Line 54... Line 54...
54 // printf("#\r\n"); 54 // printf("#\r\n");
55 printf("# commands: h, c, o, l, x, i, r, a, s, u\r\n"); 55 printf("# commands: h, c, o, l, x, i, r, a, s, u\r\n");
56 // printf("# h_eat, c_old, o_pen, l_ock, x_open, "); 56 // printf("# h_eat, c_old, o_pen, l_ock, x_open, ");
57 // printf("i_nfo, r_epeat, a_uto, s_single, u_pdate\r\n"); 57 // printf("i_nfo, r_epeat, a_uto, s_single, u_pdate\r\n");
58 // printf("#\r\n"); 58 // printf("#\r\n");
59 printf("# ver sequence inside[1/100 C] sky[1/100 C] sky[1/100 C] "); 59 printf("# ver seq in[1/100 C] sky[1/100 C] sky[1/100 C] ");
60 printf("ambient[1/100 C] heating[s] dome[s] check\r\n\r\n"); 60 printf("out[1/100 C] heat[s] dome[s] check\r\n\r\n");
61   61  
62 //---WDT 62 //---WDT
63 restart_wdt(); 63 restart_wdt();
64 } 64 }
65   65  
Line 252... Line 252...
252   252  
253 tempa=ReadTemp(SA, RAM_Tamb); // Read temperatures from sensor 253 tempa=ReadTemp(SA, RAM_Tamb); // Read temperatures from sensor
254 ta=tempa*2-27315; // °K -> °C 254 ta=tempa*2-27315; // °K -> °C
255   255  
256 temp=ReadTemp(SA, RAM_Tobj1); 256 temp=ReadTemp(SA, RAM_Tobj1);
257 to1=temp*2-27315; 257 if (temp>0x48E1) {to1=-27315;} else {to1=temp*2-27315;}
258 temp=ReadTemp(SA, RAM_Tobj2); 258 temp=ReadTemp(SA, RAM_Tobj2);
259 to2=temp*2-27315; 259 if (temp>0x48E1) {to2=-27315;} else {to2=temp*2-27315;}
260   260  
261 touch_present(); //Issues a reset of Touch Memory device 261 touch_present(); //Issues a reset of Touch Memory device
262 touch_write_byte(0xCC); 262 touch_write_byte(0xCC);
263 touch_write_byte(0x44); 263 touch_write_byte(0x44);
264 264
Line 288... Line 288...
288 } 288 }
289 289
290 if(automatic) // Solve automatic mode 290 if(automatic) // Solve automatic mode
291 { 291 {
292 if(ta<1800) heat=MAXHEAT; // Need heating 292 if(ta<1800) heat=MAXHEAT; // Need heating
293 if((abs(to1-to2)<200)&&(tTouch>to1)&&(abs(tTouch/4-to1)>500)) 293 if((abs(to1-to2)<100)&&(tTouch>to1)&&(abs(tTouch/2-to1)>600))
294 open=MAXOPEN; // Open the dome 294 open=MAXOPEN; // Open the dome
295 } 295 }
296   296  
297 { // printf 297 { // printf
298 char output[8]; // Output buffer 298 char output[8]; // Output buffer