diff --git a/src/boards/Main/Sensors/Sensors.cpp b/src/boards/Main/Sensors/Sensors.cpp index ca3800db5ce3623bf6af10f5836cc95fb31c35dd..84d0e8fe31cd5079acd83c2bd5323168a05c7a25 100644 --- a/src/boards/Main/Sensors/Sensors.cpp +++ b/src/boards/Main/Sensors/Sensors.cpp @@ -495,8 +495,15 @@ void Sensors::ads131m04Init() void Sensors::staticPressureInit() { - function<ADCData()> getVoltage( - bind(&ADS131M04::getVoltage, ads131m04, ADC_CH_STATIC_PORT)); + function<ADCData()> getVoltage = [&]() + { + auto data = ads131m04->getVoltage(ADC_CH_STATIC_PORT); + + // Account for the voltage divider with 10K and 2.31K + data.voltage = data.voltage * (10 + 2.31) / 2.31; + + return data; + }; staticPressure = new MPXH6115A(getVoltage, REFERENCE_VOLTAGE); @@ -518,8 +525,15 @@ void Sensors::staticPressureInit() void Sensors::dplPressureInit() { - function<ADCData()> getVoltage( - bind(&ADS131M04::getVoltage, ads131m04, ADC_CH_DPL_PORT)); + function<ADCData()> getVoltage = [&]() + { + auto data = ads131m04->getVoltage(ADC_CH_DPL_PORT); + + // Account for the voltage divider with 10K and 2.31K + data.voltage = data.voltage * (10 + 2.31) / 2.31; + + return data; + }; dplPressure = new MPXH6400A(getVoltage, REFERENCE_VOLTAGE);