1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-19 14:25:13 +03:00

Add DataView.asHex()

Returns the DataView as an hex formatted string with a '/' indicating
the current offset position. Useful for debugging.
This commit is contained in:
Alberto García Hierro 2020-01-21 20:56:38 +00:00
parent ab011139be
commit ad465ec654

View file

@ -101,4 +101,15 @@ DataView.prototype.readString = function() {
s += String.fromCharCode(c);
}
return s;
};
};
DataView.prototype.asHex = function() {
let s = "";
for (let ii = 0; ii < this.byteLength; ii++) {
if (ii == this.offset) {
s += "/"
}
s += this.getUint8(ii).toString(16);
}
return s;
};