thermferm/server.c

changeset 79
eb9dd60aa791
parent 77
143077e54255
child 80
81bf78a7618e
equal deleted inserted replaced
78:c49ab5179bf3 79:eb9dd60aa791
64 Config.tempFormat = 'C'; 64 Config.tempFormat = 'C';
65 Config.cc_tempSetMin = 1.0; 65 Config.cc_tempSetMin = 1.0;
66 Config.cc_tempSetMax = 30.0; 66 Config.cc_tempSetMax = 30.0;
67 Config.cc_idleRangeH = 1.000; 67 Config.cc_idleRangeH = 1.000;
68 Config.cc_idleRangeL = -1.000; 68 Config.cc_idleRangeL = -1.000;
69 }
70
71
72
73 int unit_add(char *name)
74 {
75 units_list *unit, *tmp;
76 uuid_t uu;
77
78 unit = (units_list *)malloc(sizeof(units_list));
79 unit->next = NULL;
80 unit->uuid = malloc(37);
81 uuid_generate(uu);
82 uuid_unparse(uu, unit->uuid);
83 unit->name = xstrcpy(name);
84 unit->air_address = unit->beer_address = unit->io1_address = unit->io2_address = unit->profile = NULL;
85 unit->volume = 0.0;
86 unit->heater_available = unit->cooler_available = unit->fan_available = FALSE;
87 unit->air_temp = unit->beer_temp = unit->beer_set = unit->fridge_set = 20.0;
88 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = 0;
89 unit->temp_set_min = 1.0;
90 unit->temp_set_max = 30.0;
91 unit->idle_rangeH = 1.0;
92 unit->idle_rangeL = -1.0;
93 unit->prof_started = (time_t)0;
94
95
96 if (Config.units == NULL) {
97 Config.units = unit;
98 } else {
99 for (tmp = Config.units; tmp; tmp = tmp->next) {
100 if (tmp->next == NULL) {
101 tmp->next = unit;
102 break;
103 }
104 }
105 }
106 return 0;
69 } 107 }
70 108
71 109
72 110
73 /* 111 /*

mercurial