CUSTOM_INSTANT_MAP_DECODING

This commit is contained in:
rusefillc 2022-09-15 15:07:31 -04:00
parent 7654c84c41
commit ac03dc55d8
2 changed files with 7 additions and 2 deletions

View File

@ -2123,7 +2123,7 @@ typedef enum {
CUSTOM_ERR_6728 = 6728,
CUSTOM_ARTIFICIAL_MISFIRE = 6729,
CUSTOM_INSTANT_MAP_DECODING = 6899,
STACK_USAGE_COMMUNICATION = 6900,
STACK_USAGE_MIL = 6901,
STACK_USAGE_BENCH = 6902,

View File

@ -104,7 +104,12 @@ void mapAveragingAdcCallback(adcsample_t adcValue) {
efiAssertVoid(CUSTOM_ERR_6650, getCurrentRemainingStack() > 128, "lowstck#9a");
float instantVoltage = adcToVoltsDivided(adcValue);
float instantMap = convertMap(instantVoltage).value_or(0);
SensorResult mapResult = convertMap(instantVoltage);
if (!mapResult) {
// hopefully this warning is not too much CPU consumption for fast ADC callback
warning(CUSTOM_INSTANT_MAP_DECODING, "Invalid MAP at %f", instantVoltage);
}
float instantMap = mapResult.value_or(0);
#if EFI_TUNER_STUDIO
engine->outputChannels.instantMAPValue = instantMap;
#endif // EFI_TUNER_STUDIO