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
Revision 4:9065e9ccb078, committed 2014-05-07
- Comitter:
- alpov
- Date:
- Wed May 07 07:03:18 2014 +0000
- Parent:
- 3:ede67e9b60eb
- Child:
- 5:5c8e97742751
- Commit message:
- fixed sensor table
Changed in this revision
--- a/USBDeviceLite.lib Tue May 06 19:21:27 2014 +0000 +++ b/USBDeviceLite.lib Wed May 07 07:03:18 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/alpov/code/USBDeviceLite/#96a0946caef5 +http://mbed.org/users/alpov/code/USBDeviceLite/#f0299e22d4c0
--- a/inc/sensor.h Tue May 06 19:21:27 2014 +0000 +++ b/inc/sensor.h Wed May 07 07:03:18 2014 +0000 @@ -1,8 +1,10 @@ #ifndef _SENSOR_H #define _SENSOR_H -extern uint8_t sensor_roms[8][16]; -extern int16_t sensor_temps[16]; +#define MAX_SENSORS 16 + +extern uint8_t sensor_roms[MAX_SENSORS][8]; +extern int16_t sensor_temps[MAX_SENSORS]; extern int sensor_count; extern Mutex sensor_mutex;
--- a/mbed.bld Tue May 06 19:21:27 2014 +0000 +++ b/mbed.bld Wed May 07 07:03:18 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/6473597d706e \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file
--- a/src/main.cpp Tue May 06 19:21:27 2014 +0000 +++ b/src/main.cpp Wed May 07 07:03:18 2014 +0000 @@ -27,6 +27,8 @@ int main(void) { + pc.printf("EMIRv2 compiled " __DATE__ " " __TIME__ "\n"); + pc.printf("Starting threads... "); Thread sensor(sensor_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); Thread comm(comm_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE);
--- 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;