Correct adc gain

This commit is contained in:
Ben V. Brown
2022-05-23 19:34:33 +10:00
parent 4e95cb47a7
commit 226750df4c
6 changed files with 18 additions and 25 deletions

View File

@@ -9,6 +9,7 @@
#include "BSP.h"
#include "Settings.h"
#include "Utils.h"
#include "configuration.h"
#include "main.hpp"
#include "power.hpp"
/*
@@ -32,7 +33,7 @@ uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC, bool ski
// This takes the raw ADC samples, converts these to uV
// Then divides this down by the gain to convert to the uV on the input to the op-amp (A+B terminals)
// Then remove the calibration value that is stored as a tip offset
uint32_t vddRailmVX10 = 33000; // The vreg is +-2%, but we have no higher accuracy available
uint32_t vddRailmVX10 = ADC_VDD_MV * 10; // The vreg is +-2%, but we have no higher accuracy available
// 4096 * 8 readings for full scale
// Convert the input ADC reading back into mV times 10 format.
uint32_t rawInputmVX10 = (rawADC * vddRailmVX10) / (4096 * 8);