EMIR - Ekvitermní mikroprocesorová regulace https://code.google.com/p/emir/ https://code.google.com/p/emir/wiki/DesignV3
Dependencies: ConfigFile DS1307 OneWire SDFileSystem USBDeviceLite mbed-rtos mbed
Diff: src/sensor.cpp
- Revision:
- 4:9065e9ccb078
- Parent:
- 3:ede67e9b60eb
- Child:
- 5:5c8e97742751
--- a/src/sensor.cpp Tue May 06 19:21:27 2014 +0000 +++ b/src/sensor.cpp Wed May 07 07:03:18 2014 +0000 @@ -3,8 +3,8 @@ #include "1wire.h" #include "sensor.h" -uint8_t sensor_roms[8][16]; -int16_t sensor_temps[16]; +uint8_t sensor_roms[MAX_SENSORS][8]; +int16_t sensor_temps[MAX_SENSORS]; int sensor_count; Mutex sensor_mutex; @@ -23,7 +23,7 @@ sensor_count = 0; memset(rom, 0, sizeof(rom)); result = ow.First(rom); - while (result == OW_FOUND) { + while (result == OW_FOUND && sensor_count < MAX_SENSORS) { if (ow.ReadTemperature(rom, &temp) == 0) { memcpy(sensor_roms[sensor_count], rom, sizeof(rom)); sensor_temps[sensor_count] = temp;