mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 06:15:10 +03:00
USB modes cleanup (#5396)
* USB modes cleanup * Forgot a couple * Exclude joystick code from bootloader
This commit is contained in:
parent
f2cf444a64
commit
8662de39f5
10 changed files with 14 additions and 20 deletions
|
@ -224,7 +224,7 @@ void menuStatisticsDebug(event_t event)
|
|||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if !defined(SIMU) && defined(USB_SERIAL)
|
||||
#if !defined(SIMU) && defined(DEBUG)
|
||||
lcdDrawTextAlignedLeft(MENU_DEBUG_Y_USB, "Usb");
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_USB, charsWritten, LEFT);
|
||||
lcdDrawText(lcdLastRightPos, MENU_DEBUG_Y_USB, " ");
|
||||
|
|
|
@ -173,7 +173,7 @@ void menuStatisticsDebug(event_t event)
|
|||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW1, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT);
|
||||
lcdDrawText(lcdLastRightPos, MENU_DEBUG_ROW1, "ms");
|
||||
|
||||
#if !defined(SIMU) && defined(USB_SERIAL)
|
||||
#if !defined(SIMU) && defined(DEBUG)
|
||||
lcdDrawTextAlignedLeft(MENU_DEBUG_ROW4, "Usb");
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW4, charsWritten, LEFT);
|
||||
lcdDrawText(lcdLastRightPos, MENU_DEBUG_ROW4, " ");
|
||||
|
|
|
@ -451,7 +451,7 @@ void perMain()
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(USB_MASS_STORAGE)
|
||||
#if defined(STM32)
|
||||
if (usbPlugged() && getSelectedUsbMode() == USB_MASS_STORAGE_MODE) {
|
||||
// disable access to menus
|
||||
lcdClear();
|
||||
|
|
|
@ -1989,7 +1989,7 @@ void opentxClose(uint8_t shutdown)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(USB_MASS_STORAGE)
|
||||
#if defined(STM32)
|
||||
void opentxResume()
|
||||
{
|
||||
TRACE("opentxResume");
|
||||
|
@ -2465,10 +2465,6 @@ uint16_t stackAvailable()
|
|||
|
||||
void opentxInit(OPENTX_INIT_ARGS)
|
||||
{
|
||||
#if defined(DEBUG) && defined(USB_SERIAL)
|
||||
// CoTickDelay(5000); // 10s
|
||||
#endif
|
||||
|
||||
TRACE("opentxInit");
|
||||
|
||||
#if defined(GUI)
|
||||
|
|
|
@ -1680,7 +1680,7 @@ FORCEINLINE void convertUnit(getvalue_t & val, uint8_t & unit)
|
|||
extern const pm_uchar logo_taranis[];
|
||||
#endif
|
||||
|
||||
#if defined(USB_MASS_STORAGE)
|
||||
#if defined(STM32)
|
||||
void usbPluggedIn();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ set(FIRMWARE_TARGET_SRC
|
|||
../common/arm/stm32/usbd_usr.cpp
|
||||
../common/arm/stm32/usb_driver.cpp
|
||||
)
|
||||
add_definitions(-DUSB_SERIAL)
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
../common/arm/stm32/usbd_cdc.cpp
|
||||
|
@ -46,7 +45,6 @@ set(STM32USB_SRC
|
|||
${STM32USB_SRC}
|
||||
STM32_USB_Device_Library/Class/cdc/src/usbd_cdc_core.c
|
||||
)
|
||||
add_definitions(-DUSB_MASS_STORAGE)
|
||||
set(STM32USB_SRC
|
||||
${STM32USB_SRC}
|
||||
STM32_USB_Device_Library/Class/msc/src/usbd_msc_data.c
|
||||
|
@ -58,7 +56,6 @@ set(FIRMWARE_TARGET_SRC
|
|||
${FIRMWARE_TARGET_SRC}
|
||||
../common/arm/stm32/usbd_storage_msd.cpp
|
||||
)
|
||||
add_definitions(-DUSB_JOYSTICK)
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
../common/arm/stm32/usbd_hid_joystick.c
|
||||
|
|
|
@ -116,7 +116,7 @@ bool usbStarted()
|
|||
return usbDriverStarted;
|
||||
}
|
||||
|
||||
#if defined(USB_JOYSTICK)
|
||||
#if !defined(BOOT)
|
||||
/*
|
||||
Prepare and send new USB data packet
|
||||
|
||||
|
@ -157,5 +157,4 @@ void usbJoystickUpdate()
|
|||
USBD_HID_SendReport(&USB_OTG_dev, HID_Buffer, HID_IN_PACKET);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // #defined(USB_JOYSTICK)
|
||||
#endif
|
||||
|
|
|
@ -45,7 +45,7 @@ void setSelectedUsbMode(int mode);
|
|||
void usbSerialPutc(uint8_t c);
|
||||
|
||||
// Used in view_statistics.cpp
|
||||
#if defined(USB_SERIAL)
|
||||
#if defined(DEBUG) && !defined(BOOT)
|
||||
extern uint16_t usbWraps;
|
||||
extern uint16_t charsWritten;
|
||||
extern volatile uint32_t APP_Rx_ptr_in;
|
||||
|
|
|
@ -61,8 +61,8 @@ set(BOOTLOADER_SRC
|
|||
boot.cpp
|
||||
)
|
||||
|
||||
remove_definitions(-DUSB_JOYSTICK -DUSB_SERIAL -DLUA -DDEBUG)
|
||||
add_definitions(-DBOOT -DUSB_MASS_STORAGE)
|
||||
remove_definitions(-DLUA -DDEBUG)
|
||||
add_definitions(-DBOOT)
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-mcpu=${MCU} -mthumb -nostartfiles -lm -T${RADIO_SRC_DIRECTORY}/targets/taranis/stm32_ramboot.ld -Wl,-Map=bootloader.map,--cref,--no-warn-mismatch,--gc-sections")
|
||||
|
||||
|
|
|
@ -170,8 +170,10 @@ void mixerTask(void * pdata)
|
|||
CoLeaveMutexSection(mixerMutex);
|
||||
DEBUG_TIMER_STOP(debugTimerMixer);
|
||||
|
||||
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
||||
usbJoystickUpdate();
|
||||
#if defined(STM32) && !defined(SIMU)
|
||||
if (getSelectedUsbMode() == USB_JOYSTICK_MODE) {
|
||||
usbJoystickUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) || defined(TELEMETRY_MAVLINK)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue