Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue of IOMCU serial showing up in the Serial Manager parameter list #29493

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,10 @@ def get_extra_bylabel(self, label, name, default=None):
def write_UART_config(self, f):
'''write UART config defines'''
serial_list = self.get_config('SERIAL_ORDER', required=False, aslist=True)
hide_iomcu_uart = False
if 'IOMCU_UART' in self.config:
hide_iomcu_uart = self.config['IOMCU_UART'][0] not in serial_list

if 'IOMCU_UART' in self.config and self.config['IOMCU_UART'][0] not in serial_list:
serial_list.append(self.config['IOMCU_UART'][0])
if serial_list is None:
Expand All @@ -1682,10 +1686,16 @@ def write_UART_config(self, f):
# write out which serial ports we actually have
nports = 0
for idx, serial in enumerate(serial_list):
if hide_iomcu_uart and self.config['IOMCU_UART'][0] == serial:
# IOMCU UART is not to be displayed in the serial parameters
f.write('#define HAL_HAVE_SERIAL%u 1\n' % idx)
f.write('#define HAL_HIDE_SERIAL%u_PARAMS 1\n' % idx)
continue
if serial == 'EMPTY':
f.write('#define HAL_HAVE_SERIAL%u 0\n' % idx)
else:
f.write('#define HAL_HAVE_SERIAL%u 1\n' % idx)
f.write('#define HAL_HIDE_SERIAL%u_PARAMS 0\n' % idx)
nports = nports + 1
f.write('#define HAL_NUM_SERIAL_PORTS %u\n' % nports)

Expand Down
32 changes: 16 additions & 16 deletions libraries/AP_SerialManager/AP_SerialManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ extern const AP_HAL::HAL& hal;
#endif

const AP_Param::GroupInfo AP_SerialManager::var_info[] = {
#if HAL_HAVE_SERIAL0
#if !HAL_HIDE_SERIAL0_PARAMS
// @Param: 0_BAUD
// @DisplayName: Serial0 baud rate
// @Description: The baud rate used on the USB console. Most stm32-based boards can support rates of up to 1500. If you setup a rate you cannot support and then can't connect to your board you should load a firmware from a different vehicle type. That will reset all your parameters to defaults.
Expand All @@ -179,7 +179,7 @@ const AP_Param::GroupInfo AP_SerialManager::var_info[] = {
AP_GROUPINFO("0_PROTOCOL", 11, AP_SerialManager, state[0].protocol, SerialProtocol_MAVLink2),
#endif

#if HAL_HAVE_SERIAL1
#if !HAL_HIDE_SERIAL1_PARAMS
// @Param: 1_PROTOCOL
// @DisplayName: Telem1 protocol selection
// @Description: Control what protocol to use on the Telem1 port. Note that the Frsky options require external converter hardware. See the wiki for details.
Expand All @@ -197,7 +197,7 @@ const AP_Param::GroupInfo AP_SerialManager::var_info[] = {
AP_GROUPINFO("1_BAUD", 2, AP_SerialManager, state[1].baud, DEFAULT_SERIAL1_BAUD),
#endif

#if HAL_HAVE_SERIAL2
#if !HAL_HIDE_SERIAL2_PARAMS
// @Param: 2_PROTOCOL
// @CopyFieldsFrom: SERIAL1_PROTOCOL
// @DisplayName: Telemetry 2 protocol selection
Expand All @@ -211,7 +211,7 @@ const AP_Param::GroupInfo AP_SerialManager::var_info[] = {
AP_GROUPINFO("2_BAUD", 4, AP_SerialManager, state[2].baud, DEFAULT_SERIAL2_BAUD),
#endif

#if HAL_HAVE_SERIAL3
#if !HAL_HIDE_SERIAL3_PARAMS
// @Param: 3_PROTOCOL
// @CopyFieldsFrom: SERIAL1_PROTOCOL
// @DisplayName: Serial 3 (GPS) protocol selection
Expand All @@ -225,7 +225,7 @@ const AP_Param::GroupInfo AP_SerialManager::var_info[] = {
AP_GROUPINFO("3_BAUD", 6, AP_SerialManager, state[3].baud, DEFAULT_SERIAL3_BAUD),
#endif

#if HAL_HAVE_SERIAL4
#if !HAL_HIDE_SERIAL4_PARAMS
// @Param: 4_PROTOCOL
// @CopyFieldsFrom: SERIAL1_PROTOCOL
// @DisplayName: Serial4 protocol selection
Expand All @@ -239,7 +239,7 @@ const AP_Param::GroupInfo AP_SerialManager::var_info[] = {
AP_GROUPINFO("4_BAUD", 8, AP_SerialManager, state[4].baud, DEFAULT_SERIAL4_BAUD),
#endif

#if HAL_HAVE_SERIAL5
#if !HAL_HIDE_SERIAL5_PARAMS
// @Param: 5_PROTOCOL
// @CopyFieldsFrom: SERIAL1_PROTOCOL
// @DisplayName: Serial5 protocol selection
Expand All @@ -255,7 +255,7 @@ const AP_Param::GroupInfo AP_SerialManager::var_info[] = {

// index 11 used by 0_PROTOCOL

#if HAL_HAVE_SERIAL6
#if !HAL_HIDE_SERIAL6_PARAMS
// @Param: 6_PROTOCOL
// @CopyFieldsFrom: SERIAL1_PROTOCOL
// @DisplayName: Serial6 protocol selection
Expand All @@ -269,7 +269,7 @@ const AP_Param::GroupInfo AP_SerialManager::var_info[] = {
AP_GROUPINFO("6_BAUD", 13, AP_SerialManager, state[6].baud, DEFAULT_SERIAL6_BAUD),
#endif

#if HAL_HAVE_SERIAL1
#if !HAL_HIDE_SERIAL1_PARAMS
// @Param: 1_OPTIONS
// @DisplayName: Telem1 options
// @Description: Control over UART options. The InvertRX option controls invert of the receive pin. The InvertTX option controls invert of the transmit pin. The HalfDuplex option controls half-duplex (onewire) mode, where both transmit and receive is done on the transmit wire. The Swap option allows the RX and TX pins to be swapped on STM32F7 based boards.
Expand All @@ -279,35 +279,35 @@ const AP_Param::GroupInfo AP_SerialManager::var_info[] = {
AP_GROUPINFO("1_OPTIONS", 14, AP_SerialManager, state[1].options, DEFAULT_SERIAL1_OPTIONS),
#endif

#if HAL_HAVE_SERIAL2
#if !HAL_HIDE_SERIAL2_PARAMS
// @Param: 2_OPTIONS
// @CopyFieldsFrom: SERIAL1_OPTIONS
// @DisplayName: Telem2 options
AP_GROUPINFO("2_OPTIONS", 15, AP_SerialManager, state[2].options, DEFAULT_SERIAL2_OPTIONS),
#endif

#if HAL_HAVE_SERIAL3
#if !HAL_HIDE_SERIAL3_PARAMS
// @Param: 3_OPTIONS
// @CopyFieldsFrom: SERIAL1_OPTIONS
// @DisplayName: Serial3 options
AP_GROUPINFO("3_OPTIONS", 16, AP_SerialManager, state[3].options, DEFAULT_SERIAL3_OPTIONS),
#endif

#if HAL_HAVE_SERIAL4
#if !HAL_HIDE_SERIAL4_PARAMS
// @Param: 4_OPTIONS
// @CopyFieldsFrom: SERIAL1_OPTIONS
// @DisplayName: Serial4 options
AP_GROUPINFO("4_OPTIONS", 17, AP_SerialManager, state[4].options, DEFAULT_SERIAL4_OPTIONS),
#endif

#if HAL_HAVE_SERIAL5
#if !HAL_HIDE_SERIAL5_PARAMS
// @Param: 5_OPTIONS
// @CopyFieldsFrom: SERIAL1_OPTIONS
// @DisplayName: Serial5 options
AP_GROUPINFO("5_OPTIONS", 18, AP_SerialManager, state[5].options, DEFAULT_SERIAL5_OPTIONS),
#endif

#if HAL_HAVE_SERIAL6
#if !HAL_HIDE_SERIAL6_PARAMS
// @Param: 6_OPTIONS
// @CopyFieldsFrom: SERIAL1_OPTIONS
// @DisplayName: Serial6 options
Expand Down Expand Up @@ -336,7 +336,7 @@ const AP_Param::GroupInfo AP_SerialManager::var_info[] = {
// @User: Advanced
AP_GROUPINFO("_PASSTIMO", 22, AP_SerialManager, passthru_timeout, 15),

#if HAL_HAVE_SERIAL7
#if !HAL_HIDE_SERIAL7_PARAMS
// @Param: 7_PROTOCOL
// @CopyFieldsFrom: SERIAL1_PROTOCOL
// @DisplayName: Serial7 protocol selection
Expand All @@ -355,7 +355,7 @@ const AP_Param::GroupInfo AP_SerialManager::var_info[] = {
AP_GROUPINFO("7_OPTIONS", 25, AP_SerialManager, state[7].options, 0),
#endif

#if HAL_HAVE_SERIAL8
#if !HAL_HIDE_SERIAL8_PARAMS
// @Param: 8_PROTOCOL
// @CopyFieldsFrom: SERIAL1_PROTOCOL
// @DisplayName: Serial8 protocol selection
Expand All @@ -374,7 +374,7 @@ const AP_Param::GroupInfo AP_SerialManager::var_info[] = {
AP_GROUPINFO("8_OPTIONS", 28, AP_SerialManager, state[8].options, 0),
#endif

#if HAL_HAVE_SERIAL9
#if !HAL_HIDE_SERIAL9_PARAMS
// @Param: 9_PROTOCOL
// @CopyFieldsFrom: SERIAL1_PROTOCOL
// @DisplayName: Serial9 protocol selection
Expand Down
60 changes: 50 additions & 10 deletions libraries/AP_SerialManager/AP_SerialManager_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,32 +146,72 @@
#define AP_SERIALMANAGER_PPP_BUFSIZE_TX 4096

#ifndef HAL_HAVE_SERIAL0
#define HAL_HAVE_SERIAL0 HAL_NUM_SERIAL_PORTS > 0
#define HAL_HAVE_SERIAL0 (HAL_NUM_SERIAL_PORTS > 0)
#endif
#ifndef HAL_HAVE_SERIAL1
#define HAL_HAVE_SERIAL1 HAL_NUM_SERIAL_PORTS > 1
#define HAL_HAVE_SERIAL1 (HAL_NUM_SERIAL_PORTS > 1)
#endif
#ifndef HAL_HAVE_SERIAL2
#define HAL_HAVE_SERIAL2 HAL_NUM_SERIAL_PORTS > 2
#define HAL_HAVE_SERIAL2 (HAL_NUM_SERIAL_PORTS > 2)
#endif
#ifndef HAL_HAVE_SERIAL3
#define HAL_HAVE_SERIAL3 HAL_NUM_SERIAL_PORTS > 3
#define HAL_HAVE_SERIAL3 (HAL_NUM_SERIAL_PORTS > 3)
#endif
#ifndef HAL_HAVE_SERIAL4
#define HAL_HAVE_SERIAL4 HAL_NUM_SERIAL_PORTS > 4
#define HAL_HAVE_SERIAL4 (HAL_NUM_SERIAL_PORTS > 4)
#endif
#ifndef HAL_HAVE_SERIAL5
#define HAL_HAVE_SERIAL5 HAL_NUM_SERIAL_PORTS > 5
#define HAL_HAVE_SERIAL5 (HAL_NUM_SERIAL_PORTS > 5)
#endif
#ifndef HAL_HAVE_SERIAL6
#define HAL_HAVE_SERIAL6 HAL_NUM_SERIAL_PORTS > 6
#define HAL_HAVE_SERIAL6 (HAL_NUM_SERIAL_PORTS > 6)
#endif
#ifndef HAL_HAVE_SERIAL7
#define HAL_HAVE_SERIAL7 HAL_NUM_SERIAL_PORTS > 7
#define HAL_HAVE_SERIAL7 (HAL_NUM_SERIAL_PORTS > 7)
#endif
#ifndef HAL_HAVE_SERIAL8
#define HAL_HAVE_SERIAL8 HAL_NUM_SERIAL_PORTS > 8
#define HAL_HAVE_SERIAL8 (HAL_NUM_SERIAL_PORTS > 8)
#endif
#ifndef HAL_HAVE_SERIAL9
#define HAL_HAVE_SERIAL9 HAL_NUM_SERIAL_PORTS > 9
#define HAL_HAVE_SERIAL9 (HAL_NUM_SERIAL_PORTS > 9)
#endif

#ifndef HAL_HIDE_SERIAL0_PARAMS
#define HAL_HIDE_SERIAL0_PARAMS !HAL_HAVE_SERIAL0
#endif

#ifndef HAL_HIDE_SERIAL1_PARAMS
#define HAL_HIDE_SERIAL1_PARAMS !HAL_HAVE_SERIAL1
#endif

#ifndef HAL_HIDE_SERIAL2_PARAMS
#define HAL_HIDE_SERIAL2_PARAMS !HAL_HAVE_SERIAL2
#endif

#ifndef HAL_HIDE_SERIAL3_PARAMS
#define HAL_HIDE_SERIAL3_PARAMS !HAL_HAVE_SERIAL3
#endif

#ifndef HAL_HIDE_SERIAL4_PARAMS
#define HAL_HIDE_SERIAL4_PARAMS !HAL_HAVE_SERIAL4
#endif

#ifndef HAL_HIDE_SERIAL5_PARAMS
#define HAL_HIDE_SERIAL5_PARAMS !HAL_HAVE_SERIAL5
#endif

#ifndef HAL_HIDE_SERIAL6_PARAMS
#define HAL_HIDE_SERIAL6_PARAMS !HAL_HAVE_SERIAL6
#endif

#ifndef HAL_HIDE_SERIAL7_PARAMS
#define HAL_HIDE_SERIAL7_PARAMS !HAL_HAVE_SERIAL7
#endif

#ifndef HAL_HIDE_SERIAL8_PARAMS
#define HAL_HIDE_SERIAL8_PARAMS !HAL_HAVE_SERIAL8
#endif

#ifndef HAL_HIDE_SERIAL9_PARAMS
#define HAL_HIDE_SERIAL9_PARAMS !HAL_HAVE_SERIAL9
#endif
Loading