Browse Source

AP_Periph: add BARO_ENABLE option

c415-sdk
CUAVcaijie 5 years ago committed by Andrew Tridgell
parent
commit
39c87f473a
  1. 1
      Tools/AP_Periph/Parameters.cpp
  2. 5
      Tools/AP_Periph/Parameters.h
  3. 3
      Tools/AP_Periph/can.cpp

1
Tools/AP_Periph/Parameters.cpp

@ -57,6 +57,7 @@ const AP_Param::Info AP_Periph_FW::var_info[] = { @@ -57,6 +57,7 @@ const AP_Param::Info AP_Periph_FW::var_info[] = {
// @Group: BARO_
// @Path: ../../libraries/AP_Baro/AP_Baro.cpp
GOBJECT(baro, "BARO_", AP_Baro),
GSCALAR(baro_enable, "BARO_ENABLE", 1),
#endif
#ifdef AP_PERIPH_HAVE_LED

5
Tools/AP_Periph/Parameters.h

@ -26,6 +26,7 @@ public: @@ -26,6 +26,7 @@ public:
k_param_adsb_baudrate,
k_param_hardpoint_id,
k_param_hardpoint_rate,
k_param_baro_enable,
};
AP_Int16 format_version;
@ -37,7 +38,9 @@ public: @@ -37,7 +38,9 @@ public:
#ifdef AP_PERIPH_HAVE_LED
AP_Int8 led_brightness;
#endif
#ifdef HAL_PERIPH_ENABLE_BARO
AP_Int8 baro_enable;
#endif
#if !defined(HAL_NO_FLASH_SUPPORT) && !defined(HAL_NO_ROMFS_SUPPORT)
AP_Int8 flash_bootloader;
#endif

3
Tools/AP_Periph/can.cpp

@ -1377,6 +1377,9 @@ void AP_Periph_FW::can_gps_update(void) @@ -1377,6 +1377,9 @@ void AP_Periph_FW::can_gps_update(void)
void AP_Periph_FW::can_baro_update(void)
{
#ifdef HAL_PERIPH_ENABLE_BARO
if (!periph.g.baro_enable) {
return;
}
baro.update();
if (last_baro_update_ms == baro.get_last_update()) {
return;

Loading…
Cancel
Save