Skip to content

Commit

Permalink
Fix WPILOG decoding edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbonner committed Sep 20, 2024
1 parent bb25160 commit 508ba7c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/hub/dataSources/wpilog/wpilogWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,30 @@ function parseField(key: string) {
});
delete dataRecordPositions[key]; // Clear memory

// Send fields
// Get set of changed fields
let fieldData: HistoricalDataSource_WorkerFieldResponse[] = [];
let hasRoot = false;
log.getChangedFields().forEach((childKey) => {
let serialized = log.getField(childKey)!.toSerialized();
if (childKey === key) hasRoot = true;
fieldData.push({
key: childKey,
data: serialized,
generatedParent: log.isGeneratedParent(childKey)
});
});
if (!hasRoot) {
let field = log.getField(key);
if (field !== null) {
fieldData.push({
key: key,
data: field.toSerialized(),
generatedParent: log.isGeneratedParent(key)
});
}
}

// Send result
sendResponse({
type: "fields",
fields: fieldData
Expand Down

0 comments on commit 508ba7c

Please sign in to comment.