Consume new tps in status_loop.cpp, settings.cpp (#1129)
* new tps * more * settings.cpp too * more * comment
This commit is contained in:
parent
d67db19a3c
commit
f7282966d2
|
@ -209,8 +209,10 @@ static void printSensors(Logging *log) {
|
|||
if (hasCltSensor()) {
|
||||
reportSensorF(log, "CLT", "C", getCoolantTemperature(), 2); // log column #4
|
||||
}
|
||||
if (hasTpsSensor()) {
|
||||
reportSensorF(log, "TPS", "%", getTPS(PASS_ENGINE_PARAMETER_SIGNATURE), 2); // log column #5
|
||||
|
||||
SensorResult tps = Sensor::get(SensorType::Tps1);
|
||||
if (tps) {
|
||||
reportSensorF(log, "TPS", "%", tps.Value, 2); // log column #5
|
||||
}
|
||||
|
||||
if (hasIatSensor()) {
|
||||
|
@ -704,7 +706,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
executorStatistics();
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
float tps = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
float coolant = getCoolantTemperature();
|
||||
float intake = getIntakeAirTemperature();
|
||||
|
||||
|
@ -719,8 +720,12 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
tsOutputChannels->coolantTemperature = coolant;
|
||||
// offset 8
|
||||
tsOutputChannels->intakeAirTemperature = intake;
|
||||
// offset 12
|
||||
tsOutputChannels->throttlePosition = tps;
|
||||
|
||||
SensorResult tps = Sensor::get(SensorType::Tps1);
|
||||
tsOutputChannels->throttlePosition = tps.Value;
|
||||
tsOutputChannels->isTpsError = !tps.Valid;
|
||||
tsOutputChannels->tpsADC = convertVoltageTo10bitADC(Sensor::getRaw(SensorType::Tps1));
|
||||
|
||||
// offset 16
|
||||
tsOutputChannels->massAirFlowVoltage = hasMafSensor() ? getMafVoltage(PASS_ENGINE_PARAMETER_SIGNATURE) : 0;
|
||||
|
||||
|
@ -734,8 +739,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
// offset 28
|
||||
tsOutputChannels->vBatt = getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
// offset 32
|
||||
tsOutputChannels->tpsADC = getTPS10bitAdc(0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
// offset 36
|
||||
#if EFI_ANALOG_SENSORS
|
||||
tsOutputChannels->baroPressure = hasBaroSensor() ? getBaroPressure() : 0;
|
||||
|
@ -992,7 +996,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
#endif /* EFI_CAN_SUPPORT */
|
||||
case DBG_ANALOG_INPUTS:
|
||||
tsOutputChannels->debugFloatField1 = (engineConfiguration->vbattAdcChannel != EFI_ADC_NONE) ? getVoltageDivided("vbatt", engineConfiguration->vbattAdcChannel PASS_ENGINE_PARAMETER_SUFFIX) : 0.0f;
|
||||
tsOutputChannels->debugFloatField2 = (engineConfiguration->tps1_1AdcChannel != EFI_ADC_NONE) ? getVoltageDivided("tps", engineConfiguration->tps1_1AdcChannel PASS_ENGINE_PARAMETER_SUFFIX) : 0.0f;
|
||||
tsOutputChannels->debugFloatField2 = Sensor::getRaw(SensorType::Tps1);
|
||||
tsOutputChannels->debugFloatField3 = (engineConfiguration->mafAdcChannel != EFI_ADC_NONE) ? getVoltageDivided("maf", engineConfiguration->mafAdcChannel PASS_ENGINE_PARAMETER_SUFFIX) : 0.0f;
|
||||
tsOutputChannels->debugFloatField4 = (engineConfiguration->map.sensor.hwChannel != EFI_ADC_NONE) ? getVoltageDivided("map", engineConfiguration->map.sensor.hwChannel PASS_ENGINE_PARAMETER_SUFFIX) : 0.0f;
|
||||
tsOutputChannels->debugFloatField5 = (engineConfiguration->clt.adcChannel != EFI_ADC_NONE) ? getVoltageDivided("clt", engineConfiguration->clt.adcChannel PASS_ENGINE_PARAMETER_SUFFIX) : 0.0f;
|
||||
|
|
|
@ -54,6 +54,11 @@
|
|||
struct SensorResult {
|
||||
const bool Valid;
|
||||
const float Value;
|
||||
|
||||
// Implicit conversion operator to bool, so you can do things like if (myResult) { ... }
|
||||
constexpr explicit operator bool() const {
|
||||
return Valid;
|
||||
}
|
||||
};
|
||||
|
||||
// Fwd declare - nobody outside of Sensor.cpp needs to see inside this type
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "thermistors.h"
|
||||
#include "adc_inputs.h"
|
||||
#include "interpolation.h"
|
||||
#include "tps.h"
|
||||
#include "map.h"
|
||||
#include "trigger_decoder.h"
|
||||
#include "console_io.h"
|
||||
|
@ -27,6 +26,7 @@
|
|||
#include "allsensors.h"
|
||||
#include "alternator_controller.h"
|
||||
#include "trigger_emulator.h"
|
||||
#include "sensor.h"
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
#include "vehicle_speed.h"
|
||||
|
@ -408,15 +408,17 @@ static void printThermistor(const char *msg, ThermistorConf *config, ThermistorM
|
|||
}
|
||||
|
||||
void printTPSInfo(void) {
|
||||
#if EFI_PROD_CODE && HAL_USE_ADC
|
||||
if (!hasTpsSensor()) {
|
||||
auto tps = Sensor::get(SensorType::Tps1);
|
||||
auto raw = Sensor::getRaw(SensorType::Tps1);
|
||||
|
||||
if (!tps.Valid) {
|
||||
scheduleMsg(&logger, "NO TPS SENSOR");
|
||||
return;
|
||||
}
|
||||
static char pinNameBuffer[16];
|
||||
|
||||
scheduleMsg(&logger, "tps min (closed) %d/max (full) %d v=%.2f @%s", engineConfiguration->tpsMin, engineConfiguration->tpsMax,
|
||||
getTPSVoltage(PASS_ENGINE_PARAMETER_SIGNATURE), getPinNameByAdcChannel("tps", engineConfiguration->tps1_1AdcChannel, pinNameBuffer));
|
||||
raw, getPinNameByAdcChannel("tps", engineConfiguration->tps1_1AdcChannel, pinNameBuffer));
|
||||
|
||||
if (hasPedalPositionSensor()) {
|
||||
scheduleMsg(&logger, "pedal up %f / down %f",
|
||||
|
@ -424,10 +426,7 @@ void printTPSInfo(void) {
|
|||
engineConfiguration->throttlePedalWOTVoltage);
|
||||
}
|
||||
|
||||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
scheduleMsg(&logger, "current 10bit=%d value=%.2f rate=%.2f", (int)getTPS10bitAdc(0), getTPS(PASS_ENGINE_PARAMETER_SIGNATURE),
|
||||
getTpsRateOfChange());
|
||||
scheduleMsg(&logger, "current 10bit=%d value=%.2f rate=%.2f", convertVoltageTo10bitADC(raw), tps.Value, getTpsRateOfChange());
|
||||
}
|
||||
|
||||
static void printTemperatureInfo(void) {
|
||||
|
|
Loading…
Reference in New Issue