--- a/brewco/setup.c Fri Dec 04 22:57:23 2015 +0100 +++ b/brewco/setup.c Sat Dec 05 21:46:22 2015 +0100 @@ -151,6 +151,9 @@ +/* + * Edit a single unit + */ void editUnit(units_list *unit) { int index = 1, key; @@ -252,7 +255,18 @@ if (key == KEY_ENTER) { switch(index) { - + case 1: // name + break; + case 2: // HLT sensor + break; + case 3: // HLT heater + break; + case 4: // MLT sensor + break; + case 5: // MLT heater + break; + case 6: // MLT pump + break; case 7: toggleYesNo(&unit->hlt_heater_mltfirst, (char *)"MLT heat b4 HLT"); break; case 8: editInteger(&unit->pump_cycle, 5, 15, (char *)"Pump cycle"); @@ -277,30 +291,12 @@ break; case 19: toggleYesNo(&unit->whirlpool, (char *)"Do a whirlpool"); break; - + case 20: // PID_hlt + break; + case 21: // PID_mlt + break; } } - // name - // hlt_sensor picklist - // hlt_heater picklist + value range - // mlt_sensor picklist - // mlt_heater picklist + value range - // mlt_pump picklist + value range - // hlt_heater_mltfirst 0/1 - // pump_cycle 5..15 - // pump_rest 1..5 - // pump_premash 0/1 - // pump_onmash 0/1 - // pump_mashout 0/1 - // pump_onboil 0/1 - // pump_stop 80..110 - // skip_add 0/1 - // skip_remove 0/1 - // skip_iodine 0/1 - // iodine_time 0..90 - // whirlpool 0/1 - // PID_hlt - // PID_mlt } if (debug) @@ -314,6 +310,7 @@ units_list *tmpu, *unit = (units_list *)malloc(sizeof(units_list)); char name[81]; uuid_t uu; + double Input, Output, Setpoint; if (debug) fprintf(stdout, "Adding new brewsystem %d\n", number); @@ -346,8 +343,10 @@ unit->whirlpool = 1; unit->PID_hlt = (pid_var *)malloc(sizeof(pid_var)); unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var)); - InitPID(unit->PID_hlt); - InitPID(unit->PID_mlt); + Input = Setpoint = 20.0; + Output = 0; + PID_init(unit->PID_hlt, &Input, &Output, &Setpoint, 2, 5, 1, P_DIRECT); + PID_init(unit->PID_mlt, &Input, &Output, &Setpoint, 2, 5, 1, P_DIRECT); editUnit(unit);