Color sensor reset at the end of calibration added. sensor id auto assignment was changed to be a fixed value assignment to avoid sensor id shift when some sensor is absent.
Dependencies: UniGraphic mbed vt100
Revision 1:8818b793d147, committed 2018-02-23
- Comitter:
- Rhyme
- Date:
- Fri Feb 23 07:51:55 2018 +0000
- Parent:
- 0:ce97f6d34336
- Commit message:
- Wrong behavior when one of color sensor is missing has been fixed.
Changed in this revision
edge_sensor/edge_sensor.h | Show annotated file Show diff for this revision Revisions of this file |
edge_utils/edge_mgr.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r ce97f6d34336 -r 8818b793d147 edge_sensor/edge_sensor.h --- a/edge_sensor/edge_sensor.h Fri Feb 23 05:40:22 2018 +0000 +++ b/edge_sensor/edge_sensor.h Fri Feb 23 07:51:55 2018 +0000 @@ -27,6 +27,13 @@ virtual void reset(void) ; /** + * assign _id manually + */ + virtual void setId(uint16_t id) { _id = id ; } + + virtual uint16_t getId(void) { return _id ; } + +/** * enable the edge_sensor */ virtual void enable(void) ;
diff -r ce97f6d34336 -r 8818b793d147 edge_utils/edge_mgr.cpp --- a/edge_utils/edge_mgr.cpp Fri Feb 23 05:40:22 2018 +0000 +++ b/edge_utils/edge_mgr.cpp Fri Feb 23 07:51:55 2018 +0000 @@ -365,6 +365,7 @@ mma8451q = new MMA8451Q(edge_i2c1, MMA8451Q_I2C_ADDRESS) ; accel = new edge_accel(mma8451q) ; sensor[0] = accel ; + sensor[0]->setId( 0 ) ; num_sensor++ ; } else { sensor[0] = 0 ; @@ -385,6 +386,7 @@ led[2] = new PwmOut(PIN_LED_B) ; color[0] = new edge_color(veml6040[0], led, pwm) ; sensor[1] = color[0] ; + sensor[1]->setId( 1 ) ; num_sensor++ ; } else { sensor[1] = 0 ; @@ -407,6 +409,7 @@ } color[1] = new edge_color(veml6040[1], led, pwm) ; sensor[2] = color[1] ; + sensor[2]->setId(2) ; num_sensor++ ; } else { sensor[2] = 0 ; @@ -450,6 +453,7 @@ smtc502at1 = new SMTC502AT(an1) ; temp = new edge_temp(lm75b0, smtc502at0, smtc502at1, lm75b1) ; sensor[3] = temp ; + sensor[3]->setId(3) ; num_sensor++ ; @@ -459,6 +463,7 @@ pse530 = new PSE530(an2) ; pressure = new edge_pressure(pse530, pse530_en) ; sensor[4] = pressure ; + sensor[4]->setId(4) ; num_sensor++ ; reset_watch_dog() ;