2023-01-22 21:47:03 +00:00
|
|
|
#include <Arduino.h>
|
|
|
|
|
2023-02-08 19:17:58 +00:00
|
|
|
|
|
|
|
|
2023-01-31 21:50:25 +00:00
|
|
|
#include "flipdot.h"
|
2023-02-08 19:17:58 +00:00
|
|
|
#include "image.h"
|
2023-01-22 21:47:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-08 19:17:58 +00:00
|
|
|
Image flip;
|
2023-01-31 20:28:49 +00:00
|
|
|
|
2023-01-22 21:47:03 +00:00
|
|
|
unsigned long loopmillis=0;
|
|
|
|
unsigned long last_update=0;
|
2023-01-24 22:46:52 +00:00
|
|
|
|
2023-02-08 19:17:58 +00:00
|
|
|
|
2023-01-22 21:47:03 +00:00
|
|
|
|
|
|
|
void setup() {
|
2023-02-08 19:17:58 +00:00
|
|
|
flip.init();
|
2023-01-22 21:47:03 +00:00
|
|
|
|
|
|
|
Serial.begin(115200);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
loopmillis = millis();
|
2023-01-31 20:28:49 +00:00
|
|
|
|
2023-02-08 20:00:15 +00:00
|
|
|
static unsigned long last_change=0;
|
|
|
|
static bool color=0;
|
2023-02-08 20:29:10 +00:00
|
|
|
if (loopmillis-last_change >= 5000)
|
2023-02-08 20:00:15 +00:00
|
|
|
{
|
2023-02-08 20:29:10 +00:00
|
|
|
//Serial.print("Change to Solid color ="); Serial.println(color);
|
|
|
|
//flip.setBuffer_solid(color);
|
|
|
|
//color=1-color;
|
|
|
|
|
|
|
|
uint8_t _randomvalue=random(256);
|
|
|
|
Serial.print("set buffer random. ");
|
|
|
|
Serial.println(_randomvalue);
|
|
|
|
flip.setBuffer_random(_randomvalue);
|
2023-02-08 20:00:15 +00:00
|
|
|
|
|
|
|
last_change=loopmillis;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-02-08 20:29:10 +00:00
|
|
|
static bool last_result;
|
|
|
|
bool result=flip.updateByColumn(0,0,0,0); //0=not finished, 1=finished
|
|
|
|
if (result && !last_result) //just finished
|
|
|
|
{
|
|
|
|
unsigned long duration=millis()-last_change;
|
|
|
|
Serial.print("Last Change took "); Serial.print(duration); Serial.println(" ms");
|
|
|
|
Serial.print("Update max took "); Serial.print(flip.updateDuration); Serial.println(" ms");
|
|
|
|
flip.updateDuration=0; //reset
|
|
|
|
}
|
|
|
|
last_result=result;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2023-02-08 20:00:15 +00:00
|
|
|
if (loopmillis > last_update + UPDATE_INTERVAL)
|
|
|
|
{
|
|
|
|
Serial.print("UpdateByColumn ");
|
|
|
|
bool result=flip.updateByColumn(0,0,0,0);
|
|
|
|
Serial.println(result);
|
|
|
|
|
|
|
|
last_update=loopmillis;
|
|
|
|
}
|
2023-02-08 20:29:10 +00:00
|
|
|
*/
|
2023-02-08 20:00:15 +00:00
|
|
|
|
2023-01-22 21:47:03 +00:00
|
|
|
|
2023-02-08 20:00:15 +00:00
|
|
|
/*
|
2023-01-22 21:47:03 +00:00
|
|
|
if (loopmillis > last_update + UPDATE_INTERVAL)
|
|
|
|
{
|
2023-02-08 19:17:58 +00:00
|
|
|
flip.loop_drawClearTest();
|
|
|
|
//loop_testDots();
|
2023-01-24 22:46:52 +00:00
|
|
|
|
2023-01-22 21:47:03 +00:00
|
|
|
last_update=loopmillis;
|
|
|
|
}
|
2023-02-08 20:00:15 +00:00
|
|
|
*/
|
2023-01-22 21:47:03 +00:00
|
|
|
|
2023-02-08 19:17:58 +00:00
|
|
|
|
2023-01-22 21:47:03 +00:00
|
|
|
|
|
|
|
}
|