fix minor bug that happenend when encoding values
This commit is contained in:
parent
46b328ca75
commit
5e2ab4326a
1 changed files with 4 additions and 4 deletions
|
@ -76,9 +76,9 @@ Arduino.prototype.processWriteBuffer = function () {
|
||||||
// Helpers
|
// Helpers
|
||||||
|
|
||||||
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);
|
||||||
|
@ -89,9 +89,9 @@ 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