mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 03:04:25 +01:00
more robust extended sleep time and 'no updates between' handling
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -75,6 +75,7 @@ struct Config {
|
||||
uint8_t discovery;
|
||||
String repo;
|
||||
String env;
|
||||
uint8_t showtimestamp;
|
||||
};
|
||||
|
||||
struct Color {
|
||||
|
||||
@@ -6,9 +6,8 @@ platform = platformio/espressif32@^6.10.0
|
||||
;platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
|
||||
framework = arduino
|
||||
lib_deps =
|
||||
ESP32Async/AsyncTCP
|
||||
ESP32Async/ESPAsyncWebServer
|
||||
|
||||
ESP32Async/AsyncTCP
|
||||
ESP32Async/ESPAsyncWebServer
|
||||
bblanchon/ArduinoJson
|
||||
bodmer/TFT_eSPI
|
||||
https://github.com/Bodmer/TJpg_Decoder.git
|
||||
@@ -30,7 +29,9 @@ build_flags =
|
||||
-D DISABLE_ALL_LIBRARY_WARNINGS
|
||||
-D ILI9341_DRIVER
|
||||
-D SMOOTH_FONT
|
||||
-D ARDUINOJSON_ENABLE_COMMENTS=1
|
||||
-D LOAD_FONT2
|
||||
-D LOAD_GLCD
|
||||
-D ARDUINOJSON_ENABLE_COMMENTS=1
|
||||
; ----------------------------------------------------------------------------------------
|
||||
; !!! this configuration expects the 16MB Flash / 8MB Ram version of the ESP32-S3-DevkitC1
|
||||
; ----------------------------------------------------------------------------------------
|
||||
@@ -101,11 +102,11 @@ board = esp32-s3-devkitc-1
|
||||
board_build.partitions = large_spiffs_16MB.csv
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
-D ARDUINO_USB_MODE=1
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D ILI9341_DRIVER
|
||||
-D ARDUINO_USB_MODE=1
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D ILI9341_DRIVER
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
-std=gnu++17
|
||||
${env.build_flags}
|
||||
@@ -144,7 +145,6 @@ build_flags =
|
||||
-D TFT_RST=1
|
||||
-D TFT_RGB_ORDER=TFT_BGR
|
||||
-D USE_HSPI_PORT
|
||||
-D LOAD_FONT2
|
||||
-D MD5_ENABLED=1
|
||||
-D SERIAL_FLASHER_INTERFACE_UART=1
|
||||
-D SERIAL_FLASHER_BOOT_HOLD_TIME_MS=50
|
||||
@@ -169,8 +169,8 @@ monitor_dtr = 0
|
||||
monitor_rts = 0
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
;-D ILI9341_DRIVER
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
;-D ILI9341_DRIVER
|
||||
lib_deps = ${env.lib_deps}
|
||||
lib_extra_dirs = lib2/Arduino_GFX-1.3.7
|
||||
build_flags =
|
||||
@@ -207,7 +207,6 @@ build_flags =
|
||||
-D TFT_HEIGHT=480
|
||||
-D TFT_HW_TYPE=226
|
||||
-D USE_HSPI_PORT
|
||||
-D LOAD_FONT2
|
||||
-D MD5_ENABLED=1
|
||||
-D SERIAL_FLASHER_INTERFACE_UART=1
|
||||
-D SERIAL_FLASHER_BOOT_HOLD_TIME_MS=200
|
||||
@@ -233,11 +232,11 @@ monitor_dtr = 0
|
||||
monitor_rts = 0
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
lib_deps = ${env.lib_deps}
|
||||
lib_extra_dirs = lib2/Arduino_GFX-1.3.7
|
||||
lib2/gt911-touch
|
||||
build_flags =
|
||||
lib2/gt911-touch
|
||||
build_flags =
|
||||
-std=gnu++17
|
||||
${env.build_flags}
|
||||
-D HAS_TFT
|
||||
@@ -250,7 +249,7 @@ build_flags =
|
||||
-D BOARD_HAS_PSRAM
|
||||
-D CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y
|
||||
-D HAS_BLE_WRITER
|
||||
-D FLASHER_AP_SS=-1
|
||||
-D FLASHER_AP_SS=-1
|
||||
-D FLASHER_AP_CLK=-1
|
||||
-D FLASHER_AP_MOSI=-1
|
||||
-D FLASHER_AP_MISO=-1
|
||||
@@ -272,7 +271,6 @@ build_flags =
|
||||
-D TFT_HEIGHT=480
|
||||
-D TFT_HW_TYPE=226
|
||||
-D USE_HSPI_PORT
|
||||
-D LOAD_FONT2
|
||||
-D MD5_ENABLED=1
|
||||
-D SERIAL_FLASHER_INTERFACE_UART=1
|
||||
-D SERIAL_FLASHER_BOOT_HOLD_TIME_MS=200
|
||||
@@ -295,15 +293,15 @@ board = esp32-s3-devkitc-1
|
||||
board_build.partitions = large_spiffs_16MB.csv
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
-std=gnu++17
|
||||
${env.build_flags}
|
||||
-D HAS_BLE_WRITER
|
||||
-D CORE_DEBUG_LEVEL=0
|
||||
-D ARDUINO_USB_CDC_ON_BOOT
|
||||
-D ARDUINO_USB_CDC_ON_BOOT
|
||||
-D CONFIG_ESP32S3_SPIRAM_SUPPORT=1
|
||||
-D CONFIG_SPIRAM_USE_MALLOC=1
|
||||
-D POWER_NO_SOFT_POWER
|
||||
@@ -344,15 +342,15 @@ board = esp32-s3-devkitc-1
|
||||
board_build.partitions = large_spiffs_16MB.csv
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
-std=gnu++17
|
||||
${env.build_flags}
|
||||
-D HAS_BLE_WRITER
|
||||
-D CORE_DEBUG_LEVEL=0
|
||||
-D ARDUINO_USB_CDC_ON_BOOT
|
||||
-D ARDUINO_USB_CDC_ON_BOOT
|
||||
-D CONFIG_ESP32S3_SPIRAM_SUPPORT=1
|
||||
-D CONFIG_SPIRAM_USE_MALLOC=1
|
||||
-D POWER_NO_SOFT_POWER
|
||||
@@ -393,15 +391,15 @@ board = esp32-s3-devkitc-1
|
||||
board_build.partitions = large_spiffs_16MB.csv
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
-std=gnu++17
|
||||
${env.build_flags}
|
||||
-D HAS_BLE_WRITER
|
||||
-D CORE_DEBUG_LEVEL=0
|
||||
-D ARDUINO_USB_CDC_ON_BOOT
|
||||
-D ARDUINO_USB_CDC_ON_BOOT
|
||||
-D CONFIG_ESP32S3_SPIRAM_SUPPORT=1
|
||||
-D CONFIG_SPIRAM_USE_MALLOC=1
|
||||
-D POWER_NO_SOFT_POWER
|
||||
@@ -445,16 +443,16 @@ board = esp32-s3-devkitc-1
|
||||
board_build.partitions = large_spiffs_16MB.csv
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D ILI9341_DRIVER
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
-std=gnu++17
|
||||
${env.build_flags}
|
||||
-D HAS_TFT
|
||||
-D CORE_DEBUG_LEVEL=1
|
||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-D CONFIG_ESP32S3_SPIRAM_SUPPORT=1
|
||||
-D CONFIG_SPIRAM_USE_MALLOC=1
|
||||
-D POWER_NO_SOFT_POWER
|
||||
@@ -489,16 +487,13 @@ build_flags =
|
||||
-D TFT_RST=1
|
||||
-D TFT_RGB_ORDER=TFT_BGR
|
||||
-D USE_HSPI_PORT
|
||||
-D LOAD_FONT2
|
||||
-D LOAD_FONT4
|
||||
-D LOAD_GLCD
|
||||
-D MD5_ENABLED=1
|
||||
-D SERIAL_FLASHER_INTERFACE_UART=1
|
||||
-D SERIAL_FLASHER_BOOT_HOLD_TIME_MS=200
|
||||
-D SERIAL_FLASHER_RESET_HOLD_TIME_MS=200
|
||||
-D C6_OTA_FLASHING
|
||||
-D HAS_SUBGHZ
|
||||
build_src_filter =
|
||||
-D HAS_SUBGHZ
|
||||
build_src_filter =
|
||||
+<*>-<usbflasher.cpp>-<swd.cpp>-<webflasher.cpp>
|
||||
board_build.flash_mode=qio
|
||||
board_build.arduino.memory_type = qio_opi
|
||||
@@ -514,16 +509,16 @@ board = esp32-s3-devkitc-1
|
||||
board_build.partitions = large_spiffs_16MB.csv
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D ILI9341_DRIVER
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
-std=gnu++17
|
||||
${env.build_flags}
|
||||
-D HAS_TFT
|
||||
-D CORE_DEBUG_LEVEL=1
|
||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-D CONFIG_ESP32S3_SPIRAM_SUPPORT=1
|
||||
-D CONFIG_SPIRAM_USE_MALLOC=1
|
||||
-D POWER_NO_SOFT_POWER
|
||||
@@ -558,16 +553,13 @@ build_flags =
|
||||
-D TFT_RST=1
|
||||
-D TFT_RGB_ORDER=TFT_BGR
|
||||
-D USE_HSPI_PORT
|
||||
-D LOAD_FONT2
|
||||
-D LOAD_FONT4
|
||||
-D LOAD_GLCD
|
||||
-D MD5_ENABLED=1
|
||||
-D SERIAL_FLASHER_INTERFACE_UART=1
|
||||
-D SERIAL_FLASHER_BOOT_HOLD_TIME_MS=200
|
||||
-D SERIAL_FLASHER_RESET_HOLD_TIME_MS=200
|
||||
-D C6_OTA_FLASHING
|
||||
-D HAS_SUBGHZ
|
||||
build_src_filter =
|
||||
-D HAS_SUBGHZ
|
||||
build_src_filter =
|
||||
+<*>-<usbflasher.cpp>-<swd.cpp>-<webflasher.cpp>
|
||||
board_build.flash_mode=qio
|
||||
board_build.arduino.memory_type = qio_opi
|
||||
@@ -583,11 +575,11 @@ board = esp32-s3-devkitc-1
|
||||
board_build.partitions = large_spiffs_16MB.csv
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
-D ARDUINO_USB_MODE=1
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D ARDUINO_USB_MODE=1
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
-std=gnu++17
|
||||
${env.build_flags}
|
||||
-D CORE_DEBUG_LEVEL=0
|
||||
@@ -633,8 +625,8 @@ build_unflags =
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-std=gnu++11
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
-std=gnu++17
|
||||
${env.build_flags}
|
||||
-D OPENEPAPERLINK_POE_AP_PCB
|
||||
@@ -676,17 +668,17 @@ monitor_dtr = 0
|
||||
monitor_rts = 0
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D ILI9341_DRIVER
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
-std=gnu++17
|
||||
${env.build_flags}
|
||||
-D HAS_TFT
|
||||
-D HAS_EXT_FLASHER
|
||||
-D CORE_DEBUG_LEVEL=1
|
||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-D CONFIG_ESP32S3_SPIRAM_SUPPORT=1
|
||||
-D CONFIG_SPIRAM_USE_MALLOC=1
|
||||
-D POWER_NO_SOFT_POWER
|
||||
@@ -741,16 +733,13 @@ build_flags =
|
||||
-D TFT_RST=1
|
||||
-D TFT_RGB_ORDER=TFT_BGR
|
||||
-D USE_HSPI_PORT
|
||||
-D LOAD_FONT2
|
||||
-D LOAD_FONT4
|
||||
-D LOAD_GLCD
|
||||
-D MD5_ENABLED=1
|
||||
-D SERIAL_FLASHER_INTERFACE_UART=1
|
||||
-D SERIAL_FLASHER_BOOT_HOLD_TIME_MS=200
|
||||
-D SERIAL_FLASHER_RESET_HOLD_TIME_MS=200
|
||||
-D C6_OTA_FLASHING
|
||||
-D HAS_SUBGHZ
|
||||
build_src_filter =
|
||||
-D HAS_SUBGHZ
|
||||
build_src_filter =
|
||||
+<*>
|
||||
board_build.flash_mode=qio
|
||||
board_build.arduino.memory_type = qio_opi
|
||||
@@ -767,11 +756,11 @@ board = esp32-s3-devkitc-1
|
||||
board_build.partitions = large_spiffs_16MB.csv
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
-D ARDUINO_USB_MODE=1
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D ILI9341_DRIVER
|
||||
-D ARDUINO_USB_MODE=1
|
||||
-D CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
-D ILI9341_DRIVER
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
${env.lib_deps}
|
||||
build_flags =
|
||||
-std=gnu++17
|
||||
${env.build_flags}
|
||||
|
||||
@@ -54,17 +54,22 @@ void contentRunner() {
|
||||
|
||||
time_t now;
|
||||
time(&now);
|
||||
uint8_t wifimac[8];
|
||||
WiFi.macAddress(wifimac);
|
||||
memset(&wifimac[6], 0, 2);
|
||||
|
||||
for (tagRecord *taginfo : tagDB) {
|
||||
|
||||
const bool isAp = memcmp(taginfo->mac, wifimac, 8) == 0;
|
||||
if (taginfo->RSSI &&
|
||||
(now >= taginfo->nextupdate || needRedraw(taginfo->contentMode, taginfo->wakeupReason)) &&
|
||||
config.runStatus == RUNSTATUS_RUN &&
|
||||
Storage.freeSpace() > 31000 && !util::isSleeping(config.sleepTime1, config.sleepTime2)) {
|
||||
config.runStatus == RUNSTATUS_RUN && (taginfo->expectedNextCheckin < now + 300 || isAp) &&
|
||||
Storage.freeSpace() > 31000 && !util::isSleeping(config.sleepTime1, config.sleepTime2)) {
|
||||
drawNew(taginfo->mac, taginfo);
|
||||
taginfo->wakeupReason = 0;
|
||||
}
|
||||
|
||||
if (taginfo->expectedNextCheckin > now - 10 && taginfo->expectedNextCheckin < now + 30 && taginfo->pendingIdle == 0 && taginfo->pendingCount == 0) {
|
||||
if (taginfo->expectedNextCheckin > now - 10 && taginfo->expectedNextCheckin < now + 30 && taginfo->pendingIdle == 0 && taginfo->pendingCount == 0 && !isAp) {
|
||||
int32_t minutesUntilNextUpdate = (taginfo->nextupdate - now) / 60;
|
||||
if (minutesUntilNextUpdate > config.maxsleep) {
|
||||
minutesUntilNextUpdate = config.maxsleep;
|
||||
@@ -82,6 +87,7 @@ void contentRunner() {
|
||||
}
|
||||
if (minutesUntilNextUpdate > 1 && (wsClientCount() == 0 || config.stopsleep == 0)) {
|
||||
taginfo->pendingIdle = minutesUntilNextUpdate * 60;
|
||||
taginfo->expectedNextCheckin = now + taginfo->pendingIdle;
|
||||
if (taginfo->isExternal == false) {
|
||||
prepareIdleReq(taginfo->mac, minutesUntilNextUpdate);
|
||||
}
|
||||
|
||||
@@ -365,9 +365,23 @@ uint8_t *g5Compress(uint16_t width, uint16_t height, uint8_t *buffer, uint16_t b
|
||||
}
|
||||
#endif
|
||||
|
||||
void doTimestamp(TFT_eSprite *spr) {
|
||||
time_t now = time(nullptr);
|
||||
struct tm *timeinfo = localtime(&now);
|
||||
char buffer[20];
|
||||
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M", timeinfo);
|
||||
|
||||
// spr->drawRect(spr->width() - 16 * 6 - 4, spr->height() - 10 - 2, 16 * 6 + 3, 11, TFT_BLACK);
|
||||
spr->drawRect(spr->width() - 16 * 6 - 3, spr->height() - 10 - 1, 16 * 6 + 1, 9, TFT_WHITE);
|
||||
spr->setTextColor(TFT_BLACK, TFT_WHITE);
|
||||
spr->setCursor(spr->width() - 16 * 6 - 2, spr->height() - 10, 1);
|
||||
spr->print(buffer);
|
||||
}
|
||||
|
||||
void spr2buffer(TFT_eSprite &spr, String &fileout, imgParam &imageParams) {
|
||||
long t = millis();
|
||||
|
||||
if (config.showtimestamp) doTimestamp(&spr);
|
||||
#ifdef HAS_TFT
|
||||
extern uint8_t YellowSense;
|
||||
if (fileout == "direct") {
|
||||
|
||||
@@ -507,9 +507,9 @@ void processXferTimeout(struct espXferComplete* xfc, bool local) {
|
||||
if (taginfo != nullptr) {
|
||||
taginfo->pendingIdle = 60;
|
||||
clearPending(taginfo);
|
||||
while (dequeueItem(xfc->src)) {
|
||||
};
|
||||
}
|
||||
while (dequeueItem(xfc->src)) {
|
||||
};
|
||||
|
||||
checkQueue(xfc->src);
|
||||
|
||||
@@ -560,15 +560,14 @@ void processDataReq(struct espAvailDataReq* eadr, bool local, IPAddress remoteIP
|
||||
taginfo->apIp = IPAddress(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (taginfo->pendingIdle == 0) {
|
||||
taginfo->expectedNextCheckin = now + 60;
|
||||
if (taginfo->pendingIdle == 0 || countQueueItem(eadr->src) > 0) {
|
||||
if (taginfo->expectedNextCheckin < now + 60) taginfo->expectedNextCheckin = now + 60;
|
||||
} else if (taginfo->pendingIdle == 9999) {
|
||||
taginfo->expectedNextCheckin = 3216153600;
|
||||
taginfo->pendingIdle = 0;
|
||||
} else {
|
||||
taginfo->expectedNextCheckin = now + taginfo->pendingIdle;
|
||||
taginfo->pendingIdle = 0;
|
||||
}
|
||||
taginfo->pendingIdle = 0;
|
||||
taginfo->lastseen = now;
|
||||
|
||||
if (eadr->adr.lastPacketRSSI != 0) {
|
||||
@@ -607,6 +606,7 @@ void processDataReq(struct espAvailDataReq* eadr, bool local, IPAddress remoteIP
|
||||
if (local) {
|
||||
sprintf(buffer, "<ADR %02X%02X%02X%02X%02X%02X%02X%02X\r\n\0", eadr->src[7], eadr->src[6], eadr->src[5], eadr->src[4], eadr->src[3], eadr->src[2], eadr->src[1], eadr->src[0]);
|
||||
Serial.print(buffer);
|
||||
checkQueue(eadr->src); // experiemental 3/26/25: redundant check
|
||||
}
|
||||
|
||||
if (local) {
|
||||
|
||||
@@ -211,7 +211,7 @@ bool loadDB(const String& filename) {
|
||||
taginfo->nextupdate = (uint32_t)tag["nextupdate"];
|
||||
taginfo->expectedNextCheckin = (uint32_t)tag["nextcheckin"];
|
||||
if (taginfo->expectedNextCheckin < now) {
|
||||
taginfo->expectedNextCheckin = now + 1800;
|
||||
taginfo->expectedNextCheckin = now + 60;
|
||||
}
|
||||
taginfo->pendingCount = 0;
|
||||
taginfo->alias = tag["alias"].as<String>();
|
||||
@@ -280,11 +280,11 @@ uint32_t getTagCount(uint32_t& timeoutcount, uint32_t& lowbattcount) {
|
||||
if (!taginfo->isExternal) tagcount++;
|
||||
const int32_t timeout = now - taginfo->lastseen;
|
||||
if (taginfo->expectedNextCheckin < 3600) {
|
||||
// not initialised, timeout if not seen last 10 minutes
|
||||
if (timeout > 600) timeoutcount++;
|
||||
} else if (now - taginfo->expectedNextCheckin > 600) {
|
||||
// expected checkin is behind, timeout if not seen last 10 minutes
|
||||
if (timeout > 600) timeoutcount++;
|
||||
// not initialised, timeout if not seen last 5 minutes
|
||||
if (timeout > config.maxsleep * 60 + 300) timeoutcount++;
|
||||
} else if (now - static_cast<time_t>(taginfo->expectedNextCheckin) > 600) {
|
||||
// expected checkin is behind, timeout if not seen last 5 minutes
|
||||
if (timeout > config.maxsleep * 60 + 300) timeoutcount++;
|
||||
}
|
||||
if (taginfo->batteryMv < 2400 && taginfo->batteryMv != 0 && taginfo->batteryMv != 1337) lowbattcount++;
|
||||
}
|
||||
@@ -335,8 +335,9 @@ void initAPconfig() {
|
||||
config.sleepTime2 = APconfig["sleeptime2"].is<uint8_t>() ? APconfig["sleeptime2"] : 0;
|
||||
config.ble = APconfig["ble"].is<uint8_t>() ? APconfig["ble"] : 0;
|
||||
config.discovery = APconfig["discovery"].is<uint8_t>() ? APconfig["discovery"] : 0;
|
||||
config.showtimestamp = APconfig["showtimestamp"].is<uint8_t>() ? APconfig["showtimestamp"] : 0;
|
||||
#ifdef BLE_ONLY
|
||||
config.ble = true;
|
||||
config.ble = true;
|
||||
#endif
|
||||
// default wifi power 8.5 dbM
|
||||
// see https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/src/WiFiGeneric.h#L111
|
||||
@@ -373,6 +374,7 @@ void saveAPconfig() {
|
||||
APconfig["repo"] = config.repo;
|
||||
APconfig["env"] = config.env;
|
||||
APconfig["discovery"] = config.discovery;
|
||||
APconfig["showtimestamp"] = config.showtimestamp;
|
||||
serializeJsonPretty(APconfig, configFile);
|
||||
configFile.close();
|
||||
xSemaphoreGive(fsMutex);
|
||||
|
||||
@@ -634,6 +634,9 @@ void init_web() {
|
||||
if (request->hasParam("discovery", true)) {
|
||||
config.discovery = static_cast<uint8_t>(request->getParam("discovery", true)->value().toInt());
|
||||
}
|
||||
if (request->hasParam("showtimestamp", true)) {
|
||||
config.showtimestamp = static_cast<uint8_t>(request->getParam("showtimestamp", true)->value().toInt());
|
||||
}
|
||||
if (request->hasParam("repo", true)) {
|
||||
config.repo = request->getParam("repo", true)->value();
|
||||
}
|
||||
|
||||
@@ -290,24 +290,24 @@ options:
|
||||
<option value="27">27</option>
|
||||
</select>
|
||||
</p>
|
||||
<p title="Enable SubGhz support and select channel. This requires an AP that has an optional CC1101 SubGhz radio module attached.">
|
||||
<label for="apcfgsubgigchid">SubGhz channel</label>
|
||||
<select id="apcfgsubgigchid">
|
||||
<option value="0" selected>disabled</option>
|
||||
<option value="100">100 - 864.000 Mhz (Europe, etc)</option>
|
||||
<option value="101">101 - 865.006 Mhz (Europe, etc)</option>
|
||||
<option value="102">102 - 866.014 Mhz (Europe, etc)</option>
|
||||
<option value="103">103 - 867.020 Mhz (Europe, etc)</option>
|
||||
<option value="104">104 - 868.027 Mhz (Europe, etc)</option>
|
||||
<option value="105">105 - 869.034 Mhz (Europe, etc)</option>
|
||||
<option value="200">200 - 903.000 Mhz (US, etc)</option>
|
||||
<option value="201">201 - 907.027 Mhz (US, etc)</option>
|
||||
<option value="202">202 - 911.054 Mhz (US, etc)</option>
|
||||
<option value="203">203 - 915.083 Mhz (US, etc)</option>
|
||||
<option value="204">204 - 919.110 Mhz (US, etc)</option>
|
||||
<option value="205">205 - 923.138 Mhz (US, etc)</option>
|
||||
</select>
|
||||
</p>
|
||||
<p title="Enable SubGhz support and select channel. This requires an AP that has an optional CC1101 SubGhz radio module attached.">
|
||||
<label for="apcfgsubgigchid">SubGhz channel</label>
|
||||
<select id="apcfgsubgigchid">
|
||||
<option value="0" selected>disabled</option>
|
||||
<option value="100">100 - 864.000 Mhz (Europe, etc)</option>
|
||||
<option value="101">101 - 865.006 Mhz (Europe, etc)</option>
|
||||
<option value="102">102 - 866.014 Mhz (Europe, etc)</option>
|
||||
<option value="103">103 - 867.020 Mhz (Europe, etc)</option>
|
||||
<option value="104">104 - 868.027 Mhz (Europe, etc)</option>
|
||||
<option value="105">105 - 869.034 Mhz (Europe, etc)</option>
|
||||
<option value="200">200 - 903.000 Mhz (US, etc)</option>
|
||||
<option value="201">201 - 907.027 Mhz (US, etc)</option>
|
||||
<option value="202">202 - 911.054 Mhz (US, etc)</option>
|
||||
<option value="203">203 - 915.083 Mhz (US, etc)</option>
|
||||
<option value="204">204 - 919.110 Mhz (US, etc)</option>
|
||||
<option value="205">205 - 923.138 Mhz (US, etc)</option>
|
||||
</select>
|
||||
</p>
|
||||
<p title="Enable Bluetooth (BLE) support. Only enable this if you have BLE capable tags. Changing this value requires a reboot to take effect.">
|
||||
<label for="apcfgble">Bluetooth</label>
|
||||
<select id="apcfgble">
|
||||
@@ -479,6 +479,13 @@ options:
|
||||
<option value="1">Broadcast</option>
|
||||
</select>
|
||||
</p>
|
||||
<p title="Show a timestamp on the screen when the tag is updated">
|
||||
<label for="apcshowtimestamp">Enable timestamp</label>
|
||||
<select id="apcshowtimestamp">
|
||||
<option value="0" selected>no</option>
|
||||
<option value="1">yes</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<input type="button" value="Save" id="apcfgsave"><span id="apcfgmsg"></span>
|
||||
</p>
|
||||
|
||||
@@ -375,7 +375,7 @@ function processTags(tagArray) {
|
||||
if (element.nextcheckin > 1672531200) {
|
||||
div.dataset.nextcheckin = element.nextcheckin;
|
||||
} else {
|
||||
div.dataset.nextcheckin = element.lastseen + 1800;
|
||||
div.dataset.nextcheckin = element.lastseen + 60;
|
||||
}
|
||||
|
||||
div.style.opacity = '1';
|
||||
@@ -461,7 +461,7 @@ function updatecards() {
|
||||
if (item.dataset.lastseen && item.dataset.lastseen > (Date.now() / 1000) - servertimediff - 30 * 24 * 3600 * 60) {
|
||||
let idletime = (Date.now() / 1000) - servertimediff - item.dataset.lastseen;
|
||||
$('#tag' + tagmac + ' .lastseen').innerHTML = "<span>last seen</span>" + displayTime(Math.floor(idletime)) + " ago";
|
||||
if ((Date.now() / 1000) - servertimediff - 600 > item.dataset.nextcheckin) {
|
||||
if ((Date.now() / 1000) - servertimediff - apConfig.maxsleep * 60 - 300 > item.dataset.nextcheckin) {
|
||||
$('#tag' + tagmac + ' .warningicon').style.display = 'inline-block';
|
||||
$('#tag' + tagmac).classList.remove("tagpending")
|
||||
$('#tag' + tagmac).style.background = '#e0e0a0';
|
||||
@@ -793,6 +793,7 @@ document.addEventListener("loadTab", function (event) {
|
||||
$("#apcnight1").value = data.sleeptime1;
|
||||
$("#apcnight2").value = data.sleeptime2;
|
||||
$("#apcdiscovery").value = data.discovery;
|
||||
$("#apcshowtimestamp").value = data.showtimestamp;
|
||||
}
|
||||
})
|
||||
$('#apcfgmsg').innerHTML = '';
|
||||
@@ -830,7 +831,8 @@ $('#apcfgsave').onclick = function () {
|
||||
formData.append('timezone', $('#apctimezone').value);
|
||||
formData.append('sleeptime1', $('#apcnight1').value);
|
||||
formData.append('sleeptime2', $('#apcnight2').value);
|
||||
formData.append('discovery', $('#apcdiscovery').value)
|
||||
formData.append('discovery', $('#apcdiscovery').value);
|
||||
formData.append('showtimestamp', $('#apcshowtimestamp').value);
|
||||
fetch("save_apcfg", {
|
||||
method: "POST",
|
||||
body: formData
|
||||
@@ -1788,14 +1790,24 @@ function populateAPInfo(apip) {
|
||||
})
|
||||
.then(data => {
|
||||
if (data.env) {
|
||||
let gModuleType = "";
|
||||
if (data.hasC6 == 1) {
|
||||
gModuleType = "esp32-C6";
|
||||
}
|
||||
if (data.hasH2 == 1) {
|
||||
gModuleType = "esp32-H2";
|
||||
}
|
||||
if (data.hasTslr == 1) {
|
||||
gModuleType = "TSLR";
|
||||
}
|
||||
let version = '';
|
||||
version += `env: ${data.env}<br>`;
|
||||
version += `build date: ${formatEpoch(data.buildtime)}<br>`;
|
||||
version += `esp32 version: ${data.buildversion}<br>`;
|
||||
version += `psram size: ${data.psramsize}<br>`;
|
||||
version += `flash size: ${data.flashsize}<br>`;
|
||||
if (data.hasC6) {
|
||||
version += `ESP-C6/H2 version: 0x${parseInt(data.C6version).toString(16).toUpperCase()}<br>`;
|
||||
if (gModuleType) {
|
||||
version += `${gModuleType} version: 0x${parseInt(data.ap_version).toString(16).toUpperCase()}<br>`;
|
||||
}
|
||||
$('#ap' + apid + ' .apswversion').innerHTML = version;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user