Abstraction for the glider class
Diff: Glider.cpp
- Revision:
- 14:a226bedae730
- Parent:
- 13:d95070aa9140
- Child:
- 15:5fea9af1cdb7
--- a/Glider.cpp Sat Apr 29 21:27:57 2017 +0000 +++ b/Glider.cpp Tue May 02 00:38:48 2017 +0000 @@ -1,6 +1,6 @@ #include "Glider.h" -Glider::Glider(Serial* device, PinName sda, PinName scl, PinName tx, PinName rx) : xbeeRxInt(rx), pitot(p15), buzzer(p26) { +Glider::Glider(Serial* device, PinName sda, PinName scl, PinName tx, PinName rx) : xbeeRxInt(rx), pitot(p15), solVoltIn(p16), buzzer(p26) { dev = device; dev->printf("constructing glider..."); initSaveData(); @@ -34,6 +34,11 @@ this->speed = sqrt((2*diffPressure) / AIR_DENSITY); } +void Glider::setSolarVoltage() { + solarVoltage = solVoltIn.read_u16() * PITO_ADC_RATIO; + solarVoltage = solarVoltage / SOLAR_V_DIVIDER; +} + void Glider::setMissionTime() { this->missionTime = time(NULL) - this->startTime; //duration = current tome - start time } @@ -42,6 +47,7 @@ setHeading(); setTempPressAlt(); setAirSpeed(); + setSolarVoltage(); setMissionTime(); }