Skip to content

Commit

Permalink
Skip markers for now in MSL
Browse files Browse the repository at this point in the history
  • Loading branch information
karniv00l committed Sep 10, 2023
1 parent 608f200 commit eafd652
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/components/Logs/LogCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ const LogCanvas = ({
selectedFields2.length,
plotSync.key,
);

options2 = result2.options;
plotData2 = [result2.xData, ...result2.yData];
}
Expand Down
18 changes: 14 additions & 4 deletions src/utils/logs/MslLogParser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Result } from 'mlg-converter/dist/types';
import { Record, Result, BlockType } from 'mlg-converter/dist/types';
import { ParserInterface } from '../ParserInterface';

class MslLogParser implements ParserInterface {
private markerPrefix = 'MARK';

private raw = '';

private result: Result = {
Expand Down Expand Up @@ -32,6 +34,7 @@ class MslLogParser implements ParserInterface {
continue;
}

// header line eg. Time SD: Present SD: Logging triggerScopeReady...
if (line.startsWith('Time') || line.startsWith('RPM')) {
unitsIndex = lineIndex + 1;
const fields = line.split('\t');
Expand All @@ -50,15 +53,22 @@ class MslLogParser implements ParserInterface {
continue;
}

// markers: eg. MARK 000
if (line.startsWith(this.markerPrefix)) {
// TODO: parse markers
continue;
}

if (lineIndex > unitsIndex) {
// data line eg. 215.389 0 0 0 0 0 1 0 1...
const fields = line.split('\t');
const record = {
type: 'field' as const,
const record: Record = {
type: 'field' as BlockType, // TODO: use enum
timestamp: 0,
};

fields.forEach((value, fieldIndex) => {
(record as any)[this.result.fields[fieldIndex].name] = parseFloat(value);
record[this.result.fields[fieldIndex].name] = parseFloat(value);
});

this.result.records.push(record);
Expand Down
1 change: 1 addition & 0 deletions src/workers/logParserWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ ctx.addEventListener('message', ({ data }: { data: ArrayBuffer }) => {

if (logParser.isMSL()) {
const mslResult = parseMsl(raw, t0);

ctx.postMessage({
type: 'metrics',
elapsed: elapsed(t0),
Expand Down

0 comments on commit eafd652

Please sign in to comment.