Merge branch 'master' into development

This commit is contained in:
Nic Limper
2023-02-14 23:01:40 +01:00
19 changed files with 359 additions and 70 deletions

View File

@@ -4,6 +4,8 @@
// images generated by https://lvgl.io/tools/imageconverter, prepended with width, height. "CF_INDEXED_1_BIT"-mode, little-endian
#include <stdint.h>
#include "screen.h"
static const uint8_t __code solum[] = {
128, 26,
0x00, 0x00, 0x07, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -207,4 +209,96 @@ static const uint8_t __code failed[] = {
0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00,
};
#if (SCREEN_WIDTH != 128)
static const uint8_t __code ant[] = {
16, 16,
0x00, 0x40,
0x02, 0x20,
0x01, 0x20,
0x11, 0x20,
0x11, 0x20,
0x12, 0x20,
0x28, 0x40,
0x28, 0x00,
0x28, 0x00,
0x44, 0x00,
0x44, 0x00,
0x44, 0x00,
0x44, 0x00,
0x82, 0x00,
0x82, 0x00,
0xfe, 0x00,
};
#else
static const uint8_t __code ant[] = {
// rotated 90 degrees
16,16,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x7c, 0x00,
0x82, 0x00,
0x00, 0x00,
0x38, 0x00,
0x44, 0x07,
0x00, 0x79,
0x03, 0x81,
0x1c, 0x01,
0x03, 0x81,
0x00, 0x79,
0x00, 0x07,
};
#endif
static const uint8_t __code cross[] = {
8,8,
0x00,
0x63,
0x77,
0x3e,
0x1c,
0x3e,
0x77,
0x63
};
#if (SCREEN_WIDTH != 128)
static const uint8_t __code battery[] = {
16,10,
0x00, 0x00,
0x7f, 0xfc,
0x40, 0x04,
0x58, 0x06,
0x58, 0x06,
0x58, 0x06,
0x58, 0x06,
0x40, 0x04,
0x7f, 0xfc,
0x00, 0x00,
};
#else
// this battery symbol is rotated 90'
static const uint8_t __code battery[] = {
16,16,
0x00, 0x00,
0x03, 0xc0,
0x0f, 0xf0,
0x08, 0x10,
0x08, 0x10,
0x08, 0x10,
0x08, 0x10,
0x08, 0x10,
0x08, 0x10,
0x08, 0x10,
0x08, 0x10,
0x0b, 0xd0,
0x0b, 0xd0,
0x08, 0x10,
0x0f, 0xf0,
0x00, 0x00,
};
#endif
#endif

View File

@@ -21,7 +21,5 @@
#define SCREEN_DATA_PASSES 2
#define SCREEN_LUT_LENGTH 10
#endif

View File

@@ -21,7 +21,4 @@
#define SCREEN_DATA_PASSES 2
#define SCREEN_LUT_LENGTH 7
#endif

View File

@@ -21,7 +21,5 @@
#define SCREEN_DATA_PASSES 2
#define SCREEN_LUT_LENGTH 7
#endif

View File

@@ -11,6 +11,7 @@
#include "screen.h"
#include "timer.h"
#include "userinterface.h" // for addIcons
#define COMPRESSION_BITPACKED_3x5_to_7 0x62700357 // 3 pixels of 5 possible colors in 7 bits
#define COMPRESSION_BITPACKED_5x3_to_8 0x62700538 // 5 pixels of 3 possible colors in 8 bits
#define COMPRESSION_BITPACKED_3x6_to_8 0x62700368 // 3 pixels of 6 possible colors in 8 bits
@@ -333,7 +334,7 @@ void ByteDecode(uint8_t byte) {
}
}
void drawImageAtAddress(uint32_t addr) {
void drawImageAtAddress(uint32_t addr, uint8_t lut) {
uint32_t __xdata clutAddr;
pr("sending to EPD - ");
clutAddr = drawPrvParseHeader(addr);
@@ -342,6 +343,7 @@ void drawImageAtAddress(uint32_t addr) {
drawPrvLoadAndMapClut(clutAddr);
epdSetup();
if(lut)selectLUT(lut);
mPassNo = 0;
beginFullscreenImage();
beginWriteFramebuffer(EPD_COLOR_BLACK);
@@ -358,6 +360,6 @@ void drawImageAtAddress(uint32_t addr) {
endWriteFramebuffer();
pr(" complete.\n");
addOverlay();
drawWithSleep();
}

View File

@@ -7,7 +7,7 @@
void set_offline(__bit state);
#pragma callee_saves drawImageAtAddress
void drawImageAtAddress(uint32_t addr);
void drawImageAtAddress(uint32_t addr, uint8_t lut);
#endif

View File

@@ -11,6 +11,7 @@
#include "lut.h"
#include "printf.h"
#include "screen.h"
#include "settings.h"
#include "sleep.h"
#include "spi.h"
#include "timer.h"
@@ -73,16 +74,14 @@ static uint8_t __xdata rbuffer[32]; // used to rotate bits around
static uint16_t __xdata fontCurXpos = 0; // current X value we're working with
static uint16_t __xdata fontCurYpos = 0; // current Y value we're working with
static uint8_t __xdata currentLut = 0;
static uint8_t __xdata dispLutSize = 0;
static bool __xdata isInited = false;
uint8_t waveformbuffer[120];
#if (SCREEN_LUT_LENGTH == 10)
struct waveform10* __xdata waveform = (struct waveform10*)waveformbuffer; // holds the LUT/waveform
#endif
#if (SCREEN_LUT_LENGTH == 7)
struct waveform* __xdata waveform = (struct waveform*)waveformbuffer; // holds the LUT/waveform
#endif
#define LUT_BUFFER_SIZE 128
uint8_t waveformbuffer[LUT_BUFFER_SIZE];
struct waveform10* __xdata waveform10 = (struct waveform10*)waveformbuffer; // holds the LUT/waveform
struct waveform* __xdata waveform7 = (struct waveform*)waveformbuffer; // holds the LUT/waveform
#pragma callee_saves epdBusySleep
#pragma callee_saves epdBusyWait
@@ -239,7 +238,6 @@ static uint8_t epdGetStatus() {
return sta;
}
uint16_t epdGetBattery(void) {
uint16_t voltage = 2600;
uint8_t val;
@@ -283,7 +281,7 @@ void loadFixedTempOTPLUT() {
}
static void writeLut() {
commandBegin(CMD_WRITE_LUT);
for (uint8_t i = 0; i < (SCREEN_LUT_LENGTH * 10); i++)
for (uint8_t i = 0; i < (dispLutSize * 10); i++)
epdSend(waveformbuffer[i]);
commandEnd();
}
@@ -292,24 +290,56 @@ static void readLut() {
uint16_t checksum = 0;
uint16_t ident = 0;
uint16_t shortl = 0;
for (uint16_t c = 0; c < ((SCREEN_LUT_LENGTH * 10) + 6); c++) {
for (uint16_t c = 0; c < LUT_BUFFER_SIZE; c++) {
waveformbuffer[c] = epdReadByte();
}
commandReadEnd();
}
static uint8_t getLutSize() {
uint8_t ref = 0;
for (uint8_t c = (LUT_BUFFER_SIZE - 4); c > 16; c--) {
uint8_t check = waveformbuffer[c];
for (uint8_t d = 1; d < 4; d++) {
if (waveformbuffer[c + d] != check) {
ref = c;
goto end;
}
}
}
end:;
return ref + 1;
}
static void lutGroupDisable(uint8_t group) {
memset(&(waveform->group[group]), 0x00, 5);
if (dispLutSize == 7) {
memset(&(waveform7->group[group]), 0x00, 5);
} else {
memset(&(waveform10->group[group]), 0x00, 5);
}
}
static void lutGroupSpeedup(uint8_t group, uint8_t speed) {
for (uint8_t i = 0; i < 4; i++) {
waveform->group[group].phaselength[i] = 1 + (waveform->group[group].phaselength[i] / speed);
if (dispLutSize == 7) {
for (uint8_t i = 0; i < 4; i++) {
waveform7->group[group].phaselength[i] = 1 + (waveform7->group[group].phaselength[i] / speed);
}
} else {
for (uint8_t i = 0; i < 4; i++) {
waveform10->group[group].phaselength[i] = 1 + (waveform10->group[group].phaselength[i] / speed);
}
}
}
static void lutGroupRepeat(uint8_t group, uint8_t repeat) {
waveform->group[group].repeat = repeat;
if (dispLutSize == 7) {
waveform7->group[group].repeat = repeat;
} else {
waveform10->group[group].repeat = repeat;
}
}
static void lutGroupRepeatReduce(uint8_t group, uint8_t factor) {
waveform->group[group].repeat = waveform->group[group].repeat / factor;
if (dispLutSize == 7) {
waveform7->group[group].repeat = waveform7->group[group].repeat / factor;
} else {
waveform10->group[group].repeat = waveform10->group[group].repeat / factor;
}
}
void selectLUT(uint8_t lut) {
if (currentLut == lut) {
@@ -333,6 +363,15 @@ void selectLUT(uint8_t lut) {
// download the current LUT from the waveform buffer
readLut();
if (dispLutSize == 0) {
dispLutSize = getLutSize();
dispLutSize /= 10;
pr("lut size = %d\n", dispLutSize);
#ifdef PRINT_LUT
dump(waveformbuffer, LUT_BUFFER_SIZE);
#endif
}
switch (lut) {
case EPD_LUT_NO_REPEATS:
lutGroupDisable(LUTGROUP_NEGATIVE);
@@ -358,7 +397,7 @@ void selectLUT(uint8_t lut) {
lutGroupDisable(LUTGROUP_NEGATIVE);
lutGroupDisable(LUTGROUP_FASTBLINK);
lutGroupDisable(LUTGROUP_SLOWBLINK);
lutGroupRepeat(LUTGROUP_SET, 0);
lutGroupRepeat(LUTGROUP_SET, 1);
lutGroupSpeedup(LUTGROUP_SET, 2);
lutGroupDisable(LUTGROUP_IMPROVE_SHARPNESS);
lutGroupDisable(LUTGROUP_IMPROVE_REDS);
@@ -366,12 +405,12 @@ void selectLUT(uint8_t lut) {
break;
}
#if (SCREEN_LUT_LENGTH == 10)
lutGroupDisable(LUTGROUP_UNUSED);
lutGroupDisable(LUTGROUP_UNKNOWN);
lutGroupDisable(LUTGROUP_UNUSED3);
lutGroupDisable(LUTGROUP_UNUSED4);
#endif
if (dispLutSize == 10) {
lutGroupDisable(LUTGROUP_UNUSED);
lutGroupDisable(LUTGROUP_UNKNOWN);
lutGroupDisable(LUTGROUP_UNUSED3);
lutGroupDisable(LUTGROUP_UNUSED4);
}
writeLut();
}
@@ -746,9 +785,4 @@ void readRam() {
epdSend(blockXferBuffer[c]);
}
commandEnd();
}
void lutTest() {
readLut();
dump((uint8_t*)&waveform, 96);
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -10,11 +10,10 @@
#define LUTGROUP_IMPROVE_REDS 5
#define LUTGROUP_UNUSED 6
#if (SCREEN_LUT_LENGTH == 10)
#define LUTGROUP_UNKNOWN 7
#define LUTGROUP_UNUSED3 8
#define LUTGROUP_UNUSED4 9
#endif
struct vgroup {
uint8_t A : 2;

View File

@@ -71,6 +71,14 @@ void displayLoop() {
wdtOn();
wdt30s();
pr("Longterm sleep screen\n");
powerUp(INIT_EPD);
showLongTermSleep();
timerDelay(TIMER_TICKS_PER_SECOND * 4);
wdtOn();
wdt30s();
pr("NO EEPROM\n");
powerUp(INIT_EPD);
showNoEEPROM();
@@ -216,6 +224,20 @@ void mainProtocolLoop(void) {
}
voltageCheckCounter++;
// check if the battery level is below minimum, and force a redraw of the screen
if ((lowBattery && !lowBatteryShown) || (noAPShown)) {
powerUp(INIT_EPD);
// Check if we were already displaying an image
if (curImgSlot != 0xFF) {
powerUp(INIT_EEPROM);
drawImageFromEeprom();
powerDown(INIT_EEPROM);
} else {
showAPFound();
powerDown(INIT_EPD);
}
}
avail = getAvailDataInfo();
if (avail != NULL) {
longDataReqCounter = 0;
@@ -270,13 +292,32 @@ void mainProtocolLoop(void) {
} else {
// not associated
powerUp(INIT_BASE | INIT_RADIO); // || INIT_GPIO | INIT_UART
if (((scanAttempts != 0) && (scanAttempts % VOLTAGEREADING_DURING_SCAN_INTERVAL == 0)) || (scanAttempts > (INTERVAL_1_ATTEMPTS + INTERVAL_2_ATTEMPTS))) {
powerUp(INIT_BASE | INIT_EPD_VOLTREADING | INIT_RADIO);
} else {
powerUp(INIT_BASE | INIT_RADIO); // || INIT_GPIO | INIT_UART
}
// try to find a working channel
powerUp(INIT_RADIO);
wdt30s();
currentChannel = channelSelect();
powerDown(INIT_RADIO | INIT_GPIO);
powerDown(INIT_RADIO);
if ((!currentChannel && !noAPShown) || (lowBattery && !lowBatteryShown) || (scanAttempts == (INTERVAL_1_ATTEMPTS + INTERVAL_2_ATTEMPTS - 1))) {
powerUp(INIT_EPD);
if (curImgSlot != 0xFF) {
powerUp(INIT_EEPROM);
drawImageFromEeprom();
powerDown(INIT_EEPROM);
} else if ((scanAttempts >= (INTERVAL_1_ATTEMPTS + INTERVAL_2_ATTEMPTS - 1))) {
showLongTermSleep();
powerDown(INIT_EPD);
} else {
showNoAP();
powerDown(INIT_EPD);
}
}
powerDown(INIT_GPIO);
// did we find a working channel?
if (currentChannel) {

View File

@@ -34,6 +34,7 @@ uint8_t __xdata scanAttempts = 0;
int8_t __xdata temperature = 0;
uint16_t __xdata batteryVoltage = 0;
bool __xdata lowBattery = false;
uint16_t __xdata longDataReqCounter = 0;
uint16_t __xdata voltageCheckCounter = 0;
@@ -70,6 +71,11 @@ void powerUp(uint8_t parts) {
if (!(parts & INIT_GPIO))
boardInit();
batteryVoltage = epdGetBattery();
if(batteryVoltage<BATTERY_VOLTAGE_MINIMUM){
lowBattery = true;
} else {
lowBattery = false;
}
}
if (parts & INIT_UART) {

View File

@@ -42,15 +42,17 @@
#define MAXIMUM_PING_ATTEMPTS 20 // How many attempts to discover an AP the tag should do
#define PING_REPLY_WINDOW 2UL
#define LONG_DATAREQ_INTERVAL 300 // How often (in seconds, approximately) the tag should do a long datareq (including temperature)
#define VOLTAGE_CHECK_INTERVAL 288 // How often the tag should do a battery voltage check (multiplied by LONG_DATAREQ_INTERVAL)
#define LONG_DATAREQ_INTERVAL 300 // How often (in seconds, approximately) the tag should do a long datareq (including temperature)
#define VOLTAGE_CHECK_INTERVAL 288 // How often the tag should do a battery voltage check (multiplied by LONG_DATAREQ_INTERVAL)
#define BATTERY_VOLTAGE_MINIMUM 2600 // 2600 or below is the best we can do on the EPD
// power saving when no AP's were found (scanning every X)
#define INTERVAL_1_TIME 3600UL // Try every hour
#define INTERVAL_1_ATTEMPTS 24 // for 24 attempts (an entire day)
#define INTERVAL_2_TIME 7200UL // Try every 2 hours
#define INTERVAL_2_ATTEMPTS 12 // for 12 attempts (an additional day)
#define INTERVAL_3_TIME 86400UL // Finally, try every day
#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
#define INTERVAL_1_ATTEMPTS 24 // for 24 attempts (an entire day)
#define INTERVAL_2_TIME 7200UL // Try every 2 hours
#define INTERVAL_2_ATTEMPTS 12 // for 12 attempts (an additional day)
#define INTERVAL_3_TIME 86400UL // Finally, try every day
extern void powerUp(uint8_t parts);
extern void powerDown(uint8_t parts);
@@ -70,6 +72,7 @@ extern uint16_t __xdata nextCheckInFromAP;
extern uint8_t __xdata dataReqLastAttempt;
extern int8_t __xdata temperature;
extern uint16_t __xdata batteryVoltage;
extern bool __xdata lowBattery;
extern uint8_t __xdata scanAttempts;
extern uint16_t __xdata longDataReqCounter;
extern uint16_t __xdata voltageCheckCounter;

View File

@@ -3,9 +3,9 @@
#include <stdint.h>
#define FW_VERSION 013 // version number (max 2.5.5 :) )
#define FW_VERSION_SUFFIX "-rf99" // suffix, like -RC1 or whatever.
#define HAS_BUTTON // uncomment to enable reading a push button (connect between 'TEST' en 'GND' on the tag, along with a 100nF capacitor in parallel).
#define DEBUGBLOCKS // uncomment to enable extra debug information on the block transfers
#define FW_VERSION 014 // version number (max 2.5.5 :) )
#define FW_VERSION_SUFFIX "-lutje" // suffix, like -RC1 or whatever.
#define HAS_BUTTON // uncomment to enable reading a push button (connect between 'TEST' en 'GND' on the tag, along with a 100nF capacitor in parallel).
#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
#endif

View File

@@ -33,11 +33,11 @@ uint16_t __xdata dataRemaining = 0; // since the targeted solum tags don't have
bool __xdata curXferComplete = false;
bool __xdata requestPartialBlock = false;
// uint8_t __xdata *tempBuffer = blockXferBuffer;
uint8_t __xdata curImgSlot = 0;
uint8_t __xdata curImgSlot = 0xFF;
uint32_t __xdata curHighSlotId = 0;
uint8_t __xdata nextImgSlot = 0;
uint8_t __xdata imgSlots = 0;
uint8_t __xdata drawWithLut = 0;
// doDownload persistent variables
bool __xdata lastBlock = false;
@@ -456,7 +456,9 @@ void drawImageFromEeprom() {
// enable WDT, to make sure de tag resets if it's for some reason unable to draw the image
wdtSetResetVal(0xFFFFFFFF - 0x38C340);
wdtOn();
drawImageAtAddress(getAddressForSlot(curImgSlot));
drawImageAtAddress(getAddressForSlot(curImgSlot), drawWithLut);
drawWithLut = 0; // default back to the regular ol' stock/OTP LUT
powerDown(INIT_EPD);
}
uint32_t getHighSlotId() {
@@ -519,7 +521,7 @@ bool doDataDownload(struct AvailDataInfo *__xdata avail) {
// mark as completed and draw from EEPROM
curXferComplete = true;
xMemCopyShort(&curDataInfo, (void *)avail, sizeof(struct AvailDataInfo));
drawWithLut = avail->dataTypeArgument;
drawImageFromEeprom();
return true;
} else {
@@ -528,7 +530,7 @@ bool doDataDownload(struct AvailDataInfo *__xdata avail) {
nextImgSlot++;
if (nextImgSlot >= imgSlots) nextImgSlot = 0;
curImgSlot = nextImgSlot;
drawWithLut = avail->dataTypeArgument;
eepromErase(getAddressForSlot(curImgSlot), EEPROM_IMG_EACH / EEPROM_ERZ_SECTOR_SZ);
pr("new download, writing to slot %d\n", curImgSlot);
// continue!

View File

@@ -8,12 +8,15 @@ extern uint8_t __xdata mSelfMac[];
extern uint8_t __xdata currentChannel;
extern uint8_t __xdata APmac[];
extern uint8_t __xdata curImgSlot;
extern void setupRadio(void);
extern void killRadio(void);
extern struct AvailDataInfo *__xdata getAvailDataInfo();
extern struct AvailDataInfo *__xdata getShortAvailDataInfo();
extern void drawImageFromEeprom();
extern bool doDataDownload(struct AvailDataInfo *__xdata avail);
extern void initializeProto();
extern uint8_t detectAP(uint8_t channel);

View File

@@ -13,6 +13,7 @@
#include "epd.h"
#include "font.h"
#include "lut.h"
#include "powermgt.h"
#include "printf.h"
#include "screen.h"
#include "settings.h"
@@ -21,13 +22,48 @@
#include "syncedproto.h" // for APmac / Channel
#include "timer.h"
extern uint8_t __xdata mSelfMac[8];
extern uint8_t __xdata currentChannel;
extern uint8_t __xdata APmac[];
// extern uint8_t __xdata mSelfMac[8];
// extern uint8_t __xdata currentChannel;
// extern uint8_t __xdata APmac[];
// extern uint16_t __xdata batteryVoltage;
const uint8_t __code fwVersion = FW_VERSION;
const char __code fwVersionSuffix[] = FW_VERSION_SUFFIX;
bool __xdata lowBatteryShown = false;
bool __xdata noAPShown = false;
void addOverlay() {
if (currentChannel == 0) {
#if (SCREEN_WIDTH == 152)
loadRawBitmap(ant, SCREEN_WIDTH - 16, 0, EPD_COLOR_BLACK);
loadRawBitmap(cross, SCREEN_WIDTH - 8, 7, EPD_COLOR_RED);
#elif (SCREEN_WIDTH == 128)
loadRawBitmap(ant, 0, 0, EPD_COLOR_BLACK);
loadRawBitmap(cross, 8, 0, EPD_COLOR_RED);
#elif (SCREEN_WIDTH == 400)
loadRawBitmap(ant, SCREEN_WIDTH - 24, 6, EPD_COLOR_BLACK);
loadRawBitmap(cross, SCREEN_WIDTH - 16, 13, EPD_COLOR_RED);
#endif
noAPShown = true;
} else {
noAPShown = false;
}
if (batteryVoltage != 2600) {
#if (SCREEN_WIDTH == 152)
loadRawBitmap(battery, SCREEN_WIDTH - 16, SCREEN_HEIGHT - 10, EPD_COLOR_BLACK);
#elif (SCREEN_WIDTH == 400)
loadRawBitmap(battery, SCREEN_WIDTH - 24, SCREEN_HEIGHT - 16, EPD_COLOR_BLACK);
#elif (SCREEN_WIDTH == 128)
loadRawBitmap(battery, 112, 0, EPD_COLOR_BLACK);
#endif
lowBatteryShown = true;
} else {
lowBatteryShown = false;
}
}
void showSplashScreen() {
selectLUT(EPD_LUT_NO_REPEATS);
clearScreen();
@@ -109,7 +145,8 @@ void showSplashScreen() {
spr(buffer + 4, "%02X%02X", mSelfMac[5], mSelfMac[4]);
spr(buffer + 8, "%02X%02X", mSelfMac[3], mSelfMac[2]);
spr(buffer + 12, "%02X%02X", mSelfMac[1], mSelfMac[0]);
printBarcode(buffer, 392, 286);
printBarcode(buffer, 392, 264);
printBarcode(buffer, 384, 264);
#endif
drawWithSleep();
@@ -169,7 +206,6 @@ void showScanningWindow() {
loadRawBitmap(receive, 320, 125, EPD_COLOR_BLACK);
#endif
draw();
selectLUT(EPD_LUT_FAST);
resultcounter = 0;
@@ -180,11 +216,11 @@ void addScanResult(uint8_t channel, uint8_t lqi) {
#if (SCREEN_WIDTH == 128) // 2.9"
epdPrintBegin(56 + ((resultcounter % 4) * 16), 282 - (47 * (resultcounter / 4)), EPD_DIRECTION_Y, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
#endif
#if (SCREEN_WIDTH ==150) // 1.54"
#if (SCREEN_WIDTH == 152) // 1.54"
epdPrintBegin(4 + (47 * (resultcounter / 8)), 31 + (15 * (resultcounter % 8)), EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
#endif
#if (SCREEN_WIDTH == 400) // 4.2"
epdPrintBegin(4 + (47 * (resultcounter / 8)), 50 + (15 * (resultcounter % 8)), EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
epdPrintBegin(4 + (47 * (resultcounter / 8)), 58 + (15 * (resultcounter % 8)), EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
#endif
epdpr("%d-%d", channel, lqi);
epdPrintEnd();
@@ -260,13 +296,48 @@ void showAPFound() {
epdpr("%02X%02X", mSelfMac[1], mSelfMac[0]);
epdPrintEnd();
#endif
#if (SCREEN_WIDTH == 400)
epdPrintBegin(10, 10, EPD_DIRECTION_X, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK);
epdpr("Waiting for data...");
epdPrintEnd();
epdPrintBegin(48, 80, EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
epdpr("Found the following AP:");
epdPrintEnd();
epdPrintBegin(48, 96, EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
epdpr("AP MAC: %02X:%02X", APmac[7], APmac[6]);
epdpr(":%02X:%02X", APmac[5], APmac[4]);
epdpr(":%02X:%02X", APmac[3], APmac[2]);
epdpr(":%02X:%02X", APmac[1], APmac[0]);
epdPrintEnd();
epdPrintBegin(48, 112, EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
epdpr("Ch: %d RSSI: %d LQI: %d", currentChannel, mLastRSSI, mLastLqi);
epdPrintEnd();
epdPrintBegin(366, 258, EPD_DIRECTION_Y, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
epdpr("Tag MAC: %02X:%02X", mSelfMac[7], mSelfMac[6]);
epdpr(":%02X:%02X", mSelfMac[5], mSelfMac[4]);
epdpr(":%02X:%02X", mSelfMac[3], mSelfMac[2]);
epdpr(":%02X:%02X", mSelfMac[1], mSelfMac[0]);
epdPrintEnd();
uint8_t __xdata buffer[17];
spr(buffer, "%02X%02X", mSelfMac[7], mSelfMac[6]);
spr(buffer + 4, "%02X%02X", mSelfMac[5], mSelfMac[4]);
spr(buffer + 8, "%02X%02X", mSelfMac[3], mSelfMac[2]);
spr(buffer + 12, "%02X%02X", mSelfMac[1], mSelfMac[0]);
printBarcode(buffer, 392, 253);
printBarcode(buffer, 384, 253);
loadRawBitmap(receive, 100, 170, EPD_COLOR_BLACK);
#endif
addOverlay();
drawWithSleep();
}
void showNoAP() {
selectLUT(EPD_LUT_NO_REPEATS);
setColorMode(EPD_MODE_NORMAL, EPD_MODE_INVERT);
clearScreen();
#if (SCREEN_WIDTH == 128) // 1.54"
#if (SCREEN_WIDTH == 128) // 2,9"
epdPrintBegin(0, 285, EPD_DIRECTION_Y, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK);
epdpr("No AP found :(");
epdPrintEnd();
@@ -294,9 +365,36 @@ void showNoAP() {
epdpr("a little while");
epdPrintEnd();
#endif
#if (SCREEN_WIDTH == 400) // 4.2"
epdPrintBegin(10, 10, EPD_DIRECTION_X, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK);
epdpr("No AP found :(");
epdPrintEnd();
epdPrintBegin(10, 274, EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
epdpr("We'll try again in a little while");
epdPrintEnd();
loadRawBitmap(receive, 76, 120, EPD_COLOR_BLACK);
loadRawBitmap(failed, 82, 122, EPD_COLOR_RED);
#endif
addOverlay();
drawWithSleep();
}
void showLongTermSleep() {
selectLUT(EPD_LUT_NO_REPEATS);
setColorMode(EPD_MODE_NORMAL, EPD_MODE_INVERT);
clearScreen();
#if (SCREEN_WIDTH == 128) // 2.9"
epdPrintBegin(0, 295, EPD_DIRECTION_Y, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
epdpr("zZ");
epdPrintEnd();
#else
epdPrintBegin(2, SCREEN_HEIGHT - 16, EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
epdpr("zZ");
epdPrintEnd();
#endif
addOverlay();
drawWithSleep();
}
void showNoEEPROM() {
selectLUT(EPD_LUT_NO_REPEATS);
clearScreen();
@@ -322,6 +420,15 @@ void showNoEEPROM() {
epdPrintBegin(3, 136, EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
epdpr("Sleeping forever :'(");
epdPrintEnd();
#endif
#if (SCREEN_WIDTH == 400) // 4.2"
epdPrintBegin(50 , 3, EPD_DIRECTION_X, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK);
epdpr("EEPROM FAILED :(");
epdPrintEnd();
loadRawBitmap(failed, 176, 126, EPD_COLOR_RED);
epdPrintBegin(100, 284, EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_BLACK);
epdpr("Sleeping forever :'(");
epdPrintEnd();
#endif
drawWithSleep();
}
@@ -351,7 +458,7 @@ void showNoMAC() {
epdpr("Sleeping forever :'(");
epdPrintEnd();
#endif
#if (SCREEN_WIDTH == 400) // 1.54"
#if (SCREEN_WIDTH == 400) // 4.2"
epdPrintBegin(100, 3, EPD_DIRECTION_X, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK);
epdpr("NO MAC SET :(");
epdPrintEnd();

View File

@@ -2,16 +2,21 @@
#define _UI_H_
#include <stdint.h>
void addOverlay();
void showSplashScreen();
void showApplyUpdate();
void showScanningWindow();
void addScanResult(uint8_t channel, uint8_t lqi);
void showAPFound();
void showNoAP();
void showLongTermSleep();
void showNoEEPROM();
void showNoMAC();
extern const uint8_t __code fwVersion;
extern const char __code fwVersionSuffix[];
extern bool __xdata lowBatteryShown;
extern bool __xdata noAPShown;
#endif