rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
status_loop.cpp File Reference

Detailed Description

Human-readable protocol status messages.

http://rusefi.com/forum/viewtopic.php?t=263 rusEfi console overview http://rusefi.com/forum/viewtopic.php?t=210 Commands overview

Date
Mar 15, 2013
Author
Andrey Belomutskiy, (c) 2012-2020

This file is part of rusEfi - see http://rusefi.com

rusEfi is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file status_loop.cpp.

Functions

static void printVersionForConsole (const char *engineTypeName, const char *firmwareBuildId)
 
static void printOutPin (const char *pinName, brain_pin_e hwPin)
 
static void printEngineSnifferPinMappings ()
 
void printOverallStatus ()
 
void updateDevConsoleState ()
 Sends all pending data to rusEfi console.
 
void initWarningRunningPins ()
 
static void initStatusLeds ()
 
static bool isTriggerErrorNow ()
 
static int packEngineMode ()
 
static void updateTempSensors ()
 
void updateUnfilteredRawPedal ()
 
static void updateThrottles ()
 
static void updateLambda ()
 
static void updateFuelSensors ()
 
static void updateEgtSensors ()
 
static void updateVvtSensors ()
 
static void updateVehicleSpeed ()
 
static void updateRawSensors ()
 
static void updatePressures ()
 
static void updateMiscSensors ()
 
static void updateSensors ()
 
static void updateFuelCorrections ()
 
static void updateFuelResults ()
 
static void updateFuelInfo ()
 
static void updateIgnition (float rpm)
 
static void updateFlags ()
 
void updateTunerStudioState ()
 
void startStatusThreads ()
 

Variables

WaveChart waveChart
 
int maxTriggerReentrant
 
uint32_t maxLockedDuration
 
static Timer printVersionTimer
 
static char logicAnalyzerBuffer [LOGIC_ANALYZER_BUFFER_SIZE]
 
static Logging logicAnalyzerLogger ("logic analyzer", logicAnalyzerBuffer, sizeof(logicAnalyzerBuffer))
 
static OutputPinleds []
 
bool consoleByteArrived
 
static CommunicationBlinkingTask communicationsBlinkingTask
 
static SensorType luaGaugeTypes []
 

Function Documentation

◆ initStatusLeds()

static void initStatusLeds ( )
static

Definition at line 235 of file status_loop.cpp.

235 {
236 enginePins.communicationLedPin.initPin("led: comm status", getCommsLedPin(), LED_PIN_MODE, true);
237 // checkEnginePin is already initialized by the time we get here
238}
Gpio getCommsLedPin()
OutputPin communicationLedPin
Definition efi_gpio.h:106
void initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError=false)
Definition efi_gpio.cpp:711
EnginePins enginePins
Definition efi_gpio.cpp:24

Referenced by startStatusThreads().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initWarningRunningPins()

void initWarningRunningPins ( )

Definition at line 226 of file status_loop.cpp.

226 {
227#if EFI_PROD_CODE
228 // open question if we need warningLedPin and runningLedPin at all!
229 enginePins.warningLedPin.initPin("led: warning status", getWarningLedPin(), LED_PIN_MODE, true);
230 enginePins.runningLedPin.initPin("led: running status", getRunningLedPin(), LED_PIN_MODE, true);
231#endif /* EFI_PROD_CODE */
232}
Gpio getWarningLedPin()
Gpio getRunningLedPin()
OutputPin runningLedPin
Definition efi_gpio.h:108
OutputPin warningLedPin
Definition efi_gpio.h:107

Referenced by initRealHardwareEngineController().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isTriggerErrorNow()

static bool isTriggerErrorNow ( )
static

Definition at line 240 of file status_loop.cpp.

240 {
241#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
243 return justHadError || engine->triggerCentral.isTriggerDecoderError();
244#else
245 return false;
246#endif /* EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT */
247}
TriggerCentral triggerCentral
Definition engine.h:326
PrimaryTriggerDecoder triggerState
bool someSortOfTriggerError() const
static EngineAccessor engine
Definition engine.h:421

Referenced by updateFlags().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ packEngineMode()

static int packEngineMode ( )
static

This is useful if we are changing engine mode dynamically For example http://rusefi.com/forum/viewtopic.php?f=5&t=1085

Definition at line 339 of file status_loop.cpp.

Referenced by updateTunerStudioState().

Here is the caller graph for this function:

◆ printEngineSnifferPinMappings()

static void printEngineSnifferPinMappings ( )
static

Definition at line 126 of file status_loop.cpp.

126 {
127#if EFI_PROD_CODE
130 for (int i = 0;i<CAM_INPUTS_COUNT;i++) {
131 extern const char *vvtNames[];
133 }
134
135 int cylCount = minI(engineConfiguration->cylindersCount, MAX_CYLINDER_COUNT);
136 for (int i = 0; i < cylCount; i++) {
141 }
142#endif /* EFI_PROD_CODE */
143}
InjectorOutputPin injectorsStage2[MAX_CYLINDER_COUNT]
Definition efi_gpio.h:128
IgnitionOutputPin trailingCoils[MAX_CYLINDER_COUNT]
Definition efi_gpio.h:130
InjectorOutputPin injectors[MAX_CYLINDER_COUNT]
Definition efi_gpio.h:127
IgnitionOutputPin coils[MAX_CYLINDER_COUNT]
Definition efi_gpio.h:129
const char * getShortName() const
Definition efi_gpio.cpp:430
const char * vvtNames[]
Definition efi_gpio.cpp:34
static void printOutPin(const char *pinName, brain_pin_e hwPin)
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]

Referenced by printOverallStatus().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printOutPin()

static void printOutPin ( const char pinName,
brain_pin_e  hwPin 
)
static

Definition at line 108 of file status_loop.cpp.

108 {
109 if (hwPin == Gpio::Unassigned || hwPin == Gpio::Invalid) {
110 return;
111 }
112 const char *hwPinName;
113 if (isBrainPinValid(hwPin)) {
114 hwPinName = hwPortname(hwPin);
115 } else {
116 hwPinName = "smart";
117 }
118
119 efiPrintfProto(PROTOCOL_OUTPIN, "%s@%s", pinName, hwPinName);
120}
@ Unassigned
@ Invalid
const char * hwPortname(brain_pin_e brainPin)
bool isBrainPinValid(brain_pin_e brainPin)

Referenced by printEngineSnifferPinMappings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printOverallStatus()

void printOverallStatus ( )

we report the version every second - this way the console does not need to request it and we will display it pretty soon

Definition at line 145 of file status_loop.cpp.

145 {
146#if EFI_ENGINE_SNIFFER
148#endif /* EFI_ENGINE_SNIFFER */
149
150
151 /**
152 * we report the version every second - this way the console does not need to
153 * request it and we will display it pretty soon
154 */
155 if (printVersionTimer.hasElapsedSec(1)) {
156 // we're sending, reset the timer
157 printVersionTimer.reset();
158
159 // Output the firmware version, board type, git hash, uptime in seconds, etc for rusEFI console
161
162 // Output the current engine sniffer pin mappings
164 }
165}
const char * getEngine_type_e(engine_type_e value)
void publishIfFull()
static void printEngineSnifferPinMappings()
static void printVersionForConsole(const char *engineTypeName, const char *firmwareBuildId)
static Timer printVersionTimer
WaveChart waveChart

Referenced by handleGetText().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printVersionForConsole()

static void printVersionForConsole ( const char engineTypeName,
const char firmwareBuildId 
)
static

Definition at line 96 of file status_loop.cpp.

96 {
97 // VersionChecker in rusEFI console is parsing these version string, please follow the expected format
98 efiPrintfProto(PROTOCOL_VERSION_TAG, "%d@%u %s %s %ld",
99 getRusEfiVersion(), /*do we have a working way to print 64 bit values?!*/(unsigned int)SIGNATURE_HASH,
100 firmwareBuildId,
101 engineTypeName,
102 (uint32_t)getTimeNowS());
103}
efitimesec_t getTimeNowS()
Current system time in seconds (32 bits)
Definition efitime.cpp:42
int getRusEfiVersion()

Referenced by printOverallStatus().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startStatusThreads()

void startStatusThreads ( )

Definition at line 764 of file status_loop.cpp.

764 {
765 // todo: refactoring needed, this file should probably be split into pieces
766#if EFI_PROD_CODE
769#endif /* EFI_PROD_CODE */
770}
static void initStatusLeds()
static CommunicationBlinkingTask communicationsBlinkingTask

Referenced by commonEarlyInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateDevConsoleState()

void updateDevConsoleState ( )

Sends all pending data to rusEfi console.

This method is periodically invoked by the main loop todo: is this mostly dead code?

Definition at line 183 of file status_loop.cpp.

183 {
184#if EFI_PROD_CODE
185 // todo: unify with simulator!
186 if (hasFirmwareError()) {
187 efiPrintf("%s error: %s", CRITICAL_PREFIX, getCriticalErrorMessage());
188 return;
189 }
190#endif /* EFI_PROD_CODE */
191
192#if EFI_RTC
194#endif
195
196#if HAL_USE_ADC
198#endif /* HAL_USE_ADC */
199
200#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
201 int currentCkpEventCounter = engine->triggerCentral.triggerState.getTotalEventCounter();
202 systime_t nowSeconds = getTimeNowS();
203static int prevCkpEventCounter = -1;
204static systime_t timeOfPreviousReport = (systime_t) -1;
205 if (prevCkpEventCounter == currentCkpEventCounter && timeOfPreviousReport == nowSeconds) {
206 return;
207 }
208 timeOfPreviousReport = nowSeconds;
209
210 prevCkpEventCounter = currentCkpEventCounter;
211#else
212 chThdSleepMilliseconds(200);
213#endif
214
215#if EFI_LOGIC_ANALYZER
218#endif /* EFI_LOGIC_ANALYZER */
219}
void printFullAdcReportIfNeeded(void)
TunerStudioOutputChannels outputChannels
Definition engine.h:113
int64_t getTotalEventCounter() const
const char * getCriticalErrorMessage()
void scheduleLogging(Logging *logging)
void printWave(Logging *logging)
uint32_t getEpochTime()
static Logging logicAnalyzerLogger("logic analyzer", logicAnalyzerBuffer, sizeof(logicAnalyzerBuffer))

Referenced by runMainLoop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateEgtSensors()

static void updateEgtSensors ( )
static

◆ updateFlags()

static void updateFlags ( )
static

Definition at line 602 of file status_loop.cpp.

602 {
604 // todo: eliminate state copy logic by giving DfcoController it's owm xxx.txt and leveraging LiveData
606
607#if EFI_LAUNCH_CONTROL
609#endif
610
611#if EFI_PROD_CODE
613#endif // EFI_PROD_CODE
614
615#if EFI_CONFIGURATION_STORAGE
617#endif /* EFI_CONFIGURATION_STORAGE */
618#if EFI_FILE_LOGGING
620#endif
621}
LaunchControlBase launchController
Definition engine.h:224
constexpr auto & module()
Definition engine.h:204
OutputPin o2heater
Definition efi_gpio.h:99
bool getLogicValue() const
Definition efi_gpio.cpp:667
void updateSdCardLiveFlags()
static bool isTriggerErrorNow()
bool getNeedToWriteConfiguration()
Definition storage.cpp:353

Referenced by updateTunerStudioState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateFuelCorrections()

static void updateFuelCorrections ( )
static

Definition at line 568 of file status_loop.cpp.

568 {
570}
EngineState engineState
Definition engine.h:352
float stftCorrection[FT_BANK_COUNT]
scaled_channel< uint16_t, 100, 1 > Gego

Referenced by updateFuelInfo().

Here is the caller graph for this function:

◆ updateFuelInfo()

static void updateFuelInfo ( )
static

Definition at line 584 of file status_loop.cpp.

584 {
587#if EFI_ENGINE_CONTROL
589 engine->outputChannels.wallFuelAmount = wallFuel.getWallFuel() * 1000; // Convert grams to mg
590 engine->outputChannels.wallFuelCorrectionValue = wallFuel.wallFuelCorrection * 1000; // Convert grams to mg
591
593#endif // EFI_ENGINE_CONTROL
594}
FuelSchedule injectionEvents
Definition engine.h:296
InjectionEvent elements[MAX_CYLINDER_COUNT]
WallFuel & getWallFuel()
wallFuel("Fuel on the wall\nin ms of injector open time for each injector.", SensorCategory.SENSOR_INPUTS, FieldType.INT, 1760, 1.0, -1.0, -1.0, "")
static void updateFuelCorrections()
static void updateFuelResults()
scaled_channel< uint16_t, 10, 1 > veValue
scaled_channel< int16_t, 100, 1 > wallFuelCorrectionValue
scaled_channel< uint16_t, 100, 1 > wallFuelAmount

Referenced by updateTunerStudioState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateFuelResults()

static void updateFuelResults ( )
static

Definition at line 572 of file status_loop.cpp.

572 {
573#if EFI_VEHICLE_SPEED && defined (MODULE_ODOMETER)
574 engine->outputChannels.fuelFlowRate = engine->module<TripOdometer>()->getConsumptionGramPerSecond();
576 engine->outputChannels.ignitionOnTime = engine->module<TripOdometer>()->getIgnitionOnTime();
577 engine->outputChannels.engineRunTime = engine->module<TripOdometer>()->getEngineRunTime();
578
579 // output channel in km
580 engine->outputChannels.distanceTraveled = 0.001f * engine->module<TripOdometer>()->getDistanceMeters();
581#endif // EFI_VEHICLE_SPEED MODULE_ODOMETER
582}
scaled_channel< uint16_t, 10, 1 > distanceTraveled
scaled_channel< uint16_t, 200, 1 > fuelFlowRate

Referenced by updateFuelInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateFuelSensors()

static void updateFuelSensors ( )
static

Definition at line 421 of file status_loop.cpp.

421 {
422 // Low pressure is directly in kpa
424 // High pressure is in bar, aka 100 kpa
426
428
430}
@ FuelEthanolPercent
scaled_channel< int16_t, 10, 1 > highFuelPressure
scaled_channel< int16_t, 100, 1 > fuelTankLevel
scaled_channel< int16_t, 30, 1 > lowFuelPressure
scaled_channel< uint8_t, 2, 1 > flexPercent

Referenced by updateSensors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateIgnition()

static void updateIgnition ( float  rpm)
static

Definition at line 596 of file status_loop.cpp.

596 {
597#if EFI_ENGINE_CONTROL
599#endif // EFI_ENGINE_CONTROL
600}
percent_t getCoilDutyCycle(float rpm)
scaled_channel< uint16_t, 100, 1 > coilDutyCycle

Referenced by updateTunerStudioState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateLambda()

static void updateLambda ( )
static

Definition at line 405 of file status_loop.cpp.

405 {
409 // TODO: this can be calculated on PC side!
412
413 float lambda2Value = Sensor::getOrZero(SensorType::Lambda2);
414 engine->outputChannels.lambdaValue2 = lambda2Value;
416 // TODO: this can be calculated on PC side!
417 engine->outputChannels.afr2GasolineScale = lambda2Value * STOICH_RATIO;
419}
FuelComputer fuelComputer
Definition engine.h:143
lambdaValue("Lambda", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 38, 1.0E-4, 0.0, 0.0, "")
scaled_channel< uint16_t, 1000, 1 > stoichiometricRatio
scaled_channel< uint16_t, 1000, 1 > afrGasolineScale
scaled_channel< uint16_t, 10000, 1 > lambdaValue
scaled_channel< uint16_t, 1000, 1 > afr2GasolineScale
scaled_channel< uint16_t, 1000, 1 > AFRValue2
scaled_channel< uint16_t, 1000, 1 > AFRValue
scaled_channel< uint16_t, 1000, 1 > SmoothedAFRValue2
scaled_channel< uint16_t, 1000, 1 > SmoothedAFRValue
scaled_channel< uint16_t, 10000, 1 > lambdaValue2

Referenced by updateSensors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateMiscSensors()

static void updateMiscSensors ( )
static

Definition at line 537 of file status_loop.cpp.

537 {
539
541
543
547
548#if HAL_USE_ADC
552#endif /* HAL_USE_ADC */
553}
float getMCUInternalTemperature(void)
float getMCUVref(void)
float getMcuVbatVoltage()
Definition mpu_util.cpp:279
scaled_channel< int16_t, 100, 1 > idlePositionSensor
scaled_channel< int16_t, 100, 1 > wastegatePositionSensor
scaled_channel< uint16_t, 1000, 1 > VBatt
scaled_channel< int16_t, 1000, 1 > internalVref
scaled_channel< int16_t, 1000, 1 > internalVbat

Referenced by updateSensors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatePressures()

static void updatePressures ( )
static

Definition at line 517 of file status_loop.cpp.

517 {
519 // instantMAPValue is injected in a very different way
520 float mapValue = Sensor::getOrZero(SensorType::Map);
521 engine->outputChannels.MAPValue = mapValue;
522
526
530
535}
@ ThrottleInletPressure
@ CompressorDischargePressure
@ BarometricPressure
scaled_channel< uint16_t, 30, 1 > throttleInletPressure
scaled_channel< uint16_t, 30, 1 > oilPressure
scaled_channel< uint16_t, 30, 1 > baroPressure
scaled_channel< uint16_t, 30, 1 > compressorDischargePressure
scaled_channel< uint16_t, 30, 1 > MAPValue
float getThrottlePressureRatio(float map)

Referenced by updateSensors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateRawSensors()

static void updateRawSensors ( )
static

Definition at line 475 of file status_loop.cpp.

475 {
502
503 for (size_t i = 0;i<LUA_GAUGE_COUNT;i++) {
505 }
506
507 for (int i = 0; i < LUA_ANALOG_INPUT_COUNT; i++) {
510 engine->outputChannels.rawAnalogInput[i] = adcGetScaledVoltage("raw aux", channel).value_or(0);
511 }
512 }
513
514 // TODO: transition AFR to new sensor model
515 engine->outputChannels.rawAfr = (engineConfiguration->afr.hwChannel == EFI_ADC_NONE) ? 0 : adcGetScaledVoltage("ego", engineConfiguration->afr.hwChannel).value_or(0);
516}
expected< float > adcGetScaledVoltage(const char *msg, adc_channel_e hwChannel)
bool isAdcChannelValid(adc_channel_e hwChannel)
Definition adc_inputs.h:23
uint16_t channel
Definition adc_inputs.h:104
virtual float getRaw() const
Definition sensor.h:148
@ AmbientTemperature
@ AcceleratorPedalPrimary
@ AcceleratorPedalSecondary
static SensorType luaGaugeTypes[]
scaled_channel< int16_t, 1000, 1 > rawBattery
float luaGauges[LUA_GAUGE_COUNT]
scaled_channel< int16_t, 1000, 1 > rawAuxAnalog4
scaled_channel< int16_t, 1000, 1 > rawTps2Secondary
scaled_channel< int16_t, 1000, 1 > rawTps1Secondary
scaled_channel< int16_t, 1000, 1 > rawAuxAnalog1
scaled_channel< int16_t, 1000, 1 > rawHighFuelPressure
scaled_channel< uint16_t, 1000, 1 > rawMaf
scaled_channel< int16_t, 1000, 1 > rawTps1Primary
scaled_channel< int16_t, 1000, 1 > rawOilPressure
scaled_channel< int16_t, 1000, 1 > rawWastegatePosition
scaled_channel< int16_t, 1000, 1 > rawAuxTemp1
scaled_channel< int16_t, 1000, 1 > rawIat
scaled_channel< int16_t, 1000, 1 > rawAuxTemp2
scaled_channel< int16_t, 1000, 1 > rawLowFuelPressure
scaled_channel< uint16_t, 1000, 1 > rawMap
scaled_channel< int16_t, 1000, 1 > rawClt
scaled_channel< int16_t, 1000, 1 > rawAuxAnalog3
scaled_channel< int16_t, 1000, 1 > rawAmbientTemp
scaled_channel< int16_t, 1000, 1 > rawFuelLevel
scaled_channel< uint16_t, 1000, 1 > rawMaf2
scaled_channel< uint16_t, 1000, 1 > rawAfr
scaled_channel< int16_t, 1000, 1 > rawIdlePositionSensor
scaled_channel< int16_t, 1000, 1 > rawTps2Primary
scaled_channel< int16_t, 1000, 1 > rawAcPressure
scaled_channel< int16_t, 1000, 1 > rawAnalogInput[LUA_ANALOG_INPUT_COUNT]
scaled_channel< int16_t, 1000, 1 > rawAuxAnalog2

Referenced by updateSensors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateSensors()

static void updateSensors ( )
static

Definition at line 555 of file status_loop.cpp.

555 {
559 updateLambda();
566}
static void updateTempSensors()
static void updateLambda()
static void updateVehicleSpeed()
static void updateVvtSensors()
static void updateFuelSensors()
static void updateEgtSensors()
static void updateMiscSensors()
static void updatePressures()
static void updateThrottles()
static void updateRawSensors()

Referenced by updateTunerStudioState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTempSensors()

static void updateTempSensors ( )
static

Definition at line 345 of file status_loop.cpp.

345 {
347 engine->outputChannels.coolant = clt.value_or(0);
349
351 engine->outputChannels.intake = iat.value_or(0);
353
355 engine->outputChannels.auxTemp1 = auxTemp1.value_or(0);
356
358 engine->outputChannels.auxTemp2 = auxTemp2.value_or(0);
359
361 engine->outputChannels.oilTemp = oilTemp.value_or(0);
362
363 // see also updateFuelSensors()
365 engine->outputChannels.fuelTemp = fuelTemp.value_or(0);
366
369
372}
virtual SensorResult get() const =0
static CCM_OPTIONAL FunctionalSensor iat(SensorType::Iat, MS2NT(10))
static CCM_OPTIONAL FunctionalSensor clt(SensorType::Clt, MS2NT(10))
expected< float > SensorResult
Definition sensor.h:46
@ CompressorDischargeTemperature
ambientTemp("ambientTemp", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 748, 0.01, 0.0, 0.0, "deg C")
fuelTemp("fuelTemp", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 746, 0.01, 0.0, 0.0, "deg C")
auxTemp2("auxTemp2", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 22, 0.01, 0.0, 0.0, "deg C")
oilTemp("oilTemp", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 744, 0.01, 0.0, 0.0, "deg C")
compressorDischargeTemp("compressorDischargeTemp", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 750, 0.01, 0.0, 0.0, "deg C")
auxTemp1("auxTemp1", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 20, 0.01, 0.0, 0.0, "deg C")
scaled_channel< int16_t, 100, 1 > compressorDischargeTemp
scaled_channel< int16_t, 100, 1 > auxTemp2
scaled_channel< int16_t, 100, 1 > ambientTemp
scaled_channel< int16_t, 100, 1 > fuelTemp
scaled_channel< int16_t, 100, 1 > intake
scaled_channel< int16_t, 100, 1 > oilTemp
scaled_channel< int16_t, 100, 1 > coolant
scaled_channel< int16_t, 100, 1 > auxTemp1

Referenced by updateSensors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateThrottles()

static void updateThrottles ( )
static

Definition at line 376 of file status_loop.cpp.

376 {
378 engine->outputChannels.TPSValue = tps1.value_or(0);
381
383 engine->outputChannels.TPS2Value = tps2.value_or(0);
384 // If we don't have a TPS2 at all, don't turn on the failure light
386
389 // Only report fail if you have one (many people don't)
391
392 // TPS 1 pri/sec split
394 // TPS 2 pri/sec split
396 // TPS1 - TPS2 split
398 // Pedal pri/sec split
400
403}
virtual bool hasSensor() const
Definition sensor.h:141
static RedundantPair pedal(pedalPrimary, pedalSecondary, SensorType::AcceleratorPedalUnfiltered)
static RedundantPair tps2(tps2p, tps2s, SensorType::Tps2)
@ AcceleratorPedalUnfiltered
void updateUnfilteredRawPedal()
Definition init_tps.cpp:194
scaled_channel< int16_t, 100, 1 > accPedalUnfiltered
scaled_channel< int16_t, 100, 1 > TPS2Value
scaled_channel< int16_t, 100, 1 > tps12Split
scaled_channel< int16_t, 100, 1 > accPedalSplit
scaled_channel< int16_t, 100, 1 > tps1Split
scaled_channel< int16_t, 100, 1 > throttlePedalPosition
scaled_channel< int16_t, 100, 1 > tps2Split
scaled_channel< int16_t, 100, 1 > TPSValue
constexpr int convertVoltageTo10bitADC(float voltage)
Definition tps.h:21

Referenced by updateSensors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTunerStudioState()

void updateTunerStudioState ( )

Definition at line 627 of file status_loop.cpp.

627 {
628 TunerStudioOutputChannels *tsOutputChannels = &engine->outputChannels;
629#if EFI_USB_SERIAL
630 // pretty much SD card logs know if specifically USB serial is active
632#endif // EFI_USB_SERIAL
633
634 float rpm = Sensor::get(SensorType::Rpm).value_or(0);
635
636
637 static Timer blinkIndicatorsTimer;
638 constexpr float blinkHalfPeriod = 0.3;
639 bool isBlinkPhase = blinkIndicatorsTimer.hasElapsedSec(blinkHalfPeriod);
640#if EFI_ELECTRONIC_THROTTLE_BODY
641 blinkEtbErrorCodes(isBlinkPhase);
642#endif // EFI_ELECTRONIC_THROTTLE_BODY
643 if (isBlinkPhase) {
646
647 if (blinkIndicatorsTimer.hasElapsedSec(2 * blinkHalfPeriod)) {
648 blinkIndicatorsTimer.reset();
649 }
650 } else {
653 }
654
655
656#if EFI_PROD_CODE
658#endif /* EFI_PROD_CODE */
659
662 engine->dc_motors.isEnabled0_int = dc->msg() == nullptr;
663
664 tsOutputChannels->RPMValue = rpm;
665#if EFI_SHAFT_POSITION_INPUT
669
671#endif // EFI_SHAFT_POSITION_INPUT
672
675 updateIgnition(rpm);
676 updateFlags();
677 // update calibration channel, reset to None state after timeout
679
680 // Output both the estimated air flow, and measured air flow (if available)
681 tsOutputChannels->mafMeasured = Sensor::getOrZero(SensorType::Maf);
683 tsOutputChannels->mafEstimate = engine->engineState.airflowEstimate;
684
685#if EFI_ENGINE_CONTROL
686 tsOutputChannels->injectorDutyCycle = minF(/*let's avoid scaled "uint8_t, 2" overflow*/127, getInjectorDutyCycle(rpm));
688#endif
689
690 tsOutputChannels->seconds = getTimeNowS();
691
692 tsOutputChannels->engineMode = packEngineMode();
693 tsOutputChannels->firmwareVersion = getRusEfiVersion();
694
695 tsOutputChannels->accelerationLat = engine->sensors.accelerometer.lat;
696 tsOutputChannels->accelerationLon = engine->sensors.accelerometer.lon;
697 tsOutputChannels->accelerationVert = engine->sensors.accelerometer.vert;
698 tsOutputChannels->gyroYaw = engine->sensors.accelerometer.yawRate;
699
700#if EFI_DYNO_VIEW
701 tsOutputChannels->hp = getDynoviewHP();
702 tsOutputChannels->torque = getDynoviewTorque();
703#else
704 tsOutputChannels->hp = -1;
705 tsOutputChannels->torque = -1;
706#endif
707
713
714 tsOutputChannels->hasCriticalError = hasFirmwareError() || hasConfigError() || engine->engineState.warnings.hasWarningMessage();
715 tsOutputChannels->hasFaultReportFile = hasErrorReportFile();
717
718 tsOutputChannels->isWarnNow = engine->engineState.warnings.isWarningNow();
719
720 tsOutputChannels->tpsAccelFuel = engine->engineState.tpsAccelEnrich;
721
722 tsOutputChannels->checkEngine = hasErrorCodes();
723
725
728
729
731
732#if EFI_CLOCK_LOCKS
733 tsOutputChannels->maxLockedDuration = NT2US(maxLockedDuration);
734#endif /* EFI_CLOCK_LOCKS */
735
736#if EFI_SHAFT_POSITION_INPUT
737 tsOutputChannels->maxTriggerReentrant = maxTriggerReentrant;
740
743
744#endif // EFI_SHAFT_POSITION_INPUT
745
746#if HAL_USE_PAL && EFI_PROD_CODE
747 tsOutputChannels->extiOverflowCount = getExtiOverflowCounter();
748#endif
749
751 case DBG_LOGIC_ANALYZER:
752#if EFI_LOGIC_ANALYZER
753 // used by HW CI
755#endif /* EFI_LOGIC_ANALYZER */
756 break;
757 default:
758 ;
759 }
760}
const char * msg()
Definition dc_motors.h:70
TwoPinDcMotor dcMotor
Definition dc_motors.h:63
dc_motors_s dc_motors
Definition engine.h:354
RpmCalculator rpmCalculator
Definition engine.h:314
SensorsState sensors
Definition engine.h:361
RegisteredOutputPin starterControl
Definition efi_gpio.h:82
RegisteredOutputPin starterRelayDisable
Definition efi_gpio.h:84
floatms_t tpsAccelEnrich
float airflowEstimate
WarningCodeState warnings
float getRpmAcceleration() const
uint32_t getRevolutionCounterSinceStart(void) const
InstantRpmCalculator instantRpm
int getHwEventCounter(int index) const
uint32_t totalTriggerErrorCounter
float get() const override
Get the current motor duty cycle.
Definition dc_motor.cpp:48
bool hasWarningMessage()
Definition engine2.cpp:102
bool isWarningNow() const
Definition engine2.cpp:114
bool is_usb_serial_ready()
DcHardware * getPrimaryDCHardwareForLogging()
Definition dc_motors.cpp:86
uint8_t getExtiOverflowCounter()
int getDynoviewHP()
Definition dynoview.cpp:164
int getDynoviewTorque()
Definition dynoview.cpp:168
void blinkEtbErrorCodes(bool blinkPhase)
bool hasConfigError()
bool hasErrorReportFile()
percent_t getInjectorDutyCycleStage2(float rpm)
percent_t getInjectorDutyCycle(float rpm)
FrequencySensor inputShaftSpeedSensor(SensorType::InputShaftSpeed, MS2NT(500))
FrequencySensor vehicleSpeedSensor(SensorType::VehicleSpeed, MS2NT(500))
void reportLogicAnalyzerToTS()
bool ltftNeedVeRefresh()
bool hasErrorCodes(void)
void executorStatistics()
@ SHAFT_SECONDARY_RISING
@ SHAFT_SECONDARY_FALLING
@ SHAFT_PRIMARY_FALLING
@ SHAFT_PRIMARY_RISING
static void updateFlags()
uint32_t maxLockedDuration
static void updateFuelInfo()
static void updateIgnition(float rpm)
static int packEngineMode()
int maxTriggerReentrant
static void updateSensors()
Accelerometer accelerometer
scaled_channel< int16_t, 1000, 1 > accelerationLat
scaled_channel< int16_t, 1000, 1 > accelerationVert
scaled_channel< uint16_t, 10, 1 > mafEstimate
scaled_channel< uint8_t, 2, 1 > injectorDutyCycle
scaled_channel< int16_t, 1000, 1 > accelerationLon
scaled_channel< int16_t, 300, 1 > tpsAccelFuel
scaled_channel< int16_t, 1000, 1 > gyroYaw
scaled_channel< uint16_t, 10, 1 > mafMeasured2
scaled_channel< uint16_t, 10, 1 > mafMeasured
scaled_channel< uint8_t, 2, 1 > injectorDutyCycleStage2
bool needToTriggerTsRefresh()

Referenced by TunerStudio::cmdOutputChannels(), configureRusefiLuaHooks(), and MLG::writeSdLogLine().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateUnfilteredRawPedal()

void updateUnfilteredRawPedal ( )

Definition at line 194 of file init_tps.cpp.

194 {
195 pedal.updateUnfilteredRawValues();
196}

Referenced by updateThrottles().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateVehicleSpeed()

static void updateVehicleSpeed ( )
static

Definition at line 453 of file status_loop.cpp.

453 {
454#if EFI_VEHICLE_SPEED
457#ifdef MODULE_GEAR_DETECTOR
460#endif
461#endif /* EFI_VEHICLE_SPEED */
462}
scaled_channel< uint16_t, 100, 1 > speedToRpmRatio
scaled_channel< uint16_t, 100, 1 > vehicleSpeedKph

Referenced by updateSensors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateVvtSensors()

static void updateVvtSensors ( )
static

Definition at line 443 of file status_loop.cpp.

443 {
444#if EFI_SHAFT_POSITION_INPUT
445 // 248
446 engine->outputChannels.vvtPositionB1I = engine->triggerCentral.getVVTPosition(/*bankIndex*/0, /*camIndex*/0);
447 engine->outputChannels.vvtPositionB1E = engine->triggerCentral.getVVTPosition(/*bankIndex*/0, /*camIndex*/1);
448 engine->outputChannels.vvtPositionB2I = engine->triggerCentral.getVVTPosition(/*bankIndex*/1, /*camIndex*/0);
449 engine->outputChannels.vvtPositionB2E = engine->triggerCentral.getVVTPosition(/*bankIndex*/1, /*camIndex*/1);
450#endif
451}
angle_t getVVTPosition(uint8_t bankIndex, uint8_t camIndex)
scaled_channel< int16_t, 50, 1 > vvtPositionB1E
scaled_channel< int16_t, 50, 1 > vvtPositionB2E
scaled_channel< int16_t, 50, 1 > vvtPositionB2I
scaled_channel< int16_t, 50, 1 > vvtPositionB1I

Referenced by updateSensors().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ communicationsBlinkingTask

CommunicationBlinkingTask communicationsBlinkingTask
static

Definition at line 328 of file status_loop.cpp.

Referenced by startStatusThreads().

◆ consoleByteArrived

bool consoleByteArrived
extern

Definition at line 47 of file console_io.cpp.

Referenced by onDataArrived().

◆ leds

OutputPin* leds[]
static

◆ logicAnalyzerBuffer

char logicAnalyzerBuffer[LOGIC_ANALYZER_BUFFER_SIZE]
static

Definition at line 173 of file status_loop.cpp.

◆ logicAnalyzerLogger

Logging logicAnalyzerLogger("logic analyzer", logicAnalyzerBuffer, sizeof(logicAnalyzerBuffer)) ( "logic analyzer"  ,
logicAnalyzerBuffer  ,
sizeof(logicAnalyzerBuffer  
)
static

Referenced by updateDevConsoleState().

◆ luaGaugeTypes

SensorType luaGaugeTypes[]
static

◆ maxLockedDuration

uint32_t maxLockedDuration
extern

Maximum time before requesting lock and releasing lock at the end of critical section

Definition at line 549 of file error_handling.cpp.

Referenced by updateTunerStudioState().

◆ maxTriggerReentrant

int maxTriggerReentrant
extern

Definition at line 460 of file trigger_central.cpp.

Referenced by updateTunerStudioState().

◆ printVersionTimer

Timer printVersionTimer
static

Time when the firmware version was last reported TODO: implement a request/response instead of just constantly sending this out

Definition at line 93 of file status_loop.cpp.

Referenced by printOverallStatus().

◆ waveChart

WaveChart waveChart
extern

Go to the source code of this file.