--- a/brewco/devices.c Wed Nov 25 22:49:35 2015 +0100 +++ b/brewco/devices.c Thu Nov 26 22:47:42 2015 +0100 @@ -438,31 +438,57 @@ ndev->subdevice = i; ndev->gpiopin = pin; ndev->timestamp = time(NULL); - if (i == PANEL_RETURN) { - ndev->direction = DEVDIR_IN_BIN; - ndev->inuse = 1; - ndev->comment = xstrcpy((char *)"Frontpanel Return"); - } else if (i == PANEL_ENTER) { - ndev->direction = DEVDIR_IN_BIN; - ndev->inuse = 1; - ndev->comment = xstrcpy((char *)"Frontpanel Enter key"); - } else if (i == PANEL_DOWN) { - ndev->direction = DEVDIR_IN_BIN; - ndev->inuse = 1; - ndev->comment = xstrcpy((char *)"Frontpanel Down key"); - } else if (i == PANEL_UP) { - ndev->direction = DEVDIR_IN_BIN; - ndev->inuse = 1; - ndev->comment = xstrcpy((char *)"Frontpanel Up key"); - } else if (i == 7) { - ndev->direction = DEVDIR_INTERN; - ndev->inuse = 1; - ndev->comment = xstrcpy((char *)"1-Wire bus"); - } else { - ndev->direction = DEVDIR_IN_BIN; - ndev->inuse = 0; - ndev->comment = xstrcpy((char *)"Raspberry GPIO"); - } + switch (i) { + case 0: + ndev->direction = DEVDIR_OUT_ANALOG; + ndev->inuse = 1; + ndev->comment = xstrcpy((char *)"MLT heater SSR"); + break; + case 1: + ndev->direction = DEVDIR_OUT_ANALOG; + ndev->inuse = 1; + ndev->comment = xstrcpy((char *)"MLT heater PWM"); + break; + case 2: + ndev->direction = DEVDIR_OUT_ANALOG; + ndev->inuse = 1; + ndev->comment = xstrcpy((char *)"MLT pump relay"); + break; + case PANEL_RETURN: + ndev->direction = DEVDIR_IN_BIN; + ndev->inuse = 1; + ndev->comment = xstrcpy((char *)"Frontpanel Return"); + break; + case PANEL_ENTER: + ndev->direction = DEVDIR_IN_BIN; + ndev->inuse = 1; + ndev->comment = xstrcpy((char *)"Frontpanel Enter key"); + break; + case PANEL_DOWN: + ndev->direction = DEVDIR_IN_BIN; + ndev->inuse = 1; + ndev->comment = xstrcpy((char *)"Frontpanel Down key"); + break; + case PANEL_UP: + ndev->direction = DEVDIR_IN_BIN; + ndev->inuse = 1; + ndev->comment = xstrcpy((char *)"Frontpanel Up key"); + break; + case 7: + ndev->direction = DEVDIR_INTERN; + ndev->inuse = 1; + ndev->comment = xstrcpy((char *)"1-Wire bus"); + break; + case 8: + ndev->direction = DEVDIR_OUT_BIN; + ndev->inuse = 1; + ndev->comment = xstrcpy((char *)"Buzzer"); + break; + default: + ndev->direction = DEVDIR_IN_BIN; + ndev->inuse = 0; + ndev->comment = xstrcpy((char *)"Raspberry GPIO"); + } pin++; if (Config.devices == NULL) { @@ -491,7 +517,7 @@ } if (found == FALSE) { - subdevices = 5; + subdevices = 6; for (i = 0; i < subdevices; i++) { ndev = (devices_list *)malloc(sizeof(devices_list)); ndev->next = NULL; @@ -528,6 +554,10 @@ ndev->address = xstrcpy((char *)"SimMLTheater"); ndev->description = xstrcpy((char *)"Simulated MLT heater"); break; + case 5: ndev->direction = DEVDIR_OUT_ANALOG; + ndev->address = xstrcpy((char *)"SimMLTpump"); + ndev->description = xstrcpy((char *)"Simulated MLT pump"); + break; } if (Config.devices == NULL) {