vn-rfid/util/debugStream.js

26 lines
985 B
JavaScript
Raw Normal View History

2023-01-31 13:59:05 +00:00
export default (parsed, conf) => {
2023-01-27 11:40:09 +00:00
if (conf.env != 'dev') return;
// TOTAL
console.log('TOTAL BUFFER: ', parsed.codes.size);
// TOTAL READS BY ANTENNA
const totalRead = [0, 0, 0, 0];
for (let read of parsed.extended)
totalRead[read.antenna - 1]++;
console.log('TOTAL READ ANTENNA:', totalRead);
// UNIQUE READS BY ANTENNA
const uniqueRead = [new Set(), new Set(), new Set(), new Set()];
for (let read of parsed.extended)
uniqueRead[read.antenna - 1].add(read.code);
console.log('UNIQUE READ ANTENNA:', uniqueRead[0].size, uniqueRead[1].size, uniqueRead[2].size, uniqueRead[3].size);
// WARNING IF AN ANTENNA READS LESS THAN IT SHOULD
for (const [index, set] of uniqueRead.entries()) {
if (((set.size * 100) / parsed.codes.size) < 25)
2023-02-02 13:51:25 +00:00
console.logger.warn(`[ANTENNA]: ${index + 1} ONLY ${set.size}`);
2023-01-27 11:40:09 +00:00
}
console.log('----------------------------------------------------------------');
};