mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 14:25:11 +03:00
Projectkk2glider/issue 4479 slow joystick (#4569)
* Missing debug timer * USB driver cleanup * Re #4479: Joystick update called from mixer thread every 10ms * Cosmetics * Compilation fix * Cosmetics * Another compilation fix
This commit is contained in:
parent
15a373c1cd
commit
03b65b06b6
12 changed files with 136 additions and 161 deletions
|
@ -240,6 +240,7 @@ const char * const debugTimerNames[DEBUG_TIMERS_COUNT] = {
|
||||||
,"Mixer calc " // debugTimerMixer,
|
,"Mixer calc " // debugTimerMixer,
|
||||||
,"Tel. wakeup" // debugTimerTelemetryWakeup,
|
,"Tel. wakeup" // debugTimerTelemetryWakeup,
|
||||||
,"perMain dur" // debugTimerPerMain,
|
,"perMain dur" // debugTimerPerMain,
|
||||||
|
," period " // debugTimerPerMainPeriod,
|
||||||
," perMain s1" // debugTimerPerMain1,
|
," perMain s1" // debugTimerPerMain1,
|
||||||
," guiMain " // debugTimerGuiMain,
|
," guiMain " // debugTimerGuiMain,
|
||||||
," LUA bg " // debugTimerLuaBg,
|
," LUA bg " // debugTimerLuaBg,
|
||||||
|
|
|
@ -366,6 +366,7 @@ enum DebugTimers {
|
||||||
debugTimerMixer,
|
debugTimerMixer,
|
||||||
debugTimerTelemetryWakeup,
|
debugTimerTelemetryWakeup,
|
||||||
debugTimerPerMain,
|
debugTimerPerMain,
|
||||||
|
debugTimerPerMainPeriod,
|
||||||
debugTimerPerMain1,
|
debugTimerPerMain1,
|
||||||
debugTimerGuiMain,
|
debugTimerGuiMain,
|
||||||
debugTimerLuaBg,
|
debugTimerLuaBg,
|
||||||
|
|
|
@ -27,30 +27,19 @@ uint8_t mainRequestFlags = 0;
|
||||||
void handleUsbConnection()
|
void handleUsbConnection()
|
||||||
{
|
{
|
||||||
#if defined(STM32) && !defined(SIMU)
|
#if defined(STM32) && !defined(SIMU)
|
||||||
static bool usbStarted = false;
|
if (!usbStarted() && usbPlugged()) {
|
||||||
|
|
||||||
if (!usbStarted && usbPlugged()) {
|
|
||||||
usbStarted = true;
|
|
||||||
usbStart();
|
usbStart();
|
||||||
#if defined(USB_MASS_STORAGE)
|
#if defined(USB_MASS_STORAGE)
|
||||||
opentxClose(false);
|
opentxClose(false);
|
||||||
usbPluggedIn();
|
usbPluggedIn();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (usbStarted && !usbPlugged()) {
|
if (usbStarted() && !usbPlugged()) {
|
||||||
usbStarted = false;
|
|
||||||
usbStop();
|
usbStop();
|
||||||
#if defined(USB_MASS_STORAGE) && !defined(EEPROM)
|
#if defined(USB_MASS_STORAGE) && !defined(EEPROM)
|
||||||
opentxResume();
|
opentxResume();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USB_JOYSTICK)
|
|
||||||
if (usbStarted ) {
|
|
||||||
usbJoystickUpdate();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // defined(STM32) && !defined(SIMU)
|
#endif // defined(STM32) && !defined(SIMU)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ set(FIRMWARE_TARGET_SRC
|
||||||
../common/arm/stm32/usb_bsp.c
|
../common/arm/stm32/usb_bsp.c
|
||||||
../common/arm/stm32/usbd_desc.c
|
../common/arm/stm32/usbd_desc.c
|
||||||
../common/arm/stm32/usbd_usr.cpp
|
../common/arm/stm32/usbd_usr.cpp
|
||||||
../common/arm/stm32/usb_driver.c
|
../common/arm/stm32/usb_driver.cpp
|
||||||
)
|
)
|
||||||
if(USB STREQUAL SERIAL)
|
if(USB STREQUAL SERIAL)
|
||||||
add_definitions(-DUSB_SERIAL)
|
add_definitions(-DUSB_SERIAL)
|
||||||
|
|
|
@ -18,12 +18,21 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
#include "usb_dcd_int.h"
|
#include "usb_dcd_int.h"
|
||||||
#include "usb_bsp.h"
|
#include "usb_bsp.h"
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "opentx.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
int usbPlugged(void)
|
static bool usbDriverStarted = false;
|
||||||
|
|
||||||
|
int usbPlugged()
|
||||||
{
|
{
|
||||||
// debounce
|
// debounce
|
||||||
static uint8_t debounced_state = 0;
|
static uint8_t debounced_state = 0;
|
||||||
|
@ -46,19 +55,20 @@ int usbPlugged(void)
|
||||||
|
|
||||||
USB_OTG_CORE_HANDLE USB_OTG_dev;
|
USB_OTG_CORE_HANDLE USB_OTG_dev;
|
||||||
|
|
||||||
void OTG_FS_IRQHandler(void)
|
extern "C" void OTG_FS_IRQHandler()
|
||||||
{
|
{
|
||||||
DEBUG_INTERRUPT(INT_OTG_FS);
|
DEBUG_INTERRUPT(INT_OTG_FS);
|
||||||
USBD_OTG_ISR_Handler(&USB_OTG_dev);
|
USBD_OTG_ISR_Handler(&USB_OTG_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void usbInit(void)
|
void usbInit()
|
||||||
{
|
{
|
||||||
// Initialize hardware
|
// Initialize hardware
|
||||||
USB_OTG_BSP_Init(&USB_OTG_dev);
|
USB_OTG_BSP_Init(&USB_OTG_dev);
|
||||||
|
usbDriverStarted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void usbStart(void)
|
void usbStart()
|
||||||
{
|
{
|
||||||
#if defined(USB_JOYSTICK)
|
#if defined(USB_JOYSTICK)
|
||||||
// initialize USB as HID device
|
// initialize USB as HID device
|
||||||
|
@ -70,9 +80,60 @@ void usbStart(void)
|
||||||
// initialize USB as MSC device
|
// initialize USB as MSC device
|
||||||
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb);
|
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb);
|
||||||
#endif
|
#endif
|
||||||
|
usbDriverStarted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void usbStop(void)
|
void usbStop()
|
||||||
{
|
{
|
||||||
|
usbDriverStarted = false;
|
||||||
USBD_DeInit(&USB_OTG_dev);
|
USBD_DeInit(&USB_OTG_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t usbStarted()
|
||||||
|
{
|
||||||
|
return usbDriverStarted;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(USB_JOYSTICK)
|
||||||
|
/*
|
||||||
|
Prepare and send new USB data packet
|
||||||
|
|
||||||
|
The format of HID_Buffer is defined by
|
||||||
|
USB endpoint description can be found in
|
||||||
|
file usb_hid_joystick.c, variable HID_JOYSTICK_ReportDesc
|
||||||
|
*/
|
||||||
|
void usbJoystickUpdate()
|
||||||
|
{
|
||||||
|
static uint8_t HID_Buffer[HID_IN_PACKET];
|
||||||
|
|
||||||
|
// test to se if TX buffer is free
|
||||||
|
if (USBD_HID_SendReport(&USB_OTG_dev, 0, 0) == USBD_OK) {
|
||||||
|
//buttons
|
||||||
|
HID_Buffer[0] = 0;
|
||||||
|
HID_Buffer[1] = 0;
|
||||||
|
HID_Buffer[2] = 0;
|
||||||
|
for (int i = 0; i < 8; ++i) {
|
||||||
|
if ( channelOutputs[i+8] > 0 ) {
|
||||||
|
HID_Buffer[0] |= (1 << i);
|
||||||
|
}
|
||||||
|
if ( channelOutputs[i+16] > 0 ) {
|
||||||
|
HID_Buffer[1] |= (1 << i);
|
||||||
|
}
|
||||||
|
if ( channelOutputs[i+24] > 0 ) {
|
||||||
|
HID_Buffer[2] |= (1 << i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//analog values
|
||||||
|
//uint8_t * p = HID_Buffer + 1;
|
||||||
|
for (int i = 0; i < 8; ++i) {
|
||||||
|
int16_t value = channelOutputs[i] / 8;
|
||||||
|
if ( value > 127 ) value = 127;
|
||||||
|
else if ( value < -127 ) value = -127;
|
||||||
|
HID_Buffer[i+3] = static_cast<int8_t>(value);
|
||||||
|
}
|
||||||
|
USBD_HID_SendReport(&USB_OTG_dev, HID_Buffer, HID_IN_PACKET);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // #defined(USB_JOYSTICK)
|
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "usbd_desc.h"
|
#include "usbd_desc.h"
|
||||||
#include "usbd_hid_core.h"
|
#include "usbd_hid_core.h"
|
||||||
|
@ -385,25 +385,24 @@ static uint8_t USBD_HID_Setup (void *pdev,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USBD_HID_SendReport
|
* @brief USBD_HID_SendReport
|
||||||
* Send HID Report
|
* Send HID Report if TX buffer is free and USB device is configured.
|
||||||
* @param pdev: device instance
|
* @param pdev: device instance
|
||||||
* @param buff: pointer to report
|
* @param buff: pointer to report, if this parameter is NULL then function just test if new buffer can be sent
|
||||||
* @retval status
|
* @retval status
|
||||||
*/
|
*/
|
||||||
uint8_t USBD_HID_SendReport (USB_OTG_CORE_HANDLE *pdev,
|
uint8_t USBD_HID_SendReport(USB_OTG_CORE_HANDLE *pdev, uint8_t * report, uint16_t len)
|
||||||
uint8_t *report,
|
|
||||||
uint16_t len)
|
|
||||||
{
|
{
|
||||||
if (pdev->dev.device_status == USB_OTG_CONFIGURED )
|
if (pdev->dev.device_status == USB_OTG_CONFIGURED) {
|
||||||
{
|
if (ReportSent) {
|
||||||
if ( ReportSent )
|
if (report) {
|
||||||
{
|
ReportSent = 0;
|
||||||
ReportSent = 0;
|
DCD_EP_Tx (pdev, HID_IN_EP, report, len);
|
||||||
DCD_EP_Tx (pdev, HID_IN_EP, report, len);
|
}
|
||||||
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return USBD_OK;
|
return USBD_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -425,6 +424,9 @@ static const uint8_t *USBD_HID_GetCfgDesc (uint8_t speed, uint16_t *length)
|
||||||
* @param pdev: device instance
|
* @param pdev: device instance
|
||||||
* @param epnum: endpoint index
|
* @param epnum: endpoint index
|
||||||
* @retval status
|
* @retval status
|
||||||
|
|
||||||
|
This function is called when buffer has been sent over the USB.
|
||||||
|
The TX buffer is now empty and can be filled with new data.
|
||||||
*/
|
*/
|
||||||
static uint8_t USBD_HID_DataIn (void *pdev,
|
static uint8_t USBD_HID_DataIn (void *pdev,
|
||||||
uint8_t epnum)
|
uint8_t epnum)
|
||||||
|
|
|
@ -211,51 +211,6 @@ void boardOff()
|
||||||
pwrOff();
|
pwrOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
|
||||||
extern USB_OTG_CORE_HANDLE USB_OTG_dev;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Prepare and send new USB data packet
|
|
||||||
|
|
||||||
The format of HID_Buffer is defined by
|
|
||||||
USB endpoint description can be found in
|
|
||||||
file usb_hid_joystick.c, variable HID_JOYSTICK_ReportDesc
|
|
||||||
*/
|
|
||||||
void usbJoystickUpdate(void)
|
|
||||||
{
|
|
||||||
static uint8_t HID_Buffer[HID_IN_PACKET];
|
|
||||||
|
|
||||||
//buttons
|
|
||||||
HID_Buffer[0] = 0;
|
|
||||||
HID_Buffer[1] = 0;
|
|
||||||
HID_Buffer[2] = 0;
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
|
||||||
if ( channelOutputs[i+8] > 0 ) {
|
|
||||||
HID_Buffer[0] |= (1 << i);
|
|
||||||
}
|
|
||||||
if ( channelOutputs[i+16] > 0 ) {
|
|
||||||
HID_Buffer[1] |= (1 << i);
|
|
||||||
}
|
|
||||||
if ( channelOutputs[i+24] > 0 ) {
|
|
||||||
HID_Buffer[2] |= (1 << i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//analog values
|
|
||||||
//uint8_t * p = HID_Buffer + 1;
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
|
||||||
int16_t value = channelOutputs[i] / 8;
|
|
||||||
if ( value > 127 ) value = 127;
|
|
||||||
else if ( value < -127 ) value = -127;
|
|
||||||
HID_Buffer[i+3] = static_cast<int8_t>(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
USBD_HID_SendReport (&USB_OTG_dev, HID_Buffer, HID_IN_PACKET );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // #defined(USB_JOYSTICK) && !defined(SIMU)
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t currentTrainerMode = 0xff;
|
uint8_t currentTrainerMode = 0xff;
|
||||||
|
|
||||||
void checkTrainerSettings()
|
void checkTrainerSettings()
|
||||||
|
|
|
@ -448,11 +448,15 @@ void backlightEnable(uint8_t dutyCycle);
|
||||||
#define isBacklightEnabled() true
|
#define isBacklightEnabled() true
|
||||||
|
|
||||||
// USB driver
|
// USB driver
|
||||||
int usbPlugged(void);
|
int usbPlugged();
|
||||||
void usbInit(void);
|
void usbInit();
|
||||||
void usbStart(void);
|
void usbStart();
|
||||||
void usbStop(void);
|
void usbStop();
|
||||||
|
uint8_t usbStarted();
|
||||||
void usbSerialPutc(uint8_t c);
|
void usbSerialPutc(uint8_t c);
|
||||||
|
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
||||||
|
void usbJoystickUpdate();
|
||||||
|
#endif
|
||||||
#if defined(PCBX12S)
|
#if defined(PCBX12S)
|
||||||
#define USB_NAME "FrSky Horus"
|
#define USB_NAME "FrSky Horus"
|
||||||
#define USB_MANUFACTURER 'F', 'r', 'S', 'k', 'y', ' ', ' ', ' ' /* 8 bytes */
|
#define USB_MANUFACTURER 'F', 'r', 'S', 'k', 'y', ' ', ' ', ' ' /* 8 bytes */
|
||||||
|
@ -532,10 +536,6 @@ int bluetoothRead(void * buffer, int len);
|
||||||
void bluetoothWakeup(void);
|
void bluetoothWakeup(void);
|
||||||
void bluetoothDone(void);
|
void bluetoothDone(void);
|
||||||
|
|
||||||
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
|
||||||
void usbJoystickUpdate(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern uint8_t currentTrainerMode;
|
extern uint8_t currentTrainerMode;
|
||||||
void checkTrainerSettings(void);
|
void checkTrainerSettings(void);
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,9 @@ void interrupt5ms()
|
||||||
|
|
||||||
if (++pre_scale >= 2) {
|
if (++pre_scale >= 2) {
|
||||||
pre_scale = 0 ;
|
pre_scale = 0 ;
|
||||||
|
DEBUG_TIMER_START(debugTimerPer10ms);
|
||||||
per10ms();
|
per10ms();
|
||||||
|
DEBUG_TIMER_STOP(debugTimerPer10ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
|
@ -262,51 +264,6 @@ void boardOff()
|
||||||
pwrOff();
|
pwrOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
|
||||||
extern USB_OTG_CORE_HANDLE USB_OTG_dev;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Prepare and send new USB data packet
|
|
||||||
|
|
||||||
The format of HID_Buffer is defined by
|
|
||||||
USB endpoint description can be found in
|
|
||||||
file usb_hid_joystick.c, variable HID_JOYSTICK_ReportDesc
|
|
||||||
*/
|
|
||||||
void usbJoystickUpdate(void)
|
|
||||||
{
|
|
||||||
static uint8_t HID_Buffer[HID_IN_PACKET];
|
|
||||||
|
|
||||||
//buttons
|
|
||||||
HID_Buffer[0] = 0;
|
|
||||||
HID_Buffer[1] = 0;
|
|
||||||
HID_Buffer[2] = 0;
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
|
||||||
if ( channelOutputs[i+8] > 0 ) {
|
|
||||||
HID_Buffer[0] |= (1 << i);
|
|
||||||
}
|
|
||||||
if ( channelOutputs[i+16] > 0 ) {
|
|
||||||
HID_Buffer[1] |= (1 << i);
|
|
||||||
}
|
|
||||||
if ( channelOutputs[i+24] > 0 ) {
|
|
||||||
HID_Buffer[2] |= (1 << i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//analog values
|
|
||||||
//uint8_t * p = HID_Buffer + 1;
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
|
||||||
int16_t value = channelOutputs[i] / 8;
|
|
||||||
if ( value > 127 ) value = 127;
|
|
||||||
else if ( value < -127 ) value = -127;
|
|
||||||
HID_Buffer[i+3] = static_cast<int8_t>(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
USBD_HID_SendReport (&USB_OTG_dev, HID_Buffer, HID_IN_PACKET );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // #defined(USB_JOYSTICK) && !defined(SIMU)
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t currentTrainerMode = 0xff;
|
uint8_t currentTrainerMode = 0xff;
|
||||||
|
|
||||||
void checkTrainerSettings()
|
void checkTrainerSettings()
|
||||||
|
|
|
@ -454,11 +454,15 @@ uint8_t isBacklightEnabled(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// USB driver
|
// USB driver
|
||||||
int usbPlugged(void);
|
int usbPlugged();
|
||||||
void usbInit(void);
|
void usbInit();
|
||||||
void usbStart(void);
|
void usbStart();
|
||||||
void usbStop(void);
|
void usbStop();
|
||||||
|
uint8_t usbStarted();
|
||||||
void usbSerialPutc(uint8_t c);
|
void usbSerialPutc(uint8_t c);
|
||||||
|
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
||||||
|
void usbJoystickUpdate();
|
||||||
|
#endif
|
||||||
#define USB_NAME "FrSky Taranis"
|
#define USB_NAME "FrSky Taranis"
|
||||||
#define USB_MANUFACTURER 'F', 'r', 'S', 'k', 'y', ' ', ' ', ' ' /* 8 bytes */
|
#define USB_MANUFACTURER 'F', 'r', 'S', 'k', 'y', ' ', ' ', ' ' /* 8 bytes */
|
||||||
#define USB_PRODUCT 'T', 'a', 'r', 'a', 'n', 'i', 's', ' ' /* 8 Bytes */
|
#define USB_PRODUCT 'T', 'a', 'r', 'a', 'n', 'i', 's', ' ' /* 8 Bytes */
|
||||||
|
@ -612,10 +616,6 @@ void setTopBatteryValue(uint32_t volts);
|
||||||
|
|
||||||
#define USART_FLAG_ERRORS (USART_FLAG_ORE | USART_FLAG_NE | USART_FLAG_FE | USART_FLAG_PE)
|
#define USART_FLAG_ERRORS (USART_FLAG_ORE | USART_FLAG_NE | USART_FLAG_FE | USART_FLAG_PE)
|
||||||
|
|
||||||
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
|
||||||
void usbJoystickUpdate(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern uint8_t currentTrainerMode;
|
extern uint8_t currentTrainerMode;
|
||||||
void checkTrainerSettings(void);
|
void checkTrainerSettings(void);
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ set(BOOTLOADER_SRC
|
||||||
../../common/arm/stm32/delays.cpp
|
../../common/arm/stm32/delays.cpp
|
||||||
../../common/arm/stm32/usbd_desc.c
|
../../common/arm/stm32/usbd_desc.c
|
||||||
../../common/arm/stm32/usb_bsp.c
|
../../common/arm/stm32/usb_bsp.c
|
||||||
../../common/arm/stm32/usb_driver.c
|
../../common/arm/stm32/usb_driver.cpp
|
||||||
../pwr_driver.cpp
|
../pwr_driver.cpp
|
||||||
init.c
|
init.c
|
||||||
boot.cpp
|
boot.cpp
|
||||||
|
|
|
@ -143,7 +143,11 @@ void mixerTask(void * pdata)
|
||||||
|
|
||||||
uint32_t now = CoGetOSTime();
|
uint32_t now = CoGetOSTime();
|
||||||
bool run = false;
|
bool run = false;
|
||||||
if ((now - lastRunTime) > 10) { // run at least every 20ms
|
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
||||||
|
if ((now - lastRunTime) >= (usbStarted() ? 5 : 10)) { // run at least every 20ms (every 10ms if USB is active)
|
||||||
|
#else
|
||||||
|
if ((now - lastRunTime) >= 10) { // run at least every 20ms
|
||||||
|
#endif
|
||||||
run = true;
|
run = true;
|
||||||
}
|
}
|
||||||
else if (now == nextMixerTime[0]) {
|
else if (now == nextMixerTime[0]) {
|
||||||
|
@ -171,6 +175,10 @@ void mixerTask(void * pdata)
|
||||||
CoLeaveMutexSection(mixerMutex);
|
CoLeaveMutexSection(mixerMutex);
|
||||||
DEBUG_TIMER_STOP(debugTimerMixer);
|
DEBUG_TIMER_STOP(debugTimerMixer);
|
||||||
|
|
||||||
|
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
||||||
|
usbJoystickUpdate();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(TELEMETRY_FRSKY) || defined(TELEMETRY_MAVLINK)
|
#if defined(TELEMETRY_FRSKY) || defined(TELEMETRY_MAVLINK)
|
||||||
DEBUG_TIMER_START(debugTimerTelemetryWakeup);
|
DEBUG_TIMER_START(debugTimerTelemetryWakeup);
|
||||||
telemetryWakeup();
|
telemetryWakeup();
|
||||||
|
@ -217,6 +225,7 @@ void menusTask(void * pdata)
|
||||||
#endif
|
#endif
|
||||||
uint32_t start = (uint32_t)CoGetOSTime();
|
uint32_t start = (uint32_t)CoGetOSTime();
|
||||||
DEBUG_TIMER_START(debugTimerPerMain);
|
DEBUG_TIMER_START(debugTimerPerMain);
|
||||||
|
DEBUG_TIMER_SAMPLE(debugTimerPerMainPeriod);
|
||||||
perMain();
|
perMain();
|
||||||
DEBUG_TIMER_STOP(debugTimerPerMain);
|
DEBUG_TIMER_STOP(debugTimerPerMain);
|
||||||
// TODO remove completely massstorage from sky9x firmware
|
// TODO remove completely massstorage from sky9x firmware
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue