1300 kBytes? Wow - and I was getting fed up with the ~120k of Nordic softdevice :)
Can you see any obvious ways to speed up shiftOut? I guess minifying and maybe unrolling the 16 entry FOR loop would help a bit, but I'm not sure how much.
It did look like maybe jshPinSetValue on ESP32 could skip the mapping call (if that were in PinSetState) and that might help?
I guess for convertArray you could do:
g = Graphics.createArrayBuffer(64,32,8); // 8 bits to make shifting easier
ledBuf = new Uint8Array(1024);
ledBuf.set(new Uint8Array(g.buffer)); // fill first part
// now use 32 bit arrays to mash 4 pixels together at once
var s = new Uint32Array(g.buffer,1024,1024);
var d = new Uint32Array(ledBuf.buffer);
for (var i=0;i<256;i++) d[i]|=s[i]<<4;
Not tested, but that should work - I guess it may still not be that fast but it should be an improvement.
© Espruino, powered by microcosm.
Report a problem