Rev 2112 | Rev 2164 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2112 | Rev 2160 | ||
---|---|---|---|
Line 304... | Line 304... | ||
304 | // do not restart ADC converter. |
304 | // do not restart ADC converter. |
305 | } |
305 | } |
306 | } |
306 | } |
Line 307... | Line 307... | ||
307 | 307 | ||
- | 308 | void measureGyroActivity(int16_t newValue) { |
|
308 | void measureGyroActivity(int16_t newValue) { |
309 | gyroActivity += newValue * newValue; |
309 | gyroActivity += (uint32_t)((int32_t)newValue * newValue); |
310 | // abs(newValue); // (uint32_t)((int32_t)newValue * newValue); |
Line 310... | Line 311... | ||
310 | } |
311 | } |
311 | 312 | ||
312 | #define GADAMPING 6 |
313 | #define GADAMPING 6 |
- | 314 | void dampenGyroActivity(void) { |
|
313 | void dampenGyroActivity(void) { |
315 | static uint8_t cnt = 0; |
314 | static uint8_t cnt = 0; |
316 | |
315 | if (++cnt >= IMUConfig.gyroActivityDamping) { |
317 | if (++cnt >= IMUConfig.gyroActivityDamping) { |
316 | cnt = 0; |
318 | cnt = 0; |
317 | gyroActivity *= (uint32_t)((1L<<GADAMPING)-1); |
319 | gyroActivity *= (uint32_t)((1L<<GADAMPING)-1); |
- | 320 | gyroActivity >>= GADAMPING; |
|
- | 321 | } |
|
- | 322 | ||
- | 323 | /* |
|
- | 324 | if (gyroActivity >= 10) gyroActivity -= 10; |
|
318 | gyroActivity >>= GADAMPING; |
325 | else if (gyroActivity <=- 10) gyroActivity += 10; |
Line 319... | Line 326... | ||
319 | } |
326 | */ |
320 | } |
327 | } |
321 | 328 | ||
Line 467... | Line 474... | ||
467 | } |
474 | } |
468 | } |
475 | } |
Line 469... | Line 476... | ||
469 | 476 | ||
470 | // Even if the sample is off-range, use it. |
477 | // Even if the sample is off-range, use it. |
471 | simpleAirPressure = getSimplePressure(rawAirPressure); |
478 | simpleAirPressure = getSimplePressure(rawAirPressure); |
472 | debugOut.analog[6] = rawAirPressure; |
479 | // debugOut.analog[6] = rawAirPressure; |
Line 473... | Line 480... | ||
473 | debugOut.analog[7] = simpleAirPressure; |
480 | // debugOut.analog[7] = simpleAirPressure; |
474 | 481 | ||
475 | if (simpleAirPressure < MIN_RANGES_EXTRAPOLATION * rangewidth) { |
482 | if (simpleAirPressure < MIN_RANGES_EXTRAPOLATION * rangewidth) { |
476 | // Danger: pressure near lower end of range. If the measurement saturates, the |
483 | // Danger: pressure near lower end of range. If the measurement saturates, the |