From 73256d2d98b5ba89d1ddf936b8d58706d373bbe1 Mon Sep 17 00:00:00 2001 From: Jonah <47046556+jwbonner@users.noreply.github.com> Date: Thu, 31 Oct 2024 08:16:07 -0400 Subject: [PATCH] URCL clean up --- src/hub/dataSources/schema/URCLSchema.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/hub/dataSources/schema/URCLSchema.ts b/src/hub/dataSources/schema/URCLSchema.ts index 6f73da58..2627d457 100644 --- a/src/hub/dataSources/schema/URCLSchema.ts +++ b/src/hub/dataSources/schema/URCLSchema.ts @@ -14,10 +14,16 @@ type FirmwareVersion = { const PERSISTENT_SIZE = 8; const PERIODIC_SIZE = 14; const PERIODIC_API_CLASS = sparkFramesSpec.periodicFrames.STATUS_0.apiClass; -const PERIODIC_FRAME_SPECS = Object.entries(sparkFramesSpec.periodicFrames) - .filter(([name, _]) => name.startsWith("STATUS_")) - .sort(([nameA, _A], [nameB, _B]) => nameA.localeCompare(nameB)) - .map(([_, spec]) => spec); +const PERIODIC_FRAME_SPECS = [ + sparkFramesSpec.periodicFrames.STATUS_0, + sparkFramesSpec.periodicFrames.STATUS_1, + sparkFramesSpec.periodicFrames.STATUS_2, + sparkFramesSpec.periodicFrames.STATUS_3, + sparkFramesSpec.periodicFrames.STATUS_4, + sparkFramesSpec.periodicFrames.STATUS_5, + sparkFramesSpec.periodicFrames.STATUS_6, + sparkFramesSpec.periodicFrames.STATUS_7 +]; const FIRMWARE_FRAME_SPEC = sparkFramesSpec.nonPeriodicFrames.GET_FIRMWARE_VERSION; const FIRMWARE_API = (FIRMWARE_FRAME_SPEC.apiClass << 4) | FIRMWARE_FRAME_SPEC.apiIndex; @@ -28,7 +34,7 @@ export default class URCLSchema { private constructor() {} /** - * Parses a set of frames recorded by URCL using revision 2. + * Parses a set of frames recorded by URCL using revision 3. */ static parseURCLr3(log: Log, key: string, timestamp: number, value: Uint8Array) { let devices: { [key: string]: { alias?: string; firmware?: FirmwareVersion } } = {};