thermferm/thermferm.c

changeset 422
13502d0dda65
parent 420
644a6106d712
child 423
02653162b03b
equal deleted inserted replaced
421:0258107a9e72 422:13502d0dda65
394 394
395 395
396 /* 396 /*
397 * Handle panel key events 397 * Handle panel key events
398 */ 398 */
399 #ifdef HAVE_WIRINGPI_H
400 void panel_key_events(int key) 399 void panel_key_events(int key)
401 { 400 {
402 units_list *unit; 401 units_list *unit;
403 profiles_list *profile; 402 profiles_list *profile;
404 int rc; 403 int rc;
797 go_menu(MENU_NONE); 796 go_menu(MENU_NONE);
798 } 797 }
799 break; 798 break;
800 } 799 }
801 } 800 }
802 #endif
803
804 801
805 802
806 803
807 int main(int argc, char *argv[]) 804 int main(int argc, char *argv[])
808 { 805 {
930 time_t now, last = (time_t)0; 927 time_t now, last = (time_t)0;
931 units_list *unit; 928 units_list *unit;
932 profiles_list *profile; 929 profiles_list *profile;
933 prof_step *step; 930 prof_step *step;
934 int row, rc, run = 1, seconds = 0, minutes = 0, temp, deviation; 931 int row, rc, run = 1, seconds = 0, minutes = 0, temp, deviation;
935 int run_seconds, run_minutes, run_hours, tot_minutes; 932 int run_seconds, run_minutes, run_hours, tot_minutes, key;
936 struct tm *tm; 933 struct tm *tm;
937 #ifdef HAVE_WIRINGPI_H 934 #ifndef HAVE_WIRINGPI_H
938 int key;
939 #else
940 long t = 0; 935 long t = 0;
941 #endif 936 #endif
942 int current_step, valid_step, time_until_now, previous_fridge_mode; 937 int current_step, valid_step, time_until_now, previous_fridge_mode;
943 float previous_target_lo, previous_target_hi; 938 float previous_target_lo, previous_target_hi;
944 939
980 t++; 975 t++;
981 #endif 976 #endif
982 } 977 }
983 978
984 #ifdef HAVE_WIRINGPI_H 979 #ifdef HAVE_WIRINGPI_H
985 if ((rc = piThreadCreate(my_panel_loop))) { 980 rc = piThreadCreate(my_panel_loop) {
981 #else
982 rc = pthread_create(&threads[t], NULL, my_panel_loop, (void *)t );
983 #endif
984 if (rc) {
986 fprintf(stderr, "my_panel_loop thread didn't start rc=%d\n", rc); 985 fprintf(stderr, "my_panel_loop thread didn't start rc=%d\n", rc);
987 syslog(LOG_NOTICE, "my_panel_loop thread didn't start rc=%d", rc); 986 syslog(LOG_NOTICE, "my_panel_loop thread didn't start rc=%d", rc);
987 #ifndef HAVE_WIRINGPI_H
988 } else {
989 t++;
990 #endif
988 } 991 }
989 #endif
990
991 992
992 #ifdef USE_SIMULATOR 993 #ifdef USE_SIMULATOR
993 #ifdef HAVE_WIRINGPI_H 994 #ifdef HAVE_WIRINGPI_H
994 rc = piThreadCreate(my_simulator_loop); 995 rc = piThreadCreate(my_simulator_loop);
995 #else 996 #else
1782 if ((minutes == 15) || (minutes == 45)) 1783 if ((minutes == 15) || (minutes == 45))
1783 wrconfig(); 1784 wrconfig();
1784 } 1785 }
1785 } 1786 }
1786 1787
1787 #ifdef HAVE_WIRINGPI_H 1788 slcdDummy(slcdHandle);
1788 key = keycheck(); 1789 key = keycheck();
1789 if (key != KEY_NONE) 1790 if (key != KEY_NONE)
1790 panel_key_events(key); 1791 panel_key_events(key);
1791 #endif
1792 1792
1793 usleep(100000); 1793 usleep(100000);
1794 1794
1795 } while (run); 1795 } while (run);
1796 1796

mercurial