Added debugging counters

This commit is contained in:
blckmn 2016-07-02 21:35:52 +10:00
parent 6df2b6db8d
commit 405d9f051a
4 changed files with 9 additions and 7 deletions

View File

@ -359,6 +359,7 @@ void esc4wayProcess(serialPort_t *serial)
TX_LED_ON; TX_LED_ON;
if (replyAck == esc4wayAck_OK) if (replyAck == esc4wayAck_OK)
replyAck = esc4wayProcessCmd(command, addr, paramBuf, inLen, &outLen); replyAck = esc4wayProcessCmd(command, addr, paramBuf, inLen, &outLen);
RX_LED_OFF;
// send single '\0' byte is output when length is zero (len ==0 -> 256 bytes) // send single '\0' byte is output when length is zero (len ==0 -> 256 bytes)
if(!outLen) { if(!outLen) {
@ -366,7 +367,6 @@ void esc4wayProcess(serialPort_t *serial)
outLen = 1; outLen = 1;
} }
RX_LED_OFF;
crcOut = 0; crcOut = 0;
serialBeginWrite(port); serialBeginWrite(port);
writeByteCrc(cmd_Remote_Escape); writeByteCrc(cmd_Remote_Escape);
@ -374,7 +374,7 @@ void esc4wayProcess(serialPort_t *serial)
writeByteCrc(addr >> 8); writeByteCrc(addr >> 8);
writeByteCrc(addr & 0xff); writeByteCrc(addr & 0xff);
writeByteCrc(outLen & 0xff); // only low byte is send, 0x00 -> 256B writeByteCrc(outLen & 0xff); // only low byte is send, 0x00 -> 256B
for(int i = 0; i < outLen; i++) for(int i = 0; i < outLen % 0x100; i++)
writeByteCrc(paramBuf[i]); writeByteCrc(paramBuf[i]);
writeByteCrc(replyAck); writeByteCrc(replyAck);
writeByte(crcOut >> 8); writeByte(crcOut >> 8);

View File

@ -238,7 +238,7 @@ void BL_SendCMDRunRestartBootloader(void)
static uint8_t BL_SendCMDSetAddress(ioMem_t *pMem) //supports only 16 bit Adr static uint8_t BL_SendCMDSetAddress(ioMem_t *pMem) //supports only 16 bit Adr
{ {
// skip if adr == 0xFFFF // skip if adr == 0xFFFF
if((pMem->addr == 0xffff)) if(pMem->addr == 0xffff)
return 1; return 1;
uint8_t sCMD[] = {CMD_SET_ADDRESS, 0, pMem->addr >> 8, pMem->addr & 0xff }; uint8_t sCMD[] = {CMD_SET_ADDRESS, 0, pMem->addr >> 8, pMem->addr & 0xff };
BL_SendBuf(sCMD, sizeof(sCMD), true); BL_SendBuf(sCMD, sizeof(sCMD), true);

View File

@ -218,18 +218,20 @@ uint32_t CDC_Receive_DATA(uint8_t* recvBuf, uint32_t len)
* @param Len: Number of data received (in bytes) * @param Len: Number of data received (in bytes)
* @retval Result of the opeartion: USBD_OK if all operations are OK else VCP_FAIL * @retval Result of the opeartion: USBD_OK if all operations are OK else VCP_FAIL
*/ */
static uint32_t rxTotalBytes = 0;
static uint32_t rxPackets = 0;
static uint16_t VCP_DataRx(uint8_t* Buf, uint32_t Len) static uint16_t VCP_DataRx(uint8_t* Buf, uint32_t Len)
{ {
__disable_irq(); rxPackets++;
for (uint32_t i = 0; i < Len; i++) { for (uint32_t i = 0; i < Len; i++) {
usbData.buffer[usbData.bufferInPosition] = Buf[i]; usbData.buffer[usbData.bufferInPosition] = Buf[i];
usbData.bufferInPosition = (usbData.bufferInPosition + 1) % USB_RX_BUFSIZE; usbData.bufferInPosition = (usbData.bufferInPosition + 1) % USB_RX_BUFSIZE;
receiveLength++; receiveLength++;
rxTotalBytes++;
} }
__enable_irq();
if(receiveLength > (USB_RX_BUFSIZE-1)) if(receiveLength > (USB_RX_BUFSIZE-1))
return USBD_FAIL; return USBD_FAIL;

View File

@ -34,7 +34,7 @@
#include "usbd_usr.h" #include "usbd_usr.h"
#include "usbd_desc.h" #include "usbd_desc.h"
#define USB_RX_BUFSIZE 1024 #define USB_RX_BUFSIZE 2048
__ALIGN_BEGIN USB_OTG_CORE_HANDLE USB_OTG_dev __ALIGN_END; __ALIGN_BEGIN USB_OTG_CORE_HANDLE USB_OTG_dev __ALIGN_END;