brewco/brewco.c

changeset 459
1f88be70f253
parent 456
045db83dd013
child 464
4a624c071ca9
equal deleted inserted replaced
458:43a8ecb53637 459:1f88be70f253
21 *****************************************************************************/ 21 *****************************************************************************/
22 22
23 #include "brewco.h" 23 #include "brewco.h"
24 #include "rdconfig.h" 24 #include "rdconfig.h"
25 #include "rdsession.h" 25 #include "rdsession.h"
26 #include "rdrecipes.h"
26 #include "util.h" 27 #include "util.h"
27 #include "xutil.h" 28 #include "xutil.h"
28 #include "lcd-pcf8574.h" 29 #include "lcd-pcf8574.h"
29 #include "slcd.h" 30 #include "slcd.h"
30 #include "lock.h" 31 #include "lock.h"
455 if (seconds > 59) { 456 if (seconds > 59) {
456 seconds = 0; 457 seconds = 0;
457 minutes++; 458 minutes++;
458 } 459 }
459 460
460 fprintf(stdout, "%d seconds %d minutes %ld millis\n", seconds, minutes, millis()); 461 //fprintf(stdout, "%d seconds %d minutes %ld millis\n", seconds, minutes, millis());
461 462
462 rc = device_in(unit->hlt_sensor.uuid, &temp); 463 rc = device_in(unit->hlt_sensor.uuid, &temp);
463 if (rc == DEVPRESENT_YES) { 464 if (rc == DEVPRESENT_YES) {
464 hltInput = temp / 1000.0; 465 hltInput = temp / 1000.0;
465 unit->hlt_sensor.state = 0; 466 unit->hlt_sensor.state = 0;
549 if (shutdown(sock, SHUT_RDWR)) { 550 if (shutdown(sock, SHUT_RDWR)) {
550 syslog(LOG_NOTICE, "Can't shutdown socket: %s", strerror(errno)); 551 syslog(LOG_NOTICE, "Can't shutdown socket: %s", strerror(errno));
551 } 552 }
552 sock = -1; 553 sock = -1;
553 } 554 }
555 wrrecipes();
554 wrconfig(); 556 wrconfig();
557
555 // ulockprog((char *)"brewco"); 558 // ulockprog((char *)"brewco");
556 return 0; 559 return 0;
557 } 560 }
558 561
559 562
592 syslog(LOG_NOTICE, "Error reading configuration: halted"); 595 syslog(LOG_NOTICE, "Error reading configuration: halted");
593 return 1; 596 return 1;
594 } 597 }
595 if (debug) 598 if (debug)
596 fprintf(stdout, "configuration loaded\n"); 599 fprintf(stdout, "configuration loaded\n");
600
601 if (rdrecipes()) {
602 fprintf(stderr, "Error reading recipes\n");
603 syslog(LOG_NOTICE, "Error reading recipes: halted");
604 return 1;
605 }
606 if (debug)
607 fprintf(stdout, "recipes loaded\n");
597 608
598 /* 609 /*
599 * Catch all the signals we can, and ignore the rest. Note that SIGKILL can't be ignored 610 * Catch all the signals we can, and ignore the rest. Note that SIGKILL can't be ignored
600 * but that's live. This daemon should only be stopped by SIGTERM. 611 * but that's live. This daemon should only be stopped by SIGTERM.
601 * Don't catch SIGCHLD. 612 * Don't catch SIGCHLD.

mercurial