This commit is contained in:
2026-04-03 15:18:05 +02:00
parent a4a6dc7370
commit 96a78958dc
+4 -2
View File
@@ -289,7 +289,7 @@ class RDSDecoder {
} }
} }
if(d_error < 2) { if(d_error < 2) {
const offset = (multiplier == 2) ? 0 : 2; const offset = multiplier - 2;
const err = Math.ceil(d_error * (10/3)); const err = Math.ceil(d_error * (10/3));
const old_err = this.rt1_errors[idx * multiplier + offset]; const old_err = this.rt1_errors[idx * multiplier + offset];
if(err < old_err) { if(err < old_err) {
@@ -320,6 +320,7 @@ class RDSDecoder {
if(c_error < 2 && multiplier !== 2) { if(c_error < 2 && multiplier !== 2) {
const err = Math.ceil(c_error * (10/3)); const err = Math.ceil(c_error * (10/3));
const old_err = this.rt0_errors[idx * multiplier]; const old_err = this.rt0_errors[idx * multiplier];
console.log(err, old_err);
if(err < old_err) { if(err < old_err) {
this.rt0[idx * multiplier] = decode_charset(blockC >> 8); this.rt0[idx * multiplier] = decode_charset(blockC >> 8);
this.rt0[idx * multiplier + 1] = decode_charset(blockC & 0xFF); this.rt0[idx * multiplier + 1] = decode_charset(blockC & 0xFF);
@@ -328,9 +329,10 @@ class RDSDecoder {
} }
} }
if(d_error < 2) { if(d_error < 2) {
const offset = (multiplier == 2) ? 0 : 2; const offset = multiplier - 2; // 2 or 0
const err = Math.ceil(d_error * (10/3)); const err = Math.ceil(d_error * (10/3));
const old_err = this.rt0_errors[idx * multiplier + offset]; const old_err = this.rt0_errors[idx * multiplier + offset];
console.log(err, old_err, offset);
if(err < old_err) { if(err < old_err) {
this.rt0[idx * multiplier + offset] = decode_charset(blockD >> 8); this.rt0[idx * multiplier + offset] = decode_charset(blockD >> 8);
this.rt0[idx * multiplier + offset + 1] = decode_charset(blockD & 0xFF); this.rt0[idx * multiplier + offset + 1] = decode_charset(blockD & 0xFF);