Skip to content

Commit

Permalink
Merge pull request #9019 from RomanLut/submit-fix-broken-pitot
Browse files Browse the repository at this point in the history
fixed pitot sensor
  • Loading branch information
DzikuVx authored May 8, 2023
2 parents f31f6fc + 19d0992 commit cf506d5
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/main/sensors/pitotmeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,14 @@ STATIC_PROTOTHREAD(pitotThread)

pitot.dev.calculate(&pitot.dev, &pitotPressureTmp, NULL);
#ifdef USE_SIMULATOR
float airSpeed;
if (SIMULATOR_HAS_OPTION(HITL_AIRSPEED)) {
airSpeed = simulatorData.airSpeed;
#if defined(USE_PITOT_FAKE)
} else if (pitotmeterConfig()->pitot_hardware == PITOT_FAKE) {
airSpeed = fakePitotGetAirspeed();
#endif
} else {
airSpeed = 0;
pitotPressureTmp = sq(simulatorData.airSpeed) * SSL_AIR_DENSITY / 20000.0f + SSL_AIR_PRESSURE;
}
pitotPressureTmp = sq(airSpeed) * SSL_AIR_DENSITY / 20000.0f + SSL_AIR_PRESSURE;
#endif
#if defined(USE_PITOT_FAKE)
if (pitotmeterConfig()->pitot_hardware == PITOT_FAKE) {
pitotPressureTmp = sq(fakePitotGetAirspeed()) * SSL_AIR_DENSITY / 20000.0f + SSL_AIR_PRESSURE;
}
#endif
ptYield();

Expand Down Expand Up @@ -246,12 +243,11 @@ STATIC_PROTOTHREAD(pitotThread)
#ifdef USE_SIMULATOR
if (SIMULATOR_HAS_OPTION(HITL_AIRSPEED)) {
pitot.airSpeed = simulatorData.airSpeed;
}
#endif
#if defined(USE_PITOT_FAKE)
} else if (pitotmeterConfig()->pitot_hardware == PITOT_FAKE) {
if (pitotmeterConfig()->pitot_hardware == PITOT_FAKE) {
pitot.airSpeed = fakePitotGetAirspeed();
#endif
} else {
pitot.airSpeed = 0;
}
#endif
}
Expand Down

0 comments on commit cf506d5

Please sign in to comment.