This commit is contained in:
Nic Limper
2023-03-23 23:40:16 +01:00
6 changed files with 6 additions and 95 deletions

Binary file not shown.

Binary file not shown.

5
esp32_fw/.gitignore vendored
View File

@@ -1,5 +0,0 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

View File

@@ -1,31 +0,0 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:lolin32_lite]
platform = espressif32
board = esp32dev
framework = arduino
board_build.partitions = no_ota.csv
platform_packages =
monitor_filters = esp32_exception_decoder
monitor_speed = 115200
board_build.f_cpu = 240000000L
board_build.filesystem = littlefs
lib_deps =
https://github.com/me-no-dev/ESPAsyncWebServer
https://github.com/tzapu/WiFiManager.git#feature_asyncwebserver
bblanchon/ArduinoJson
bodmer/TFT_eSPI
https://github.com/Bodmer/TJpg_Decoder.git
https://github.com/garretlab/shoddyxml2
https://github.com/Bodmer/U8g2_for_TFT_eSPI
https://github.com/ricmoo/qrcode
upload_port = COM12
monitor_port = COM12

View File

@@ -1,55 +0,0 @@
#include <Arduino.h>
#include <WiFi.h>
#include <WiFiManager.h>
#include <time.h>
#include "contentmanager.h"
#include "flasher.h"
#include "makeimage.h"
#include "pendingdata.h"
#include "serial.h"
#include "settings.h"
#include "soc/rtc_wdt.h"
#include "tag_db.h"
#include "web.h"
void timeTask(void* parameter) {
while (1) {
time_t now;
time(&now);
tm tm;
if (!getLocalTime(&tm)) {
Serial.println("Waiting for valid time from NTP-server");
} else {
if (now % 10 == 0) wsSendSysteminfo();
if (now % 30 == 3) Ping();
if (now % 300 == 6) saveDB("/current/tagDB.json");
contentRunner();
}
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
void setup() {
Serial.begin(115200);
Serial.print(">\n");
pinMode(ONBOARD_LED, OUTPUT);
digitalWrite(ONBOARD_LED, HIGH);
configTzTime("CET-1CEST,M3.5.0,M10.5.0/3", "0.nl.pool.ntp.org", "europe.pool.ntp.org", "time.nist.gov");
// https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv
init_web();
loadDB("/current/tagDB.json");
xTaskCreate(zbsRxTask, "zbsRX Process", 10000, NULL, 2, NULL);
xTaskCreate(garbageCollection, "pending-data cleanup", 5000, NULL, 1, NULL);
xTaskCreate(webSocketSendProcess, "ws", 5000, NULL,configMAX_PRIORITIES-10, NULL);
xTaskCreate(timeTask, "timed tasks", 10000, NULL, 2, NULL);
}
void loop() {
vTaskDelay(30000 / portTICK_PERIOD_MS);
}

View File

@@ -26,9 +26,9 @@ CMD_SAVE_MAC_FROM_FW = 40
CMD_PASS_THROUGH = 50
def print_arg_manual():
print("For use with the OpenEpaperLink PCB - Will use external flasher-header by default, or add 'internalap' to access the Internal AP header")
print("For use with the OpenEpaperLink PCB - Will use external flasher-header by default, or add 'internalap'/'altradio' to access the Internal AP header/altradio header")
print("\n")
print("Manual: COM1 [read][readI][write][writeI] file.bin [internalap][slow_spi] baudrate(default 115200) pass at the end for UART Pass Through mode")
print("Manual: COM1 [read][readI][write][writeI] file.bin [internalap/altradio][slow_spi] baudrate(default 115200) pass at the end for UART Pass Through mode")
print("Example: COM1 read file.bin slow_spi 115200 <- will read flash to file.bin with slow SPI and 115200 baud")
print("Example: COM1 write file.bin <- will write file.bin to flash with fast SPI and default 115200 baud")
print("Example: COM1 write file.bin internalap <- will write file.bin to the internal AP on the OpenEpaperLink PCB")
@@ -48,7 +48,7 @@ custom_mac = "ffffffffffffffff"
file = ""
usedCom = sys.argv[1] # "COM5"
read_or_write = sys.argv[2]
usedBaud = 1000000
usedBaud = 115200
mac_folder = "mac_backups/"
if(sys.argv[2].lower() == "mac".lower()):
@@ -83,6 +83,8 @@ if len(sys.argv) >= 5:
after_work_pass_through = 1
elif sys.argv[4].lower() == "internalap".lower():
use_internal_ap = 2
elif sys.argv[4].lower() == "altradio".lower():
use_internal_ap = 4
if len(sys.argv) >= 6:
usedBaud = int(sys.argv[5])
print("Using custom baudrate: " + str(usedBaud))
@@ -193,7 +195,7 @@ def zbs_init():
global use_internal_ap
retry = 3
while(retry):
send_cmd(CMD_ZBS_BEGIN, bytearray([(spi_speed&1)|use_internal_ap&2]))
send_cmd(CMD_ZBS_BEGIN, bytearray([(spi_speed&1)|use_internal_ap&6]))
answer_array = uart_receive_handler()
#print(' '.join(format(x, '02x') for x in answer_array))
if answer_array[0] == 0 and answer_array[2] == 1: