Skip to content

Commit

Permalink
Merge pull request #21 from rpitv/Daktronics-Dump
Browse files Browse the repository at this point in the history
dumping Daktronics data
  • Loading branch information
SuperUltraMegaChicken authored and robere2 committed Dec 15, 2023
1 parent 98c98c9 commit f5220ec
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/glimpse-graphics/src/extension/daktronics-rtd/protocol.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {sports} from "./sports-definitions";
import {replicants} from "../util/replicants";
import {logger} from "../util/logger";
import { writeFile } from "fs";

const packetBytes: number[] = [];
let computedChecksum = 0;
Expand Down Expand Up @@ -57,6 +58,16 @@ export function daktronicsRtdListener(data: Buffer) {
logger.trace({rawBytes: bufferToHexString(data)},'Received data from serial port');
}

// dumping the Daktronics serial connection to a log file
const d = new Date();
writeFile(`${__dirname}/_Daktronics_${d.getFullYear()}-${d.getMonth()}-${d.getDay()}.log`,
bufferToHexString(data) + "\n", (err) => {
logger.trace(
`failed to save buffer"
${bufferToHexString(data)}
"to file: ${__dirname}/_Daktronics_${d.getFullYear()}-${d.getMonth()}-${d.getDay()}.log`)
})

for(const byte of data) {
if(byte === 0x16) {
// Start of a new packet. Clear the packet buffer and reset the checksum.
Expand Down

0 comments on commit f5220ec

Please sign in to comment.