Closed XaviLC closed 6 years ago
This is not a bug in asHexString
, but rather a GIGO caused by the way you're instantiating your Uint8Array
.
The Uint8Array
constructor takes an array of Number
s as its first parameter. If the elements in that array are not instances of Number
, they will be casted into a decimal number as usual. Any letter will be casted to NaN
, which will turn into a zero.
You can check this yourself by running the instantiation standalone:
> new Uint8Array("ABCDEF123".split(""));
Uint8Array(9) [ 0, 0, 0, 0, 0, 0, 1, 2, 3 ]
And, if you look at your output carefully, you'll see that asHexString
is just outputting the values stored in such an Uint8Array:
:09FC0000000000000000010203F5
or
:09FC0000 00 00 00 00 00 00 01 02 03 F5
I will also call your attention over this particular line of code:
As this is not a bug in nrf-intel-hex itself, I'm closing this.
THe function asHexString() does not map the hexadecimals values properly and they are converted to 0's?
Gives as ouput the following, where the hex string "ABCDEF123" is not parsed at all and ABCDEF values are set to zeros...