In the Particle ecosystem PROGMEM
and pgm_read_byte()
and the likes are null-instructions.
See here https://github.com/particle-iot/device-os/blob/develop/wiring/inc/spark_wiring_arduino.h
Instead of trying to fix something that’s not necessary in the first place I’d rather remove it entirely.
const unsigned char IMAGE_BLACK[] = { /* 0X00,0X01,0XC8,0X00,0XC8,0X00, */
0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF,
...
0XFF, 0XFF, 0XFF, 0XFF,
};
const unsigned char IMAGE_RED[] = { /* 0X00,0X01,0XC8,0X00,0XC8,0X00, */
0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF,
...
0XFF, 0XFF, 0XFF, 0XFF,
};
...
//Send data to e-link board.
void serial_send_data(const uint8_t* data, uint32_t data_len) {
for (int i = 0; i < data_len; i++) {
Serial1.write(data[i]);
}
}
If the code is blocking in the while(1)
loops (well before the first instance of using pgm_read_byte()
) it’s probably a good idea to add some sort of timeout.
It may also be a good idea to check whether the signals from and to the display are actually finding their correct way - e.g. via logic analyzer or oscilloscope