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 "SMTC502AT.h"
Rhyme 0:774324cbc5a6 3
Rhyme 0:774324cbc5a6 4 SMTC502AT::SMTC502AT(AnalogIn *ain, float R0, float R1, float B, float T0)
Rhyme 0:774324cbc5a6 5 {
Rhyme 0:774324cbc5a6 6 _ain = ain ;
Rhyme 0:774324cbc5a6 7 _r0 = R0 ;
Rhyme 0:774324cbc5a6 8 _r1 = R1 ;
Rhyme 0:774324cbc5a6 9 _b = B ;
Rhyme 0:774324cbc5a6 10 _t0 = T0 ;
Rhyme 0:774324cbc5a6 11 }
Rhyme 0:774324cbc5a6 12
Rhyme 0:774324cbc5a6 13 SMTC502AT::~SMTC502AT(void)
Rhyme 0:774324cbc5a6 14 {
Rhyme 0:774324cbc5a6 15 if (_ain) {
Rhyme 0:774324cbc5a6 16 delete _ain ;
Rhyme 0:774324cbc5a6 17 }
Rhyme 0:774324cbc5a6 18 }
Rhyme 0:774324cbc5a6 19
Rhyme 0:774324cbc5a6 20 /**
Rhyme 0:774324cbc5a6 21 * getTemp returns the temperature
Rhyme 0:774324cbc5a6 22 * operational temperature is -50C to +105C
Rhyme 0:774324cbc5a6 23 */
Rhyme 0:774324cbc5a6 24 float SMTC502AT::getTemp(void)
Rhyme 0:774324cbc5a6 25 {
Rhyme 0:774324cbc5a6 26 float result = 0.0 ;
Rhyme 0:774324cbc5a6 27 float f, raw, rr1, t ;
Rhyme 0:774324cbc5a6 28 if (_ain) {
Rhyme 0:774324cbc5a6 29 f = _ain->read() ;
Rhyme 0:774324cbc5a6 30 #if 0
Rhyme 0:774324cbc5a6 31 if (f < 0.087) { /* +105C */
Rhyme 0:774324cbc5a6 32 printf("Temp is Too high or the sensor is absent\n") ;
Rhyme 0:774324cbc5a6 33 f = 0.087 ;
Rhyme 0:774324cbc5a6 34 }
Rhyme 0:774324cbc5a6 35 if (f > 0.978) { /* -50C */
Rhyme 0:774324cbc5a6 36 printf("Temp is Too low or the sensor encountered a problem\n") ;
Rhyme 0:774324cbc5a6 37 f = 0.978 ;
Rhyme 0:774324cbc5a6 38 }
Rhyme 0:774324cbc5a6 39 #endif
Rhyme 0:774324cbc5a6 40 raw = f * 3.3 ;
Rhyme 0:774324cbc5a6 41 rr1 = _r1 * raw / (3.3 - raw) ;
Rhyme 0:774324cbc5a6 42 t = 1.0 / (log(rr1 / _r0) / _b + (1/_t0)) ;
Rhyme 0:774324cbc5a6 43 result = t - 273.15 ;
Rhyme 0:774324cbc5a6 44 }
Rhyme 0:774324cbc5a6 45 return( result ) ;
Rhyme 0:774324cbc5a6 46 }
Rhyme 0:774324cbc5a6 47