thermferm/thermferm.c

changeset 656
ca47c742a25d
parent 654
e981d0185485
child 660
a28ef4d9afa4
equal deleted inserted replaced
655:780cc08df263 656:ca47c742a25d
1035 syslog(LOG_NOTICE, "Can't lock"); 1035 syslog(LOG_NOTICE, "Can't lock");
1036 return 1; 1036 return 1;
1037 } 1037 }
1038 mqtt_connect(); 1038 mqtt_connect();
1039 1039
1040 /*
1041 * First scan the one-wire bus
1042 */
1043 rc = pthread_create(&threads[t], NULL, my_one_wire_loop, (void *)t );
1044 if (rc) {
1045 fprintf(stderr, "my_one_wire_loop thread didn't start rc=%d\n", rc);
1046 syslog(LOG_NOTICE, "my_one_wire_loop thread didn't start rc=%d", rc);
1047 } else {
1048 t++;
1049 mDelay(250); /* Wait a while to detect the devices */
1050 }
1051
1040 if ((rc = devices_detect())) { 1052 if ((rc = devices_detect())) {
1041 syslog(LOG_NOTICE, "Detected %d new devices", rc); 1053 syslog(LOG_NOTICE, "Detected %d new devices", rc);
1042 wrconfig(); 1054 wrconfig();
1043 } 1055 }
1044 1056
1060 1072
1061 rc = pthread_create(&threads[t], NULL, my_panel_loop, (void *)t ); 1073 rc = pthread_create(&threads[t], NULL, my_panel_loop, (void *)t );
1062 if (rc) { 1074 if (rc) {
1063 fprintf(stderr, "my_panel_loop thread didn't start rc=%d\n", rc); 1075 fprintf(stderr, "my_panel_loop thread didn't start rc=%d\n", rc);
1064 syslog(LOG_NOTICE, "my_panel_loop thread didn't start rc=%d", rc); 1076 syslog(LOG_NOTICE, "my_panel_loop thread didn't start rc=%d", rc);
1065 } else {
1066 t++;
1067 }
1068
1069 rc = pthread_create(&threads[t], NULL, my_one_wire_loop, (void *)t );
1070 if (rc) {
1071 fprintf(stderr, "my_one_wire_loop thread didn't start rc=%d\n", rc);
1072 syslog(LOG_NOTICE, "my_one_wire_loop thread didn't start rc=%d", rc);
1073 } else { 1077 } else {
1074 t++; 1078 t++;
1075 } 1079 }
1076 1080
1077 #ifdef USE_SIMULATOR 1081 #ifdef USE_SIMULATOR

mercurial