Some more comments and a little formatting clean up
This commit is contained in:
parent
9c303d6669
commit
414e02d9fe
|
@ -2483,8 +2483,9 @@ static void printConfig(char *cmdline, bool doDiff)
|
|||
|
||||
uint8_t currentRateIndex = currentProfile->activeRateProfile;
|
||||
uint8_t rateCount;
|
||||
for (rateCount=0; rateCount<MAX_RATEPROFILES; rateCount++)
|
||||
for (rateCount = 0; rateCount < MAX_RATEPROFILES; rateCount++) {
|
||||
cliDumpRateProfile(rateCount, dumpMask, &defaultConfig);
|
||||
}
|
||||
|
||||
cliPrint("\r\n# restore original rateprofile selection\r\n");
|
||||
changeControlRateProfile(currentRateIndex);
|
||||
|
@ -2513,8 +2514,10 @@ static void printConfig(char *cmdline, bool doDiff)
|
|||
|
||||
static void cliDumpProfile(uint8_t profileIndex, uint8_t dumpMask, master_t *defaultConfig)
|
||||
{
|
||||
if (profileIndex >= MAX_PROFILE_COUNT) // Faulty values
|
||||
if (profileIndex >= MAX_PROFILE_COUNT) {
|
||||
// Faulty values
|
||||
return;
|
||||
}
|
||||
changeProfile(profileIndex);
|
||||
cliPrint("\r\n# profile\r\n");
|
||||
cliProfile("");
|
||||
|
@ -2523,8 +2526,10 @@ static void cliDumpProfile(uint8_t profileIndex, uint8_t dumpMask, master_t *def
|
|||
|
||||
static void cliDumpRateProfile(uint8_t rateProfileIndex, uint8_t dumpMask, master_t *defaultConfig)
|
||||
{
|
||||
if (rateProfileIndex >= MAX_RATEPROFILES) // Faulty values
|
||||
if (rateProfileIndex >= MAX_RATEPROFILES) {
|
||||
// Faulty values
|
||||
return;
|
||||
}
|
||||
changeControlRateProfile(rateProfileIndex);
|
||||
cliPrint("\r\n# rateprofile\r\n");
|
||||
cliRateProfile("");
|
||||
|
@ -2744,8 +2749,9 @@ static void cliMap(char *cmdline)
|
|||
|
||||
if (len == 8) {
|
||||
// uppercase it
|
||||
for (i = 0; i < 8; i++)
|
||||
for (i = 0; i < 8; i++) {
|
||||
cmdline[i] = toupper((unsigned char)cmdline[i]);
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (strchr(rcChannelLetters, cmdline[i]) && !strchr(cmdline + i + 1, cmdline[i]))
|
||||
continue;
|
||||
|
@ -2755,8 +2761,9 @@ static void cliMap(char *cmdline)
|
|||
parseRcChannels(cmdline, &masterConfig.rxConfig);
|
||||
}
|
||||
cliPrint("Map: ");
|
||||
for (i = 0; i < 8; i++)
|
||||
for (i = 0; i < 8; i++) {
|
||||
out[masterConfig.rxConfig.rcmap[i]] = rcChannelLetters[i];
|
||||
}
|
||||
out[i] = '\0';
|
||||
cliPrintf("%s\r\n", out);
|
||||
}
|
||||
|
|
|
@ -165,7 +165,13 @@ uint32_t CDC_Send_DATA(uint8_t *ptrBuffer, uint8_t sendLength)
|
|||
|
||||
uint32_t CDC_Send_FreeBytes(void)
|
||||
{
|
||||
/* return the bytes free in the circular buffer */
|
||||
/*
|
||||
return the bytes free in the circular buffer
|
||||
|
||||
functionally equivalent to:
|
||||
(APP_Rx_ptr_out > APP_Rx_ptr_in ? APP_Rx_ptr_out - APP_Rx_ptr_in : APP_RX_DATA_SIZE - APP_Rx_ptr_in + APP_Rx_ptr_in)
|
||||
but without the impact of the condition check.
|
||||
*/
|
||||
return ((APP_Rx_ptr_out - APP_Rx_ptr_in) + (-((int)(APP_Rx_ptr_out <= APP_Rx_ptr_in)) & APP_RX_DATA_SIZE)) - 1;
|
||||
}
|
||||
|
||||
|
@ -183,13 +189,13 @@ static uint16_t VCP_DataTx(uint8_t* Buf, uint32_t Len)
|
|||
could just check for: USB_CDC_ZLP, but better to be safe
|
||||
and wait for any existing transmission to complete.
|
||||
*/
|
||||
while (USB_Tx_State);
|
||||
while (USB_Tx_State != 0);
|
||||
|
||||
for (uint32_t i = 0; i < Len; i++) {
|
||||
APP_Rx_Buffer[APP_Rx_ptr_in] = Buf[i];
|
||||
APP_Rx_ptr_in = (APP_Rx_ptr_in + 1) % APP_RX_DATA_SIZE;
|
||||
|
||||
while (!CDC_Send_FreeBytes());
|
||||
while (CDC_Send_FreeBytes() <= 0);
|
||||
}
|
||||
|
||||
return USBD_OK;
|
||||
|
|
Loading…
Reference in New Issue