You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Try replacing:

    digitalWrite([B8,B8,B5,B6,B7],8|(((((col&0x80808000)>>15)*0x4081)>>14)&7));
    

    with:

    digitalWrite([B8,B8,B5,B6,B7],8|(((((col&0x80808000)>>>15)*0x4081)>>14)&7));
    

    The >>> operator is an unsigned shift, whereas >> is a signed shift.

    The issue is that when the top bit of a number gets set, signed shift shifts in extra 1s as you shift right (so -8>>1 == -4 like you'd expect) - unsigned shift always shifts in 0.

    Having said that, there appears to be a bug in Espruino that causes Uint32Array to return negative numbers (which is why this is a problem). I've had it down as something to fix - however it works when compiled on the PC, but not when running on the device!

About

Avatar for Gordon @Gordon started