diff --git a/server/rds.js b/server/rds.js index 88b36af..465c774 100644 --- a/server/rds.js +++ b/server/rds.js @@ -289,7 +289,7 @@ class RDSDecoder { } } if(d_error < 2) { - const offset = (multiplier == 2) ? 0 : 2; + const offset = multiplier - 2; const err = Math.ceil(d_error * (10/3)); const old_err = this.rt1_errors[idx * multiplier + offset]; if(err < old_err) { @@ -320,6 +320,7 @@ class RDSDecoder { if(c_error < 2 && multiplier !== 2) { const err = Math.ceil(c_error * (10/3)); const old_err = this.rt0_errors[idx * multiplier]; + console.log(err, old_err); if(err < old_err) { this.rt0[idx * multiplier] = decode_charset(blockC >> 8); this.rt0[idx * multiplier + 1] = decode_charset(blockC & 0xFF); @@ -328,9 +329,10 @@ class RDSDecoder { } } 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 old_err = this.rt0_errors[idx * multiplier + offset]; + console.log(err, old_err, offset); if(err < old_err) { this.rt0[idx * multiplier + offset] = decode_charset(blockD >> 8); this.rt0[idx * multiplier + offset + 1] = decode_charset(blockD & 0xFF);