fix buffer content and update when data arrives during update
This commit is contained in:
parent
1e6036cde4
commit
5eaba03d2f
|
@ -43,6 +43,8 @@ private:
|
|||
|
||||
void serialPrintInt(uint16_t source);
|
||||
|
||||
bool isBuffersEqual();
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -657,11 +657,12 @@ UpdateReturn Image::updateByColumn(bool clearFirst, bool optimizeClear, bool opt
|
|||
}
|
||||
|
||||
}else{ //odd counter numbers are for setting
|
||||
uint16_t _colSet=backBuffer[x]& ~frontBuffer[x];
|
||||
uint16_t backBuffer_x=backBuffer[x]; //store buffer, because it may change when different data arrives during setting dots
|
||||
uint16_t _colSet=backBuffer_x& ~frontBuffer[x];
|
||||
if (!optimizeSet || _colSet>0) { //at least on dot has to be set in this column (if optimize is enabled)
|
||||
flipdot.selectColumnSet(x); //lower column number is on the left
|
||||
if (!optimizeSet) {
|
||||
flipdot.setRow(backBuffer[x]); //flip all set dots in this column
|
||||
flipdot.setRow(backBuffer_x); //flip all set dots in this column
|
||||
}else{
|
||||
flipdot.setRow(_colSet); //flip only currently not set dots in this column that have to be set
|
||||
}
|
||||
|
@ -671,7 +672,7 @@ UpdateReturn Image::updateByColumn(bool clearFirst, bool optimizeClear, bool opt
|
|||
}
|
||||
lastUpdateMillis=millis();
|
||||
|
||||
frontBuffer[x]=backBuffer[x]; //flip current column in buffer
|
||||
frontBuffer[x]=backBuffer_x; //flip current column in buffer
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -685,11 +686,24 @@ UpdateReturn Image::updateByColumn(bool clearFirst, bool optimizeClear, bool opt
|
|||
flag_updating=false;
|
||||
update_counter=0;
|
||||
flag_redraw=false;
|
||||
if (!isBuffersEqual()) {
|
||||
flag_updating=true; //update again if buffers not equal
|
||||
return updating;
|
||||
}
|
||||
|
||||
return finished; //finished
|
||||
}
|
||||
return updating; //not finished
|
||||
}
|
||||
|
||||
bool Image::isBuffersEqual() {
|
||||
for (uint8_t x=0;x<COLUMNS;x++) {
|
||||
if (frontBuffer[x]!=backBuffer[x]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Image::loop_testDots() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue