update with altimeter, swimfile.txt endleg.txt, etc see changes_13sep.txt also reset_PI()
Dependencies: mbed MODSERIAL FATFileSystem
Diff: Sensors/Sensors.cpp
- Revision:
- 73:f6f378311c8d
- Child:
- 74:d281aaef9766
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sensors/Sensors.cpp Mon Jul 30 16:48:48 2018 +0000 @@ -0,0 +1,24 @@ +#include "Sensors.hpp" +#include "StaticDefs.hpp" + +Sensors::Sensors() { + _reference_voltage = 5.0; //check this against actual v_ref +} + + // extrapolated from graph if V_s = 5.0 + // https://www.nxp.com/docs/en/data-sheet/MPXA6115A.pdf +float Sensors::getInternalPressurePSI() { + return ( ( 22.029 * ( _reference_voltage * adc().readCh5() / 4095.0 ) + 10.884 ) * 0.145038 ); // Press_Xducer (on-board) +} + +float Sensors::getVoltageInput() { + return ( adc().readCh6() / 4095.0 * _reference_voltage * 7.8 ); +} + +float Sensors::getCurrentInput() { + return ( adc().readCh7() / 4095.0 * _reference_voltage ); +} + +float Sensors::getAltimeterChannelReadings() { + return adc().readCh5(); +} \ No newline at end of file