Digging around in the core code, rather than the library, I realised that code in setup runs at 80MHz, while code in loop runs at the faster speed.
Rather than modify the core to change this, I added the following into my setup function:
#if defined(ESP8266)
extern void preloop_update_frequency();
#endif
void setup()
{
#if defined(ESP8266)
preloop_update_frequency();
#endif
// rest of code as usual.
}
This resolves the issue. What was happening was that the setup code was calling 'show' and stretching the pulses it sent by a factor of two, which I saw as turning the 0 bits into 1 bits.
A more appropriate fix might be to change core_esp8266_main.cpp from:
static void loop_wrapper() {
static bool setup_done = false;
if(!setup_done) {
setup();
setup_done = true;
}
preloop_update_frequency();
loop();
esp_schedule();
}
to
static void loop_wrapper() {
static bool setup_done = false;
preloop_update_frequency();
if(!setup_done) {
setup();
setup_done = true;
}
loop();
esp_schedule();
}
I confess, however, I do not know whether this might adversely affect other timer/frequency based stuff.