Release candidate version. The pointer in GAS Pressure display is changed to a triangle.

Dependencies:   UniGraphic mbed vt100

Please note, at 2-Mar-2018 the current version of mbed-lib has a defect in Ticker.
https://os.mbed.com/forum/bugs-suggestions/topic/29287/

So, mbed lib version 157 is intentionally being used.
Please do not update mbed library until the problem in the above URL is fixed.

In this version, format of GAS Pressure Display has been changed.
/media/uploads/Rhyme/low.jpg

/media/uploads/Rhyme/good.jpg

/media/uploads/Rhyme/high.jpg

moto

Committer:
Rhyme
Date:
Fri Mar 02 07:56:09 2018 +0000
Revision:
0:774324cbc5a6
Release candidate version. GAS Pressure pointer is now a triangle.; Some source file clean-up was done.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:774324cbc5a6 1 #include "mbed.h"
Rhyme 0:774324cbc5a6 2 #include "edge_sensor.h"
Rhyme 0:774324cbc5a6 3 #include "edge_time.h"
Rhyme 0:774324cbc5a6 4 #include "edge_reset_mgr.h"
Rhyme 0:774324cbc5a6 5 #include "PSE530.h"
Rhyme 0:774324cbc5a6 6 #include "edge_pressure.h"
Rhyme 0:774324cbc5a6 7 #include <ILI9341.h>
Rhyme 0:774324cbc5a6 8 #include "edge_chart.h"
Rhyme 0:774324cbc5a6 9 // #include "SO1602A.h"
Rhyme 0:774324cbc5a6 10
Rhyme 0:774324cbc5a6 11 // extern SO1602A *display ; /* OLED display on I2C */
Rhyme 0:774324cbc5a6 12 extern ILI9341 *display ;
Rhyme 0:774324cbc5a6 13
Rhyme 0:774324cbc5a6 14 #define LOW_THR 0.2
Rhyme 0:774324cbc5a6 15 #define HIGH_THR 0.3
Rhyme 0:774324cbc5a6 16 #define MIN_TEMP 12.0
Rhyme 0:774324cbc5a6 17 #define MAX_TEMP 30.0
Rhyme 0:774324cbc5a6 18
Rhyme 0:774324cbc5a6 19 /**
Rhyme 0:774324cbc5a6 20 * SMC PSE530 pressure sensor
Rhyme 0:774324cbc5a6 21 * analog output 1.0V - 5.0V
Rhyme 0:774324cbc5a6 22 * 1.0V : 0
Rhyme 0:774324cbc5a6 23 * 5.0V : 1MPa
Rhyme 0:774324cbc5a6 24 * (at 0.6V : -0.1MPa)
Rhyme 0:774324cbc5a6 25 * Our sensor I/F converts 0-5V to 0-1
Rhyme 0:774324cbc5a6 26 * So we suppose V = Analog Float Value : Pressure
Rhyme 0:774324cbc5a6 27 * 0.2 = 0
Rhyme 0:774324cbc5a6 28 * 1.0 = 1MPa
Rhyme 0:774324cbc5a6 29 */
Rhyme 0:774324cbc5a6 30
Rhyme 0:774324cbc5a6 31 float temp2expected(float temp)
Rhyme 0:774324cbc5a6 32 {
Rhyme 0:774324cbc5a6 33 const float coef_A = 0.089 ;
Rhyme 0:774324cbc5a6 34 const float coef_B = 0.831 ;
Rhyme 0:774324cbc5a6 35 float pressure ;
Rhyme 0:774324cbc5a6 36
Rhyme 0:774324cbc5a6 37 pressure = temp * coef_A + coef_B ;
Rhyme 0:774324cbc5a6 38 return( pressure ) ;
Rhyme 0:774324cbc5a6 39 }
Rhyme 0:774324cbc5a6 40
Rhyme 0:774324cbc5a6 41 edge_pressure::edge_pressure(PSE530 *pse, DigitalOut *en)
Rhyme 0:774324cbc5a6 42 {
Rhyme 0:774324cbc5a6 43 _pse = pse ;
Rhyme 0:774324cbc5a6 44 _en = en ;
Rhyme 0:774324cbc5a6 45 _value = 0.0 ;
Rhyme 0:774324cbc5a6 46 _interval = 30 ;
Rhyme 0:774324cbc5a6 47 _thr_mode = 0 ;
Rhyme 0:774324cbc5a6 48 _thr_high = HIGH_THR ;
Rhyme 0:774324cbc5a6 49 _thr_low = LOW_THR ;
Rhyme 0:774324cbc5a6 50 }
Rhyme 0:774324cbc5a6 51
Rhyme 0:774324cbc5a6 52 edge_pressure::~edge_pressure(void)
Rhyme 0:774324cbc5a6 53 {
Rhyme 0:774324cbc5a6 54 if (_pse) {
Rhyme 0:774324cbc5a6 55 delete _pse ;
Rhyme 0:774324cbc5a6 56 }
Rhyme 0:774324cbc5a6 57 _value = 0.0 ;
Rhyme 0:774324cbc5a6 58 }
Rhyme 0:774324cbc5a6 59
Rhyme 0:774324cbc5a6 60 float edge_pressure::get_value(void)
Rhyme 0:774324cbc5a6 61 {
Rhyme 0:774324cbc5a6 62 float value = 0.0 ;
Rhyme 0:774324cbc5a6 63 value = _pse->getPressure() ;
Rhyme 0:774324cbc5a6 64 return( value ) ;
Rhyme 0:774324cbc5a6 65 }
Rhyme 0:774324cbc5a6 66
Rhyme 0:774324cbc5a6 67 void edge_pressure::reset(void)
Rhyme 0:774324cbc5a6 68 {
Rhyme 0:774324cbc5a6 69 _value = 0.0 ;
Rhyme 0:774324cbc5a6 70 _sampled_time = 0 ;
Rhyme 0:774324cbc5a6 71 }
Rhyme 0:774324cbc5a6 72
Rhyme 0:774324cbc5a6 73 void edge_pressure::prepare(void)
Rhyme 0:774324cbc5a6 74 {
Rhyme 0:774324cbc5a6 75 }
Rhyme 0:774324cbc5a6 76
Rhyme 0:774324cbc5a6 77 int edge_pressure::sample(void)
Rhyme 0:774324cbc5a6 78 {
Rhyme 0:774324cbc5a6 79 int result = 0 ;
Rhyme 0:774324cbc5a6 80 *_en = 1 ; /* enable pressure sensor */
Rhyme 0:774324cbc5a6 81 wait_ms(30) ;
Rhyme 0:774324cbc5a6 82 _value = get_value() ;
Rhyme 0:774324cbc5a6 83 _sampled_time = edge_time ;
Rhyme 0:774324cbc5a6 84 *_en = 0 ; /* disable pressure sensor */
Rhyme 0:774324cbc5a6 85 wait_ms(10) ; /* to avoid power transition effect remaining */
Rhyme 0:774324cbc5a6 86 return( result ) ; /* this always success */
Rhyme 0:774324cbc5a6 87 }
Rhyme 0:774324cbc5a6 88
Rhyme 0:774324cbc5a6 89 void edge_pressure::set_thr_high(int16_t thr_high)
Rhyme 0:774324cbc5a6 90 {
Rhyme 0:774324cbc5a6 91 switch(_thr_mode) {
Rhyme 0:774324cbc5a6 92 case 0: /* absolute value */
Rhyme 0:774324cbc5a6 93 _thr_high = (float)thr_high/100.0 ;
Rhyme 0:774324cbc5a6 94 break ;
Rhyme 0:774324cbc5a6 95 case 1: /* persentage */
Rhyme 0:774324cbc5a6 96 _thr_high = (float)(thr_high/100.0) ;
Rhyme 0:774324cbc5a6 97 break ;
Rhyme 0:774324cbc5a6 98 default:
Rhyme 0:774324cbc5a6 99 printf("Unknown Threshold mode %d\n", _thr_mode) ;
Rhyme 0:774324cbc5a6 100 _thr_high = (float)thr_high/100.0 ;
Rhyme 0:774324cbc5a6 101 break ;
Rhyme 0:774324cbc5a6 102 }
Rhyme 0:774324cbc5a6 103 // printf("thr_high = %.3f\n", _thr_high) ;
Rhyme 0:774324cbc5a6 104 }
Rhyme 0:774324cbc5a6 105
Rhyme 0:774324cbc5a6 106 float edge_pressure::get_thr_high(float expected)
Rhyme 0:774324cbc5a6 107 {
Rhyme 0:774324cbc5a6 108 float thr_high ;
Rhyme 0:774324cbc5a6 109
Rhyme 0:774324cbc5a6 110 switch(_thr_mode) {
Rhyme 0:774324cbc5a6 111 case 0: /* absolute value */
Rhyme 0:774324cbc5a6 112 thr_high = expected + _thr_high ;
Rhyme 0:774324cbc5a6 113 break ;
Rhyme 0:774324cbc5a6 114 case 1: /* persentage */
Rhyme 0:774324cbc5a6 115 thr_high = expected * (1.0 + _thr_high) ;
Rhyme 0:774324cbc5a6 116 break ;
Rhyme 0:774324cbc5a6 117 default:
Rhyme 0:774324cbc5a6 118 printf("Unknown Threshold mode %d\n", _thr_mode) ;
Rhyme 0:774324cbc5a6 119 thr_high = expected + _thr_high ; /* use this as default */
Rhyme 0:774324cbc5a6 120 break ;
Rhyme 0:774324cbc5a6 121 }
Rhyme 0:774324cbc5a6 122 return (thr_high) ;
Rhyme 0:774324cbc5a6 123 }
Rhyme 0:774324cbc5a6 124
Rhyme 0:774324cbc5a6 125 void edge_pressure::set_thr_low(int16_t thr_low)
Rhyme 0:774324cbc5a6 126 {
Rhyme 0:774324cbc5a6 127 switch(_thr_mode) {
Rhyme 0:774324cbc5a6 128 case 0: /* absolute value */
Rhyme 0:774324cbc5a6 129 _thr_low = (float)thr_low/100.0 ;
Rhyme 0:774324cbc5a6 130 break ;
Rhyme 0:774324cbc5a6 131 case 1: /* persentage */
Rhyme 0:774324cbc5a6 132 _thr_low = (float)(thr_low/100.0) ;
Rhyme 0:774324cbc5a6 133 break ;
Rhyme 0:774324cbc5a6 134 default:
Rhyme 0:774324cbc5a6 135 printf("Unknown Threshold mode %d\n", _thr_mode) ;
Rhyme 0:774324cbc5a6 136 _thr_low = (float)thr_low/100.0 ;
Rhyme 0:774324cbc5a6 137 break ;
Rhyme 0:774324cbc5a6 138 }
Rhyme 0:774324cbc5a6 139 //printf("thr_low = %.3f\n", _thr_low) ;
Rhyme 0:774324cbc5a6 140 }
Rhyme 0:774324cbc5a6 141
Rhyme 0:774324cbc5a6 142 float edge_pressure::get_thr_low(float expected)
Rhyme 0:774324cbc5a6 143 {
Rhyme 0:774324cbc5a6 144 float thr_low ;
Rhyme 0:774324cbc5a6 145
Rhyme 0:774324cbc5a6 146 switch(_thr_mode) {
Rhyme 0:774324cbc5a6 147 case 0: /* absolute value */
Rhyme 0:774324cbc5a6 148 thr_low = expected - _thr_low ;
Rhyme 0:774324cbc5a6 149 break ;
Rhyme 0:774324cbc5a6 150 case 1: /* persentage */
Rhyme 0:774324cbc5a6 151 thr_low = expected * (1.0 - _thr_low) ;
Rhyme 0:774324cbc5a6 152 break ;
Rhyme 0:774324cbc5a6 153 default:
Rhyme 0:774324cbc5a6 154 printf("Unknown Threshold mode %d\n", _thr_mode) ;
Rhyme 0:774324cbc5a6 155 thr_low = expected + _thr_low ; /* use this as default */
Rhyme 0:774324cbc5a6 156 break ;
Rhyme 0:774324cbc5a6 157 }
Rhyme 0:774324cbc5a6 158 return (thr_low) ;
Rhyme 0:774324cbc5a6 159 }
Rhyme 0:774324cbc5a6 160
Rhyme 0:774324cbc5a6 161 int edge_pressure::deliver(void)
Rhyme 0:774324cbc5a6 162 {
Rhyme 0:774324cbc5a6 163 char str_buf[32] ;
Rhyme 0:774324cbc5a6 164 char timestr[16] ;
Rhyme 0:774324cbc5a6 165 int result ;
Rhyme 0:774324cbc5a6 166
Rhyme 0:774324cbc5a6 167 reset_watch_dog() ;
Rhyme 0:774324cbc5a6 168 print_time(_sampled_time) ;
Rhyme 0:774324cbc5a6 169 if (current_temp != 0) {
Rhyme 0:774324cbc5a6 170 sprintf(str_buf, "GAS: %.3f kgf/cm2 @ %.1fC", _value, *current_temp ) ;
Rhyme 0:774324cbc5a6 171 } else {
Rhyme 0:774324cbc5a6 172 sprintf(str_buf, "GAS: %.3f kgf/cm2", _value ) ;
Rhyme 0:774324cbc5a6 173 }
Rhyme 0:774324cbc5a6 174 printf(" ") ;
Rhyme 0:774324cbc5a6 175 printf(str_buf) ;
Rhyme 0:774324cbc5a6 176
Rhyme 0:774324cbc5a6 177 if (current_temp != 0) {
Rhyme 0:774324cbc5a6 178 reset_watch_dog() ;
Rhyme 0:774324cbc5a6 179 _expected = temp2expected(*current_temp) ;
Rhyme 0:774324cbc5a6 180 _higher = get_thr_high(_expected) ;
Rhyme 0:774324cbc5a6 181 _lower = get_thr_low(_expected) ;
Rhyme 0:774324cbc5a6 182 printf(" (%.3f, %.3f) ", _higher, _lower) ;
Rhyme 0:774324cbc5a6 183 }
Rhyme 0:774324cbc5a6 184
Rhyme 0:774324cbc5a6 185 reset_watch_dog() ;
Rhyme 0:774324cbc5a6 186 printf(" %s\n", str_buf) ;
Rhyme 0:774324cbc5a6 187 time2seq(_sampled_time, timestr) ;
Rhyme 0:774324cbc5a6 188 // printf(str_buf) ;
Rhyme 0:774324cbc5a6 189 // printf("\n") ;
Rhyme 0:774324cbc5a6 190 sprintf(_str_buf,
Rhyme 0:774324cbc5a6 191 "{\"DEVICE\":\"PRESS\",\"PN\":\"PSE530\",\"VAL\":\"%.3f\",\"UNIT\":\"kgf/cm2\",\"T\":\"%s\",\"E\":\"%d\"}",
Rhyme 0:774324cbc5a6 192 _value, timestr, _error_count) ;
Rhyme 0:774324cbc5a6 193 reset_watch_dog() ;
Rhyme 0:774324cbc5a6 194 result = afero->setAttribute(1, _str_buf) ;
Rhyme 0:774324cbc5a6 195 return( result == afSUCCESS ) ;
Rhyme 0:774324cbc5a6 196 }
Rhyme 0:774324cbc5a6 197
Rhyme 0:774324cbc5a6 198 int v2x(float value)
Rhyme 0:774324cbc5a6 199 {
Rhyme 0:774324cbc5a6 200 int result ;
Rhyme 0:774324cbc5a6 201 if (value < 0) {
Rhyme 0:774324cbc5a6 202 result = 20 ;
Rhyme 0:774324cbc5a6 203 } else if (value > 4) {
Rhyme 0:774324cbc5a6 204 result = 300 ;
Rhyme 0:774324cbc5a6 205 } else {
Rhyme 0:774324cbc5a6 206 result = 20 + (int)(70 * value + 0.5) ;
Rhyme 0:774324cbc5a6 207 }
Rhyme 0:774324cbc5a6 208 return( result ) ;
Rhyme 0:774324cbc5a6 209 }
Rhyme 0:774324cbc5a6 210
Rhyme 0:774324cbc5a6 211 int press_v2y(float value, edge_chart_type *p)
Rhyme 0:774324cbc5a6 212 {
Rhyme 0:774324cbc5a6 213 int y ;
Rhyme 0:774324cbc5a6 214 if (value < p->min) {
Rhyme 0:774324cbc5a6 215 value = p->min ;
Rhyme 0:774324cbc5a6 216 } else if (value > p->max) {
Rhyme 0:774324cbc5a6 217 value = p->max ;
Rhyme 0:774324cbc5a6 218 }
Rhyme 0:774324cbc5a6 219 y = p->top + p->height - 2
Rhyme 0:774324cbc5a6 220 - (int)((p->height - 2) * ((value - p->min) /(p->max - p->min))) ;
Rhyme 0:774324cbc5a6 221 return( y ) ;
Rhyme 0:774324cbc5a6 222 }
Rhyme 0:774324cbc5a6 223
Rhyme 0:774324cbc5a6 224 /**
Rhyme 0:774324cbc5a6 225 * drawPointer
Rhyme 0:774324cbc5a6 226 *
Rhyme 0:774324cbc5a6 227 * draw a triangle pointer at value place
Rhyme 0:774324cbc5a6 228 * in GAS pressure display mode
Rhyme 0:774324cbc5a6 229 */
Rhyme 0:774324cbc5a6 230 void edge_pressure::drawPointer(int c)
Rhyme 0:774324cbc5a6 231 {
Rhyme 0:774324cbc5a6 232 float delta_x ;
Rhyme 0:774324cbc5a6 233 int x[2], y, i ;
Rhyme 0:774324cbc5a6 234 const int top = 75 ;
Rhyme 0:774324cbc5a6 235 const int pointer_height = 15 ;
Rhyme 0:774324cbc5a6 236 for (i = 0 ; i < pointer_height ; i++ ) {
Rhyme 0:774324cbc5a6 237 y = top + i ;
Rhyme 0:774324cbc5a6 238 delta_x = i * 5.0 / 8.0 ;
Rhyme 0:774324cbc5a6 239 x[0] = c - delta_x ;
Rhyme 0:774324cbc5a6 240 x[1] = c + delta_x ;
Rhyme 0:774324cbc5a6 241 display->line(x[0], y, x[1], y, White) ;
Rhyme 0:774324cbc5a6 242 }
Rhyme 0:774324cbc5a6 243 }
Rhyme 0:774324cbc5a6 244
Rhyme 0:774324cbc5a6 245 void edge_pressure::show(void)
Rhyme 0:774324cbc5a6 246 {
Rhyme 0:774324cbc5a6 247 edge_chart_type *p = &edge_chart[ _id ] ;
Rhyme 0:774324cbc5a6 248 uint16_t color = White ;
Rhyme 0:774324cbc5a6 249 char str_buf[32] ;
Rhyme 0:774324cbc5a6 250 int i, x, y, l, r, c, str_x ;
Rhyme 0:774324cbc5a6 251 if (display) {
Rhyme 0:774324cbc5a6 252 reset_watch_dog() ;
Rhyme 0:774324cbc5a6 253 /* for debug */
Rhyme 0:774324cbc5a6 254 // _value = _lower - 0.5 ; /* LOW */
Rhyme 0:774324cbc5a6 255 // _value = (_higher + _lower) / 2 ; /* GOOD */
Rhyme 0:774324cbc5a6 256 // _value = _higher + 0.2 ; /* HIGH */
Rhyme 0:774324cbc5a6 257
Rhyme 0:774324cbc5a6 258 if (_value > _higher) {
Rhyme 0:774324cbc5a6 259 sprintf(str_buf, "HIGH") ;
Rhyme 0:774324cbc5a6 260 color = Red ;
Rhyme 0:774324cbc5a6 261 str_x = 60 ;
Rhyme 0:774324cbc5a6 262 } else if (_value < _lower) {
Rhyme 0:774324cbc5a6 263 sprintf(str_buf, "LOW") ;
Rhyme 0:774324cbc5a6 264 color = Yellow ;
Rhyme 0:774324cbc5a6 265 str_x = 60 ;
Rhyme 0:774324cbc5a6 266 } else {
Rhyme 0:774324cbc5a6 267 sprintf(str_buf, "GOOD") ;
Rhyme 0:774324cbc5a6 268 color = Green ;
Rhyme 0:774324cbc5a6 269 str_x = 35 ;
Rhyme 0:774324cbc5a6 270 }
Rhyme 0:774324cbc5a6 271 switch(display_mode) {
Rhyme 0:774324cbc5a6 272 case DISPLAY_MODE_GAS:
Rhyme 0:774324cbc5a6 273 display->BusEnable(true) ;
Rhyme 0:774324cbc5a6 274 display->cls() ;
Rhyme 0:774324cbc5a6 275 /* printf frame */
Rhyme 0:774324cbc5a6 276 display->foreground(White) ;
Rhyme 0:774324cbc5a6 277 display->line(20, 75, 300, 75, White) ;
Rhyme 0:774324cbc5a6 278 for (i = 0 ; i <= 8 ; i++ ) {
Rhyme 0:774324cbc5a6 279 x = 20 + i * 35 ;
Rhyme 0:774324cbc5a6 280 if (i & 0x01) { /* odd */
Rhyme 0:774324cbc5a6 281 display->line(x, 55, x, 95, White) ;
Rhyme 0:774324cbc5a6 282 } else { /* even */
Rhyme 0:774324cbc5a6 283 display->line(x, 45, x, 105, White) ;
Rhyme 0:774324cbc5a6 284 }
Rhyme 0:774324cbc5a6 285 }
Rhyme 0:774324cbc5a6 286 display->set_font((unsigned char*) Arial28x28);
Rhyme 0:774324cbc5a6 287 for (i = 0 ; i <= 4 ; i++ ) {
Rhyme 0:774324cbc5a6 288 x = 12 + i * 70 ;
Rhyme 0:774324cbc5a6 289 display->locate(x, 10) ;
Rhyme 0:774324cbc5a6 290 display->printf("%d", i) ;
Rhyme 0:774324cbc5a6 291 }
Rhyme 0:774324cbc5a6 292 /* print expected area and current pressure */
Rhyme 0:774324cbc5a6 293 l = v2x(_lower) ;
Rhyme 0:774324cbc5a6 294 r = v2x(_higher) ;
Rhyme 0:774324cbc5a6 295 c = v2x(_value) ;
Rhyme 0:774324cbc5a6 296 // display->fillrect(l, 70, r, 80, Red) ;
Rhyme 0:774324cbc5a6 297 display->fillrect(l, 65, r, 74, Red) ;
Rhyme 0:774324cbc5a6 298 // display->fillcircle(c, 75, 10, White) ;
Rhyme 0:774324cbc5a6 299 drawPointer(c) ;
Rhyme 0:774324cbc5a6 300
Rhyme 0:774324cbc5a6 301 /* print status */
Rhyme 0:774324cbc5a6 302 display->locate(str_x, 140) ;
Rhyme 0:774324cbc5a6 303 display->set_font_zoom(3, 3) ;
Rhyme 0:774324cbc5a6 304 display->foreground(color) ;
Rhyme 0:774324cbc5a6 305 display->printf(str_buf) ;
Rhyme 0:774324cbc5a6 306 display->set_font_zoom(1, 1) ;
Rhyme 0:774324cbc5a6 307 display->BusEnable(false) ;
Rhyme 0:774324cbc5a6 308 break ;
Rhyme 0:774324cbc5a6 309 case DISPLAY_MODE_SUMMARY:
Rhyme 0:774324cbc5a6 310 display->BusEnable(true) ;
Rhyme 0:774324cbc5a6 311 display->set_font((unsigned char*) Arial12x12);
Rhyme 0:774324cbc5a6 312 display->set_font_zoom(2, 2) ;
Rhyme 0:774324cbc5a6 313 display->foreground(White) ;
Rhyme 0:774324cbc5a6 314 display->locate(10, EDGE_SUMMARY_TIME_Y) ;
Rhyme 0:774324cbc5a6 315 displayTime(_sampled_time) ;
Rhyme 0:774324cbc5a6 316 // display->locate(10,50) ;
Rhyme 0:774324cbc5a6 317 // display->printf(timestr) ;
Rhyme 0:774324cbc5a6 318 display->locate(10, EDGE_SUMMARY_PRESS_Y) ;
Rhyme 0:774324cbc5a6 319 display->printf("Press: ") ;
Rhyme 0:774324cbc5a6 320 display->foreground(color) ;
Rhyme 0:774324cbc5a6 321 display->locate(90, EDGE_SUMMARY_PRESS_Y) ;
Rhyme 0:774324cbc5a6 322 display->printf("%.3f ", _value) ;
Rhyme 0:774324cbc5a6 323 display->foreground(White) ;
Rhyme 0:774324cbc5a6 324 display->printf("kgf/cm2") ;
Rhyme 0:774324cbc5a6 325 display->BusEnable(false) ;
Rhyme 0:774324cbc5a6 326 break ;
Rhyme 0:774324cbc5a6 327 case DISPLAY_MODE_CHART:
Rhyme 0:774324cbc5a6 328 x = p->left + p->index + 1;
Rhyme 0:774324cbc5a6 329 y = press_v2y(_value, p) ;
Rhyme 0:774324cbc5a6 330 display->BusEnable(true) ;
Rhyme 0:774324cbc5a6 331 if (p->index == 0) {
Rhyme 0:774324cbc5a6 332 draw_chart_frame(p) ;
Rhyme 0:774324cbc5a6 333 }
Rhyme 0:774324cbc5a6 334 display->foreground(color) ;
Rhyme 0:774324cbc5a6 335 display->pixel(x, y, color) ;
Rhyme 0:774324cbc5a6 336 display->set_font((unsigned char*) Arial12x12);
Rhyme 0:774324cbc5a6 337 display->locate(p->left + 40, p->top + 5) ;
Rhyme 0:774324cbc5a6 338 display->printf("%5s", str_buf) ;
Rhyme 0:774324cbc5a6 339 display->foreground(White) ;
Rhyme 0:774324cbc5a6 340 display->BusEnable(false) ;
Rhyme 0:774324cbc5a6 341 p->index = (p->index + 1) % (p->width - 2) ;
Rhyme 0:774324cbc5a6 342 break ;
Rhyme 0:774324cbc5a6 343 }
Rhyme 0:774324cbc5a6 344 }
Rhyme 0:774324cbc5a6 345 reset_watch_dog() ;
Rhyme 0:774324cbc5a6 346 }