657 break; |
657 break; |
658 case 2: ndev->direction = DEVDIR_IN_ANALOG; |
658 case 2: ndev->direction = DEVDIR_IN_ANALOG; |
659 ndev->address = xstrcpy((char *)"SimBeerTemp"); |
659 ndev->address = xstrcpy((char *)"SimBeerTemp"); |
660 ndev->description = xstrcpy((char *)"Simulated beer temperature"); |
660 ndev->description = xstrcpy((char *)"Simulated beer temperature"); |
661 break; |
661 break; |
662 case 3: ndev->direction = DEVDIR_OUT_ANALOG; |
662 case 3: ndev->direction = DEVDIR_OUT_BIN; |
663 ndev->address = xstrcpy((char *)"SimHeater"); |
663 ndev->address = xstrcpy((char *)"SimHeater"); |
664 ndev->description = xstrcpy((char *)"Simulated heater"); |
664 ndev->description = xstrcpy((char *)"Simulated heater"); |
665 break; |
665 break; |
666 case 4: ndev->direction = DEVDIR_OUT_ANALOG; |
666 case 4: ndev->direction = DEVDIR_OUT_BIN; |
667 ndev->address = xstrcpy((char *)"SimCooler"); |
667 ndev->address = xstrcpy((char *)"SimCooler"); |
668 ndev->description = xstrcpy((char *)"Simulated cooler"); |
668 ndev->description = xstrcpy((char *)"Simulated cooler"); |
669 break; |
669 break; |
670 } |
670 } |
671 |
671 |
930 simulator = Config.simulators; |
930 simulator = Config.simulators; |
931 if (device->subdevice == 0) { |
931 if (device->subdevice == 0) { |
932 device->value = (int)((int)(simulator->room_temperature * 1000) / 500) * 500; |
932 device->value = (int)((int)(simulator->room_temperature * 1000) / 500) * 500; |
933 device->timestamp = time(NULL); |
933 device->timestamp = time(NULL); |
934 } else if (device->subdevice == 1) { |
934 } else if (device->subdevice == 1) { |
935 device->value = (int)((int)(simulator->air_temperature * 1000) / 125) * 125; |
935 device->value = (int)((int)(simulator->air_temperature * 1000) / 62.5) * 62.5; |
936 device->timestamp = time(NULL); |
936 device->timestamp = time(NULL); |
937 } else if (device->subdevice == 2) { |
937 } else if (device->subdevice == 2) { |
938 device->value = (int)((int)(simulator->beer_temperature * 1000) / 125) * 125; |
938 device->value = (int)((int)(simulator->beer_temperature * 1000) / 62.5) * 62.5; |
939 device->timestamp = time(NULL); |
939 device->timestamp = time(NULL); |
940 } |
940 } |
941 } |
941 } |
942 #ifdef HAVE_WIRINGPI_H |
942 #ifdef HAVE_WIRINGPI_H |
943 piUnlock(LOCK_DEVICES); |
943 piUnlock(LOCK_DEVICES); |