comparison tempctrl.c @ 55:6b1057409d9a

Skip beep related stuff #ifdef WITHUSB.
author darius@Inchoate
date Wed, 29 Oct 2008 17:45:32 +1030
parents 58f1ec46bff6
children c72cf25881fe
comparison
equal deleted inserted replaced
54:58f1ec46bff6 55:6b1057409d9a
78 78
79 /* Check/stale times */ 79 /* Check/stale times */
80 int16_t check_interval; 80 int16_t check_interval;
81 int16_t stale_factor; 81 int16_t stale_factor;
82 82
83 #ifndef WITHUSB
83 /* Beep if stale */ 84 /* Beep if stale */
84 int8_t dobeep; 85 int8_t dobeep;
86 #endif
85 } __attribute__((packed)) settings_t; 87 } __attribute__((packed)) settings_t;
86 88
87 /* Current settings in RAM */ 89 /* Current settings in RAM */
88 static settings_t settings; 90 static settings_t settings;
89 91
110 .coolbits = _BV(6), 112 .coolbits = _BV(6),
111 .heatbits = _BV(7), 113 .heatbits = _BV(7),
112 .idlebits = 0x00, 114 .idlebits = 0x00,
113 .check_interval = 10, 115 .check_interval = 10,
114 .stale_factor = 3, 116 .stale_factor = 3,
117 #ifndef WITHUSB
115 .dobeep = 1 118 .dobeep = 1
119 #endif
116 }; 120 };
117 121
118 /* Local variable declarations */ 122 /* Local variable declarations */
119 volatile static time_t now; 123 volatile static time_t now;
120 #ifndef WITHUSB 124 #ifndef WITHUSB
284 288
285 /* Override if we have stale data */ 289 /* Override if we have stale data */
286 if (stale) 290 if (stale)
287 nextstate = 'i'; 291 nextstate = 'i';
288 292
289 /* Handle beeping */ 293 #ifndef WITHUSB
294 /* Handle beeping */
290 if (settings.dobeep && stale) 295 if (settings.dobeep && stale)
291 beeping = 1; 296 beeping = 1;
292 else 297 else
293 beeping = 0; 298 beeping = 0;
299 #endif
294 300
295 /* Handle state forcing */ 301 /* Handle state forcing */
296 if (settings.mode != TC_MODE_AUTO) 302 if (settings.mode != TC_MODE_AUTO)
297 forced = 1; 303 forced = 1;
298 else 304 else
506 "Ambient ROM ID %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\r\n" 512 "Ambient ROM ID %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\r\n"
507 "Mode - %c, Target - %d, Hystersis - %d\r\n" 513 "Mode - %c, Target - %d, Hystersis - %d\r\n"
508 "Min heat overshoot - %d, Min cool overshoot - %d\r\n" 514 "Min heat overshoot - %d, Min cool overshoot - %d\r\n"
509 "Min cool on time - %d, Min cool off time - %d\r\n" 515 "Min cool on time - %d, Min cool off time - %d\r\n"
510 "Min heat on time - %d, Min heat off time - %d\r\n" 516 "Min heat on time - %d, Min heat off time - %d\r\n"
511 "Beep on stale - %S\r\n"), 517 #ifndef WITHUSB
518 "Beep on stale - %S\r\n"
519 #endif
520 ),
512 settings.fermenter_ROM[0], settings.fermenter_ROM[1], settings.fermenter_ROM[2], settings.fermenter_ROM[3], 521 settings.fermenter_ROM[0], settings.fermenter_ROM[1], settings.fermenter_ROM[2], settings.fermenter_ROM[3],
513 settings.fermenter_ROM[4], settings.fermenter_ROM[5], settings.fermenter_ROM[6], settings.fermenter_ROM[7], 522 settings.fermenter_ROM[4], settings.fermenter_ROM[5], settings.fermenter_ROM[6], settings.fermenter_ROM[7],
514 settings.fridge_ROM[0], settings.fridge_ROM[1], settings.fridge_ROM[2], settings.fridge_ROM[3], 523 settings.fridge_ROM[0], settings.fridge_ROM[1], settings.fridge_ROM[2], settings.fridge_ROM[3],
515 settings.fridge_ROM[4], settings.fridge_ROM[5], settings.fridge_ROM[6], settings.fridge_ROM[7], 524 settings.fridge_ROM[4], settings.fridge_ROM[5], settings.fridge_ROM[6], settings.fridge_ROM[7],
516 settings.ambient_ROM[0], settings.ambient_ROM[1], settings.ambient_ROM[2], settings.ambient_ROM[3], 525 settings.ambient_ROM[0], settings.ambient_ROM[1], settings.ambient_ROM[2], settings.ambient_ROM[3],
517 settings.ambient_ROM[4], settings.ambient_ROM[5], settings.ambient_ROM[6], settings.ambient_ROM[7], 526 settings.ambient_ROM[4], settings.ambient_ROM[5], settings.ambient_ROM[6], settings.ambient_ROM[7],
518 settings.mode, settings.target_temp, settings.hysteresis, 527 settings.mode, settings.target_temp, settings.hysteresis,
519 settings.minheatovershoot, settings.mincoolovershoot, 528 settings.minheatovershoot, settings.mincoolovershoot,
520 settings.mincoolontime, settings.minheatontime, 529 settings.mincoolontime, settings.minheatontime,
521 settings.minheatontime, settings.minheatofftime, 530 settings.minheatontime, settings.minheatofftime,
522 settings.dobeep ? PSTR("yes") : PSTR("no")); 531 #ifndef WITHUSB
532 settings.dobeep ? PSTR("yes") : PSTR("no")
533 #endif
534 );
523 return; 535 return;
524 } 536 }
525 if (!strcasecmp_P(cmd, PSTR("mode"))) { 537 if (!strcasecmp_P(cmd, PSTR("mode"))) {
526 switch (buf[8]) { 538 switch (buf[8]) {
527 case TC_MODE_AUTO: 539 case TC_MODE_AUTO:
536 printf_P(PSTR("Unknown mode character '%c'\r\n"), buf[8]); 548 printf_P(PSTR("Unknown mode character '%c'\r\n"), buf[8]);
537 break; 549 break;
538 } 550 }
539 return; 551 return;
540 } 552 }
553 #ifndef WITHUSB
541 if (!strcasecmp_P(cmd, PSTR("beep"))) { 554 if (!strcasecmp_P(cmd, PSTR("beep"))) {
542 if (buf[8] == '1') 555 if (buf[8] == '1')
543 settings.dobeep = 1; 556 settings.dobeep = 1;
544 else if (buf[8] == '0') 557 else if (buf[8] == '0')
545 settings.dobeep = 0; 558 settings.dobeep = 0;
546 else 559 else
547 printf_P(PSTR("Expected a 0 or 1\r\n")); 560 printf_P(PSTR("Expected a 0 or 1\r\n"));
548 return; 561 return;
549 } 562 }
563 #endif
550 if (!strcasecmp_P(cmd, PSTR("ferm")) || 564 if (!strcasecmp_P(cmd, PSTR("ferm")) ||
551 !strcasecmp_P(cmd, PSTR("frg")) || 565 !strcasecmp_P(cmd, PSTR("frg")) ||
552 !strcasecmp_P(cmd, PSTR("amb"))) { 566 !strcasecmp_P(cmd, PSTR("amb"))) {
553 567
554 if (sscanf_P((char *)cmd, PSTR("tc %5s %hhx:%hhx:%hhx:%hhx:%hhx:%hhx:%hhx:%hhx"), cmd, 568 if (sscanf_P((char *)cmd, PSTR("tc %5s %hhx:%hhx:%hhx:%hhx:%hhx:%hhx:%hhx:%hhx"), cmd,