hellen on a bike: both TS and SD card logs report -32v on secondary TPS and secondary PPS #6376

only:saving sensorVolts
This commit is contained in:
Andrey 2024-04-21 20:38:55 -04:00 committed by rusefillc
parent f7ea2e68f8
commit 5a0761f533
4 changed files with 17 additions and 1 deletions

View File

@ -184,6 +184,8 @@ int16_t rpmAcceleration;dRPM;"RPM acceleration",1, 0, 0, 5, 2
uint8_t fuelClosedLoopBinIdx;;"", 1, 0, 0, 0, 0
int16_t autoscale rawPpsSecondary;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale rawRawPpsPrimary;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale rawRawPpsSecondary;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale idlePositionSensor;@@GAUGE_NAME_IDLE_POSITION@@;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2

View File

@ -391,6 +391,8 @@ static void updateTempSensors() {
engine->outputChannels.compressorDischargeTemp = compressorDischargeTemp.value_or(0);
}
void updateUnfilteredRawPedal();
static void updateThrottles() {
SensorResult tps1 = Sensor::get(SensorType::Tps1);
engine->outputChannels.TPSValue = tps1.value_or(0);
@ -415,6 +417,7 @@ static void updateThrottles() {
engine->outputChannels.tps12Split = Sensor::getOrZero(SensorType::Tps1) - Sensor::getOrZero(SensorType::Tps2);
// Pedal pri/sec split
engine->outputChannels.accPedalSplit = Sensor::getOrZero(SensorType::AcceleratorPedalPrimary) - Sensor::getOrZero(SensorType::AcceleratorPedalSecondary);
updateUnfilteredRawPedal();
}
static void updateLambda() {

View File

@ -11,6 +11,7 @@
struct AdcSubscriptionEntry {
FunctionalSensor *Sensor;
float VoltsPerAdcVolt;
// raw voltage before we apply biquad filter
float sensorVolts;
Biquad Filter;
adc_channel_e Channel;

View File

@ -20,6 +20,7 @@ struct TpsConfig {
class FuncSensPair {
public:
AdcSubscriptionEntry *adc = nullptr;
FuncSensPair(float divideInput, SensorType type)
: m_func(divideInput)
, m_sens(type, MS2NT(10))
@ -34,7 +35,7 @@ public:
}
float lowpassCutoffHz = engineConfiguration->magicNumberAvailableForDevTricks > 3 ? engineConfiguration->magicNumberAvailableForDevTricks : 200;
AdcSubscription::SubscribeSensor(m_sens, cfg.channel, lowpassCutoffHz);
adc = AdcSubscription::SubscribeSensor(m_sens, cfg.channel, lowpassCutoffHz);
return m_sens.Register();
}
@ -151,6 +152,11 @@ printf("init m_redund.Register() %s\n", getSensorType(m_redund.type()));
}
void updateUnfilteredRawValues() {
engine->outputChannels.rawRawPpsPrimary = m_pri.adc == nullptr ? 0 : m_pri.adc->sensorVolts;
engine->outputChannels.rawRawPpsSecondary = m_sec.adc == nullptr ? 0 : m_sec.adc->sensorVolts;
}
private:
FuncSensPair& m_pri;
FuncSensPair& m_sec;
@ -179,6 +185,10 @@ static FuncSensPair pedalPrimary(1, SensorType::AcceleratorPedalPrimary);
static FuncSensPair pedalSecondary(1, SensorType::AcceleratorPedalSecondary);
static RedundantPair pedal(pedalPrimary, pedalSecondary, SensorType::AcceleratorPedal);
void updateUnfilteredRawPedal() {
pedal.updateUnfilteredRawValues();
}
// This sensor indicates the driver's throttle intent - Pedal if we have one, TPS if not.
static ProxySensor driverIntent(SensorType::DriverThrottleIntent);