@HughB Although I may come back to this at some point, so far your current approach keeps winning out. It is easy to beat it for one or two of the sample files, but it is always at the great expense of another. My best experiments have all come back to a variation on the same theme as your state machine, and none have beat it.
I had an idea just before falling asleep last night, I hope I can still remember enough of it to give it a try (when I come to it, it might suddenly turn out to be obvious nonsense). Sadly I've got day job stuff to catch up on first.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@HughB Although I may come back to this at some point, so far your current approach keeps winning out. It is easy to beat it for one or two of the sample files, but it is always at the great expense of another. My best experiments have all come back to a variation on the same theme as your state machine, and none have beat it.