MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / tracePacket

Function tracePacket

tools/xsbug/esptool.js:826–847  ·  view source on GitHub ↗
(prefix, bytes)

Source from the content-addressed store, hash-verified

824}
825
826function tracePacket(prefix, bytes) {
827 return;
828 for (let i = 0; i < bytes.length; i += 16) {
829 let line = prefix;
830 let end = i + 16;
831 if (end > bytes.length) end = bytes.length;
832 for (let j = i; j < end; j++) {
833 let byte = bytes[j].toString(16);
834 if (byte.length < 2) byte = "0" + byte;
835 line += byte + " ";
836 }
837 line += " ";
838 for (let j = i; j < end; j++) {
839 let byte = bytes[j];
840 if ((32 <= byte) && (byte < 128))
841 line += String.fromCharCode(byte);
842 else
843 line += ".";
844 }
845 console.log(line);
846 }
847};
848
849/*
850 These ROM loader images are from esptool.py at

Callers 2

getReplyMethod · 0.70
writeSLIPMethod · 0.70

Calls 2

logMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected