mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 23:49:00 +08:00
[modules] baro_board: only call event handler if there is new data
This commit is contained in:
committed by
Tobias Muench
parent
732bdcde90
commit
446292761b
@@ -54,7 +54,7 @@ void baro_MS5534A_event_task( void );
|
||||
|
||||
void baro_MS5534A_event( void );
|
||||
|
||||
#define BaroMS5534AUpdate(_b) { if (baro_MS5534A_available) { _b = baro_MS5534A_pressure; baro_MS5534A_available = FALSE; } }
|
||||
#define BaroMS5534AUpdate(_b, _h) { if (baro_MS5534A_available) { _b = baro_MS5534A_pressure; _h(); baro_MS5534A_available = FALSE; } }
|
||||
|
||||
#endif // USE_BARO_MS5534A
|
||||
|
||||
|
||||
@@ -47,6 +47,6 @@ extern void baro_amsys_read_event( void );
|
||||
|
||||
#define BaroAmsysEvent() { if (baro_amsys_i2c_trans.status == I2CTransSuccess) baro_amsys_read_event(); }
|
||||
|
||||
#define BaroAmsysUpdate(_b) { if (baro_amsys_valid) { _b = baro_amsys_adc; baro_amsys_valid = FALSE; } }
|
||||
#define BaroAmsysUpdate(_b, _h) { if (baro_amsys_valid) { _b = baro_amsys_adc; _h(); baro_amsys_valid = FALSE; } }
|
||||
|
||||
#endif // BARO_AMSYS_H
|
||||
|
||||
@@ -51,6 +51,6 @@ void baro_bmp_init(void);
|
||||
void baro_bmp_periodic(void);
|
||||
void baro_bmp_event(void);
|
||||
|
||||
#define BaroBmpUpdate(_b) { if (baro_bmp_valid) { _b = baro_bmp_pressure; baro_bmp_valid = FALSE; } }
|
||||
#define BaroBmpUpdate(_b, _h) { if (baro_bmp_valid) { _b = baro_bmp_pressure; _h(); baro_bmp_valid = FALSE; } }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -56,10 +56,8 @@
|
||||
* Need to be maped to one the external baro running has a module
|
||||
*/
|
||||
#define BaroEvent(_b_abs_handler, _b_diff_handler) { \
|
||||
BARO_ABS_EVENT(baro.absolute); \
|
||||
BARO_DIFF_EVENT(baro.differential); \
|
||||
_b_abs_handler(); \
|
||||
_b_diff_handler(); \
|
||||
BARO_ABS_EVENT(baro.absolute, _b_abs_handler); \
|
||||
BARO_DIFF_EVENT(baro.differential, _b_diff_handler); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -63,6 +63,6 @@ extern void baro_ets_read_event( void );
|
||||
|
||||
#define BaroEtsEvent() { if (baro_ets_i2c_trans.status == I2CTransSuccess) baro_ets_read_event(); }
|
||||
|
||||
#define BaroEtsUpdate(_b) { if (baro_ets_valid) { _b = baro_ets_adc; baro_ets_valid = FALSE; } }
|
||||
#define BaroEtsUpdate(_b, _h) { if (baro_ets_valid) { _b = baro_ets_adc; _h(); baro_ets_valid = FALSE; } }
|
||||
|
||||
#endif // BARO_ETS_H
|
||||
|
||||
@@ -42,6 +42,6 @@ extern void baro_ms5611_d1(void);
|
||||
extern void baro_ms5611_d2(void);
|
||||
extern void baro_ms5611_event(void);
|
||||
|
||||
#define BaroMs5611Update(_b) { if (baro_ms5611_valid) { _b = baro_ms5611_alt; baro_ms5611_valid = FALSE; } }
|
||||
#define BaroMs5611Update(_b, _h) { if (baro_ms5611_valid) { _b = baro_ms5611_alt; _h(); baro_ms5611_valid = FALSE; } }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,6 @@ void baro_scp_init(void);
|
||||
void baro_scp_periodic(void);
|
||||
void baro_scp_event(void);
|
||||
|
||||
#define BaroScpUpdate(_b) { if (baro_scp_available) { _b = baro_scp_pressure; baro_scp_available = FALSE; } }
|
||||
#define BaroScpUpdate(_b, _h) { if (baro_scp_available) { _b = baro_scp_pressure; _h(); baro_scp_available = FALSE; } }
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user