fix further encoding bugs
This commit is contained in:
parent
5e2ab4326a
commit
5213deaa78
1 changed files with 4 additions and 4 deletions
|
@ -78,11 +78,11 @@ Arduino.prototype.processWriteBuffer = function () {
|
||||||
Arduino.prototype.valueToLastFour = function(val) {
|
Arduino.prototype.valueToLastFour = function(val) {
|
||||||
var encodedVal = "";
|
var encodedVal = "";
|
||||||
|
|
||||||
for (var i = 3; i > 0; i--) {
|
for (var i = 3; i >= 0; i--) {
|
||||||
|
|
||||||
encodedVal += String.fromCharCode(val/(Math.pow(2,8*i)));
|
encodedVal += String.fromCharCode(val/(Math.pow(2,8*i)));
|
||||||
val = val%Math.pow(2,8*i);
|
val = val % Math.pow(2,8*i);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return encodedVal;
|
return encodedVal;
|
||||||
|
@ -91,7 +91,7 @@ Arduino.prototype.valueToLastFour = function(val) {
|
||||||
Arduino.prototype.valueToFirstTwo = function(val) {
|
Arduino.prototype.valueToFirstTwo = function(val) {
|
||||||
var encodedVal = "";
|
var encodedVal = "";
|
||||||
|
|
||||||
for (var i = 1; i > 0; i--) {
|
for (var i = 1; i >= 0; i--) {
|
||||||
|
|
||||||
encodedVal += String.fromCharCode(val/(Math.pow(2,8*i)));
|
encodedVal += String.fromCharCode(val/(Math.pow(2,8*i)));
|
||||||
val = val%Math.pow(2,8*i);
|
val = val%Math.pow(2,8*i);
|
||||||
|
|
Reference in a new issue