remove row sr update when clearing

This commit is contained in:
interfisch 2023-02-11 17:18:50 +01:00
parent fa29d3af04
commit 5b344a6b4e
3 changed files with 15 additions and 18 deletions

View File

@ -68,7 +68,8 @@ public:
void setRow(uint16_t _row); void setRow(uint16_t _row);
uint16_t getRow(); uint16_t getRow();
void shiftData(); void shiftDataRow();
void shiftDataColumn();
}; };
#endif #endif

View File

@ -70,10 +70,10 @@ void Flipdot::selectColumn(uint8_t selcolumn, bool clear) {
} }
bool Flipdot::clearSelectedColumn() { bool Flipdot::clearSelectedColumn() {
shiftDataColumn();
//Clear Columns //Clear Columns
if (row!=0) {
return 0; //error. row is selected (short circuit!)
}
for (uint8_t cc=0;cc<COLUMNBYTES;cc++) { for (uint8_t cc=0;cc<COLUMNBYTES;cc++) {
//Serial.print("checking cc="); Serial.println(cc); //Serial.print("checking cc="); Serial.println(cc);
for (uint8_t i=0;i<8;i+=2) { for (uint8_t i=0;i<8;i+=2) {
@ -97,6 +97,9 @@ bool Flipdot::clearSelectedColumn() {
bool Flipdot::setSelectedDot() { bool Flipdot::setSelectedDot() {
shiftDataRow();
shiftDataColumn();
for (uint8_t cc=0;cc<COLUMNBYTES;cc++) { for (uint8_t cc=0;cc<COLUMNBYTES;cc++) {
//Serial.print("checking cc="); Serial.println(cc); //Serial.print("checking cc="); Serial.println(cc);
for (uint8_t i=1;i<8;i+=2) { for (uint8_t i=1;i<8;i+=2) {
@ -112,7 +115,7 @@ bool Flipdot::setSelectedDot() {
return 0; return 0;
} }
digitalWrite(PIN_SR_OE, LOW); //Active Low digitalWrite(PIN_SR_OE, LOW); //Active Low. Enable Row
digitalWrite(PIN_DRIVE, HIGH); digitalWrite(PIN_DRIVE, HIGH);
delayMicroseconds(MICROS_DRIVEDOTSET); //Drive Dot delayMicroseconds(MICROS_DRIVEDOTSET); //Drive Dot
digitalWrite(PIN_SR_OE, HIGH); //Active Low digitalWrite(PIN_SR_OE, HIGH); //Active Low
@ -137,7 +140,7 @@ bool Flipdot::HBridgeOK() {
} }
void Flipdot::shiftData() { //send out all data to shift registers void Flipdot::shiftDataRow() { //send out all data to shift registers
//select Rows via shift registers on own controller board //select Rows via shift registers on own controller board
shiftOutSlow(PIN_SR_DATA, PIN_SR_CLK, LSBFIRST, row&0xff); //lower byte shiftOutSlow(PIN_SR_DATA, PIN_SR_CLK, LSBFIRST, row&0xff); //lower byte
@ -146,6 +149,10 @@ void Flipdot::shiftData() { //send out all data to shift registers
delayMicroseconds(MICROS_SHIFT_LATCH); delayMicroseconds(MICROS_SHIFT_LATCH);
digitalWrite(PIN_SR_LATCH, LOW); digitalWrite(PIN_SR_LATCH, LOW);
}
void Flipdot::shiftDataColumn() { //send out all data to shift registers
digitalWrite(PIN_RESET_DRVBRD,LOW); //get driverboard shift registers out of reset digitalWrite(PIN_RESET_DRVBRD,LOW); //get driverboard shift registers out of reset
//Select Columns via Shift registers //Select Columns via Shift registers

View File

@ -75,7 +75,6 @@ bool Image::updateByColumn(bool direction, bool clearFirst, bool optimizeClear,
if (update_counter%2==0) { //even counter numbers are for clearing if (update_counter%2==0) { //even counter numbers are for clearing
flipdot.setRow(0); flipdot.setRow(0);
flipdot.selectColumnClear(x); flipdot.selectColumnClear(x);
flipdot.shiftData();
if (!flipdot.clearSelectedColumn()) { if (!flipdot.clearSelectedColumn()) {
Serial.println("Error clearing column!"); Serial.println("Error clearing column!");
} }
@ -84,7 +83,6 @@ bool Image::updateByColumn(bool direction, bool clearFirst, bool optimizeClear,
flipdot.selectColumnSet(x); //lower column number is on the left flipdot.selectColumnSet(x); //lower column number is on the left
flipdot.setRow(backBuffer[x]); flipdot.setRow(backBuffer[x]);
flipdot.shiftData();
flipdot.setSelectedDot(); flipdot.setSelectedDot();
frontBuffer[x]=backBuffer[x]; //flip current column in buffer frontBuffer[x]=backBuffer[x]; //flip current column in buffer
@ -114,7 +112,6 @@ void Image::loop_testDots() {
for (int l=0;l<COLUMNS;l++) { for (int l=0;l<COLUMNS;l++) {
flipdot.selectColumnClear(l%COLUMNS); flipdot.selectColumnClear(l%COLUMNS);
flipdot.shiftData();
if (!flipdot.clearSelectedColumn()) { if (!flipdot.clearSelectedColumn()) {
Serial.println("Error clearing column!"); Serial.println("Error clearing column!");
@ -135,7 +132,6 @@ void Image::loop_testDots() {
Serial.println("Clearing"); Serial.println("Clearing");
flipdot.setRow(0); flipdot.setRow(0);
flipdot.selectColumnClear(23); flipdot.selectColumnClear(23);
flipdot.shiftData();
if (!flipdot.clearSelectedColumn()) { if (!flipdot.clearSelectedColumn()) {
Serial.println("Error clearing column!"); Serial.println("Error clearing column!");
} }
@ -143,7 +139,6 @@ void Image::loop_testDots() {
flipdot.setRow(0); flipdot.setRow(0);
flipdot.selectColumnClear(24); flipdot.selectColumnClear(24);
flipdot.shiftData();
if (!flipdot.clearSelectedColumn()) { if (!flipdot.clearSelectedColumn()) {
Serial.println("Error clearing column!"); Serial.println("Error clearing column!");
} }
@ -157,7 +152,6 @@ void Image::loop_testDots() {
flipdot.setRow(0); flipdot.setRow(0);
flipdot.setRow(flipdot.getRow()+pow(2, 4));//low significant bits are lower rows (when connector at top) flipdot.setRow(flipdot.getRow()+pow(2, 4));//low significant bits are lower rows (when connector at top)
flipdot.setRow(flipdot.getRow()+pow(2, 5));//low significant bits are lower rows (when connector at top) flipdot.setRow(flipdot.getRow()+pow(2, 5));//low significant bits are lower rows (when connector at top)
flipdot.shiftData();
flipdot.setSelectedDot(); flipdot.setSelectedDot();
delay(50); delay(50);
} }
@ -180,8 +174,6 @@ void Image::loop_drawClearTest() {
for (int l=0;l<COLUMNS;l++) { for (int l=0;l<COLUMNS;l++) {
flipdot.selectColumnClear(l%COLUMNS); flipdot.selectColumnClear(l%COLUMNS);
flipdot.shiftData();
if (!flipdot.clearSelectedColumn()) { if (!flipdot.clearSelectedColumn()) {
Serial.println("Error clearing column!"); Serial.println("Error clearing column!");
}else{ }else{
@ -223,9 +215,6 @@ void Image::loop_drawClearTest() {
unsigned long starttime=micros(); unsigned long starttime=micros();
flipdot.shiftData();
flipdot.setSelectedDot(); flipdot.setSelectedDot();