@@ -134,17 +134,30 @@ bool pitotDetect(pitotDev_t *dev, uint8_t pitotHardwareToUse)
134134 FALLTHROUGH ;
135135
136136 case PITOT_VIRTUAL :
137- #if defined(USE_WIND_ESTIMATOR ) && defined(USE_PITOT_VIRTUAL )
138- if ((pitotHardwareToUse != PITOT_AUTODETECT ) && virtualPitotDetect (dev )) {
139- pitotHardware = PITOT_VIRTUAL ;
140- break ;
141- }
142- #endif
143- /* If we are asked for a specific sensor - break out, otherwise - fall through and continue */
144137 if (pitotHardwareToUse != PITOT_AUTODETECT ) {
138+ #if defined(USE_WIND_ESTIMATOR ) && defined(USE_PITOT_VIRTUAL )
139+ if (virtualPitotDetect (dev )) {
140+ pitotHardware = PITOT_VIRTUAL ;
141+ break ;
142+ }
143+ #endif
144+ requestedSensors [SENSOR_INDEX_PITOT ] = PITOT_NONE ;
145145 break ;
146146 }
147+
147148 FALLTHROUGH ;
149+ // case PITOT_VIRTUAL:
150+ // #if defined(USE_WIND_ESTIMATOR) && defined(USE_PITOT_VIRTUAL)
151+ // if ((pitotHardwareToUse != PITOT_AUTODETECT) && virtualPitotDetect(dev)) {
152+ // pitotHardware = PITOT_VIRTUAL;
153+ // break;
154+ // }
155+ // #endif
156+ // /* If we are asked for a specific sensor - break out, otherwise - fall through and continue */
157+ // if (pitotHardwareToUse != PITOT_AUTODETECT) {
158+ // break;
159+ // }
160+ // FALLTHROUGH;
148161
149162 case PITOT_MSP :
150163#ifdef USE_PITOT_MSP
@@ -240,29 +253,29 @@ STATIC_PROTOTHREAD(pitotThread)
240253 if ( pitot .lastSeenHealthyMs == 0 ) {
241254 if (pitot .dev .start (& pitot .dev )) {
242255 pitot .lastSeenHealthyMs = millis ();
243- }
256+ }
244257 }
245258
246259 if ( (millis () - pitot .lastSeenHealthyMs ) >= US2MS (pitot .dev .delay )) {
247260 if (pitot .dev .get (& pitot .dev )) // read current data
248261 pitot .lastSeenHealthyMs = millis ();
249262
250263 if (pitot .dev .start (& pitot .dev )) // init for next read
251- pitot .lastSeenHealthyMs = millis ();
264+ pitot .lastSeenHealthyMs = millis ();
252265 }
253266
254267
255268 pitot .dev .calculate (& pitot .dev , & pitotPressureTmp , & pitotTemperatureTmp );
256269
257270#ifdef USE_SIMULATOR
258271 if (SIMULATOR_HAS_OPTION (HITL_AIRSPEED )) {
259- pitotPressureTmp = sq (simulatorData .airSpeed ) * SSL_AIR_DENSITY / 20000.0f + SSL_AIR_PRESSURE ;
272+ pitotPressureTmp = sq (simulatorData .airSpeed ) * SSL_AIR_DENSITY / 20000.0f + SSL_AIR_PRESSURE ;
260273 }
261274#endif
262275#if defined(USE_PITOT_FAKE )
263- if (pitotmeterConfig ()-> pitot_hardware == PITOT_FAKE ) {
264- pitotPressureTmp = sq (fakePitotGetAirspeed ()) * SSL_AIR_DENSITY / 20000.0f + SSL_AIR_PRESSURE ;
265- }
276+ if (pitotmeterConfig ()-> pitot_hardware == PITOT_FAKE ) {
277+ pitotPressureTmp = sq (fakePitotGetAirspeed ()) * SSL_AIR_DENSITY / 20000.0f + SSL_AIR_PRESSURE ;
278+ }
266279#endif
267280 ptYield ();
268281
@@ -297,7 +310,7 @@ STATIC_PROTOTHREAD(pitotThread)
297310 }
298311
299312#if defined(USE_PITOT_FAKE )
300- if (pitotmeterConfig ()-> pitot_hardware == PITOT_FAKE ) {
313+ if (pitotmeterConfig ()-> pitot_hardware == PITOT_FAKE ) {
301314 pitot .airSpeed = fakePitotGetAirspeed ();
302315 }
303316#endif
0 commit comments