Make sure to clear the buffer after each result.

main
DustyP 9 months ago
parent f33bb7e9a3
commit 4bca452cf9

@ -198,7 +198,7 @@ func (dc *DerbyClock) readLoop() {
// Check for lane result pattern (n=t.ttttc)
// We need to look for an equals sign followed by digits, a period, more digits, and a finish character
if b[0] == ' ' || b[0] == '\n' {
if b[0] == ' ' || b[0] == '\r' {
// These characters could indicate a complete result or a separator
// Try to extract a result from the buffer
result := dc.tryExtractResult(buffer)
@ -208,6 +208,10 @@ func (dc *DerbyClock) readLoop() {
Type: EventLaneFinish,
Result: result,
}
}
// Clear the buffer after a result is extracted
buffer = buffer[:0]
}
// If we hit a newline, this might be the end of all results
if b[0] == '\n' {
@ -228,8 +232,6 @@ func (dc *DerbyClock) readLoop() {
}
}
}
}
}
}
// tryExtractResult attempts to extract a lane result from the buffer

Loading…
Cancel
Save