void show() { if(++swcnt > (sw?10:30)) { swcnt = 0; sw++; sw &= 3; } switch(sw) { case 0: get_time(); putchr(0,(hour+dst)/10); putchr(1,(hour+dst)%10); putchr(2,minute/10); putchr(3,minute%10); break; case 1: if(swcnt == 0) { temp = readTemperature() / 10; } putchr(2,temp%10); t = temp / 10; putchr(0,t/10); putchr(1,t%10); putchr(3,0x0c); break; case 2: if(swcnt == 0) { hum = readHumidity() * 5 / 512; } putchr(2,hum%10); t = hum / 10; putchr(0,t/10); putchr(1,t%10); dsp_buf[3] = chrH; break; case 3: if(swcnt == 0) { pres = readPressure() / 100; } t = pres; if(t > 999) { putchr(3,t%10); t /= 10; putchr(2,t%10); t /= 10; putchr(1,t%10); t /= 10; putchr(0,t); } else { dsp_buf[0] = chrP; putchr(3,t%10); t /= 10; putchr(2,t%10); t /= 10; putchr(1,t%10); } break; default:; } }
float ZUNO_BMP180::readAltitude(float sealevelPressure) { float altitude; float pressure = readPressure(); altitude = 44330 * (1.0 - pow(pressure /sealevelPressure,0.1903)); return altitude; }
/** Perform pressure and temperature reading and calculation at once. * Contains sleeps, better perform operations separately. */ void MS5611::update() { refreshPressure(); usleep(10000); // Waiting for pressure data ready readPressure(); refreshTemperature(); usleep(10000); // Waiting for temperature data ready readTemperature(); calculatePressureAndTemperature(); }
bool SensorReadBARO() { #if STACK_BARO #ifdef BMP085 if(SensorInitState.BARO_BRAND==BMP085) { if((getTickCount()>BaroDoTick)) { BaroDoTick = getTickCount() + 6; if(BaroDoState==0) { Sensor.rawBARO[1] = Sensor.BaroInfo.baroTemperature = readRawTemperature();// - (28262-3534); TriggerRawPressure(); Baro_Common(); BaroDoTick = getTickCount() + 21; BaroDoState = 1; return false; } else { Sensor.rawBARO[0] = readRawPressure() - SensorInitState.BARO_BasePressure; Sensor.BaroInfo.baroPressure = readPressure(); TriggerRawTemperature(); BaroDoState = 0; return true; } } else return false; } else #endif static float temperature,pressure,BaroAlt; bool beUpdate; beUpdate = BMP280_GetData(&pressure, &temperature, &BaroAlt);;//TBM if(beUpdate) { Sensor.rawBARO[0] = Sensor.BaroInfo.baroPressure = pressure; Sensor.rawBARO[1] = Sensor.BaroInfo.baroTemperature = temperature; Baro_Common(); } return beUpdate; #else return false; #endif }
/* * Fetch values from the sensor */ void SCP1000::readSensor() { readTemperature(); readPressure(); }
void update() { readPressure(); }