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

Committer:
Rhyme
Date:
Fri Feb 23 07:51:55 2018 +0000
Revision:
1:8818b793d147
Parent:
0:ce97f6d34336
Wrong behavior when one of color sensor is missing has been fixed.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:ce97f6d34336 1 #include "mbed.h"
Rhyme 0:ce97f6d34336 2 #include "edge_mgr.h"
Rhyme 0:ce97f6d34336 3 #include "edge_reset_mgr.h"
Rhyme 0:ce97f6d34336 4 #include "edge_chart.h"
Rhyme 0:ce97f6d34336 5 #if 0
Rhyme 0:ce97f6d34336 6 typedef struct _edge_chart_st {
Rhyme 0:ce97f6d34336 7 char *name ;
Rhyme 0:ce97f6d34336 8 int left ;
Rhyme 0:ce97f6d34336 9 int top ;
Rhyme 0:ce97f6d34336 10 int width ;
Rhyme 0:ce97f6d34336 11 int height ;
Rhyme 0:ce97f6d34336 12 int index ;
Rhyme 0:ce97f6d34336 13 int min ;
Rhyme 0:ce97f6d34336 14 int max ;
Rhyme 0:ce97f6d34336 15 } edge_chart_type ;
Rhyme 0:ce97f6d34336 16
Rhyme 0:ce97f6d34336 17 extern edge_chart_type edge_chart[] ;
Rhyme 0:ce97f6d34336 18 #endif
Rhyme 0:ce97f6d34336 19
Rhyme 0:ce97f6d34336 20 edge_chart_type edge_chart[] = {
Rhyme 0:ce97f6d34336 21 /* name, left, top, width, height, index, min, max */
Rhyme 0:ce97f6d34336 22 { "Accel", 0, 0, 160, 60, 0, -0.2, 0.2 },
Rhyme 0:ce97f6d34336 23 { "Color", 160, 0, 160, 120, 0, 0.0, 10000.0 },
Rhyme 0:ce97f6d34336 24 { "Color2", 160, 120, 160, 120, 0, 0.0, 10000.0 },
Rhyme 0:ce97f6d34336 25 { "Temp", 0, 120, 160, 120, 0, -10.0, 50.0 },
Rhyme 0:ce97f6d34336 26 { "Press", 0, 60, 160, 60, 0, -1.0, 5.0 },
Rhyme 0:ce97f6d34336 27 { 0, 0, 0, 0, 0, 0, 0.0, 0.0 }
Rhyme 0:ce97f6d34336 28 } ;
Rhyme 0:ce97f6d34336 29
Rhyme 0:ce97f6d34336 30 void draw_chart_frame(edge_chart_type *p)
Rhyme 0:ce97f6d34336 31 {
Rhyme 0:ce97f6d34336 32 if (display) {
Rhyme 0:ce97f6d34336 33 display->fillrect(p->left+1, p->top+1,
Rhyme 0:ce97f6d34336 34 p->left + p->width - 2, p->top + p->height - 2, Black) ;
Rhyme 0:ce97f6d34336 35 display->rect(p->left, p->top,
Rhyme 0:ce97f6d34336 36 p->left + p->width - 1,
Rhyme 0:ce97f6d34336 37 p->top + p->height -1, Blue) ;
Rhyme 0:ce97f6d34336 38 display->set_font((unsigned char*) Arial12x12);
Rhyme 0:ce97f6d34336 39 display->foreground(White) ;
Rhyme 0:ce97f6d34336 40 display->locate(p->left + 5, p->top + 5) ;
Rhyme 0:ce97f6d34336 41 display->printf(p->name) ;
Rhyme 0:ce97f6d34336 42 }
Rhyme 0:ce97f6d34336 43 }
Rhyme 0:ce97f6d34336 44
Rhyme 0:ce97f6d34336 45 void draw_all_chart_frame(void)
Rhyme 0:ce97f6d34336 46 {
Rhyme 0:ce97f6d34336 47 edge_chart_type *p ;
Rhyme 0:ce97f6d34336 48 if (display) {
Rhyme 0:ce97f6d34336 49 reset_watch_dog() ;
Rhyme 0:ce97f6d34336 50 display->BusEnable(true) ;
Rhyme 0:ce97f6d34336 51 for(p = edge_chart ; p->name ; p++ ) {
Rhyme 0:ce97f6d34336 52 draw_chart_frame(p) ;
Rhyme 0:ce97f6d34336 53 }
Rhyme 0:ce97f6d34336 54 display->BusEnable(false) ;
Rhyme 0:ce97f6d34336 55 }
Rhyme 0:ce97f6d34336 56 }