added icons, testing required for scanning-phase

This commit is contained in:
Jelmer
2023-02-12 16:28:43 +01:00
parent 11e5cf34e0
commit f50b0bd4ff
8 changed files with 167 additions and 13 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

@@ -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
@@ -359,6 +360,6 @@ void drawImageAtAddress(uint32_t addr, uint8_t lut) {
endWriteFramebuffer();
pr(" complete.\n");
addOverlay();
drawWithSleep();
}

View File

@@ -141,7 +141,7 @@ uint8_t channelSelect() { // returns 0 if no accesspoints were found
}
void mainProtocolLoop(void) {
//displayLoop(); // remove me
// displayLoop(); // remove me
powerUp(INIT_BASE | INIT_UART | INIT_GPIO);
wdt10s();
boardGetOwnMac(mSelfMac);
@@ -216,6 +216,16 @@ void mainProtocolLoop(void) {
}
voltageCheckCounter++;
// check if the battery level is below minimum, and force a redraw of the screen
if ((batteryVoltage < BATTERY_VOLTAGE_MINIMUM && !lowBatteryShown) || (noAPShown)) {
// Check if we were already displaying an image
if (curImgSlot != 0xFF) {
drawImageFromEeprom();
} else {
showAPFound();
}
}
avail = getAvailDataInfo();
if (avail != NULL) {
longDataReqCounter = 0;
@@ -276,7 +286,16 @@ void mainProtocolLoop(void) {
powerUp(INIT_RADIO);
wdt30s();
currentChannel = channelSelect();
powerDown(INIT_RADIO | INIT_GPIO);
powerDown(INIT_RADIO);
if (!currentChannel && !noAPShown) {
if (curImgSlot != 0xFF) {
drawImageFromEeprom();
} else {
showAPFound();
}
}
powerDown(INIT_GPIO);
// did we find a working channel?
if (currentChannel) {

View File

@@ -42,8 +42,9 @@
#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

View File

@@ -33,8 +33,7 @@ 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;

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,43 @@
#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 != 128)
loadRawBitmap(ant, SCREEN_WIDTH - 16, 0, EPD_COLOR_BLACK);
loadRawBitmap(cross, SCREEN_WIDTH - 8, 7, EPD_COLOR_RED);
#else
loadRawBitmap(ant, 0, 0, EPD_COLOR_BLACK);
loadRawBitmap(cross, 8, 0, EPD_COLOR_RED);
#endif
noAPShown = true;
} else {
noAPShown = false;
}
if (batteryVoltage != 2600) {
#if (SCREEN_WIDTH != 128)
loadRawBitmap(battery, SCREEN_WIDTH - 16, SCREEN_HEIGHT - 8, EPD_COLOR_BLACK);
#else
loadRawBitmap(battery, 112, 0, EPD_COLOR_BLACK);
#endif
lowBatteryShown = true;
} else {
lowBatteryShown = false;
}
}
void showSplashScreen() {
selectLUT(EPD_LUT_NO_REPEATS);
clearScreen();
@@ -169,7 +200,6 @@ void showScanningWindow() {
loadRawBitmap(receive, 320, 125, EPD_COLOR_BLACK);
#endif
draw();
selectLUT(EPD_LUT_FAST);
resultcounter = 0;
@@ -180,7 +210,7 @@ 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 ==152) // 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"
@@ -260,11 +290,13 @@ void showAPFound() {
epdpr("%02X%02X", mSelfMac[1], mSelfMac[0]);
epdPrintEnd();
#endif
addOverlay();
drawWithSleep();
}
void showNoAP() {
selectLUT(EPD_LUT_NO_REPEATS);
setColorMode(EPD_MODE_NORMAL, EPD_MODE_INVERT);
clearScreen();
#if (SCREEN_WIDTH == 128) // 1.54"
epdPrintBegin(0, 285, EPD_DIRECTION_Y, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK);
@@ -294,6 +326,7 @@ void showNoAP() {
epdpr("a little while");
epdPrintEnd();
#endif
addOverlay();
drawWithSleep();
}

View File

@@ -2,6 +2,8 @@
#define _UI_H_
#include <stdint.h>
void addOverlay();
void showSplashScreen();
void showApplyUpdate();
void showScanningWindow();
@@ -11,7 +13,9 @@ void showNoAP();
void showNoEEPROM();
void showNoMAC();
extern const uint8_t __code fwVersion;
extern const char __code fwVersionSuffix[];
extern bool __xdata lowBatteryShown;
extern bool __xdata noAPShown;
#endif