cisnan -> std::isnan

This commit is contained in:
Matthew Kennedy 2024-07-22 16:00:59 -07:00
parent aa5ea293e6
commit f086b94c81
7 changed files with 11 additions and 11 deletions

View File

@ -43,7 +43,7 @@ static angle_t getRunningAdvance(int rpm, float engineLoad) {
return NAN;
}
efiAssert(ObdCode::CUSTOM_ERR_ASSERT, !cisnan(engineLoad), "invalid el", NAN);
efiAssert(ObdCode::CUSTOM_ERR_ASSERT, !std::isnan(engineLoad), "invalid el", NAN);
// compute base ignition angle from main table
float advanceAngle = interpolate3d(

View File

@ -188,7 +188,7 @@ void EngineState::periodicFastCallback() {
void EngineState::updateTChargeK(int rpm, float tps) {
#if EFI_ENGINE_CONTROL
float newTCharge = engine->fuelComputer.getTCharge(rpm, tps);
if (!cisnan(newTCharge)) {
if (!std::isnan(newTCharge)) {
// control the rate of change or just fill with the initial value
efitick_t nowNt = getTimeNowNt();
float secsPassed = timeSinceLastTChargeK.getElapsedSeconds(nowNt);

View File

@ -307,7 +307,7 @@ float getInjectionMass(int rpm) {
bool isCranking = engine->rpmCalculator.isCranking();
float cycleFuelMass = getCycleFuelMass(isCranking, baseFuelMass);
efiAssert(ObdCode::CUSTOM_ERR_ASSERT, !cisnan(cycleFuelMass), "NaN cycleFuelMass", 0);
efiAssert(ObdCode::CUSTOM_ERR_ASSERT, !std::isnan(cycleFuelMass), "NaN cycleFuelMass", 0);
if (engine->module<DfcoController>()->cutFuel()) {
// If decel fuel cut, zero out fuel
@ -389,7 +389,7 @@ float getBaroCorrection() {
config->baroCorrRpmBins, Sensor::getOrZero(SensorType::Rpm)
);
if (cisnan(correction) || correction < 0.01) {
if (std::isnan(correction) || correction < 0.01) {
warning(ObdCode::OBD_Barometric_Press_Circ_Range_Perf, "Invalid baro correction %f", correction);
return 1;
}

View File

@ -340,7 +340,7 @@ static void setFloat(const char *offsetStr, const char *valueStr) {
if (isOutOfBounds(offset))
return;
float value = atoff(valueStr);
if (cisnan(value)) {
if (std::isnan(value)) {
efiPrintf("invalid value [%s]", valueStr);
return;
}

View File

@ -29,7 +29,7 @@
// Shifts angle into the [0..720) range for four stroke and [0..360) for two stroke
inline void wrapAngle(angle_t& angle, const char* msg, ObdCode code) {
if (cisnan(angle)) {
if (std::isnan(angle)) {
firmwareError(ObdCode::CUSTOM_ERR_ANGLE, "a NaN %s", msg);
angle = 0;
}

View File

@ -141,7 +141,7 @@ void TriggerFormDetails::prepareEventAngles(TriggerWaveform *shape) {
// Compute the relative angle of this tooth to the sync point's tooth
float angle = shape->getAngle(wrappedIndex) - firstAngle;
efiAssertVoid(ObdCode::CUSTOM_TRIGGER_CYCLE, !cisnan(angle), "trgSyncNaN");
efiAssertVoid(ObdCode::CUSTOM_TRIGGER_CYCLE, !std::isnan(angle), "trgSyncNaN");
// Wrap the angle back in to [0, 720)
wrapAngle(angle, "trgSync", ObdCode::CUSTOM_TRIGGER_SYNC_ANGLE_RANGE);
@ -469,13 +469,13 @@ expected<TriggerDecodeResult> TriggerDecoderBase::decodeTriggerEvent(
for (int i = 0; i < triggerShape.gapTrackingLength; i++) {
float ratioFrom = triggerShape.syncronizationRatioFrom[i];
if (cisnan(ratioFrom)) {
if (std::isnan(ratioFrom)) {
// we do not track gap at this depth
continue;
}
float gap = 1.0 * toothDurations[i] / toothDurations[i + 1];
if (cisnan(gap)) {
if (std::isnan(gap)) {
efiPrintf("%s index=%d NaN gap, you have noise issues?", prefix, i);
} else {
float ratioTo = triggerShape.syncronizationRatioTo[i];
@ -653,7 +653,7 @@ bool TriggerDecoderBase::isSyncPoint(const TriggerWaveform& triggerShape, trigge
auto from = triggerShape.syncronizationRatioFrom[i];
auto to = triggerShape.syncronizationRatioTo[i];
if (cisnan(from)) {
if (std::isnan(from)) {
// don't check this gap, skip it
continue;
}

View File

@ -55,7 +55,7 @@ void ensureArrayIsAscendingOrDefault(const char* msg, const TValue (&values)[TSi
template<typename kType>
int findIndexMsg(const char *msg, const kType array[], int size, kType value) {
float fvalue = (float)value;
if (cisnan(fvalue)) {
if (std::isnan(fvalue)) {
firmwareError(ObdCode::ERROR_NAN_FIND_INDEX, "NaN in findIndex%s", msg);
return 0;
}