Skip to content

Commit

Permalink
fix UART data parse logic to avoid possible hang (#730)
Browse files Browse the repository at this point in the history
Co-authored-by: <msq001>
  • Loading branch information
Msq001 authored May 30, 2020
1 parent 4ff948d commit 3e23f9b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 2 additions & 1 deletion TFT/src/User/API/parseACK.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ bool dmaL1NotEmpty(uint8_t port)
void syncL2CacheFromL1(uint8_t port)
{
uint16_t i = 0;
for (i = 0; dmaL1NotEmpty(port) && dmaL2Cache[i-1] != '\n'; i++)
while (dmaL1NotEmpty(port))
{
dmaL2Cache[i] = dmaL1Data[port].cache[dmaL1Data[port].rIndex];
dmaL1Data[port].rIndex = (dmaL1Data[port].rIndex + 1) % DMA_TRANS_LEN;
if (dmaL2Cache[i++] == '\n') break;
}
dmaL2Cache[i] = 0; // End character
}
Expand Down
4 changes: 0 additions & 4 deletions TFT/src/User/Menu/Move.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

//const GUI_RECT RecXYZ = {START_X + 1*ICON_WIDTH, STATUS_GANTRY_YOFFSET,
// 4*ICON_WIDTH+3*SPACE_X+START_X,ICON_START_Y-STATUS_GANTRY_YOFFSET};
#define X 0
#define Y 1
#define Z 2

#define X_MOVE_GCODE "G1 X%.1f\n"
#define Y_MOVE_GCODE "G1 Y%.1f\n"
#define Z_MOVE_GCODE "G1 Z%.1f\n"
Expand Down

0 comments on commit 3e23f9b

Please sign in to comment.