mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-23 08:15:19 +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
|
@ -102,3 +102,14 @@ DataView.prototype.readString = function() {
|
||||||
}
|
}
|
||||||
return s;
|
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