This commit is contained in:
atc1441
2024-05-05 15:52:14 +02:00
parent f9ea040b33
commit b5a3c8db24
10 changed files with 340 additions and 57 deletions

View File

@@ -154,7 +154,7 @@ bool radioInit(void)
int32_t radioRxDequeuePkt(uint8_t *dstBuf, uint32_t maxLen, int8_t *rssiP, uint8_t *lqiP)
{
u8 curr_rx = getRxBuffer(dstBuf, lqiP);
*rssiP = lqiP;
*rssiP = *lqiP;
/*if (curr_rx)
{

View File

@@ -17,6 +17,8 @@
uint8_t gicToOEPLtype(uint8_t gicType) {
switch (gicType) {
case 0xA0:
return GICI_BLE_TFT_21_BW;
break;
case 0x08:
return GICI_BLE_EPD_21_BW;
break;
@@ -55,7 +57,7 @@ uint8_t gicToOEPLtype(uint8_t gicType) {
return GICI_BLE_EPD_BWR_29_SILABS;
break;
default:
return GICI_BLE_UNKNOWN; // Should never happen, return 1.54"
return GICI_BLE_UNKNOWN;
break;
}
}
@@ -96,7 +98,7 @@ bool BLE_filter_add_device(BLEAdvertisedDevice advertisedDevice) {
theAdvData.src[4] = macReversed[1];
theAdvData.src[5] = macReversed[0];
theAdvData.src[6] = manuData[2]; // We use this do find out what type of display we got for compression^^
theAdvData.src[7] = 0x00;
theAdvData.src[7] = manuData[6];
theAdvData.adr.batteryMv = manuData[3] * 100;
theAdvData.adr.lastPacketRSSI = advertisedDevice.getRSSI();
theAdvData.adr.hwType = gicToOEPLtype(manuData[2]);
@@ -120,7 +122,7 @@ bool BLE_filter_add_device(BLEAdvertisedDevice advertisedDevice) {
theAdvData.src[3] = macReversed[2];
theAdvData.src[4] = macReversed[1];
theAdvData.src[5] = macReversed[0];
theAdvData.src[6] = 0x00; // We use this do find out what type of display we got for compression^^
theAdvData.src[6] = 0x00;
theAdvData.src[7] = 0x00;
theAdvData.adr.batteryMv = payloadData[14] << 8 | payloadData[15];
theAdvData.adr.temperature = (payloadData[10] << 8 | payloadData[11]) / 10;
@@ -169,21 +171,34 @@ uint32_t compress_image(uint8_t address[8], uint8_t* buffer, uint32_t max_len) {
file.close();
}
uint8_t giciType = address[6]; // here we "extract" the display info again
uint16_t giciType = (address[7] << 8) | address[6]; // here we "extract" the display info again
uint8_t screenResolution = (giciType >> 5) & 63;
uint8_t dispPtype = (giciType >> 3) & 3;
uint8_t availColors = ((giciType >> 1) & 3);
uint8_t special_color = ((giciType >> 10) & 12);
uint8_t singleDoubleMirror = giciType & 1;
uint8_t canDoCompression = (giciType & 0x4000) ? 0 : 1;
Serial.printf("BLE Filter options:\r\n");
Serial.printf("screenResolution %d\r\n", screenResolution);
Serial.printf("dispPtype %d\r\n", dispPtype);
Serial.printf("availColors %d\r\n", availColors);
Serial.printf("special_color %d\r\n", special_color);
Serial.printf("singleDoubleMirror %d\r\n", singleDoubleMirror);
Serial.printf("canDoCompression %d\r\n", canDoCompression);
bool extra_color = false;
uint16_t width_display = 104;
uint16_t height_display = 212;
switch ((giciType >> 5) & 7) // Resolution
{
default:
switch (screenResolution) {
case 0:
width_display = 104;
height_display = 212;
break;
case 1:
width_display = 296;
height_display = 128;
width_display = 128;
height_display = 296;
break;
case 2:
width_display = 300;
@@ -193,45 +208,78 @@ uint32_t compress_image(uint8_t address[8], uint8_t* buffer, uint32_t max_len) {
width_display = 384;
height_display = 640;
break;
case 5:// TFT 2.1"
width_display = 104;
height_display = 212;
case 4:
width_display = 640;
height_display = 960;
break;
case 5:
width_display = 132;
height_display = 256;
break;
case 6:
width_display = 96;
height_display = 196;
break;
case 7:
width_display = 168;
height_display = 384;
width_display = 480;
height_display = 640;
break;
}
switch ((giciType >> 1) & 3) // Extra color
{
default:
case 0:
extra_color = false;
case 8:
width_display = 128;
height_display = 256;
break;
case 1:
case 2:
extra_color = true;
case 9:
width_display = 480;
height_display = 800;
break;
case 10:
width_display = 480;
height_display = 280;
break;
}
// Yeah, this is no real compression, but maybe it will be solved in the future to the "real" RLE Compression
uint32_t len_compressed = 4;
switch (dispPtype) {
case 0: // TFT
break;
case 1: // EPA
break;
case 2: // EPA1
break;
case 3: // EPA2
break;
}
switch (availColors) {
case 0: // BW
extra_color = false;
break;
case 1: // BWR
extra_color = true;
break;
case 2: // BWY
extra_color = true;
break;
case 3: // BWRY
extra_color = true;
break;
case 4: // BWRGBYO
extra_color = true;
break;
}
switch (singleDoubleMirror) {
case 0: // Single image
break;
case 1: // 2 Images
break;
}
uint32_t len_compressed = 0;
if (canDoCompression)
len_compressed = 4;
uint32_t curr_input_posi = 0;
uint32_t byte_per_line = (height_display / 8);
for (int i = 0; i < width_display; i++) {
buffer[len_compressed++] = 0x75;
buffer[len_compressed++] = byte_per_line + 7;
buffer[len_compressed++] = byte_per_line;
buffer[len_compressed++] = 0x00;
buffer[len_compressed++] = 0x00;
buffer[len_compressed++] = 0x00;
buffer[len_compressed++] = 0x00;
for (int b = 0; b < byte_per_line; b++) {
buffer[len_compressed++] = ~queueItem->data[curr_input_posi++];
}
}
if (extra_color) {
for (int i = 0; i < width_display; i++) {
if (canDoCompression) {
buffer[len_compressed++] = 0x75;
buffer[len_compressed++] = byte_per_line + 7;
buffer[len_compressed++] = byte_per_line;
@@ -239,6 +287,22 @@ uint32_t compress_image(uint8_t address[8], uint8_t* buffer, uint32_t max_len) {
buffer[len_compressed++] = 0x00;
buffer[len_compressed++] = 0x00;
buffer[len_compressed++] = 0x00;
}
for (int b = 0; b < byte_per_line; b++) {
buffer[len_compressed++] = ~queueItem->data[curr_input_posi++];
}
}
if (extra_color) {
for (int i = 0; i < width_display; i++) {
if (canDoCompression) {
buffer[len_compressed++] = 0x75;
buffer[len_compressed++] = byte_per_line + 7;
buffer[len_compressed++] = byte_per_line;
buffer[len_compressed++] = 0x00;
buffer[len_compressed++] = 0x00;
buffer[len_compressed++] = 0x00;
buffer[len_compressed++] = 0x00;
}
for (int b = 0; b < byte_per_line; b++) {
if (queueItem->len <= curr_input_posi)
buffer[len_compressed++] = 0x00;
@@ -247,10 +311,12 @@ uint32_t compress_image(uint8_t address[8], uint8_t* buffer, uint32_t max_len) {
}
}
}
buffer[0] = len_compressed & 0xff;
buffer[1] = (len_compressed >> 8) & 0xff;
buffer[2] = (len_compressed >> 16) & 0xff;
buffer[3] = (len_compressed >> 24) & 0xff;
if (canDoCompression) {
buffer[0] = len_compressed & 0xff;
buffer[1] = (len_compressed >> 8) & 0xff;
buffer[2] = (len_compressed >> 16) & 0xff;
buffer[3] = (len_compressed >> 24) & 0xff;
}
return len_compressed;
}

View File

@@ -92,7 +92,10 @@ bool BLE_connect(uint8_t addr[8]) {
pClient->disconnect();
return false;
}
vTaskDelay(100 / portTICK_PERIOD_MS);
uint32_t timeStart = millis();
while (millis() - timeStart <= 5000) {// We wait for a few seconds as otherwise the connection might not be ready!
delay(100);
}
if (!BLE_connected)
return false;
Serial.printf("BLE starting to get service\r\n");

Binary file not shown.

View File

@@ -75,6 +75,7 @@
#define GICI_BLE_TFT_BWR_42 0xB7
#define GICI_BLE_EPD_BW_74 0xB8
#define GICI_BLE_EPD_BWR_74 0xB9
#define GICI_BLE_TFT_21_BW 0xBA
#define GICI_BLE_EPD_BWR_29_SILABS 0xBD
#define GICI_BLE_UNKNOWN 0xBF
#define ATC_MI_THERMOMETER 0xBE

View File

@@ -1,8 +1,8 @@
{
"version": 1,
"version": 3,
"name": "Gicisky BLE EPD BW 2.1\"",
"width": 212,
"height": 104,
"width": 256,
"height": 128,
"rotatebuffer": 1,
"bpp": 1,
"colortable": {
@@ -10,7 +10,72 @@
"black": [ 0, 0, 0 ]
},
"shortlut": 0,
"options": [ "button", "customlut" ],
"contentids": [ 22, 23, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21 ],
"usetemplate": 1
}
"contentids": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 27 ],
"template": {
"1": {
"weekday": [ 128, 3, "Signika-SB.ttf", 50 ],
"date": [ 128, 62, "Signika-SB.ttf", 40 ]
},
"2": {
"fonts": [ "Signika-SB.ttf", 150, 150, 150, 115, 90, 70 ],
"xy": [ 128, 53 ]
},
"16": {
"location": [ 7, 15, "t0_14b_tf" ],
"title": [ 210, 11, "glasstown_nbp_tf" ],
"cols": [ 4, 121, 10, "glasstown_nbp_tf" ],
"bars": [ 10, 110, 8 ]
},
"4": {
"location": [ 5, 3, "fonts/bahnschrift30" ],
"wind": [ 245, 3, "fonts/bahnschrift30" ],
"temp": [ 10, 60, "fonts/bahnschrift70" ],
"icon": [ 240, 20, 70, 2 ],
"dir": [ 210, -12, 40 ],
"umbrella": [ 175, -50, 25 ]
},
"8": {
"location": [ 5, 12, "t0_14b_tf" ],
"column": [ 5, 51 ],
"day": [ 28, 18, "fonts/twcondensed20", 41, 108 ],
"icon": [ 28, 55, 30 ],
"wind": [ 18, 26 ],
"line": [ 20, 128 ]
},
"9": {
"title": [ 8, 2, "bahnschrift20.vlw", 25 ],
"items": 5,
"line": [ 8, 25, "REFSAN12.vlw" ],
"desc": [ 0, 5, "", 1 ]
},
"10": {
"title": [ 128, 2, "calibrib16.vlw" ],
"pos": [ 128, 16 ]
},
"11": {
"mode": 0,
"days": 1,
"title": [ 10, 2, "fonts/bahnschrift20" ],
"date": [ 245, 2 ],
"items": 7,
"red": [ 0, 21, 256, 14 ],
"line": [ 10, 32, 15, "t0_14b_tf", 50 ]
},
"21": [
{ "text": [ 10, 5, "OpenEpaperLink AP", "bahnschrift20", 1, 0, 0 ] },
{ "text": [ 10, 50, "IP address:", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 110, 50, "{ap_ip}", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 10, 70, "Channel:", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 110, 70, "{ap_ch}", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 10, 90, "Tag count:", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 110, 90, "{ap_tagcount}", "t0_14b_tf", 1, 0, 0 ] }
],
"27": {
"bars": [ 26, 216, 80, 20 ],
"time": [ "tahoma9.vlw" ],
"yaxis": [ "tahoma9.vlw", 6, 6 ],
"head": [ "bahnschrift20.vlw" ]
}
}
}

View File

@@ -1,8 +1,8 @@
{
"version": 1,
"version": 3,
"name": "Gicisky BLE EPD BWR 2.1\"",
"width": 212,
"height": 104,
"width": 256,
"height": 128,
"rotatebuffer": 1,
"bpp": 2,
"colortable": {
@@ -10,6 +10,73 @@
"black": [ 0, 0, 0 ],
"red": [ 255, 0, 0 ]
},
"contentids": [ 22, 23, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 27 ],
"usetemplate": 1
}
"shortlut": 0,
"contentids": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 27 ],
"template": {
"1": {
"weekday": [ 128, 3, "Signika-SB.ttf", 50 ],
"date": [ 128, 62, "Signika-SB.ttf", 40 ]
},
"2": {
"fonts": [ "Signika-SB.ttf", 150, 150, 150, 115, 90, 70 ],
"xy": [ 128, 53 ]
},
"16": {
"location": [ 7, 15, "t0_14b_tf" ],
"title": [ 210, 11, "glasstown_nbp_tf" ],
"cols": [ 4, 121, 10, "glasstown_nbp_tf" ],
"bars": [ 10, 110, 8 ]
},
"4": {
"location": [ 5, 3, "fonts/bahnschrift30" ],
"wind": [ 245, 3, "fonts/bahnschrift30" ],
"temp": [ 10, 60, "fonts/bahnschrift70" ],
"icon": [ 240, 20, 70, 2 ],
"dir": [ 210, -12, 40 ],
"umbrella": [ 175, -50, 25 ]
},
"8": {
"location": [ 5, 12, "t0_14b_tf" ],
"column": [ 5, 51 ],
"day": [ 28, 18, "fonts/twcondensed20", 41, 108 ],
"icon": [ 28, 55, 30 ],
"wind": [ 18, 26 ],
"line": [ 20, 128 ]
},
"9": {
"title": [ 8, 2, "bahnschrift20.vlw", 25 ],
"items": 5,
"line": [ 8, 25, "REFSAN12.vlw" ],
"desc": [ 0, 5, "", 1 ]
},
"10": {
"title": [ 128, 2, "calibrib16.vlw" ],
"pos": [ 128, 16 ]
},
"11": {
"mode": 0,
"days": 1,
"title": [ 10, 2, "fonts/bahnschrift20" ],
"date": [ 245, 2 ],
"items": 7,
"red": [ 0, 21, 256, 14 ],
"line": [ 10, 32, 15, "t0_14b_tf", 50 ]
},
"21": [
{ "text": [ 10, 5, "OpenEpaperLink AP", "bahnschrift20", 1, 0, 0 ] },
{ "text": [ 10, 50, "IP address:", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 110, 50, "{ap_ip}", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 10, 70, "Channel:", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 110, 70, "{ap_ch}", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 10, 90, "Tag count:", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 110, 90, "{ap_tagcount}", "t0_14b_tf", 1, 0, 0 ] }
],
"27": {
"bars": [ 26, 216, 80, 20 ],
"time": [ "tahoma9.vlw" ],
"yaxis": [ "tahoma9.vlw", 6, 6 ],
"head": [ "bahnschrift20.vlw" ]
}
}
}

View File

@@ -0,0 +1,81 @@
{
"version": 1,
"name": "Gicisky BLE TFT 2.13\"",
"width": 250,
"height": 132,
"rotatebuffer": 1,
"bpp": 1,
"colortable": {
"white": [ 255, 255, 255 ],
"black": [ 0, 0, 0 ]
},
"shortlut": 0,
"contentids": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 27 ],
"template": {
"1": {
"weekday": [ 128, 3, "Signika-SB.ttf", 50 ],
"date": [ 128, 62, "Signika-SB.ttf", 40 ]
},
"2": {
"fonts": [ "Signika-SB.ttf", 150, 150, 150, 115, 90, 70 ],
"xy": [ 128, 53 ]
},
"16": {
"location": [ 7, 15, "t0_14b_tf" ],
"title": [ 210, 11, "glasstown_nbp_tf" ],
"cols": [ 4, 121, 10, "glasstown_nbp_tf" ],
"bars": [ 10, 110, 8 ]
},
"4": {
"location": [ 5, 3, "fonts/bahnschrift30" ],
"wind": [ 245, 3, "fonts/bahnschrift30" ],
"temp": [ 10, 60, "fonts/bahnschrift70" ],
"icon": [ 240, 20, 70, 2 ],
"dir": [ 210, -12, 40 ],
"umbrella": [ 175, -50, 25 ]
},
"8": {
"location": [ 5, 12, "t0_14b_tf" ],
"column": [ 5, 51 ],
"day": [ 28, 18, "fonts/twcondensed20", 41, 108 ],
"icon": [ 28, 55, 30 ],
"wind": [ 18, 26 ],
"line": [ 20, 128 ]
},
"9": {
"title": [ 8, 2, "bahnschrift20.vlw", 25 ],
"items": 5,
"line": [ 8, 25, "REFSAN12.vlw" ],
"desc": [ 0, 5, "", 1 ]
},
"10": {
"title": [ 128, 2, "calibrib16.vlw" ],
"pos": [ 128, 16 ]
},
"11": {
"mode": 0,
"days": 1,
"title": [ 10, 2, "fonts/bahnschrift20" ],
"date": [ 245, 2 ],
"items": 7,
"red": [ 0, 21, 256, 14 ],
"line": [ 10, 32, 15, "t0_14b_tf", 50 ]
},
"21": [
{ "text": [ 10, 5, "OpenEpaperLink AP", "bahnschrift20", 1, 0, 0 ] },
{ "text": [ 10, 50, "IP address:", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 110, 50, "{ap_ip}", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 10, 70, "Channel:", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 110, 70, "{ap_ch}", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 10, 90, "Tag count:", "t0_14b_tf", 1, 0, 0 ] },
{ "text": [ 110, 90, "{ap_tagcount}", "t0_14b_tf", 1, 0, 0 ] }
],
"27": {
"bars": [ 26, 216, 80, 20 ],
"time": [ "tahoma9.vlw" ],
"yaxis": [ "tahoma9.vlw", 6, 6 ],
"head": [ "bahnschrift20.vlw" ]
}
}
}