brewco/setup.c

changeset 446
78e9d5234d15
parent 445
3ec477cda546
child 447
b48368855ec4
equal deleted inserted replaced
445:3ec477cda546 446:78e9d5234d15
149 } 149 }
150 } 150 }
151 151
152 152
153 153
154 /*
155 * Edit a single unit
156 */
154 void editUnit(units_list *unit) 157 void editUnit(units_list *unit)
155 { 158 {
156 int index = 1, key; 159 int index = 1, key;
157 char pmpt[81]; 160 char pmpt[81];
158 161
250 if ((key == KEY_DOWN) && (index < 21)) 253 if ((key == KEY_DOWN) && (index < 21))
251 index++; 254 index++;
252 255
253 if (key == KEY_ENTER) { 256 if (key == KEY_ENTER) {
254 switch(index) { 257 switch(index) {
255 258 case 1: // name
259 break;
260 case 2: // HLT sensor
261 break;
262 case 3: // HLT heater
263 break;
264 case 4: // MLT sensor
265 break;
266 case 5: // MLT heater
267 break;
268 case 6: // MLT pump
269 break;
256 case 7: toggleYesNo(&unit->hlt_heater_mltfirst, (char *)"MLT heat b4 HLT"); 270 case 7: toggleYesNo(&unit->hlt_heater_mltfirst, (char *)"MLT heat b4 HLT");
257 break; 271 break;
258 case 8: editInteger(&unit->pump_cycle, 5, 15, (char *)"Pump cycle"); 272 case 8: editInteger(&unit->pump_cycle, 5, 15, (char *)"Pump cycle");
259 break; 273 break;
260 case 9: editInteger(&unit->pump_rest, 1, 5, (char *)"Pump rest "); 274 case 9: editInteger(&unit->pump_rest, 1, 5, (char *)"Pump rest ");
275 break; 289 break;
276 case 17: toggleYesNo(&unit->skip_iodine, (char *)"Skip iodine test"); 290 case 17: toggleYesNo(&unit->skip_iodine, (char *)"Skip iodine test");
277 break; 291 break;
278 case 19: toggleYesNo(&unit->whirlpool, (char *)"Do a whirlpool"); 292 case 19: toggleYesNo(&unit->whirlpool, (char *)"Do a whirlpool");
279 break; 293 break;
280 294 case 20: // PID_hlt
295 break;
296 case 21: // PID_mlt
297 break;
281 } 298 }
282 } 299 }
283 // name
284 // hlt_sensor picklist
285 // hlt_heater picklist + value range
286 // mlt_sensor picklist
287 // mlt_heater picklist + value range
288 // mlt_pump picklist + value range
289 // hlt_heater_mltfirst 0/1
290 // pump_cycle 5..15
291 // pump_rest 1..5
292 // pump_premash 0/1
293 // pump_onmash 0/1
294 // pump_mashout 0/1
295 // pump_onboil 0/1
296 // pump_stop 80..110
297 // skip_add 0/1
298 // skip_remove 0/1
299 // skip_iodine 0/1
300 // iodine_time 0..90
301 // whirlpool 0/1
302 // PID_hlt
303 // PID_mlt
304 } 300 }
305 301
306 if (debug) 302 if (debug)
307 fprintf(stdout, "End edit brewsystem %d %s\n", unit->number, unit->uuid); 303 fprintf(stdout, "End edit brewsystem %d %s\n", unit->number, unit->uuid);
308 } 304 }
312 void addUnit(int number) 308 void addUnit(int number)
313 { 309 {
314 units_list *tmpu, *unit = (units_list *)malloc(sizeof(units_list)); 310 units_list *tmpu, *unit = (units_list *)malloc(sizeof(units_list));
315 char name[81]; 311 char name[81];
316 uuid_t uu; 312 uuid_t uu;
313 double Input, Output, Setpoint;
317 314
318 if (debug) 315 if (debug)
319 fprintf(stdout, "Adding new brewsystem %d\n", number); 316 fprintf(stdout, "Adding new brewsystem %d\n", number);
320 unit->next = NULL; 317 unit->next = NULL;
321 unit->version = 1; 318 unit->version = 1;
344 unit->skip_iodine = 0; 341 unit->skip_iodine = 0;
345 unit->iodine_time = 90; 342 unit->iodine_time = 90;
346 unit->whirlpool = 1; 343 unit->whirlpool = 1;
347 unit->PID_hlt = (pid_var *)malloc(sizeof(pid_var)); 344 unit->PID_hlt = (pid_var *)malloc(sizeof(pid_var));
348 unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var)); 345 unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var));
349 InitPID(unit->PID_hlt); 346 Input = Setpoint = 20.0;
350 InitPID(unit->PID_mlt); 347 Output = 0;
348 PID_init(unit->PID_hlt, &Input, &Output, &Setpoint, 2, 5, 1, P_DIRECT);
349 PID_init(unit->PID_mlt, &Input, &Output, &Setpoint, 2, 5, 1, P_DIRECT);
351 350
352 editUnit(unit); 351 editUnit(unit);
353 352
354 if (Config.units == NULL) { 353 if (Config.units == NULL) {
355 Config.units = unit; 354 Config.units = unit;

mercurial