Zitat von: marvin am 25. März 2024, 18:43sieht das so besser aus?Definitiv besser. Das sieht "nur" nach einem Problem mit der Kalibrierung aus.
Sie dürfen in diesem Board keine Dateianhänge sehen.
Zitat von: NuclearPhoenix am 25. März 2024, 16:12Ich frag das nur, weil man nach jedem event immer einen Strichpunkt (standardmäßig) hinzufügen muss, falls du das nicht schon machst. Sonst weiß die Software nicht wo eine Nummer aufhört und eine andere beginnt, da kommt dann irgendein Blödsinn raus.
/*
Decode nanoSpec event data
nanoSpec eventData consists of two bytes that encode 11 bit
event data:
bit 7 marks the incoming char as event data
bit 6 marks high or low event data (0 - low / 1 - high)
bit 5 on the high byte marks an overflow of the "true event counter",
if this is high, events might be missing in the cumulated event data
bit 5 - 0 in the low event data are bit 5 - 0 in the event data
bis 4 - 0 in the high event data are bit 10 - 6 in the event data
So, following operations decode two characters from the serial input
to one event data word:
10EEEEEE rxByte 1 (low)
0000000010EEEEEE in 1
0000000000111111 (and)
0000000000EEEEEE ev
11xHHHHH rxByte 2 (high)
0000000011xHHHHH in 2
0000000000011111 (and)
00000HHHHH000000 (shl 6)
00000HHHHHEEEEEE ev
*/
private addRawNanoSpec(uint8Array: Uint8Array): void {
if (SerialManager.orderType === 'chron') { // CHRONOLOGICAL EVENTS
for (const rxByte of uint8Array) {
let rxNum:number = rxByte;
if (rxByte > 127) { // Event Data
if ((rxNum & 0x40) == 0) { // low data
this.eventData = rxNum & 0x3F
} else { // high data
this.eventData = this.eventData | ((rxNum & 0x1F) << 6)
if (this.eventData < 0 || this.eventData > SerialManager.adcChannels)
continue; // Fixed value range. !FIX SERIAL COMMUNICATION ERRORS!
if (this.bufferPulseData.length > SerialManager.maxSize) { // Protect from overflow and crashes
console.warn('Warning: Serial buffer is saturating!');
return;
}
this.bufferPulseData.push(this.eventData);
}
} else { // Console Data
if (this.rawConsoleData.length > this.consoleMemoryTotal - 1) {
//console.warn('Serial console log is out of memory, deleting old history...');
this.rawConsoleData = '';
}
this.rawConsoleData += String.fromCharCode(rxByte);
}
}
} else if (SerialManager.orderType === 'hist') { // HISTOGRAM DATA
// Kommt noch...
}
}
Zitat von: NuclearPhoenix am 25. März 2024, 15:32Und der Ausgang zur Konsole, wie werden die Daten dort ausgegeben?
Seite erstellt in 0.236 Sekunden mit 20 Abfragen.