bigger availdatareq struct with version

This commit is contained in:
jjwbruijn
2023-06-27 23:00:11 +02:00
parent 5376f2540e
commit 306e5aaf00
21 changed files with 45 additions and 68 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -6,6 +6,7 @@
#define SOLUM_SEG_EU 0xF1
#define SOLUM_NODISPLAY 0xFF
#define CAPABILITY_SUPPORTS_COMPRESSION 0x02
#define CAPABILITY_SUPPORTS_CUSTOM_LUTS 0x04
#define CAPABILITY_ALT_LUT_SIZE 0x08
#define CAPABILITY_HAS_EXT_POWER 0x10
@@ -30,4 +31,11 @@
#define CMD_DO_REBOOT 0
#define CMD_DO_SCAN 1
#define CMD_DO_RESET_SETTINGS 2
#define CMD_DO_RESET_SETTINGS 2
#define WAKEUP_REASON_TIMED 0
#define WAKEUP_REASON_GPIO 2
#define WAKEUP_REASON_NFC 3
#define WAKEUP_REASON_FIRSTBOOT 0xFC
#define WAKEUP_REASON_NETWORK_SCAN 0xFD
#define WAKEUP_REASON_WDT_RESET 0xFE

View File

@@ -23,8 +23,8 @@ $stackdisturbed = false;
$mem = checkmem();
while(1){
$errlist = array();
//exec("make BUILD=zbs154v033 CPU=8051 SOC=zbs243 2>&1 | grep error | grep -v make", $errlist);
exec("make BUILD=zbs_segmented_uk CPU=8051 SOC=zbs243 2>&1 | grep error | grep -v make", $errlist);
exec("make BUILD=zbs154_ssd1619 CPU=8051 SOC=zbs243 2>&1 | grep error | grep -v make", $errlist);
//exec("make BUILD=zbs_segmented_uk CPU=8051 SOC=zbs243 2>&1 | grep error | grep -v make", $errlist);
if(checkmem()!=$mem){
$stackdisturbed = true;
echo "Stack size was $mem, is now ".checkmem()." !!!\n";

View File

@@ -163,8 +163,9 @@ void fakeTagCheckIn() {
adr->lastPacketLQI = 100;
adr->lastPacketRSSI = 100;
adr->capabilities |= CAPABILITY_HAS_EXT_POWER;
adr->tagSoftwareVersion = 1;
if (firstboot) {
adr->wakeupReason = 0xFC;
adr->wakeupReason = WAKEUP_REASON_FIRSTBOOT;
firstboot = false;
} else {
adr->wakeupReason = 0;

View File

@@ -24,13 +24,13 @@
#include "emulateTag.h"
#endif
#define MAX_PENDING_MACS 55
#define MAX_PENDING_MACS 50
#define HOUSEKEEPING_INTERVAL 60UL
struct pendingData __xdata pendingDataArr[MAX_PENDING_MACS];
// VERSION GOES HERE!
uint16_t __xdata version = 0x0016;
uint16_t __xdata version = 0x0017;
#define RAW_PKT_PADDING 2
@@ -416,9 +416,9 @@ void espNotifyAPInfo() {
countSlots();
pr("PEN>%02X\n", curPendingData);
pr("NOP>%02X\n", curNoUpdate);
#if (AP_EMULATE_TAG == 1)
fakeTagCheckIn();
#endif
//#if (AP_EMULATE_TAG == 1)
// fakeTagCheckIn(); // removed this for now to ensure IP info is properly displayed; first tag check in now happens after the first round of housekeeping (30s)
//#endif
}
// process data from tag
@@ -741,6 +741,11 @@ void main(void) {
switch (getPacketType(radiorxbuffer)) {
case PKT_AVAIL_DATA_REQ:
if (ret == 28) {
// old version of the AvailDataReq struct, set all the new fields to zero, so it will pass the CRC
processAvailDataReq(radiorxbuffer);
memset(radiorxbuffer + 1 + sizeof(struct MacFrameBcast) + sizeof(struct oldAvailDataReq), 0, sizeof(struct AvailDataReq) - sizeof(struct oldAvailDataReq) + 2);
} else if (ret == 40) {
// new version of the AvailDataReq struct
processAvailDataReq(radiorxbuffer);
}
break;

View File

@@ -1,45 +0,0 @@
-muwx
-i main.ihx
-M
-X 0x2000
-C 0xfc00
-b HOME = 0x0000
-b XSEG = 0xe000
-b PSEG = 0xe000
-b ISEG = 0x0000
-b BSEG = 0x0000
-k /usr/local/bin/../share/sdcc/lib/large
-k /usr/local/share/sdcc/lib/large
-l mcs51
-l libsdcc
-l libint
-l liblong
-l libfloat
main.rel
eeprom.rel
drawing.rel
comms.rel
syncedproto.rel
userinterface.rel
powermgt.rel
barcode.rel
i2cdevices.rel
settings.rel
soc/zbs243/soc.rel
soc/zbs243/wdt.rel
soc/zbs243/sleep.rel
soc/zbs243/spi.rel
soc/zbs243/uart.rel
soc/zbs243/timer.rel
soc/zbs243/radio.rel
soc/zbs243/flash.rel
soc/zbs243/temperature.rel
cpu/8051/random.rel
cpu/8051/printf.rel
soc/zbs243/i2c.rel
cpu/8051/asmUtil.rel
cpu/8051/cpu.rel
board/zbs29_uc8151/board.rel
board/zbs29_uc8151/screen.rel
-e

View File

@@ -2,13 +2,6 @@
#define _POWERMGT_H_
#include <stdint.h>
#define WAKEUP_REASON_TIMED 0
#define WAKEUP_REASON_GPIO 2
#define WAKEUP_REASON_NFC 3
#define WAKEUP_REASON_FIRSTBOOT 0xFC
#define WAKEUP_REASON_NETWORK_SCAN 0xFD
#define WAKEUP_REASON_WDT_RESET 0xFE
#define DETECT_P1_0_NOTHING 0
#define DETECT_P1_0_BUTTON 1
#define DETECT_P1_0_JIG 2

View File

@@ -3,8 +3,8 @@
#include <stdint.h>
#define FW_VERSION 18 // version number (max 2.5.5 :) )
#define FW_VERSION_SUFFIX "-RW" // suffix, like -RC1 or whatever.
#define FW_VERSION 19 // version number (max 2.5.5 :) )
#define FW_VERSION_SUFFIX "-VER" // suffix, like -RC1 or whatever.
// #define DEBUGBLOCKS // uncomment to enable extra debug information on the block transfers
// #define PRINT_LUT // uncomment if you want the tag to print the LUT for the current temperature bracket

View File

@@ -196,6 +196,9 @@ static void sendAvailDataReq() {
availreq->temperature = temperature;
availreq->batteryMv = batteryVoltage;
availreq->capabilities = capabilities;
availreq->tagSoftwareVersion = fwVersion;
availreq->currentChannel = currentChannel;
availreq->customMode = tagSettings.customMode;
addCRC(availreq, sizeof(struct AvailDataReq));
commsTxNoCpy(outBuffer);
}

View File

@@ -27,7 +27,7 @@
// extern uint8_t __xdata APmac[];
// extern uint16_t __xdata batteryVoltage;
const uint8_t __code fwVersion = FW_VERSION;
const uint16_t __code fwVersion = FW_VERSION;
const char __code fwVersionSuffix[] = FW_VERSION_SUFFIX;
extern uint8_t __xdata capabilities;

View File

@@ -15,7 +15,7 @@ void showLongTermSleep();
void showNoEEPROM();
void showNoMAC();
extern const uint8_t __code fwVersion;
extern const uint16_t __code fwVersion;
extern const char __code fwVersionSuffix[];
extern bool __xdata lowBatteryShown;
extern bool __xdata noAPShown;

View File

@@ -31,7 +31,6 @@ enum TagScreenType {
TagScreenTypeOther = 0x7f,
};
#ifndef __packed
#define __packed __attribute__((packed))
#endif
@@ -110,9 +109,23 @@ struct AvailDataReq {
uint16_t batteryMv;
uint8_t hwType;
uint8_t wakeupReason;
uint8_t capabilities; // undefined, as of now
uint8_t capabilities;
uint16_t tagSoftwareVersion;
uint8_t currentChannel;
uint8_t customMode;
uint8_t reserved[8];
} __packed;
struct oldAvailDataReq {
uint8_t checksum;
uint8_t lastPacketLQI;
int8_t lastPacketRSSI;
int8_t temperature;
uint16_t batteryMv;
uint8_t hwType;
uint8_t wakeupReason;
uint8_t capabilities;
} __packed;
struct AvailDataInfo {
uint8_t checksum;
@@ -190,7 +203,6 @@ struct espSetChannelPower {
uint8_t power;
} __packed;
#define MACFMT "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
#define MACCVT(x) ((const uint8_t*)(x))[7], ((const uint8_t*)(x))[6], ((const uint8_t*)(x))[5], ((const uint8_t*)(x))[4], ((const uint8_t*)(x))[3], ((const uint8_t*)(x))[2], ((const uint8_t*)(x))[1], ((const uint8_t*)(x))[0]