mirror of https://github.com/rusefi/wideband.git
Gain vs loss confusion (#304)
This commit is contained in:
parent
72d5a0dc06
commit
94f2377bca
|
@ -45,7 +45,7 @@ AnalogResult AnalogSample()
|
|||
.ch =
|
||||
{
|
||||
{
|
||||
.NernstVoltage = AverageSamples(adcBuffer, 0) * NERNST_INPUT_GAIN,
|
||||
.NernstVoltage = AverageSamples(adcBuffer, 0) * (1.0 / NERNST_INPUT_GAIN),
|
||||
.PumpCurrentVoltage = AverageSamples(adcBuffer, 1),
|
||||
.BatteryVoltage = 0,
|
||||
},
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// *******************************
|
||||
// Nernst voltage & ESR sense
|
||||
// *******************************
|
||||
#define NERNST_INPUT_GAIN (1 / 2.7f)
|
||||
#define NERNST_INPUT_GAIN (2.7f)
|
||||
|
||||
#define AFR_CHANNELS 1
|
||||
|
||||
|
|
|
@ -109,13 +109,13 @@ AnalogResult AnalogSample()
|
|||
.ch = {
|
||||
{
|
||||
/* left */
|
||||
.NernstVoltage = AverageSamples(adcBuffer, 3) * NERNST_INPUT_GAIN,
|
||||
.NernstVoltage = AverageSamples(adcBuffer, 3) * (1.0 / NERNST_INPUT_GAIN),
|
||||
.PumpCurrentVoltage = AverageSamples(adcBuffer, 2),
|
||||
.BatteryVoltage = l_heater_voltage,
|
||||
},
|
||||
{
|
||||
/* right */
|
||||
.NernstVoltage = AverageSamples(adcBuffer, 1) * NERNST_INPUT_GAIN,
|
||||
.NernstVoltage = AverageSamples(adcBuffer, 1) * (1.0 / NERNST_INPUT_GAIN),
|
||||
.PumpCurrentVoltage = AverageSamples(adcBuffer, 0),
|
||||
.BatteryVoltage = r_heater_voltage,
|
||||
},
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
// *******************************
|
||||
// Nernst voltage & ESR sense
|
||||
// *******************************
|
||||
#define NERNST_INPUT_GAIN (1 / 3.0f)
|
||||
#define NERNST_INPUT_GAIN (3.0f)
|
||||
|
||||
// *******************************
|
||||
// Battery Sensing
|
||||
|
|
|
@ -127,7 +127,7 @@ AnalogResult AnalogSample()
|
|||
float NernstRaw = AverageSamples(adcBuffer, (i == 0) ? 3 : 1);
|
||||
if ((NernstRaw > 0.01) && (NernstRaw < (3.3 - 0.01))) {
|
||||
/* not clamped */
|
||||
res.ch[i].NernstVoltage = (NernstRaw - NERNST_INPUT_OFFSET) * NERNST_INPUT_GAIN;
|
||||
res.ch[i].NernstVoltage = (NernstRaw - NERNST_INPUT_OFFSET) * (1.0 / NERNST_INPUT_GAIN);
|
||||
} else {
|
||||
/* Clamped, use ungained input */
|
||||
res.ch[i].NernstVoltage = AverageSamples(adcBuffer, (i == 0) ? 9 : 8) - HALF_VCC;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// *******************************
|
||||
// Nernst voltage & ESR sense
|
||||
// *******************************
|
||||
#define NERNST_INPUT_GAIN (1 / 3.15f)
|
||||
#define NERNST_INPUT_GAIN (3.15f)
|
||||
#define NERNST_INPUT_OFFSET (0.247)
|
||||
|
||||
// *******************************
|
||||
|
|
|
@ -62,7 +62,7 @@ AnalogResult AnalogSample()
|
|||
{
|
||||
.ch = {
|
||||
{
|
||||
.NernstVoltage = AverageSamples(adcBuffer, 2) * NERNST_INPUT_GAIN,
|
||||
.NernstVoltage = AverageSamples(adcBuffer, 2) * (1.0 / NERNST_INPUT_GAIN),
|
||||
.PumpCurrentVoltage = AverageSamples(adcBuffer, 1),
|
||||
/* We also can measure output virtual ground voltage for diagnostic purposes */
|
||||
//.VirtualGroundVoltageExt = AverageSamples(adcBuffer, 0) / VM_INPUT_DIVIDER,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// *******************************
|
||||
// Nernst voltage & ESR sense
|
||||
// *******************************
|
||||
#define NERNST_INPUT_GAIN (1 / 3.0f)
|
||||
#define NERNST_INPUT_GAIN (3.0f)
|
||||
|
||||
// *******************************
|
||||
// Battery Sensing
|
||||
|
|
|
@ -59,7 +59,7 @@ AnalogResult AnalogSample()
|
|||
{
|
||||
.ch = {
|
||||
{
|
||||
.NernstVoltage = AverageSamples(adcBuffer, 2) * NERNST_INPUT_GAIN,
|
||||
.NernstVoltage = AverageSamples(adcBuffer, 2) * (1.0 / NERNST_INPUT_GAIN),
|
||||
.PumpCurrentVoltage = AverageSamples(adcBuffer, 1),
|
||||
/* We also can measure output virtual ground voltage for diagnostic purposes */
|
||||
//.VirtualGroundVoltageExt = AverageSamples(adcBuffer, 0) / VM_INPUT_DIVIDER,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// *******************************
|
||||
// Nernst voltage & ESR sense
|
||||
// *******************************
|
||||
#define NERNST_INPUT_GAIN (1 / 3.0f)
|
||||
#define NERNST_INPUT_GAIN (3.0f)
|
||||
|
||||
// *******************************
|
||||
// Battery Sensing
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// *******************************
|
||||
// Nernst voltage & ESR sense
|
||||
// *******************************
|
||||
#define NERNST_INPUT_GAIN (1 / 2.7f)
|
||||
#define NERNST_INPUT_GAIN (2.7f)
|
||||
|
||||
#define AFR_CHANNELS 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue