From 46213eb97e0ebfb41b4ddce173ff03ae93102914 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Fri, 8 Jun 2018 17:48:56 -0700 Subject: [PATCH] chibios_hwdef: fix wrong uart index calling uart_list.index() will find the first element with that name, which is not really what we want when we have multiple EMPTY uarts. --- libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index de64bb9bcd..9c6a11f2f8 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -550,8 +550,8 @@ def write_UART_config(f): # write out driver declarations for HAL_ChibOS_Class.cpp devnames = "ABCDEFGH" sdev = 0 + idx = 0 for dev in uart_list: - idx = uart_list.index(dev) if dev == 'EMPTY': f.write('#define HAL_UART%s_DRIVER Empty::UARTDriver uart%sDriver\n' % (devnames[idx], devnames[idx])) @@ -560,6 +560,7 @@ def write_UART_config(f): '#define HAL_UART%s_DRIVER ChibiOS::UARTDriver uart%sDriver(%u)\n' % (devnames[idx], devnames[idx], sdev)) sdev += 1 + idx += 1 for idx in range(len(uart_list), 6): f.write('#define HAL_UART%s_DRIVER Empty::UARTDriver uart%sDriver\n' % (devnames[idx], devnames[idx]))