Fixed bug in missing characters

This commit is contained in:
adrcs 2025-02-09 10:44:35 -07:00 committed by GitHub
parent a7b2b63790
commit 742a9bd1e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 38 additions and 40 deletions

View file

@ -212,7 +212,7 @@ void Beacon_Task_exec(void)
buf[pos++] = '\0'; // null terminated buf[pos++] = '\0'; // null terminated
// time to send a beacon frame.. // time to send a beacon frame..
SendBeaconFrame(setup_memory.params.setup_data.stnCall, bcnPayload, pos); SendBeaconFrame(setup_memory.params.setup_data.stnCall, bcnPayload, pos+1);
} }
/* /*

View file

@ -102,7 +102,7 @@ void Chat_Task_welcome(void)
* place a frame on the queue frame content is copied * place a frame on the queue frame content is copied
* to alloc'd memory * to alloc'd memory
*/ */
BOOL EnqueChatFrame(void *raw, int length) BOOL EnqueChatFrame(void *raw)
{ {
IP400_FRAME *qFrame, *SrcFrame = (IP400_FRAME *)raw; IP400_FRAME *qFrame, *SrcFrame = (IP400_FRAME *)raw;
uint8_t *frameBuffer; uint8_t *frameBuffer;
@ -284,7 +284,7 @@ void PrintFrame(IP400_FRAME *FrameBytes)
USART_Print_string("[%d:%04d]:", FrameBytes->flagfld.flags.hop_count, FrameBytes->seqNum); USART_Print_string("[%d:%04d]:", FrameBytes->flagfld.flags.hop_count, FrameBytes->seqNum);
// now dump the data // now dump the data
memcpy(printBuf, FrameBytes->buf, dataLen+3); memcpy(printBuf, FrameBytes->buf, dataLen);
printBuf[dataLen] = '\0'; printBuf[dataLen] = '\0';
USART_Print_string("%s\r\n", printBuf); USART_Print_string("%s\r\n", printBuf);

View file

@ -276,7 +276,9 @@ void Frame_Txtask_exec(void)
tFrame = dequeFrame(&txQueue); tFrame = dequeFrame(&txQueue);
uint8_t *rawFrame = (uint8_t *)rawTxFrame; uint8_t *rawFrame = (uint8_t *)rawTxFrame;
if(tFrame != NULL) { if(tFrame == NULL)
return;
frameLen = tFrame->length; frameLen = tFrame->length;
/* /*
@ -301,18 +303,17 @@ void Frame_Txtask_exec(void)
// and now the data... // and now the data...
if((tFrame->buf != NULL) && (tFrame->length != 0)) if((tFrame->buf != NULL) && (tFrame->length != 0))
memcpy(rawFrame, tFrame->buf, tFrame->length); memcpy(rawFrame, tFrame->buf, tFrame->length);
}
// free the allocations in the reverse order... // free the allocations in the reverse order...
if(tFrame != NULL) {
if(tFrame->buf != NULL) if(tFrame->buf != NULL)
free(tFrame->buf); free(tFrame->buf);
free(tFrame);
} else {
return; // nothing to send...
}
int pktLen = rawFrame - rawTxFrame; free(tFrame);
// ensure packet length is a multiple of 4 bytes
int pktLen = (rawFrame - rawTxFrame) + frameLen;
pktLen += (pktLen % 4);
HAL_MRSubG_PktBasicSetPayloadLength(frameLen + pktLen); HAL_MRSubG_PktBasicSetPayloadLength(frameLen + pktLen);
// abort the current rx operation // abort the current rx operation
@ -408,9 +409,6 @@ void Frame_Rxtask_exec(void)
rFrame.buf = RxRaw; rFrame.buf = RxRaw;
// only interested in the 'to' port at this point...
uint32_t length = __HAL_MRSUBG_GET_DATABUFFER_SIZE();
// find a reason to reject a frame... // find a reason to reject a frame...
BOOL isMine, isUniqueFrame; BOOL isMine, isUniqueFrame;
isMine = FrameisMine(&rFrame); isMine = FrameisMine(&rFrame);
@ -428,13 +426,13 @@ void Frame_Rxtask_exec(void)
case ICMP_TYPE: case ICMP_TYPE:
Mesh_ProcessBeacon((void *)&rFrame, Stats.lastRSSI); Mesh_ProcessBeacon((void *)&rFrame, Stats.lastRSSI);
#if __DUMP_BEACON #if __DUMP_BEACON
EnqueChatFrame((void *)&rFrame, length+3); EnqueChatFrame((void *)&rFrame);
#endif #endif
Stats.nBeacons++; Stats.nBeacons++;
break; break;
case TEXT_TYPE: case TEXT_TYPE:
EnqueChatFrame((void *)&rFrame, length); EnqueChatFrame((void *)&rFrame);
Stats.framesOK++; Stats.framesOK++;
break; break;