mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 07:06:36 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46c8b73fa0 | ||
|
|
c65c8b749e | ||
|
|
f61c2e3d04 | ||
|
|
0dc406b865 | ||
|
|
25b185da28 | ||
|
|
496d4d382f | ||
|
|
d09e89c9dd | ||
|
|
0e8e7b5b75 | ||
|
|
e8a92c4fcb |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -64,7 +64,7 @@ uint8_t gicToOEPLtype(uint8_t gicType) {
|
||||
}
|
||||
}
|
||||
|
||||
struct BleAdvDataStruct {
|
||||
struct BleAdvDataStructV1 {
|
||||
uint16_t manu_id; // 0x1337 for us
|
||||
uint8_t version;
|
||||
uint16_t hw_type;
|
||||
@@ -73,6 +73,16 @@ struct BleAdvDataStruct {
|
||||
uint16_t battery_mv;
|
||||
uint8_t counter;
|
||||
} __packed;
|
||||
struct BleAdvDataStructV2 {
|
||||
uint16_t manu_id; // 0x1337 for us
|
||||
uint8_t version;
|
||||
uint16_t hw_type;
|
||||
uint16_t fw_version;
|
||||
uint16_t capabilities;
|
||||
uint16_t battery_mv;
|
||||
int8_t temperature;
|
||||
uint8_t counter;
|
||||
} __packed;
|
||||
|
||||
bool BLE_filter_add_device(BLEAdvertisedDevice advertisedDevice) {
|
||||
Serial.print("BLE Advertised Device found: ");
|
||||
@@ -91,16 +101,16 @@ bool BLE_filter_add_device(BLEAdvertisedDevice advertisedDevice) {
|
||||
uint8_t manuData[100];
|
||||
if (manuDatalen > sizeof(manuData))
|
||||
return false; // Manu data too big, could never happen but better make sure here
|
||||
#if ESP_ARDUINO_VERSION_MAJOR == 2
|
||||
memcpy(&manuData, (uint8_t*)advertisedDevice.getManufacturerData().data(), manuDatalen);
|
||||
#else
|
||||
// [Nic] suggested fix for arduino 3.x by copilot, but I cannot test it
|
||||
memcpy(&manuData, (uint8_t*)advertisedDevice.getManufacturerData().c_str(), manuDatalen);
|
||||
#endif
|
||||
Serial.printf(" Address type: %02X Manu data: ", advertisedDevice.getAddressType());
|
||||
for (int i = 0; i < advertisedDevice.getManufacturerData().length(); i++)
|
||||
Serial.printf("%02X", manuData[i]);
|
||||
Serial.printf("\r\n");
|
||||
#if ESP_ARDUINO_VERSION_MAJOR == 2
|
||||
memcpy(&manuData, (uint8_t*)advertisedDevice.getManufacturerData().data(), manuDatalen);
|
||||
#else
|
||||
// [Nic] suggested fix for arduino 3.x by copilot, but I cannot test it
|
||||
memcpy(&manuData, (uint8_t*)advertisedDevice.getManufacturerData().c_str(), manuDatalen);
|
||||
#endif
|
||||
if (manuDatalen == 7 && manuData[0] == 0x53 && manuData[1] == 0x50) { // Lets check for a Gicisky E-Paper display
|
||||
|
||||
struct espAvailDataReq theAdvData;
|
||||
@@ -125,23 +135,63 @@ bool BLE_filter_add_device(BLEAdvertisedDevice advertisedDevice) {
|
||||
|
||||
processDataReq(&theAdvData, true);
|
||||
return true;
|
||||
} else if (manuDatalen >= sizeof(BleAdvDataStruct) && manuData[0] == 0x37 && manuData[1] == 0x13) { // Lets check for a Gicisky E-Paper display
|
||||
} else if (manuDatalen >= 3 && manuData[0] == 0x37 && manuData[1] == 0x13) { // Lets check for a Gicisky E-Paper display
|
||||
Serial.printf("ATC BLE OEPL Detected\r\n");
|
||||
struct espAvailDataReq theAdvData;
|
||||
struct BleAdvDataStruct inAdvData;
|
||||
|
||||
memset((uint8_t*)&theAdvData, 0x00, sizeof(espAvailDataReq));
|
||||
memcpy(&inAdvData, manuData, sizeof(BleAdvDataStruct));
|
||||
/*Serial.printf("manu_id %04X\r\n", inAdvData.manu_id);
|
||||
Serial.printf("version %04X\r\n", inAdvData.version);
|
||||
Serial.printf("hw_type %04X\r\n", inAdvData.hw_type);
|
||||
Serial.printf("fw_version %04X\r\n", inAdvData.fw_version);
|
||||
Serial.printf("capabilities %04X\r\n", inAdvData.capabilities);
|
||||
Serial.printf("battery_mv %u\r\n", inAdvData.battery_mv);
|
||||
Serial.printf("counter %u\r\n", inAdvData.counter);*/
|
||||
if (inAdvData.version != 1) {
|
||||
printf("Version currently not supported!\r\n");
|
||||
return false;
|
||||
uint8_t versionAdvData = manuData[2];
|
||||
|
||||
switch (versionAdvData) {
|
||||
case 1: {
|
||||
if (manuDatalen >= sizeof(BleAdvDataStructV1)) {
|
||||
struct BleAdvDataStructV1 inAdvData;
|
||||
memcpy(&inAdvData, manuData, sizeof(BleAdvDataStructV1));
|
||||
printf("Version 1 ATC_BLE_OEPL Received\r\n");
|
||||
/*Serial.printf("manu_id %04X\r\n", inAdvData.manu_id);
|
||||
Serial.printf("version %02X\r\n", inAdvData.version);
|
||||
Serial.printf("hw_type %04X\r\n", inAdvData.hw_type);
|
||||
Serial.printf("fw_version %04X\r\n", inAdvData.fw_version);
|
||||
Serial.printf("capabilities %04X\r\n", inAdvData.capabilities);
|
||||
Serial.printf("battery_mv %u\r\n", inAdvData.battery_mv);
|
||||
Serial.printf("counter %u\r\n", inAdvData.counter);*/
|
||||
theAdvData.adr.batteryMv = inAdvData.battery_mv;
|
||||
theAdvData.adr.lastPacketRSSI = advertisedDevice.getRSSI();
|
||||
theAdvData.adr.hwType = inAdvData.hw_type & 0xff;
|
||||
theAdvData.adr.tagSoftwareVersion = inAdvData.fw_version;
|
||||
theAdvData.adr.capabilities = inAdvData.capabilities & 0xff;
|
||||
} else {
|
||||
printf("Version 1 data length incorrect!\r\n");
|
||||
return false;
|
||||
}
|
||||
} break;
|
||||
case 2: {
|
||||
if (manuDatalen >= sizeof(BleAdvDataStructV2)) {
|
||||
struct BleAdvDataStructV2 inAdvData;
|
||||
memcpy(&inAdvData, manuData, sizeof(BleAdvDataStructV2));
|
||||
printf("Version 2 ATC_BLE_OEPL Received\r\n");
|
||||
/*Serial.printf("manu_id %04X\r\n", inAdvData.manu_id);
|
||||
Serial.printf("version %02X\r\n", inAdvData.version);
|
||||
Serial.printf("hw_type %04X\r\n", inAdvData.hw_type);
|
||||
Serial.printf("fw_version %04X\r\n", inAdvData.fw_version);
|
||||
Serial.printf("capabilities %04X\r\n", inAdvData.capabilities);
|
||||
Serial.printf("battery_mv %u\r\n", inAdvData.battery_mv);
|
||||
Serial.printf("temperature %i\r\n", inAdvData.temperature);
|
||||
Serial.printf("counter %u\r\n", inAdvData.counter);*/
|
||||
theAdvData.adr.batteryMv = inAdvData.battery_mv;
|
||||
theAdvData.adr.temperature = inAdvData.temperature;
|
||||
theAdvData.adr.lastPacketRSSI = advertisedDevice.getRSSI();
|
||||
theAdvData.adr.hwType = inAdvData.hw_type & 0xff;
|
||||
theAdvData.adr.tagSoftwareVersion = inAdvData.fw_version;
|
||||
theAdvData.adr.capabilities = inAdvData.capabilities & 0xff;
|
||||
} else {
|
||||
printf("Version 2 data length incorrect!\r\n");
|
||||
return false;
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
printf("Version %02X currently not supported!\r\n", versionAdvData);
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
uint8_t macReversed[6];
|
||||
memcpy(&macReversed, (uint8_t*)advertisedDevice.getAddress().getNative(), 6);
|
||||
@@ -153,11 +203,6 @@ bool BLE_filter_add_device(BLEAdvertisedDevice advertisedDevice) {
|
||||
theAdvData.src[5] = macReversed[0];
|
||||
theAdvData.src[6] = manuData[0]; // We use this do find out what type of display we got for compression^^
|
||||
theAdvData.src[7] = manuData[1];
|
||||
theAdvData.adr.batteryMv = inAdvData.battery_mv;
|
||||
theAdvData.adr.lastPacketRSSI = advertisedDevice.getRSSI();
|
||||
theAdvData.adr.hwType = inAdvData.hw_type & 0xff;
|
||||
theAdvData.adr.tagSoftwareVersion = inAdvData.fw_version;
|
||||
theAdvData.adr.capabilities = inAdvData.capabilities & 0xff;
|
||||
processDataReq(&theAdvData, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3135,7 +3135,7 @@ uint32_t convert_tm_to_seconds(struct tm *t) {
|
||||
|
||||
void prepareTIME_RAW(const uint8_t *dst, time_t now) {
|
||||
uint8_t *data;
|
||||
size_t len = 1 + 4 + 4;
|
||||
size_t len = 1 + 4 + 4 + 1;
|
||||
struct tm timeinfo;
|
||||
localtime_r(&now, &timeinfo);
|
||||
uint32_t local_time = convert_tm_to_seconds(&timeinfo) + 20;// Adding 20 seconds for the average of upload time
|
||||
@@ -3151,6 +3151,7 @@ void prepareTIME_RAW(const uint8_t *dst, time_t now) {
|
||||
data[7] = ((uint8_t*)&unix_time)[1];
|
||||
data[8] = ((uint8_t*)&unix_time)[2];
|
||||
data[9] = ((uint8_t*)&unix_time)[3];
|
||||
data[10] = 1; // Design, 1 = Full DateTime 2 = Just Time Segment Style
|
||||
prepareDataAvail(data, len + 1, DATATYPE_TIME_RAW_DATA, dst);
|
||||
}
|
||||
#endif
|
||||
|
||||
25
resources/tagtypes/2B.json
Normal file
25
resources/tagtypes/2B.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"version": 1,
|
||||
"name": "M3 2.9\" BWRY",
|
||||
"width": 384,
|
||||
"height": 168,
|
||||
"rotatebuffer": 3,
|
||||
"bpp": 2,
|
||||
"colortable": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ],
|
||||
"red": [ 255, 0, 0 ],
|
||||
"yellow": [ 255, 255, 0 ]
|
||||
},
|
||||
"perceptual": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ],
|
||||
"red": [ 255, 0, 0 ],
|
||||
"yellow": [ 200, 200, 0 ]
|
||||
},
|
||||
"shortlut": 0,
|
||||
"zlib_compression": "27",
|
||||
"options": [ "led" ],
|
||||
"contentids": [ 22, 23, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 14, 16, 17, 18, 19, 20, 21, 27 ],
|
||||
"usetemplate": 51
|
||||
}
|
||||
25
resources/tagtypes/2C.json
Normal file
25
resources/tagtypes/2C.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"version": 1,
|
||||
"name": "M3 4.3\" BWRY",
|
||||
"width": 522,
|
||||
"height": 152,
|
||||
"rotatebuffer": 3,
|
||||
"bpp": 2,
|
||||
"colortable": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ],
|
||||
"red": [ 255, 0, 0 ],
|
||||
"yellow": [ 255, 255, 0 ]
|
||||
},
|
||||
"perceptual": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ],
|
||||
"red": [ 255, 0, 0 ],
|
||||
"yellow": [ 200, 200, 0 ]
|
||||
},
|
||||
"shortlut": 0,
|
||||
"zlib_compression": "27",
|
||||
"options": [ "led" ],
|
||||
"contentids": [ 22, 23, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 14, 16, 17, 18, 19, 20, 21, 27 ],
|
||||
"usetemplate": 47
|
||||
}
|
||||
25
resources/tagtypes/4A.json
Normal file
25
resources/tagtypes/4A.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"version": 1,
|
||||
"name": "M3 1.6\" 200px BWRY",
|
||||
"width": 200,
|
||||
"height": 200,
|
||||
"rotatebuffer": 0,
|
||||
"bpp": 2,
|
||||
"colortable": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ],
|
||||
"red": [ 255, 0, 0 ],
|
||||
"yellow": [ 255, 255, 0 ]
|
||||
},
|
||||
"perceptual": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ],
|
||||
"red": [ 255, 0, 0 ],
|
||||
"yellow": [ 200, 200, 0 ]
|
||||
},
|
||||
"shortlut": 0,
|
||||
"zlib_compression": "27",
|
||||
"options": [ "led" ],
|
||||
"contentids": [ 22, 23, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 14, 16, 17, 18, 19, 20, 21, 27 ],
|
||||
"usetemplate": 48
|
||||
}
|
||||
25
resources/tagtypes/4B.json
Normal file
25
resources/tagtypes/4B.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"version": 1,
|
||||
"name": "M3 2.2\" BWRY",
|
||||
"width": 296,
|
||||
"height": 160,
|
||||
"rotatebuffer": 3,
|
||||
"bpp": 2,
|
||||
"colortable": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ],
|
||||
"red": [ 255, 0, 0 ],
|
||||
"yellow": [ 255, 255, 0 ]
|
||||
},
|
||||
"perceptual": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ],
|
||||
"red": [ 255, 0, 0 ],
|
||||
"yellow": [ 200, 200, 0 ]
|
||||
},
|
||||
"shortlut": 0,
|
||||
"zlib_compression": "27",
|
||||
"options": [ "led" ],
|
||||
"contentids": [ 22, 23, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 14, 16, 17, 18, 19, 20, 21, 27 ],
|
||||
"usetemplate": 49
|
||||
}
|
||||
25
resources/tagtypes/4C.json
Normal file
25
resources/tagtypes/4C.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"version": 1,
|
||||
"name": "M3 7.5\" BWRY",
|
||||
"width": 800,
|
||||
"height": 480,
|
||||
"rotatebuffer": 0,
|
||||
"bpp": 2,
|
||||
"colortable": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ],
|
||||
"red": [ 255, 0, 0 ],
|
||||
"yellow": [ 255, 255, 0 ]
|
||||
},
|
||||
"perceptual": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ],
|
||||
"red": [ 255, 0, 0 ],
|
||||
"yellow": [ 200, 200, 0 ]
|
||||
},
|
||||
"shortlut": 0,
|
||||
"zlib_compression": "27",
|
||||
"options": [ "led" ],
|
||||
"contentids": [ 22, 23, 1, 4, 5, 7, 8, 9, 10, 11, 17, 18, 19, 20 ],
|
||||
"usetemplate": 54
|
||||
}
|
||||
25
resources/tagtypes/4D.json
Normal file
25
resources/tagtypes/4D.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"version": 3,
|
||||
"name": "M3 11.6\" BWRY",
|
||||
"width": 960,
|
||||
"height": 640,
|
||||
"rotatebuffer": 0,
|
||||
"bpp": 2,
|
||||
"colortable": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ],
|
||||
"red": [ 255, 0, 0 ],
|
||||
"yellow": [ 255, 255, 0 ]
|
||||
},
|
||||
"perceptual": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ],
|
||||
"red": [ 255, 0, 0 ],
|
||||
"yellow": [ 200, 200, 0 ]
|
||||
},
|
||||
"shortlut": 0,
|
||||
"zlib_compression": "27",
|
||||
"options": [ "led" ],
|
||||
"contentids": [ 22, 23, 1, 4, 5, 7, 8, 9, 10, 11, 17, 18, 19, 20 ],
|
||||
"usetemplate": 55
|
||||
}
|
||||
18
resources/tagtypes/4E.json
Normal file
18
resources/tagtypes/4E.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"version": 2,
|
||||
"name": "M3 2.6\" BW",
|
||||
"width": 360,
|
||||
"height": 184,
|
||||
"rotatebuffer": 3,
|
||||
"bpp": 1,
|
||||
"colortable": {
|
||||
"white": [ 255, 255, 255 ],
|
||||
"black": [ 0, 0, 0 ]
|
||||
},
|
||||
"highlight_color": 5,
|
||||
"shortlut": 0,
|
||||
"zlib_compression": "27",
|
||||
"options": [ "button", "led" ],
|
||||
"contentids": [ 22, 23, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 16, 17, 18, 19, 20, 26, 27 ],
|
||||
"usetemplate": 1
|
||||
}
|
||||
Reference in New Issue
Block a user