mirror of
https://github.com/Merricx/qrazybox.git
synced 2024-11-24 11:42:58 +01:00
fix: numeric mode for RS decoder (#13)
This commit is contained in:
parent
ece541bc19
commit
e21683438b
1 changed files with 4 additions and 4 deletions
|
@ -1173,20 +1173,20 @@ function readDataBits(data_bits){
|
|||
for(var i=0; i < Math.floor((length + 2) / 3); i++){
|
||||
if(i == Math.floor((length + 2) / 3) - 1){
|
||||
if(length % 3 == 0){
|
||||
num += parseInt(data_bits.substring(0,10), 2);
|
||||
num += parseInt(data_bits.substring(0,10), 2).toString().padStart(3, "0");
|
||||
temp_data += data_bits.substring(0,10);
|
||||
data_bits = data_bits.substring(10);
|
||||
} else if(length % 3 == 1){
|
||||
num += parseInt(data_bits.substring(0,4), 2);
|
||||
num += parseInt(data_bits.substring(0,4), 2).toString();
|
||||
temp_data += data_bits.substring(0,4);
|
||||
data_bits = data_bits.substring(4);
|
||||
} else {
|
||||
num += parseInt(data_bits.substring(0,7), 2);
|
||||
num += parseInt(data_bits.substring(0,7), 2).toString().padStart(2, "0");
|
||||
temp_data += data_bits.substring(0,7);
|
||||
data_bits = data_bits.substring(7);
|
||||
}
|
||||
} else {
|
||||
num += parseInt(data_bits.substring(0,10), 2);
|
||||
num += parseInt(data_bits.substring(0,10), 2).toString().padStart(3, "0");
|
||||
temp_data += data_bits.substring(0,10);
|
||||
data_bits = data_bits.substring(10);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue