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:
parent
ab011139be
commit
ad465ec654
1 changed files with 12 additions and 1 deletions
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue