mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 14:06:31 +01:00
improved structs for esp32 fw
This commit is contained in:
@@ -18,17 +18,25 @@ struct blockData {
|
||||
uint8_t data[];
|
||||
} __packed;
|
||||
|
||||
#define SOLUM_154_033 0
|
||||
#define SOLUM_29_033 1
|
||||
#define SOLUM_42_033 2
|
||||
|
||||
#define WAKEUP_REASON_TIMED 0
|
||||
#define WAKEUP_REASON_BOOTUP 1
|
||||
#define WAKEUP_REASON_GPIO 2
|
||||
#define WAKEUP_REASON_NFC 3
|
||||
|
||||
struct AvailDataReq {
|
||||
uint8_t checksum;
|
||||
uint8_t lastPacketLQI; // zero if not reported/not supported to be reported
|
||||
int8_t lastPacketRSSI; // zero if not reported/not supported to be reported
|
||||
uint8_t temperature; // zero if not reported/not supported to be reported. else, this minus CHECKIN_TEMP_OFFSET is temp in degrees C
|
||||
uint16_t batteryMv;
|
||||
uint8_t softVer;
|
||||
uint8_t hwType;
|
||||
uint8_t protoVer;
|
||||
uint8_t buttonState;
|
||||
} __packed;
|
||||
uint8_t lastPacketLQI : 7;
|
||||
uint8_t lastPacketRSSI : 7; // is negative
|
||||
int8_t temperature : 7; // zero if not reported/not supported to be reported. else, this minus CHECKIN_TEMP_OFFSET is temp in degrees C
|
||||
uint16_t batteryMv : 12;
|
||||
uint8_t hwType : 5; // 32 types of tags supported
|
||||
uint8_t wakeupReason : 2; // supports 4 types of wakeup reasons
|
||||
uint8_t capabilities; // undefined, as of now
|
||||
} __packed; // 7 bytes
|
||||
|
||||
struct espAvailDataReq {
|
||||
uint8_t checksum;
|
||||
@@ -43,10 +51,11 @@ struct espAvailDataReq {
|
||||
|
||||
struct AvailDataInfo {
|
||||
uint8_t checksum;
|
||||
uint64_t dataVer;
|
||||
uint32_t dataSize;
|
||||
uint8_t dataType;
|
||||
uint16_t nextCheckIn;
|
||||
uint64_t dataVer; // MD5 of potential traffic
|
||||
uint32_t dataSize;
|
||||
uint8_t dataType : 4; // allows for 16 different datatypes
|
||||
uint8_t dataTypeArgument : 4; // extra specification or instruction for the tag (LUT to be used for drawing image)
|
||||
uint16_t nextCheckIn; // when should the tag check-in again? Measured in minutes
|
||||
} __packed;
|
||||
|
||||
struct pendingData {
|
||||
|
||||
@@ -28,15 +28,22 @@
|
||||
// flasher options
|
||||
#define CUSTOM_MAC_HDR 0x0000
|
||||
|
||||
#define RXD1 16
|
||||
#define TXD1 17
|
||||
//#define RXD1 16
|
||||
//#define TXD1 17
|
||||
|
||||
#define ZBS_SS 5
|
||||
// connections to the tag
|
||||
//#define RXD1 16 //was 16 - 13
|
||||
//#define TXD1 17 // was 17 - 12
|
||||
|
||||
#define RXD1 13 // 1st
|
||||
#define TXD1 12 // 2nd
|
||||
|
||||
#define ZBS_SS 21
|
||||
#define ZBS_CLK 18
|
||||
#define ZBS_MoSi 23
|
||||
#define ZBS_MoSi 22
|
||||
#define ZBS_MiSo 19
|
||||
#define ZBS_Reset 2
|
||||
#define ZBS_POWER1 13
|
||||
#define ZBS_POWER2 15
|
||||
#define ZBS_Reset 5
|
||||
#define ZBS_POWER1 15
|
||||
#define ZBS_POWER2 2
|
||||
|
||||
#define MAX_WRITE_ATTEMPTS 5
|
||||
|
||||
@@ -24,5 +24,5 @@ lib_deps =
|
||||
bblanchon/ArduinoJson
|
||||
bodmer/TFT_eSPI
|
||||
https://github.com/Bodmer/TJpg_Decoder.git
|
||||
upload_port = COM5
|
||||
monitor_port = COM5
|
||||
upload_port = COM12
|
||||
monitor_port = COM12
|
||||
|
||||
@@ -271,7 +271,7 @@ void processDataReq(struct espAvailDataReq* eadr) {
|
||||
time(&now);
|
||||
taginfo->lastseen = now;
|
||||
taginfo->expectedNextCheckin = now + 300;
|
||||
taginfo->button = (eadr->adr.buttonState == 1);
|
||||
taginfo->button = (eadr->adr.wakeupReason==WAKEUP_REASON_GPIO);
|
||||
|
||||
sprintf(buffer, "<ADR %02X%02X%02X%02X%02X%02X\n\0", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
Serial.print(buffer);
|
||||
|
||||
Reference in New Issue
Block a user