add test images and try slower timings for better reliability

This commit is contained in:
interfisch 2023-09-20 19:22:59 +02:00
parent 17f0de5f77
commit 8cffbdea92
4 changed files with 383 additions and 7 deletions

View File

@ -35,11 +35,20 @@ D3 - _clear
//### Timings ### //### Timings ###
/* These values worked before okay:
#define MICROS_DRIVEDOTSET 1500 //time dot will be powered for flipping to bright side. in microseconds. 700 sometimes flips too late #define MICROS_DRIVEDOTSET 1500 //time dot will be powered for flipping to bright side. in microseconds. 700 sometimes flips too late
#define MICROS_DRIVEDOTCLEAR 20000 //time dot will be powered for flipping to black. in microseconds. always flips at least a whole column. 10000 is too short #define MICROS_DRIVEDOTCLEAR 30000 //time dot will be powered for flipping to black. in microseconds. always flips at least a whole column. 10000 is too short. last value was 20000
#define MICROS_SHIFTDELAY 50/2 //shift register clock (100/2 = 1/(100/1000000) Hz) .at 25/2 nothing is flipping! #define MICROS_SHIFTDELAY 50/2 //shift register clock (100/2 = 1/(100/1000000) Hz) .at 25/2 nothing is flipping!
#define MICROS_SHIFT_LATCH 100 //latch high time for 595 (row drivers) #define MICROS_SHIFT_LATCH 100 //latch high time for 595 (row drivers)
*/
//Slower values
#define MICROS_DRIVEDOTSET 5000 //time dot will be powered for flipping to bright side. in microseconds. 700 sometimes flips too late
#define MICROS_DRIVEDOTCLEAR 30000 //time dot will be powered for flipping to black. in microseconds. always flips at least a whole column. 10000 is too short. last value was 20000
#define MICROS_SHIFTDELAY 100/2 //shift register clock (100/2 = 1/(100/1000000) Hz) .at 25/2 nothing is flipping!
#define MICROS_SHIFT_LATCH 200 //latch high time for 595 (row drivers)
class Flipdot class Flipdot
{ {

View File

@ -59,6 +59,11 @@ public:
void setBufferColumn(uint8_t _colnum, uint16_t _rowdata); void setBufferColumn(uint8_t _colnum, uint16_t _rowdata);
void setBuffer_random(uint8_t randomness); void setBuffer_random(uint8_t randomness);
void setBuffer_Image1();
void setBuffer_Image2();
void setBuffer_Image3();
void setBuffer_Image4();
void loop_testDots(); void loop_testDots();
void loop_drawClearTest(); void loop_drawClearTest();

View File

@ -46,6 +46,336 @@ void Image::setBuffer_solid(bool set)
flag_updating=true; //make update run flag_updating=true; //make update run
} }
void Image::setBuffer_Image1()
{
backBuffer[0]=0b0101010101010101;
backBuffer[1]=0b1010101010101010;
backBuffer[2]=0b0101010101010101;
backBuffer[3]=0b1010101010101010;
backBuffer[4]=0b0101010101010101;
backBuffer[5]=0b1010101010101010;
backBuffer[6]=0b0101010101010101;
backBuffer[7]=0b1010101010101010;
backBuffer[8]=0b0101010101010101;
backBuffer[9]=0b1010101010101010;
backBuffer[10]=0b0101010101010101;
backBuffer[11]=0b1010101010101010;
backBuffer[12]=0b0101010101010101;
backBuffer[13]=0b1010101010101010;
backBuffer[14]=0b0101010101010101;
backBuffer[15]=0b1010101010101010;
backBuffer[16]=0b0101010101010101;
backBuffer[17]=0b1010101010101010;
backBuffer[18]=0b0101010101010101;
backBuffer[19]=0b1010101010101010;
backBuffer[20]=0b0101010101010101;
backBuffer[21]=0b1010101010101010;
backBuffer[22]=0b0101010101010101;
backBuffer[23]=0b1010101010101010;
backBuffer[24]=0b0101010101010101;
backBuffer[25]=0b1010101010101010;
backBuffer[26]=0b0101010101010101;
backBuffer[27]=0b1010101010101010;
backBuffer[28]=0b0101010101010101;
backBuffer[29]=0b1010101010101010;
backBuffer[30]=0b0101010101010101;
backBuffer[31]=0b1010101010101010;
backBuffer[32]=0b0101010101010101;
backBuffer[33]=0b1010101010101010;
backBuffer[34]=0b0101010101010101;
backBuffer[35]=0b1010101010101010;
backBuffer[36]=0b0101010101010101;
backBuffer[37]=0b1010101010101010;
backBuffer[38]=0b0101010101010101;
backBuffer[39]=0b1010101010101010;
backBuffer[40]=0b0101010101010101;
backBuffer[41]=0b1010101010101010;
backBuffer[42]=0b0101010101010101;
backBuffer[43]=0b1010101010101010;
backBuffer[44]=0b0101010101010101;
backBuffer[45]=0b1010101010101010;
backBuffer[46]=0b0101010101010101;
backBuffer[47]=0b1010101010101010;
backBuffer[48]=0b0101010101010101;
backBuffer[49]=0b1010101010101010;
backBuffer[50]=0b0101010101010101;
backBuffer[51]=0b1010101010101010;
backBuffer[52]=0b0101010101010101;
backBuffer[53]=0b1010101010101010;
backBuffer[54]=0b0101010101010101;
backBuffer[55]=0b1010101010101010;
backBuffer[56]=0b0101010101010101;
backBuffer[57]=0b1010101010101010;
backBuffer[58]=0b0101010101010101;
backBuffer[59]=0b1010101010101010;
backBuffer[60]=0b0101010101010101;
backBuffer[61]=0b1010101010101010;
backBuffer[62]=0b0101010101010101;
backBuffer[63]=0b1010101010101010;
backBuffer[64]=0b0101010101010101;
backBuffer[65]=0b1010101010101010;
backBuffer[66]=0b0101010101010101;
backBuffer[67]=0b1010101010101010;
backBuffer[68]=0b0101010101010101;
backBuffer[69]=0b1010101010101010;
backBuffer[70]=0b0101010101010101;
backBuffer[71]=0b1010101010101010;
backBuffer[72]=0b0101010101010101;
backBuffer[73]=0b1010101010101010;
backBuffer[74]=0b0101010101010101;
flag_updating=true; //make update run
}
void Image::setBuffer_Image2()
{
backBuffer[0]=0b1010101010101010;
backBuffer[1]=0b0101010101010101;
backBuffer[2]=0b1010101010101010;
backBuffer[3]=0b0101010101010101;
backBuffer[4]=0b1010101010101010;
backBuffer[5]=0b0101010101010101;
backBuffer[6]=0b1010101010101010;
backBuffer[7]=0b0101010101010101;
backBuffer[8]=0b1010101010101010;
backBuffer[9]=0b0101010101010101;
backBuffer[10]=0b1010101010101010;
backBuffer[11]=0b0101010101010101;
backBuffer[12]=0b1010101010101010;
backBuffer[13]=0b0101010101010101;
backBuffer[14]=0b1010101010101010;
backBuffer[15]=0b0101010101010101;
backBuffer[16]=0b1010101010101010;
backBuffer[17]=0b0101010101010101;
backBuffer[18]=0b1010101010101010;
backBuffer[19]=0b0101010101010101;
backBuffer[20]=0b1010101010101010;
backBuffer[21]=0b0101010101010101;
backBuffer[22]=0b1010101010101010;
backBuffer[23]=0b0101010101010101;
backBuffer[24]=0b1010101010101010;
backBuffer[25]=0b0101010101010101;
backBuffer[26]=0b1010101010101010;
backBuffer[27]=0b0101010101010101;
backBuffer[28]=0b1010101010101010;
backBuffer[29]=0b0101010101010101;
backBuffer[30]=0b1010101010101010;
backBuffer[31]=0b0101010101010101;
backBuffer[32]=0b1010101010101010;
backBuffer[33]=0b0101010101010101;
backBuffer[34]=0b1010101010101010;
backBuffer[35]=0b0101010101010101;
backBuffer[36]=0b1010101010101010;
backBuffer[37]=0b0101010101010101;
backBuffer[38]=0b1010101010101010;
backBuffer[39]=0b0101010101010101;
backBuffer[40]=0b1010101010101010;
backBuffer[41]=0b0101010101010101;
backBuffer[42]=0b1010101010101010;
backBuffer[43]=0b0101010101010101;
backBuffer[44]=0b1010101010101010;
backBuffer[45]=0b0101010101010101;
backBuffer[46]=0b1010101010101010;
backBuffer[47]=0b0101010101010101;
backBuffer[48]=0b1010101010101010;
backBuffer[49]=0b0101010101010101;
backBuffer[50]=0b1010101010101010;
backBuffer[51]=0b0101010101010101;
backBuffer[52]=0b1010101010101010;
backBuffer[53]=0b0101010101010101;
backBuffer[54]=0b1010101010101010;
backBuffer[55]=0b0101010101010101;
backBuffer[56]=0b1010101010101010;
backBuffer[57]=0b0101010101010101;
backBuffer[58]=0b1010101010101010;
backBuffer[59]=0b0101010101010101;
backBuffer[60]=0b1010101010101010;
backBuffer[61]=0b0101010101010101;
backBuffer[62]=0b1010101010101010;
backBuffer[63]=0b0101010101010101;
backBuffer[64]=0b1010101010101010;
backBuffer[65]=0b0101010101010101;
backBuffer[66]=0b1010101010101010;
backBuffer[67]=0b0101010101010101;
backBuffer[68]=0b1010101010101010;
backBuffer[69]=0b0101010101010101;
backBuffer[70]=0b1010101010101010;
backBuffer[71]=0b0101010101010101;
backBuffer[72]=0b1010101010101010;
backBuffer[73]=0b0101010101010101;
backBuffer[74]=0b1010101010101010;
flag_updating=true; //make update run
}
void Image::setBuffer_Image3()
{
backBuffer[0]=0b1010101010101010;
backBuffer[1]=0b1010101010101010;
backBuffer[2]=0b1010101010101010;
backBuffer[3]=0b1010101010101010;
backBuffer[4]=0b1010101010101010;
backBuffer[5]=0b1010101010101010;
backBuffer[6]=0b1010101010101010;
backBuffer[7]=0b1010101010101010;
backBuffer[8]=0b1010101010101010;
backBuffer[9]=0b1010101010101010;
backBuffer[10]=0b1010101010101010;
backBuffer[11]=0b1010101010101010;
backBuffer[12]=0b1010101010101010;
backBuffer[13]=0b1010101010101010;
backBuffer[14]=0b1010101010101010;
backBuffer[15]=0b1010101010101010;
backBuffer[16]=0b1010101010101010;
backBuffer[17]=0b1010101010101010;
backBuffer[18]=0b1010101010101010;
backBuffer[19]=0b1010101010101010;
backBuffer[20]=0b1010101010101010;
backBuffer[21]=0b1010101010101010;
backBuffer[22]=0b1010101010101010;
backBuffer[23]=0b1010101010101010;
backBuffer[24]=0b1010101010101010;
backBuffer[25]=0b1010101010101010;
backBuffer[26]=0b1010101010101010;
backBuffer[27]=0b1010101010101010;
backBuffer[28]=0b1010101010101010;
backBuffer[29]=0b1010101010101010;
backBuffer[30]=0b1010101010101010;
backBuffer[31]=0b1010101010101010;
backBuffer[32]=0b1010101010101010;
backBuffer[33]=0b1010101010101010;
backBuffer[34]=0b1010101010101010;
backBuffer[35]=0b1010101010101010;
backBuffer[36]=0b1010101010101010;
backBuffer[37]=0b1010101010101010;
backBuffer[38]=0b1010101010101010;
backBuffer[39]=0b1010101010101010;
backBuffer[40]=0b1010101010101010;
backBuffer[41]=0b1010101010101010;
backBuffer[42]=0b1010101010101010;
backBuffer[43]=0b1010101010101010;
backBuffer[44]=0b1010101010101010;
backBuffer[45]=0b1010101010101010;
backBuffer[46]=0b1010101010101010;
backBuffer[47]=0b1010101010101010;
backBuffer[48]=0b1010101010101010;
backBuffer[49]=0b1010101010101010;
backBuffer[50]=0b1010101010101010;
backBuffer[51]=0b1010101010101010;
backBuffer[52]=0b1010101010101010;
backBuffer[53]=0b1010101010101010;
backBuffer[54]=0b1010101010101010;
backBuffer[55]=0b1010101010101010;
backBuffer[56]=0b1010101010101010;
backBuffer[57]=0b1010101010101010;
backBuffer[58]=0b1010101010101010;
backBuffer[59]=0b1010101010101010;
backBuffer[60]=0b1010101010101010;
backBuffer[61]=0b1010101010101010;
backBuffer[62]=0b1010101010101010;
backBuffer[63]=0b1010101010101010;
backBuffer[64]=0b1010101010101010;
backBuffer[65]=0b1010101010101010;
backBuffer[66]=0b1010101010101010;
backBuffer[67]=0b1010101010101010;
backBuffer[68]=0b1010101010101010;
backBuffer[69]=0b1010101010101010;
backBuffer[70]=0b1010101010101010;
backBuffer[71]=0b1010101010101010;
backBuffer[72]=0b1010101010101010;
backBuffer[73]=0b1010101010101010;
backBuffer[74]=0b1010101010101010;
flag_updating=true; //make update run
}
void Image::setBuffer_Image4()
{
backBuffer[0]=0b0101010101010101;
backBuffer[1]=0b0101010101010101;
backBuffer[2]=0b0101010101010101;
backBuffer[3]=0b0101010101010101;
backBuffer[4]=0b0101010101010101;
backBuffer[5]=0b0101010101010101;
backBuffer[6]=0b0101010101010101;
backBuffer[7]=0b0101010101010101;
backBuffer[8]=0b0101010101010101;
backBuffer[9]=0b0101010101010101;
backBuffer[10]=0b0101010101010101;
backBuffer[11]=0b0101010101010101;
backBuffer[12]=0b0101010101010101;
backBuffer[13]=0b0101010101010101;
backBuffer[14]=0b0101010101010101;
backBuffer[15]=0b0101010101010101;
backBuffer[16]=0b0101010101010101;
backBuffer[17]=0b0101010101010101;
backBuffer[18]=0b0101010101010101;
backBuffer[19]=0b0101010101010101;
backBuffer[20]=0b0101010101010101;
backBuffer[21]=0b0101010101010101;
backBuffer[22]=0b0101010101010101;
backBuffer[23]=0b0101010101010101;
backBuffer[24]=0b0101010101010101;
backBuffer[25]=0b0101010101010101;
backBuffer[26]=0b0101010101010101;
backBuffer[27]=0b0101010101010101;
backBuffer[28]=0b0101010101010101;
backBuffer[29]=0b0101010101010101;
backBuffer[30]=0b0101010101010101;
backBuffer[31]=0b0101010101010101;
backBuffer[32]=0b0101010101010101;
backBuffer[33]=0b0101010101010101;
backBuffer[34]=0b0101010101010101;
backBuffer[35]=0b0101010101010101;
backBuffer[36]=0b0101010101010101;
backBuffer[37]=0b0101010101010101;
backBuffer[38]=0b0101010101010101;
backBuffer[39]=0b0101010101010101;
backBuffer[40]=0b0101010101010101;
backBuffer[41]=0b0101010101010101;
backBuffer[42]=0b0101010101010101;
backBuffer[43]=0b0101010101010101;
backBuffer[44]=0b0101010101010101;
backBuffer[45]=0b0101010101010101;
backBuffer[46]=0b0101010101010101;
backBuffer[47]=0b0101010101010101;
backBuffer[48]=0b0101010101010101;
backBuffer[49]=0b0101010101010101;
backBuffer[50]=0b0101010101010101;
backBuffer[51]=0b0101010101010101;
backBuffer[52]=0b0101010101010101;
backBuffer[53]=0b0101010101010101;
backBuffer[54]=0b0101010101010101;
backBuffer[55]=0b0101010101010101;
backBuffer[56]=0b0101010101010101;
backBuffer[57]=0b0101010101010101;
backBuffer[58]=0b0101010101010101;
backBuffer[59]=0b0101010101010101;
backBuffer[60]=0b0101010101010101;
backBuffer[61]=0b0101010101010101;
backBuffer[62]=0b0101010101010101;
backBuffer[63]=0b0101010101010101;
backBuffer[64]=0b0101010101010101;
backBuffer[65]=0b0101010101010101;
backBuffer[66]=0b0101010101010101;
backBuffer[67]=0b0101010101010101;
backBuffer[68]=0b0101010101010101;
backBuffer[69]=0b0101010101010101;
backBuffer[70]=0b0101010101010101;
backBuffer[71]=0b0101010101010101;
backBuffer[72]=0b0101010101010101;
backBuffer[73]=0b0101010101010101;
backBuffer[74]=0b0101010101010101;
flag_updating=true; //make update run
}
void Image::setBufferColumn(uint8_t _colnum, uint16_t _rowdata) void Image::setBufferColumn(uint8_t _colnum, uint16_t _rowdata)
{ {
if (_colnum>=COLUMNS) { if (_colnum>=COLUMNS) {

View File

@ -19,6 +19,8 @@ void setup() {
flip.init(); flip.init();
Serial.begin(115200); Serial.begin(115200);
flip.setBuffer_solid(0);
} }
@ -27,11 +29,39 @@ void loop() {
static unsigned long last_change=0; static unsigned long last_change=0;
static bool color=0; static bool color=0;
if (loopmillis-last_change >= 1000)
static uint8_t image=0;
if (loopmillis-last_change >= 1000*10)
{ {
//Serial.print("Change to Solid color ="); Serial.println(color); /*
//flip.setBuffer_solid(color); Serial.print("Change to Solid color ="); Serial.println(color);
//color=1-color;
flip.setBuffer_solid(color);
color=1-color;
*/
switch (image){
case 0:
flip.setBuffer_Image1();
break;
case 1:
flip.setBuffer_Image2();
break;
case 2:
flip.setBuffer_Image3();
break;
case 3:
flip.setBuffer_Image4();
break;
}
image++;
image%=4;
/* /*
uint8_t _randomvalue=random(128); uint8_t _randomvalue=random(128);
@ -39,12 +69,13 @@ void loop() {
Serial.println(_randomvalue); Serial.println(_randomvalue);
flip.setBuffer_random(_randomvalue); flip.setBuffer_random(_randomvalue);
*/ */
/*
for (uint8_t _x=0;_x<COLUMNS;_x++) { for (uint8_t _x=0;_x<COLUMNS;_x++) {
uint8_t _y=(sin( loopmillis/100000.0 + _x/5.0 )/2+0.5)*15+0.5; uint8_t _y=(sin( loopmillis/100000.0 + _x/5.0 )/2+0.5)*15+0.5;
uint16_t _row=pow(2, _y); uint16_t _row=pow(2, _y);
flip.setBufferColumn(_x,_row); flip.setBufferColumn(_x,_row);
} }
*/
@ -52,7 +83,8 @@ void loop() {
} }
UpdateReturn result=flip.updateByColumn(true,true,true); //0=not finished, 1=finished //UpdateReturn result=flip.updateByColumn(true,true,true); //0=not finished, 1=finished
UpdateReturn result=flip.updateByColumn(true,false,false); //0=not finished, 1=finished
if (result == finished) //just finished if (result == finished) //just finished
{ {
unsigned long duration=millis()-last_change; unsigned long duration=millis()-last_change;