# HG changeset patch # User Michiel Broek # Date 1427398493 -3600 # Node ID acd840c9fcc07d34fe4c887c899d2aec4af03287 # Parent ba3a2d27d59e98668333d1db05c505d23c7d7f25 Fixed Offset label in device editor. Added code to edit pin states for DS2408 and DS2413 1-wire devices. diff -r ba3a2d27d59e -r acd840c9fcc0 thermferm/devices.c --- a/thermferm/devices.c Thu Mar 26 16:40:53 2015 +0100 +++ b/thermferm/devices.c Thu Mar 26 20:34:53 2015 +0100 @@ -302,8 +302,10 @@ ndev->description = xstrcpy((char *)"DS18B20 Digital thermometer"); } else if (strcmp(buf, (char *)"29") == 0) { ndev->description = xstrcpy((char *)"DS2408 8 Channel addressable switch/LCD"); + ndev->direction = DEVDIR_IN_BIN; } else if (strcmp(buf, (char *)"3a") == 0) { ndev->description = xstrcpy((char *)"DS2413 Dual channel addressable switch"); + ndev->direction = DEVDIR_IN_BIN; } else if (strcmp(buf, (char *)"3b") == 0) { ndev->direction = DEVDIR_IN_ANALOG; ndev->description = xstrcpy((char *)"DS1825 Digital thermometer"); diff -r ba3a2d27d59e -r acd840c9fcc0 thermferm/server.c --- a/thermferm/server.c Thu Mar 26 16:40:53 2015 +0100 +++ b/thermferm/server.c Thu Mar 26 20:34:53 2015 +0100 @@ -668,11 +668,11 @@ #endif srv_send((char *)"213 Device record follows:"); srv_send((char *)"TYPE,%s", DEVTYPE[device->type]); + srv_send((char *)"ADDRESS,%s", device->address); srv_send((char *)"DIRECTION,%s", DEVDIR[device->direction]); srv_send((char *)"VALUE,%d", my_value); srv_send((char *)"OFFSET,%d", device->offset); srv_send((char *)"PRESENT,%s", DEVPRESENT[device->present]); - srv_send((char *)"ADDRESS,%s", device->address); srv_send((char *)"SUBDEVICE,%d", device->subdevice); srv_send((char *)"GPIOPIN,%d", device->gpiopin); srv_send((char *)"DESCRIPTION,%s", device->description); diff -r ba3a2d27d59e -r acd840c9fcc0 www-thermferm/devices.php --- a/www-thermferm/devices.php Thu Mar 26 16:40:53 2015 +0100 +++ b/www-thermferm/devices.php Thu Mar 26 20:34:53 2015 +0100 @@ -1,6 +1,6 @@ * @@ -272,12 +272,22 @@ */ $outstr .= ' '.PHP_EOL; $outstr .= ' Device Type'.PHP_EOL; - if (($type == "W1") || ($type == "GPIO")) + if (($type == "W1") || ($type == "GPIO") || ($type == "SIM")) $outstr .= ' '.$f[1].''.PHP_EOL; else $outstr .= ' '.PHP_EOL; $outstr .= ' '.PHP_EOL; } + if ($f[0] == "ADDRESS") { + $address = $f[1]; + $outstr .= ' '.PHP_EOL; + $outstr .= ' Address'.PHP_EOL; + if (($type == "W1") || ($type == "GPIO")) + $outstr .= ' '.$f[1].''.PHP_EOL; + else + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + } if ($f[0] == "DIRECTION") { $direction = $f[1]; /* @@ -285,9 +295,22 @@ */ $outstr .= ' '.PHP_EOL; $outstr .= ' IO Direction and mode'.PHP_EOL; - if ($type == "W1") - $outstr .= ' '.$f[1].''.PHP_EOL; - else { + if ($type == "W1") { + if ((strncmp($address, "29", 2) == 0) || (strncmp($address, "3a", 2) == 0)) { + $outstr .= ' '.PHP_EOL; + } else { + $outstr .= ' '.$f[1].''.PHP_EOL; + } + } else { $outstr .= ' '.PHP_EOL; } $outstr .= ' '.PHP_EOL; @@ -337,7 +364,7 @@ } if ($f[0] == "OFFSET") { $outstr .= ' '.PHP_EOL; - $outstr .= ' Value'.PHP_EOL; + $outstr .= ' Offset'.PHP_EOL; if ($direction == "IN_ANALOG") $outstr .= ' '.PHP_EOL; else @@ -366,15 +393,6 @@ } $outstr .= ' '.PHP_EOL; } - if ($f[0] == "ADDRESS") { - $outstr .= ' '.PHP_EOL; - $outstr .= ' Address'.PHP_EOL; - if (($type == "W1") || ($type == "GPIO")) - $outstr .= ' '.$f[1].''.PHP_EOL; - else - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - } if ($f[0] == "SUBDEVICE") { $outstr .= ' '.PHP_EOL; $outstr .= ' Subdevice'.PHP_EOL;