From 14080021b2f77e077767133fa82528d6bd8e86f3 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sat, 29 Oct 2016 19:46:10 +0200 Subject: [PATCH] LP-437 - Support for Revolution --- .../boards/revolution/firmware/pios_board.c | 28 +++++++++++++++++++ shared/uavobjectdefinition/hwsettings.xml | 3 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/flight/targets/boards/revolution/firmware/pios_board.c b/flight/targets/boards/revolution/firmware/pios_board.c index 15b0a2f9b..d324ef619 100644 --- a/flight/targets/boards/revolution/firmware/pios_board.c +++ b/flight/targets/boards/revolution/firmware/pios_board.c @@ -260,6 +260,7 @@ uint32_t pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_NONE]; #define PIOS_COM_MSP_TX_BUF_LEN 128 #define PIOS_COM_MSP_RX_BUF_LEN 64 #define PIOS_COM_MAVLINK_TX_BUF_LEN 128 +#define PIOS_COM_MAVLINK_RX_BUF_LEN 128 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE) #define PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN 40 @@ -279,6 +280,7 @@ uint32_t pios_com_mavlink_id = 0; #if defined(PIOS_INCLUDE_RFM22B) uint32_t pios_rfm22b_id = 0; +#include #endif uintptr_t pios_uavo_settings_fs_id; @@ -997,6 +999,32 @@ void PIOS_Board_Init(void) /* Reinitialize the modem. */ PIOS_RFM22B_Reinit(pios_rfm22b_id); + + uint8_t hwsettings_radioaux; + HwSettingsRadioAuxStreamGet(&hwsettings_radioaux); + // TODO: this is in preparation for full mavlink support and is used by LP-368 + uint16_t mavlink_rx_size = PIOS_COM_MAVLINK_RX_BUF_LEN; + + switch (hwsettings_radioaux) { + case HWSETTINGS_RADIOAUXSTREAM_DEBUGCONSOLE: + case HWSETTINGS_RADIOAUXSTREAM_DISABLED: + break; + case HWSETTINGS_RADIOAUXSTREAM_MAVLINK: + { + uint8_t *auxrx_buffer = 0; + if (mavlink_rx_size) { + auxrx_buffer = (uint8_t *)pios_malloc(mavlink_rx_size); + } + uint8_t *auxtx_buffer = (uint8_t *)pios_malloc(PIOS_COM_MAVLINK_TX_BUF_LEN); + PIOS_Assert(auxrx_buffer); + PIOS_Assert(auxtx_buffer); + if (PIOS_COM_Init(&pios_com_mavlink_id, &pios_rfm22b_aux_com_driver, pios_rfm22b_id, + auxrx_buffer, mavlink_rx_size, + auxtx_buffer, PIOS_COM_BRIDGE_TX_BUF_LEN)) { + PIOS_Assert(0); + } + } + } } } else { oplinkStatus.LinkState = OPLINKSTATUS_LINKSTATE_DISABLED; diff --git a/shared/uavobjectdefinition/hwsettings.xml b/shared/uavobjectdefinition/hwsettings.xml index fa31c1040..ae30f9ec5 100644 --- a/shared/uavobjectdefinition/hwsettings.xml +++ b/shared/uavobjectdefinition/hwsettings.xml @@ -28,7 +28,8 @@ - + +