mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 05:06:39 +01:00
M3 Universal v0027
This commit is contained in:
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -134,7 +134,7 @@ void getTemperature() {
|
||||
|
||||
temperature = (uint8_t)(temp / 100);
|
||||
|
||||
printf("temp = %lu.%lu\n", temp / 100, temp % 100);
|
||||
//printf("temp = %lu.%lu\n", temp / 100, temp % 100);
|
||||
}
|
||||
|
||||
void boardGetOwnMac(uint8_t *mac) {
|
||||
|
||||
@@ -72,7 +72,7 @@ void identifyTagInfo() {
|
||||
capabilities[1] = getUICRByte(0x13);
|
||||
tag.solumType = getUICRByte(0x16);
|
||||
|
||||
if(getUICRByte(0x0A) == 0x01){
|
||||
if (getUICRByte(0x0A) == 0x01) {
|
||||
tag.hasThirdColor = true;
|
||||
}
|
||||
|
||||
@@ -81,12 +81,12 @@ void identifyTagInfo() {
|
||||
case 0x12:
|
||||
case 0x15:
|
||||
case 0x19:
|
||||
if(epdXRes == 792 && epdYRes == 272){
|
||||
if (epdXRes == 792 && epdYRes == 272) {
|
||||
epd = new dualssd;
|
||||
}else{
|
||||
} else {
|
||||
epd = new unissd;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 0x0D:
|
||||
epd = new epdvar29;
|
||||
break;
|
||||
@@ -120,25 +120,28 @@ void identifyTagInfo() {
|
||||
if (capabilities[1] & 0x01) tag.buttonCount++;
|
||||
if (capabilities[1] & 0x10) tag.hasLED = true;
|
||||
if (capabilities[0] & 0x01) tag.hasNFC = true;
|
||||
|
||||
|
||||
#ifdef DEBUG_SHOW_TAGINFO
|
||||
|
||||
printf("TagType report:\n");
|
||||
printf("Resolution: %d*%d Px\n", epd->Xres,epd->Yres);
|
||||
printf("Resolution: %d*%d Px\n", epd->Xres, epd->Yres);
|
||||
printf("Nb of buttons: %d\n", tag.buttonCount);
|
||||
if(tag.hasLED){
|
||||
if (tag.hasLED) {
|
||||
printf("This tag have a led: Yes\n");
|
||||
}else{
|
||||
printf("This tag have a led: No\n");
|
||||
} else {
|
||||
printf("This tag have a led: No\n");
|
||||
}
|
||||
if(tag.hasNFC){
|
||||
if (tag.hasNFC) {
|
||||
printf("This tag have NFC: Yes\n");
|
||||
}else{
|
||||
printf("This tag have NFC: No\n");
|
||||
} else {
|
||||
printf("This tag have NFC: No\n");
|
||||
}
|
||||
if(tag.hasThirdColor){
|
||||
if (tag.hasThirdColor) {
|
||||
printf("This tag is Black and white only: No\n");
|
||||
}else{
|
||||
printf("This tag is Black and white only: Yes\n");
|
||||
} else {
|
||||
printf("This tag is Black and white only: Yes\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
// we'll calculate image slot size here
|
||||
uint32_t imageSize = epd->Xres * epd->Yres / 4;
|
||||
@@ -150,7 +153,7 @@ void identifyTagInfo() {
|
||||
epd->epdMirrorV = true;
|
||||
tag.OEPLtype = SOLUM_M3_BWR_16;
|
||||
epd->effectiveXRes = epdXRes;
|
||||
epd->effectiveYRes = epdYRes-1; //Yeah... I wonder why too....
|
||||
epd->effectiveYRes = epdYRes - 1; // Yeah... I wonder why too....
|
||||
break;
|
||||
case STYPE_SIZE_022:
|
||||
tag.macSuffix = 0xB190;
|
||||
@@ -161,7 +164,7 @@ void identifyTagInfo() {
|
||||
case STYPE_SIZE_026:
|
||||
tag.macSuffix = 0xB3D0;
|
||||
epd->drawDirectionRight = true;
|
||||
tag.OEPLtype = SOLUM_M3_BWR_22;
|
||||
tag.OEPLtype = SOLUM_M3_BWR_26;
|
||||
epd->XOffset = 8;
|
||||
break;
|
||||
case STYPE_SIZE_029:
|
||||
@@ -195,12 +198,10 @@ void identifyTagInfo() {
|
||||
break;
|
||||
case STYPE_SIZE_058:
|
||||
tag.macSuffix = 0xE3D0;
|
||||
epd->epdMirrorV = true;
|
||||
tag.OEPLtype = SOLUM_M3_BWR_58;
|
||||
break;
|
||||
case STYPE_SIZE_058_FREEZER:
|
||||
tag.macSuffix = 0x84D0;
|
||||
epd->epdMirrorV = true;
|
||||
tag.OEPLtype = SOLUM_M3_BW_58;
|
||||
break;
|
||||
case STYPE_SIZE_060:
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
|
||||
#define BATTERY_VOLTAGE_MINIMUM 2450 // 2600 or below is the best we can do on the EPD
|
||||
|
||||
#define WAKE_SECOND_CHECKIN_DELAY 10000UL
|
||||
|
||||
// power saving when no AP's were found (scanning every X)
|
||||
#define VOLTAGEREADING_DURING_SCAN_INTERVAL 2 // how often we should read voltages; this is done every scan attempt in interval bracket 3
|
||||
#define INTERVAL_1_TIME 3600UL // Try every hour
|
||||
|
||||
@@ -5,12 +5,26 @@
|
||||
|
||||
#define FW_VERSION 0x0027 // version number (max 2.5.5 :) )
|
||||
#define FW_VERSION_SUFFIX "ZLIB" // suffix, like RC1 or whatever.
|
||||
#define DEBUGBLOCKS // uncomment to enable extra debug information on the block transfers
|
||||
// #define DEBUGBLOCKS // uncomment to enable extra debug information on the block transfers
|
||||
#endif
|
||||
|
||||
// #define DEBUGBLOCKS // uncomment to enable extra debug information on the block transfers
|
||||
|
||||
// #define DEBUG_SHOW_TAGINFO
|
||||
// #define DEBUG_DRAWING
|
||||
// #define DEBUG_EPD
|
||||
// #define DEBUG_FS
|
||||
// #define DEBUG_COMPRESSION
|
||||
// #define DEBUG_PROTO
|
||||
// #define DEBUG_SETTINGS
|
||||
// #define DEBUG_MAIN
|
||||
// #define DEBUG_FAST_CHECK_IN
|
||||
// #define DEBUG_DONTVALIDATEPROTO
|
||||
|
||||
#if defined(DEBUG_SETTINGS) || defined(DEBUG_EPD) || defined(DEBUGBLOCKS) || defined(DEBUG_PROTO) || defined(DEBUG_COMPRESSION) || defined(DEBUG_FS) || defined(DEBUG_MAIN) || defined(DEBUG_FAST_CHECK_IN) || defined(DEBUG_SHOW_TAGINFO) || defined(DEBUG_DONTVALIDATEPROTO) || defined(DEBUG_DRAWING)
|
||||
#define DEBUG_BUILD
|
||||
#define DEBUG_DRAWING
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define SETTINGS_STRUCT_VERSION 0x01
|
||||
|
||||
@@ -48,6 +48,9 @@
|
||||
#define SCREEN_CMD_USE_MODE_2 0x08 // modified commands 0x10 and 0x04
|
||||
#define SCREEN_CMD_REFRESH 0xC7
|
||||
|
||||
#define CONTROLLER_ONE 0x00
|
||||
#define CONTROLLER_TWO 0x80
|
||||
|
||||
void dualssd::selectLUT(uint8_t lut) {
|
||||
// implement alternative LUTs here. Currently just reset the watchdog to two minutes,
|
||||
// to ensure it doesn't reset during the much longer bootup procedure
|
||||
@@ -60,7 +63,6 @@ void dualssd::epdEnterSleep() {
|
||||
epdWrite(CMD_ENTER_SLEEP, 1, 0x01);
|
||||
}
|
||||
void dualssd::epdSetup() {
|
||||
|
||||
printf("init epd...\n");
|
||||
epdReset();
|
||||
epdWrite(CMD_SOFT_RESET, 0);
|
||||
@@ -79,62 +81,61 @@ void dualssd::epdSetup() {
|
||||
0xC4, 0x00, 0x31
|
||||
0xC5, 0x0F, 0x01, 0x00, 0x00
|
||||
0xCE, 0x00
|
||||
0xCF, 0x0F, 0x01, 0x3C, 0x01
|
||||
|
||||
*/
|
||||
/* 5.85 BW INIT SEQUENCE
|
||||
0x11, 0x00
|
||||
0x91, 0x01
|
||||
0x44, 0x31, 0x00
|
||||
0x45, 0x0F, 0x01, 0x00, 0x00
|
||||
0x4E, 0x31
|
||||
0x4F, 0x0F, 0x01
|
||||
0xC4, 0x00, 0x31
|
||||
0xC5, 0x0F, 0x01, 0x00, 0x00
|
||||
0xCE, 0x00
|
||||
0xCF, 0x0F, 0x01, 0x3C, 0x01
|
||||
|
||||
*/
|
||||
0xCF, 0x0F, 0x01
|
||||
0x3C, 0x01
|
||||
|
||||
*/
|
||||
/* 5.85 BW INIT SEQUENCE
|
||||
0x11, 0x00
|
||||
0x91, 0x01
|
||||
0x44, 0x31, 0x00
|
||||
0x45, 0x0F, 0x01, 0x00, 0x00
|
||||
0x4E, 0x31
|
||||
0x4F, 0x0F, 0x01
|
||||
0xC4, 0x00, 0x31
|
||||
0xC5, 0x0F, 0x01, 0x00, 0x00
|
||||
0xCE, 0x00
|
||||
0xCF, 0x0F, 0x01
|
||||
0x3C, 0x01
|
||||
*/
|
||||
|
||||
epdWrite(0x11, 1, 0x00);
|
||||
epdWrite(0x91, 1, 0x01);
|
||||
if(tag.hasThirdColor){
|
||||
epdWrite(0x21, 2, 0x08, 0x10);
|
||||
}else{
|
||||
epdWrite(0x21, 2, 0x48, 0x10);
|
||||
epdWrite(CMD_DATA_ENTRY_MODE + CONTROLLER_ONE, 1, 0x02);
|
||||
epdWrite(CMD_DATA_ENTRY_MODE + CONTROLLER_TWO, 1, 0x03);
|
||||
|
||||
if (tag.hasThirdColor) {
|
||||
epdWrite(CMD_DISP_UPDATE_CTRL, 2, 0x08, 0x10);
|
||||
} else {
|
||||
epdWrite(CMD_DISP_UPDATE_CTRL, 2, 0x48, 0x10);
|
||||
}
|
||||
//epdWrite(CMD_WINDOW_X_SIZE, 2, this->XOffset / 8, ((this->XOffset + this->effectiveXRes) / 8) - 1);
|
||||
//epdWrite(CMD_WINDOW_Y_SIZE, 4, (this->YOffset + this->effectiveYRes) & 0xFF, (this->YOffset + this->effectiveYRes) >> 8, this->YOffset & 0xFF, this->YOffset >> 8);
|
||||
epdWrite(0x44, 2, 0x31, 0x00);
|
||||
epdWrite(0x45, 4, 0x0F, 0x01, 0x00, 0x00);
|
||||
//epdWrite(0x4E, 2, this->XOffset / 8, ((this->XOffset + this->effectiveXRes) / 8) - 1);
|
||||
//epdWrite(0x4F, 4, (this->YOffset + this->effectiveYRes) & 0xFF, (this->YOffset + this->effectiveYRes) >> 8, this->YOffset & 0xFF, this->YOffset >> 8);
|
||||
epdWrite(0x4E, 1, 0x31);
|
||||
epdWrite(0x4F, 2, 0x0F, 0x01);
|
||||
epdWrite(0xC4, 2, 0x00, 0x31);
|
||||
epdWrite(0xC5, 4, 0x0F, 0x01, 0x00, 0x00);
|
||||
epdWrite(0xCE, 1, 0x00);
|
||||
epdWrite(0xCF, 4, 0x0F, 0x01, 0x3C, 0x01);
|
||||
epdWrite(0x3C, 1, 0x01);
|
||||
|
||||
epdWrite(CMD_WINDOW_X_SIZE + CONTROLLER_ONE, 2, 0x31, 0x00);
|
||||
epdWrite(CMD_WINDOW_Y_SIZE + CONTROLLER_ONE, 4, 0x00, 0x00, 0x0F, 0x01);
|
||||
epdWrite(CMD_XSTART_POS + CONTROLLER_ONE, 1, 0x31);
|
||||
epdWrite(CMD_YSTART_POS + CONTROLLER_ONE, 2, 0x00, 0x00);
|
||||
|
||||
epdWrite(CMD_WINDOW_X_SIZE + CONTROLLER_TWO, 2, 0x00, 0x31);
|
||||
epdWrite(CMD_WINDOW_Y_SIZE + CONTROLLER_TWO, 4, 0x00, 0x00, 0x0F, 0x01);
|
||||
epdWrite(CMD_XSTART_POS + CONTROLLER_TWO, 1, 0x00);
|
||||
epdWrite(CMD_YSTART_POS + CONTROLLER_TWO, 2, 0x0F, 0x01);
|
||||
|
||||
epdWrite(CMD_BORDER_WAVEFORM_CTRL, 1, 0x01);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void dualssd::epdWriteDisplayData() {
|
||||
|
||||
uint8_t *buf[2] = {0, 0}; // this will hold pointers to odd/even data lines
|
||||
// Those dual SSD controller (SSD1683??) behave as 2 400pxx wide screens, that needs independent data transfers.
|
||||
uint8_t c_increment = 1;
|
||||
if(!tag.hasThirdColor){
|
||||
if (!tag.hasThirdColor) {
|
||||
c_increment = 2;
|
||||
}
|
||||
for (uint8_t c = 0; c < 4; c = c + c_increment) {
|
||||
delay(10);
|
||||
if (c == 0) epd_cmd(0x24);//BW
|
||||
if (c == 1) epd_cmd(0x26);//RED
|
||||
if (c == 2) epd_cmd(0xA4);//BW
|
||||
if (c == 3) epd_cmd(0xA6);//RED
|
||||
if (c == 0) epd_cmd(CMD_WRITE_FB_BW + CONTROLLER_ONE); // BW
|
||||
if (c == 1) epd_cmd(CMD_WRITE_FB_RED + CONTROLLER_ONE); // RED
|
||||
if (c == 2) epd_cmd(CMD_WRITE_FB_BW + CONTROLLER_TWO); // BW
|
||||
if (c == 3) epd_cmd(CMD_WRITE_FB_RED + CONTROLLER_TWO); // RED
|
||||
|
||||
delay(10);
|
||||
markData();
|
||||
@@ -144,11 +145,7 @@ void dualssd::epdWriteDisplayData() {
|
||||
// Get 'even' screen line
|
||||
buf[0] = (uint8_t *)calloc(epd->effectiveXRes / 8, 1);
|
||||
|
||||
if (epd->epdMirrorV) {
|
||||
drawItem::renderDrawLine(buf[0], (epd->effectiveYRes - 1) - curY, c%2);
|
||||
} else {
|
||||
drawItem::renderDrawLine(buf[0], curY, c%2);
|
||||
}
|
||||
drawItem::renderDrawLine(buf[0], curY, c % 2);
|
||||
|
||||
if (epd->epdMirrorH) drawItem::reverseBytes(buf[0], epd->effectiveXRes / 8);
|
||||
// on the first pass, the second (buf[1]) buffer is unused, so we don't have to wait for it to flush to the display / free it
|
||||
@@ -159,20 +156,17 @@ void dualssd::epdWriteDisplayData() {
|
||||
}
|
||||
|
||||
// start transfer of even data line to the screen
|
||||
if(c<2){
|
||||
epdSPIAsyncWrite(buf[0] + (epd->effectiveXRes / 16), (epd->effectiveXRes / 16)+1);
|
||||
}else{
|
||||
epdSPIAsyncWrite(buf[0], (epd->effectiveXRes / 16)+1);
|
||||
if (c < 2) {
|
||||
epdSPIAsyncWrite(buf[0] + (epd->effectiveXRes / 16), (epd->effectiveXRes / 16) + 1);
|
||||
} else {
|
||||
epdSPIAsyncWrite(buf[0], (epd->effectiveXRes / 16) + 1);
|
||||
}
|
||||
|
||||
// Get 'odd' screen display line
|
||||
buf[1] = (uint8_t *)calloc(epd->effectiveXRes / 8, 1);
|
||||
|
||||
if (epd->epdMirrorV) {
|
||||
drawItem::renderDrawLine(buf[1], (epd->effectiveYRes - 1) - (curY + 1), c%2);
|
||||
} else {
|
||||
drawItem::renderDrawLine(buf[1], curY + 1, c%2);
|
||||
}
|
||||
drawItem::renderDrawLine(buf[1], curY + 1, c % 2);
|
||||
|
||||
if (epd->epdMirrorH) drawItem::reverseBytes(buf[1], epd->effectiveXRes / 8);
|
||||
|
||||
// wait until the 'even' data has finished writing
|
||||
@@ -180,15 +174,14 @@ void dualssd::epdWriteDisplayData() {
|
||||
free(buf[0]);
|
||||
|
||||
// start transfer of the 'odd' data line
|
||||
if(c<2){
|
||||
epdSPIAsyncWrite(buf[1]+(epd->effectiveXRes / 16), (epd->effectiveXRes / 16)+1);
|
||||
}else{
|
||||
|
||||
epdSPIAsyncWrite(buf[1], (epd->effectiveXRes / 16)+1);
|
||||
if (c < 2) {
|
||||
epdSPIAsyncWrite(buf[1] + (epd->effectiveXRes / 16), (epd->effectiveXRes / 16) + 1);
|
||||
} else {
|
||||
epdSPIAsyncWrite(buf[1], (epd->effectiveXRes / 16) + 1);
|
||||
}
|
||||
}
|
||||
// check if this was the first pass. If it was, we'll need to wait until the last display line finished writing
|
||||
if (c == 0 || c==2) {
|
||||
if (c == 0 || c == 2) {
|
||||
epdSPIWait();
|
||||
epdDeselect();
|
||||
free(buf[1]);
|
||||
@@ -204,7 +197,6 @@ void dualssd::epdWriteDisplayData() {
|
||||
if (buf[1]) free(buf[1]);
|
||||
}
|
||||
|
||||
|
||||
void dualssd::draw() {
|
||||
drawNoWait();
|
||||
getVoltage();
|
||||
@@ -212,7 +204,7 @@ void dualssd::draw() {
|
||||
}
|
||||
void dualssd::drawNoWait() {
|
||||
epdWriteDisplayData();
|
||||
//epdWrite(CMD_DISP_UPDATE_CTRL2, 1, 0xF7);
|
||||
// epdWrite(CMD_DISP_UPDATE_CTRL2, 1, 0xF7);
|
||||
epdWrite(CMD_ACTIVATION, 0);
|
||||
}
|
||||
void dualssd::epdWaitRdy() {
|
||||
|
||||
@@ -75,16 +75,21 @@ void unissd::epdSetup() {
|
||||
case 0x15:
|
||||
// stock init 1.6"
|
||||
epdWrite(CMD_DRV_OUTPUT_CTRL, 3, this->effectiveYRes & 0xFF, this->effectiveYRes >> 8, 0x00);
|
||||
epdWrite(CMD_DATA_ENTRY_MODE, 1, 0x01);
|
||||
epdWrite(CMD_WINDOW_X_SIZE, 2, this->XOffset / 8, ((this->XOffset + this->effectiveXRes) / 8)-1);
|
||||
epdWrite(CMD_WINDOW_Y_SIZE, 4, (this->YOffset + this->effectiveYRes) & 0xFF, (this->YOffset + this->effectiveYRes) >> 8, this->YOffset & 0xFF, this->YOffset >> 8);
|
||||
if (epd->epdMirrorV) {
|
||||
epdWrite(CMD_DATA_ENTRY_MODE, 1, 0x03);
|
||||
epdWrite(CMD_WINDOW_Y_SIZE, 4, this->YOffset & 0xFF, this->YOffset >> 8, (this->YOffset + this->effectiveYRes) & 0xFF, (this->YOffset + this->effectiveYRes) >> 8);
|
||||
} else {
|
||||
epdWrite(CMD_DATA_ENTRY_MODE, 1, 0x01);
|
||||
epdWrite(CMD_WINDOW_Y_SIZE, 4, (this->YOffset + this->effectiveYRes) & 0xFF, (this->YOffset + this->effectiveYRes) >> 8, this->YOffset & 0xFF, this->YOffset >> 8);
|
||||
}
|
||||
epdWrite(CMD_WINDOW_X_SIZE, 2, this->XOffset / 8, ((this->XOffset + this->effectiveXRes) / 8) - 1);
|
||||
epdWrite(CMD_BORDER_WAVEFORM_CTRL, 1, 0x05);
|
||||
epdWrite(CMD_TEMP_SENSOR_CONTROL, 1, 0x80);
|
||||
// end stock init
|
||||
// added
|
||||
if(tag.hasThirdColor){
|
||||
if (tag.hasThirdColor) {
|
||||
epdWrite(CMD_DISP_UPDATE_CTRL, 2, 0x08, 0x00); // fix reversed image with stock setup
|
||||
}else{
|
||||
} else {
|
||||
epdWrite(CMD_DISP_UPDATE_CTRL, 2, 0x48, 0x00); // fix reversed image with stock setup
|
||||
}
|
||||
break;
|
||||
@@ -112,8 +117,8 @@ void unissd::epdSetup() {
|
||||
void unissd::epdWriteDisplayData() {
|
||||
// this display expects two entire framebuffers worth of data to be written, one for b/w and one for red
|
||||
uint8_t *buf[2] = {0, 0}; // this will hold pointers to odd/even data lines
|
||||
uint8_t c_end = 2; //The loop must be executed 2 times if BWR, 1 time if BW
|
||||
if(!tag.hasThirdColor){
|
||||
uint8_t c_end = 2; // The loop must be executed 2 times if BWR, 1 time if BW
|
||||
if (!tag.hasThirdColor) {
|
||||
c_end = 1;
|
||||
}
|
||||
for (uint8_t c = 0; c < c_end; c++) {
|
||||
@@ -122,7 +127,11 @@ void unissd::epdWriteDisplayData() {
|
||||
case 0x12:
|
||||
case 0x15:
|
||||
epdWrite(CMD_XSTART_POS, 1, (this->XOffset / 8));
|
||||
epdWrite(CMD_YSTART_POS, 2, (this->YOffset + this->effectiveYRes) & 0xFF, (this->YOffset + this->effectiveYRes) >> 8);
|
||||
if (epd->epdMirrorV) {
|
||||
epdWrite(CMD_YSTART_POS, 2, this->YOffset & 0xFF, (this->YOffset) >> 8);
|
||||
} else {
|
||||
epdWrite(CMD_YSTART_POS, 2, (this->YOffset + this->effectiveYRes) & 0xFF, (this->YOffset + this->effectiveYRes) >> 8);
|
||||
}
|
||||
break;
|
||||
case 0x19:
|
||||
epdWrite(CMD_XSTART_POS, 2, 0xBF, 0x03);
|
||||
@@ -138,11 +147,8 @@ void unissd::epdWriteDisplayData() {
|
||||
// Get 'even' screen line
|
||||
buf[0] = (uint8_t *)calloc(epd->effectiveXRes / 8, 1);
|
||||
|
||||
if (epd->epdMirrorV) {
|
||||
drawItem::renderDrawLine(buf[0], (epd->effectiveYRes - 1) - curY, c);
|
||||
} else {
|
||||
drawItem::renderDrawLine(buf[0], curY, c);
|
||||
}
|
||||
drawItem::renderDrawLine(buf[0], curY, c);
|
||||
|
||||
if (epd->epdMirrorH) drawItem::reverseBytes(buf[0], epd->effectiveXRes / 8);
|
||||
// on the first pass, the second (buf[1]) buffer is unused, so we don't have to wait for it to flush to the display / free it
|
||||
if (buf[1]) {
|
||||
@@ -156,11 +162,9 @@ void unissd::epdWriteDisplayData() {
|
||||
|
||||
// Get 'odd' screen display line
|
||||
buf[1] = (uint8_t *)calloc(epd->effectiveXRes / 8, 1);
|
||||
if (epd->epdMirrorV) {
|
||||
drawItem::renderDrawLine(buf[1], (epd->effectiveYRes - 1) - (curY + 1), c);
|
||||
} else {
|
||||
drawItem::renderDrawLine(buf[1], curY + 1, c);
|
||||
}
|
||||
|
||||
drawItem::renderDrawLine(buf[1], curY + 1, c);
|
||||
|
||||
if (epd->epdMirrorH) drawItem::reverseBytes(buf[1], epd->effectiveXRes / 8);
|
||||
|
||||
// wait until the 'even' data has finished writing
|
||||
|
||||
@@ -84,25 +84,10 @@ bool displayCustomImage(uint8_t imagetype) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void externalWakeHandler(uint8_t type) {
|
||||
if (displayCustomImage(type)) {
|
||||
doSleep(2000);
|
||||
|
||||
// if something else was previously on the display, draw that
|
||||
if (curImgSlot != 0xFF) {
|
||||
powerUp(INIT_EEPROM);
|
||||
uint8_t lut = getEepromImageDataArgument(curImgSlot);
|
||||
lut &= 0x03;
|
||||
powerUp(INIT_EPD);
|
||||
drawImageFromEeprom(curImgSlot, lut);
|
||||
powerDown(INIT_EPD | INIT_EEPROM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TagAssociated() {
|
||||
// associated
|
||||
bool fastNextCheckin = false;
|
||||
uint32_t fastNextCheckinDelay = WAKE_SECOND_CHECKIN_DELAY;
|
||||
struct AvailDataInfo *avail;
|
||||
static bool buttonCheckOut = false; // send another full request if the previous was a trigger reason (buttons, nfc)
|
||||
// Is there any reason why we should do a long (full) get data request (including reason, status)?
|
||||
@@ -139,23 +124,23 @@ void TagAssociated() {
|
||||
|
||||
switch (wakeUpReason) {
|
||||
case WAKEUP_REASON_BUTTON1:
|
||||
externalWakeHandler(CUSTOM_IMAGE_BUTTON1);
|
||||
if (displayCustomImage(CUSTOM_IMAGE_BUTTON1)) fastNextCheckinDelay = 0;
|
||||
fastNextCheckin = true;
|
||||
break;
|
||||
case WAKEUP_REASON_BUTTON2:
|
||||
externalWakeHandler(CUSTOM_IMAGE_BUTTON2);
|
||||
if (displayCustomImage(CUSTOM_IMAGE_BUTTON2)) fastNextCheckinDelay = 0;
|
||||
fastNextCheckin = true;
|
||||
break;
|
||||
case WAKEUP_REASON_GPIO:
|
||||
externalWakeHandler(CUSTOM_IMAGE_GPIO);
|
||||
if (displayCustomImage(CUSTOM_IMAGE_GPIO)) fastNextCheckinDelay = 0;
|
||||
fastNextCheckin = true;
|
||||
break;
|
||||
case WAKEUP_REASON_RF:
|
||||
externalWakeHandler(CUSTOM_IMAGE_RF_WAKE);
|
||||
if (displayCustomImage(CUSTOM_IMAGE_RF_WAKE)) fastNextCheckinDelay = 0;
|
||||
fastNextCheckin = true;
|
||||
break;
|
||||
case WAKEUP_REASON_NFC:
|
||||
externalWakeHandler(CUSTOM_IMAGE_NFC_WAKE);
|
||||
if (displayCustomImage(CUSTOM_IMAGE_NFC_WAKE)) fastNextCheckinDelay = 0;
|
||||
fastNextCheckin = true;
|
||||
break;
|
||||
}
|
||||
@@ -168,7 +153,7 @@ void TagAssociated() {
|
||||
}
|
||||
|
||||
// since we've had succesful contact, and communicated the wakeup reason succesfully, we can now reset to the 'normal' status
|
||||
if ((wakeUpReason == WAKEUP_REASON_BUTTON1) | (wakeUpReason == WAKEUP_REASON_BUTTON2) | (wakeUpReason == WAKEUP_REASON_NFC) | (wakeUpReason == CUSTOM_IMAGE_RF_WAKE)) {
|
||||
if ((wakeUpReason == WAKEUP_REASON_GPIO) | (wakeUpReason == WAKEUP_REASON_BUTTON1) | (wakeUpReason == WAKEUP_REASON_BUTTON2) | (wakeUpReason == WAKEUP_REASON_NFC) | (wakeUpReason == CUSTOM_IMAGE_RF_WAKE)) {
|
||||
buttonCheckOut = true;
|
||||
}
|
||||
wakeUpReason = WAKEUP_REASON_TIMED;
|
||||
@@ -225,9 +210,13 @@ void TagAssociated() {
|
||||
if (fastNextCheckin) {
|
||||
// do a fast check-in next
|
||||
fastNextCheckin = false;
|
||||
doSleep(100UL);
|
||||
if (fastNextCheckinDelay) {
|
||||
doSleep(fastNextCheckinDelay);
|
||||
} else {
|
||||
doSleep(100UL);
|
||||
}
|
||||
} else {
|
||||
if (nextCheckInFromAP) {
|
||||
if (nextCheckInFromAP & 0x7FFF) {
|
||||
// if the AP told us to sleep for a specific period, do so.
|
||||
if (nextCheckInFromAP & 0x8000) {
|
||||
doSleep((nextCheckInFromAP & 0x7FFF) * 1000UL);
|
||||
|
||||
@@ -25,20 +25,21 @@ struct fwmetadata {
|
||||
|
||||
#define EEPROM_SETTINGS_SIZE 4096
|
||||
|
||||
#define BLOCKSIZE_MS 240 // was 270
|
||||
#define BLOCKSIZE_MS 280 // was 270
|
||||
|
||||
#define FWNRF
|
||||
#define LEDSENABLED
|
||||
#define PERSISTENTVAR
|
||||
#define HAL_TIMER_TICK 1
|
||||
#define PERSISTENTVAR
|
||||
#define EEPROM_IMG_START 0
|
||||
|
||||
|
||||
;
|
||||
#define HAL_PacketRX commsRxUnencrypted
|
||||
#define HAL_msDelay delay
|
||||
|
||||
void dump(const uint8_t *a, const uint16_t l);
|
||||
|
||||
extern void executeCommand(uint8_t cmd); // this is defined in main.c
|
||||
|
||||
static void saveUpdateMetadata(uint32_t size) {
|
||||
struct fwmetadata metadata;
|
||||
metadata.magic1 = MAGIC1;
|
||||
@@ -71,8 +72,12 @@ static bool validateEepromMD5(uint64_t ver, uint32_t eepromstart, uint32_t flen)
|
||||
printf("This is what we got:\n");
|
||||
dump(hash, 16);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DONTVALIDATEPROTO
|
||||
return true;
|
||||
#else
|
||||
return isValid;
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "../../common/oepl-protocol.cpp"
|
||||
@@ -62,7 +62,7 @@ void addOverlay() {
|
||||
fontrender fr(&FreeSansBold18pt7b);
|
||||
drawMask(15, epd->Yres - 53, 130, 33, COLOR_BLACK);
|
||||
if(tag.hasThirdColor){
|
||||
drawMask(15, epd->Yres - 53, 140, 35, COLOR_RED);
|
||||
drawMask(15, epd->Yres - 53, 130, 33, COLOR_RED);
|
||||
drawRoundedRectangle(15, epd->Yres - 53, 129, 33, COLOR_RED);
|
||||
fr.epdPrintf(17, epd->Yres - 50, COLOR_RED, rotation::ROTATE_0, "DEBUG");
|
||||
}else{
|
||||
@@ -203,7 +203,7 @@ void showSplashScreen() {
|
||||
addQR(260, 160, 3, 7, "https://openepaperlink.eu/tag/0/%02X/%02X%02X%02X%02X%02X%02X%02X%02X/", tag.OEPLtype, mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]);
|
||||
break;
|
||||
}
|
||||
#ifdef DEBUGBLOCKS
|
||||
#ifdef DEBUG_BUILD
|
||||
drawMask(15, epd->Yres - 53, 129, 33, COLOR_BLACK);
|
||||
if(tag.hasThirdColor){
|
||||
drawMask(15, epd->Yres - 53, 129, 33, COLOR_RED);
|
||||
|
||||
Reference in New Issue
Block a user