Compare commits
2 Commits
8b5ff04fa5
...
3bb37dc83f
Author | SHA1 | Date |
---|---|---|
interfisch | 3bb37dc83f | |
interfisch | aa14022188 |
|
@ -2605,10 +2605,6 @@
|
|||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid 595e677f-ac79-4337-a30d-5791a17105ba)
|
||||
)
|
||||
(wire (pts (xy 64.77 125.73) (xy 64.77 147.955))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid 5a4d465d-e2fd-4ae8-aada-5d54b185331b)
|
||||
)
|
||||
(wire (pts (xy 82.55 32.385) (xy 67.945 32.385))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid 5a5ff805-77b4-4bff-9d87-bdd612c244af)
|
||||
|
@ -2705,10 +2701,6 @@
|
|||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid 6f73bfc6-5a4c-4dc2-a227-6de1aa837a5e)
|
||||
)
|
||||
(wire (pts (xy 56.515 118.11) (xy 59.69 118.11))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid 705d9097-9b0d-4c5f-a5ab-8c65d009b953)
|
||||
)
|
||||
(wire (pts (xy 67.31 63.5) (xy 67.31 65.405))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid 708cee4c-2a3c-48cd-a0eb-32d5a0f1ceff)
|
||||
|
@ -2921,7 +2913,7 @@
|
|||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid ad9ec1bf-2c27-41d7-9ab0-2b6ec57d31f5)
|
||||
)
|
||||
(wire (pts (xy 56.515 115.57) (xy 56.515 118.11))
|
||||
(wire (pts (xy 56.515 115.57) (xy 56.515 125.73))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid af34e542-efa1-4567-9311-f9b86dbdd198)
|
||||
)
|
||||
|
@ -2993,7 +2985,7 @@
|
|||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid bd8f8ee9-9791-4f2a-8061-cae7132af4b3)
|
||||
)
|
||||
(wire (pts (xy 66.04 125.73) (xy 64.77 125.73))
|
||||
(wire (pts (xy 56.515 125.73) (xy 66.04 125.73))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid beaf8fa1-72b4-4456-8cad-4cdae7739152)
|
||||
)
|
||||
|
@ -3246,6 +3238,10 @@
|
|||
(effects (font (size 1.27 1.27)) (justify left bottom))
|
||||
(uuid 4b83862e-3ecd-4e46-936d-eb3c75672377)
|
||||
)
|
||||
(text "not in \nreset when \npulled to \ngnd" (at 271.78 103.505 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left bottom))
|
||||
(uuid 91e6309b-4c9f-468a-bd8c-e874458b5621)
|
||||
)
|
||||
(text "Current: flipping one column to black takes 0.5A @14V"
|
||||
(at 118.745 28.575 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left bottom))
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#define ROWS 16
|
||||
|
||||
|
||||
#define UPDATE_INTERVAL 5
|
||||
#define UPDATE_INTERVAL 5 //TODO: remove this
|
||||
|
||||
class Image
|
||||
{
|
||||
|
@ -18,11 +18,20 @@ class Image
|
|||
private:
|
||||
Flipdot flipdot;
|
||||
|
||||
bool frontBuffer[16][16];
|
||||
//buffer is 16 bit because of 16 Rows
|
||||
uint16_t frontBuffer[COLUMNS]; //1 is bright dot / set dot. 0 is black / cleared
|
||||
uint16_t backBuffer[COLUMNS];
|
||||
|
||||
bool flag_updating; //when true, display flip is in progress. frontBuffer does not match backBuffer
|
||||
|
||||
uint8_t update_counter; //used for keeping track of progress for updating
|
||||
|
||||
int countz=0;
|
||||
|
||||
unsigned long lastUpdateMillis; //time when last dots where started flipping
|
||||
|
||||
unsigned long updateInterval;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
@ -34,6 +43,7 @@ public:
|
|||
uint8_t getW(); //returns Columns
|
||||
uint8_t getH(); //returns Rows
|
||||
|
||||
void setBuffer_solid(bool set);
|
||||
|
||||
void loop_testDots();
|
||||
void loop_drawClearTest();
|
||||
|
|
|
@ -11,6 +11,10 @@ Image::Image()
|
|||
void Image::init()
|
||||
{
|
||||
flipdot.init(); //sets pin modes etc.
|
||||
|
||||
flag_updating=false;
|
||||
update_counter=0;
|
||||
updateInterval=50;
|
||||
}
|
||||
|
||||
uint8_t Image::getW() {
|
||||
|
@ -21,6 +25,61 @@ uint8_t Image::getH() {
|
|||
return ROWS;
|
||||
}
|
||||
|
||||
void Image::setBuffer_solid(bool set)
|
||||
{
|
||||
for (uint8_t x=0;x<getW();x++) {
|
||||
if (set) {
|
||||
backBuffer[x]=0xffff; //all white
|
||||
}else{
|
||||
backBuffer[x]=0x0; //all black
|
||||
}
|
||||
}
|
||||
|
||||
flag_updating=true; //make update run
|
||||
|
||||
}
|
||||
|
||||
bool Image::updateByColumn(bool direction, bool clearFirst, bool optimizeClear, bool optimizeSet)
|
||||
{
|
||||
if (millis()-lastUpdateMillis<updateInterval){ //too early
|
||||
return 0; //not finished
|
||||
}
|
||||
|
||||
if (!flag_updating) {
|
||||
return 1; //finished
|
||||
}
|
||||
|
||||
lastUpdateMillis=millis();
|
||||
|
||||
uint8_t x=update_counter/2;
|
||||
|
||||
if (update_counter%2==0) { //even counter numbers are for clearing
|
||||
flipdot.setRow(0);
|
||||
flipdot.selectColumnClear(x);
|
||||
flipdot.shiftData();
|
||||
if (!flipdot.clearSelectedColumn()) {
|
||||
Serial.println("Error clearing column!");
|
||||
}
|
||||
frontBuffer[x]=0;
|
||||
}else{ //odd counter numbers are for setting
|
||||
flipdot.selectColumnSet(x); //lower column number is on the left
|
||||
|
||||
flipdot.setRow(backBuffer[x]);
|
||||
flipdot.shiftData();
|
||||
flipdot.setSelectedDot();
|
||||
|
||||
frontBuffer[x]=backBuffer[x]; //flip current column in buffer
|
||||
}
|
||||
|
||||
update_counter++; //next column
|
||||
|
||||
if (update_counter/2>=getW()) { //reached last column
|
||||
flag_updating=false;
|
||||
update_counter=0;
|
||||
return 1; //finished
|
||||
}
|
||||
return 0; //not finished
|
||||
}
|
||||
|
||||
|
||||
void Image::loop_testDots() {
|
||||
|
|
|
@ -25,7 +25,29 @@ void setup() {
|
|||
void loop() {
|
||||
loopmillis = millis();
|
||||
|
||||
static unsigned long last_change=0;
|
||||
static bool color=0;
|
||||
if (loopmillis-last_change >= 10000)
|
||||
{
|
||||
Serial.print("Change to Solid color ="); Serial.println(color);
|
||||
flip.setBuffer_solid(color);
|
||||
color=1-color;
|
||||
|
||||
last_change=loopmillis;
|
||||
}
|
||||
|
||||
|
||||
if (loopmillis > last_update + UPDATE_INTERVAL)
|
||||
{
|
||||
Serial.print("UpdateByColumn ");
|
||||
bool result=flip.updateByColumn(0,0,0,0);
|
||||
Serial.println(result);
|
||||
|
||||
last_update=loopmillis;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if (loopmillis > last_update + UPDATE_INTERVAL)
|
||||
{
|
||||
flip.loop_drawClearTest();
|
||||
|
@ -33,6 +55,7 @@ void loop() {
|
|||
|
||||
last_update=loopmillis;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue