Fix for needing to slow down serial in the CLI for F4 targets.
Problem is with the CLI in configurator dropping packets. It is understood that too much processing occurs following each packet, and the receive buffer starts to drop packets in the configurator. Once the BF config is updated, this fix can be removed.
This commit is contained in:
parent
fefd34d05a
commit
d384fae9f4
|
@ -117,6 +117,7 @@ static bool usbVcpFlush(vcpPort_t *port)
|
|||
if (count == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!usbIsConnected() || !usbIsConfigured()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1902,10 +1902,11 @@ static void dumpValues(uint16_t valueSection)
|
|||
cliPrintf("set %s = ", valueTable[i].name);
|
||||
cliPrintVar(value, 0);
|
||||
cliPrint("\r\n");
|
||||
|
||||
#ifdef STM32F4
|
||||
|
||||
#ifdef USE_SLOW_SERIAL_CLI
|
||||
delay(2);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1979,6 +1980,9 @@ static void cliDump(char *cmdline)
|
|||
if (yaw < 0)
|
||||
cliWrite(' ');
|
||||
cliPrintf("%s\r\n", ftoa(yaw, buf));
|
||||
#ifdef USE_SLOW_SERIAL_CLI
|
||||
delay(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_SERVOS
|
||||
|
@ -2000,6 +2004,10 @@ static void cliDump(char *cmdline)
|
|||
masterConfig.customServoMixer[i].max,
|
||||
masterConfig.customServoMixer[i].box
|
||||
);
|
||||
|
||||
#ifdef USE_SLOW_SERIAL_CLI
|
||||
delay(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -2012,12 +2020,18 @@ static void cliDump(char *cmdline)
|
|||
if (featureNames[i] == NULL)
|
||||
break;
|
||||
cliPrintf("feature -%s\r\n", featureNames[i]);
|
||||
#ifdef USE_SLOW_SERIAL_CLI
|
||||
delay(2);
|
||||
#endif
|
||||
}
|
||||
for (i = 0; ; i++) { // reenable what we want.
|
||||
if (featureNames[i] == NULL)
|
||||
break;
|
||||
if (mask & (1 << i))
|
||||
cliPrintf("feature %s\r\n", featureNames[i]);
|
||||
#ifdef USE_SLOW_SERIAL_CLI
|
||||
delay(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -2077,6 +2091,9 @@ static void cliDump(char *cmdline)
|
|||
for (channel = 0; channel < INPUT_SOURCE_COUNT; channel++) {
|
||||
if (servoDirection(i, channel) < 0) {
|
||||
cliPrintf("smix reverse %d %d r\r\n", i , channel);
|
||||
#ifdef USE_SLOW_SERIAL_CLI
|
||||
delay(2);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2109,6 +2126,9 @@ static void cliDump(char *cmdline)
|
|||
|
||||
changeControlRateProfile(currentRateIndex);
|
||||
cliRateProfile("");
|
||||
#ifdef USE_SLOW_SERIAL_CLI
|
||||
delay(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
cliPrint("\r\n# restore original profile selection\r\n");
|
||||
|
@ -2133,7 +2153,8 @@ static void cliDump(char *cmdline)
|
|||
}
|
||||
}
|
||||
|
||||
void cliDumpProfile(uint8_t profileIndex) {
|
||||
void cliDumpProfile(uint8_t profileIndex)
|
||||
{
|
||||
if (profileIndex >= MAX_PROFILE_COUNT) // Faulty values
|
||||
return;
|
||||
|
||||
|
@ -2148,7 +2169,8 @@ void cliDumpProfile(uint8_t profileIndex) {
|
|||
cliRateProfile("");
|
||||
}
|
||||
|
||||
void cliDumpRateProfile(uint8_t rateProfileIndex) {
|
||||
void cliDumpRateProfile(uint8_t rateProfileIndex)
|
||||
{
|
||||
if (rateProfileIndex >= MAX_RATEPROFILES) // Faulty values
|
||||
return;
|
||||
|
||||
|
@ -2718,7 +2740,7 @@ static void cliSet(char *cmdline)
|
|||
cliPrintVar(val, len); // when len is 1 (when * is passed as argument), it will print min/max values as well, for gui
|
||||
cliPrint("\r\n");
|
||||
|
||||
#ifdef STM32F4
|
||||
#ifdef USE_SLOW_SERIAL_CLI
|
||||
delay(2);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -18,11 +18,16 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef STM32F4
|
||||
|
||||
#define TASK_GYROPID_DESIRED_PERIOD 125
|
||||
#define SCHEDULER_DELAY_LIMIT 10
|
||||
#define USE_SLOW_SERIAL_CLI
|
||||
|
||||
#else
|
||||
|
||||
#define TASK_GYROPID_DESIRED_PERIOD 1000
|
||||
#define SCHEDULER_DELAY_LIMIT 100
|
||||
|
||||
#endif
|
||||
|
||||
#define SERIAL_RX
|
||||
|
|
|
@ -153,12 +153,11 @@ static uint16_t VCP_Ctrl(uint32_t Cmd, uint8_t* Buf, uint32_t Len)
|
|||
*******************************************************************************/
|
||||
uint32_t CDC_Send_DATA(uint8_t *ptrBuffer, uint8_t sendLength)
|
||||
{
|
||||
if(USB_Tx_State!=1)
|
||||
{
|
||||
VCP_DataTx(ptrBuffer,sendLength);
|
||||
return sendLength;
|
||||
}
|
||||
return 0;
|
||||
if (USB_Tx_State)
|
||||
return 0;
|
||||
|
||||
VCP_DataTx(ptrBuffer, sendLength);
|
||||
return sendLength;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,7 +170,6 @@ uint32_t CDC_Send_DATA(uint8_t *ptrBuffer, uint8_t sendLength)
|
|||
*/
|
||||
static uint16_t VCP_DataTx(uint8_t* Buf, uint32_t Len)
|
||||
{
|
||||
|
||||
uint16_t ptr = APP_Rx_ptr_in;
|
||||
uint32_t i;
|
||||
|
||||
|
@ -179,7 +177,7 @@ static uint16_t VCP_DataTx(uint8_t* Buf, uint32_t Len)
|
|||
APP_Rx_Buffer[ptr++ & (APP_RX_DATA_SIZE-1)] = Buf[i];
|
||||
|
||||
APP_Rx_ptr_in = ptr % APP_RX_DATA_SIZE;
|
||||
|
||||
|
||||
return USBD_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue