2dom/PxMatrix

[small Hint]: using prefix operator instead postfix operator

Closed this issue · 0 comments

I saw some loops which use the following:

'''
void PxMATRIX::flushDisplay(void) {
for (int ii = 0; I I< _send_buffer_size; ii++)
SPI_BYTE(0x00);
}
'''
You use 'ii++', which every time it takes a copy of the old value of 'ii' which is not necessary here.

Using '++ii' instead prevents making this copy here

'''
void PxMATRIX::flushDisplay(void) {
for (int ii = 0; ii < _send_buffer_size; ++ii)
SPI_BYTE(0x00);
}
'''
works also fine with less overhead.