diff --git a/conf/boards/px4fmu_2.4.makefile b/conf/boards/px4fmu_2.4.makefile index e1452f66f5..1a0496230c 100644 --- a/conf/boards/px4fmu_2.4.makefile +++ b/conf/boards/px4fmu_2.4.makefile @@ -24,7 +24,7 @@ HARD_FLOAT=yes FLASH_MODE ?= PX4_BOOTLOADER PX4_PROTOTYPE ?= "${PAPARAZZI_HOME}/sw/tools/px4/px4fmu-v2.prototype" PX4_BL_PORT ?= "/dev/serial/by-id/usb-3D_Robotics*,/dev/serial/by-id/pci-3D_Robotics*" -$(TARGET).MAKEFILE = stm32 + # # default LED configuration diff --git a/conf/boards/px4io_2.4.makefile b/conf/boards/px4io_2.4.makefile index 42406c6d1d..d6957c71c2 100644 --- a/conf/boards/px4io_2.4.makefile +++ b/conf/boards/px4io_2.4.makefile @@ -20,7 +20,7 @@ PX4_BL_PORT ?= "/dev/serial/by-id/usb-FTDI_*" PX4_PROTOTYPE ?= "${PAPARAZZI_HOME}/sw/tools/px4/px4io-v2.prototype" FLASH_MODE ?= PX4_BOOTLOADER -$(TARGET).MAKEFILE = stm32 + # # default LED configuration diff --git a/conf/firmwares/subsystems/fixedwing/intermcu_uart.makefile b/conf/firmwares/subsystems/fixedwing/intermcu_uart.makefile index 2c220b3971..37548b465c 100644 --- a/conf/firmwares/subsystems/fixedwing/intermcu_uart.makefile +++ b/conf/firmwares/subsystems/fixedwing/intermcu_uart.makefile @@ -7,15 +7,22 @@ ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE)) $(error Using intermcu via UART, so dual mcu with separate fbw. Please add ) endif +FBW_MODE_LED ?= none +INTERMCU_BAUD ?= B57600 + ifeq ($(TARGET),fbw) INTERMCU_PORT ?= UART2 INTERMCU_PORT_LOWER = $(shell echo $(INTERMCU_PORT) | tr A-Z a-z) - fbw.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER) -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=B57600 + INTERMCU_PORT_UPPER = $(shell echo $(INTERMCU_PORT) | tr a-z A-Z) + fbw.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER) -DUSE_$(INTERMCU_PORT_UPPER) -D$(INTERMCU_PORT_UPPER)_BAUD=$(INTERMCU_BAUD) +ifneq ($(FBW_MODE_LED),none) fbw.CFLAGS += -DFBW_MODE_LED=$(FBW_MODE_LED) +endif else INTERMCU_PORT ?= UART5 INTERMCU_PORT_LOWER = $(shell echo $(INTERMCU_PORT) | tr A-Z a-z) - ap.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER) -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=B57600 + INTERMCU_PORT_UPPER = $(shell echo $(INTERMCU_PORT) | tr a-z A-Z) + ap.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER) -DUSE_$(INTERMCU_PORT_UPPER) -D$(INTERMCU_PORT_UPPER)_BAUD=$(INTERMCU_BAUD) endif ifneq ($(TARGET),sim) diff --git a/conf/firmwares/subsystems/rotorcraft/intermcu_uart.makefile b/conf/firmwares/subsystems/rotorcraft/intermcu_uart.makefile index 8b2feea188..91b73b7ba3 100644 --- a/conf/firmwares/subsystems/rotorcraft/intermcu_uart.makefile +++ b/conf/firmwares/subsystems/rotorcraft/intermcu_uart.makefile @@ -2,28 +2,32 @@ # InterMCU type UART +FBW_MODE_LED ?= none +INTERMCU_PORT ?= UART3 +INTERMCU_BAUD ?= B230400 + +INTERMCU_PORT_LOWER = $(shell echo $(INTERMCU_PORT) | tr A-Z a-z) +INTERMCU_PORT_UPPER = $(shell echo $(INTERMCU_PORT) | tr a-z A-Z) + ifeq ($(TARGET),fbw) - INTERMCU_PORT ?= UART3 - INTERMCU_BAUD ?= B230400 - INTERMCU_PORT_LOWER = $(shell echo $(INTERMCU_PORT) | tr A-Z a-z) - fbw.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER) -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=$(INTERMCU_BAUD) + fbw.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER) + fbw.CFLAGS += -DUSE_$(INTERMCU_PORT_UPPER) -D$(INTERMCU_PORT_UPPER)_BAUD=$(INTERMCU_BAUD) fbw.CFLAGS += -DINTER_MCU_FBW -DDOWNLINK +ifneq ($(FBW_MODE_LED),none) fbw.CFLAGS += -DFBW_MODE_LED=$(FBW_MODE_LED) +endif fbw.srcs += pprzlink/src/pprz_transport.c fbw.srcs += subsystems/intermcu/intermcu_fbw.c else - INTERMCU_PORT ?= UART3 - INTERMCU_BAUD ?= B230400 - INTERMCU_PORT_LOWER = $(shell echo $(INTERMCU_PORT) | tr A-Z a-z) ap.CFLAGS += -DINTER_MCU_AP -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER) - ap.CFLAGS += -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=$(INTERMCU_BAUD) + ap.CFLAGS += -DUSE_$(INTERMCU_PORT_UPPER) -D$(INTERMCU_PORT_UPPER)_BAUD=$(INTERMCU_BAUD) $(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/intermcu/intermcu_ap.h\" -DRADIO_CONTROL RADIO_CONTROL_LED ?= none ifneq ($(RADIO_CONTROL_LED),none) $(TARGET).CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED) endif - ap.srcs += subsystems/intermcu/intermcu_ap.c - ap.srcs += pprzlink/src/pprz_transport.c - $(TARGET).srcs += subsystems/radio_control.c + ap.srcs += subsystems/intermcu/intermcu_ap.c + ap.srcs += pprzlink/src/pprz_transport.c + $(TARGET).srcs += subsystems/radio_control.c endif diff --git a/sw/airborne/subsystems/intermcu/intermcu_fbw.c b/sw/airborne/subsystems/intermcu/intermcu_fbw.c index 068e5df276..decff4ed0b 100644 --- a/sw/airborne/subsystems/intermcu/intermcu_fbw.c +++ b/sw/airborne/subsystems/intermcu/intermcu_fbw.c @@ -182,7 +182,9 @@ static inline void checkPx4RebootCommand(unsigned char b) return; } +#ifdef SYS_TIME_LED LED_ON(SYS_TIME_LED); +#endif if (b == px4RebootSequence[px4RebootSequenceCount]) { px4RebootSequenceCount++; @@ -202,9 +204,16 @@ static inline void checkPx4RebootCommand(unsigned char b) intermcu_device->put_byte(intermcu_device->periph, 0x66); // dummy byte, seems to be necessary otherwise one byte is missing at the fmu side... - while (((struct uart_periph *)(intermcu_device->periph))->tx_running) {LED_TOGGLE(SYS_TIME_LED);} // tx_running is volatile now, so LED_TOGGLE not necessary anymore + while (((struct uart_periph *)(intermcu_device->periph))->tx_running) { + // tx_running is volatile now, so LED_TOGGLE not necessary anymore +#ifdef SYS_TIME_LED + LED_TOGGLE(SYS_TIME_LED); +#endif + } +#ifdef SYS_TIME_LED LED_OFF(SYS_TIME_LED); +#endif scb_reset_system(); } }