diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index 88602c0d10..e6aedc3def 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -1199,12 +1199,11 @@ def write_UART_config(f): devnames = "ABCDEFGHI" sdev = 0 idx = 0 - num_empty_uarts = 0 for dev in uart_list: if dev == 'EMPTY': f.write('#define HAL_UART%s_DRIVER Empty::UARTDriver uart%sDriver\n' % (devnames[idx], devnames[idx])) - num_empty_uarts += 1 + sdev += 1 else: f.write( '#define HAL_UART%s_DRIVER ChibiOS::UARTDriver uart%sDriver(%u)\n' @@ -1242,6 +1241,7 @@ def write_UART_config(f): elif dev.startswith('OTG'): n = int(dev[3:]) elif dev.startswith('EMPTY'): + devlist.append('{}') continue else: error("Invalid element %s in UART_ORDER" % dev) @@ -1307,7 +1307,7 @@ def write_UART_config(f): num_uarts -= 1 if num_uarts > 9: error("Exceeded max num UARTs of 9 (%u)" % num_uarts) - f.write('#define HAL_UART_NUM_SERIAL_PORTS %u\n' % (num_uarts+num_empty_uarts)) + f.write('#define HAL_UART_NUM_SERIAL_PORTS %u\n' % num_uarts) def write_UART_config_bootloader(f):