mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 06:06:23 +01:00
various small fixes
- neopixel patterns optimized. The 'breathing' led state now is green colored if everything is okay, and blue if there are one or more tags timed out. - time zone is now set before wifi connect to show correct time zone in the logs during startup - concurrent image upload POST is now blocked. If an upload is in progress while you do a second http POST, http status 409 Conflict is returned. - small synchronisation bug fix in web interface on loading tag type - dialog window close bugfix in painter - image upload is now logged in /log.txt
This commit is contained in:
@@ -29,6 +29,7 @@ void updateBrightnessFromConfig();
|
||||
|
||||
#ifdef HAS_RGB_LED
|
||||
extern CRGB rgbIdleColor;
|
||||
extern uint16_t rgbIdlePeriod;
|
||||
void shortBlink(CRGB cname);
|
||||
void showColorPattern(CRGB colorone, CRGB colortwo, CRGB colorthree);
|
||||
void rgbIdle();
|
||||
|
||||
@@ -15,6 +15,7 @@ int maxledbrightness = 255;
|
||||
#ifdef HAS_RGB_LED
|
||||
QueueHandle_t rgbLedQueue;
|
||||
CRGB rgbIdleColor = CRGB::Green;
|
||||
uint16_t rgbIdlePeriod = 511;
|
||||
|
||||
struct ledInstructionRGB {
|
||||
CRGB ledColor;
|
||||
@@ -122,8 +123,6 @@ void showRGB() {
|
||||
FastLED.show();
|
||||
}
|
||||
|
||||
volatile uint16_t rgbIdlePeriod = 767;
|
||||
|
||||
void rgbIdleStep() {
|
||||
static bool dirUp = true;
|
||||
static uint16_t step = 0;
|
||||
@@ -131,7 +130,7 @@ void rgbIdleStep() {
|
||||
if (dirUp) {
|
||||
// up
|
||||
step++;
|
||||
if (step == rgbIdlePeriod) {
|
||||
if (step >= rgbIdlePeriod) {
|
||||
dirUp = false;
|
||||
}
|
||||
} else {
|
||||
@@ -226,9 +225,6 @@ void ledTask(void* parameter) {
|
||||
addFadeColor(CRGB::Red);
|
||||
addFadeColor(CRGB::Green);
|
||||
addFadeColor(CRGB::Blue);
|
||||
addFadeColor(CRGB::Red);
|
||||
addFadeColor(CRGB::Green);
|
||||
addFadeColor(CRGB::Blue);
|
||||
CRGB oldColor = CRGB::Black;
|
||||
uint16_t rgbInstructionFadeTime = 0;
|
||||
#endif
|
||||
|
||||
@@ -53,11 +53,6 @@ void setup() {
|
||||
xTaskCreate(ledTask, "ledhandler", 2000, NULL, 2, NULL);
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
|
||||
#ifdef HAS_RGB_LED
|
||||
// show a nice pattern to indicate the AP is booting / waiting for WiFi setup
|
||||
showColorPattern(CRGB::Aqua, CRGB::Green, CRGB::Blue);
|
||||
#endif
|
||||
|
||||
#if defined(OPENEPAPERLINK_MINI_AP_PCB) || defined(OPENEPAPERLINK_NANO_AP_PCB)
|
||||
APEnterEarlyReset();
|
||||
// this allows us to view the booting process. After the device showing up, you have 3 seconds to open a terminal on the COM port
|
||||
@@ -119,6 +114,7 @@ void setup() {
|
||||
|
||||
initAPconfig();
|
||||
|
||||
xTaskCreate(initTime, "init time", 5000, NULL, 2, NULL);
|
||||
updateLanguageFromConfig();
|
||||
updateBrightnessFromConfig();
|
||||
|
||||
@@ -140,7 +136,6 @@ void setup() {
|
||||
config.runStatus = RUNSTATUS_PAUSE;
|
||||
}
|
||||
|
||||
xTaskCreate(initTime, "init time", 5000, NULL, 2, NULL);
|
||||
xTaskCreate(delayedStart, "delaystart", 2000, NULL, 2, NULL);
|
||||
|
||||
wsSendSysteminfo();
|
||||
|
||||
@@ -151,6 +151,7 @@ void setAPstate(bool isOnline, uint8_t state) {
|
||||
CRGB::YellowGreen
|
||||
};
|
||||
rgbIdleColor = colorMap[state];
|
||||
rgbIdlePeriod = (isOnline ? 767 : 255);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "serialap.h"
|
||||
#include "settings.h"
|
||||
#include "storage.h"
|
||||
#include "system.h"
|
||||
#include "tag_db.h"
|
||||
#include "udp.h"
|
||||
#include "wifimanager.h"
|
||||
@@ -101,8 +102,10 @@ void wsSendSysteminfo() {
|
||||
uint32_t tagcount = getTagCount(timeoutcount);
|
||||
char result[40];
|
||||
if (timeoutcount > 0) {
|
||||
if (apInfo.state == AP_STATE_ONLINE && apInfo.isOnline == true) rgbIdleColor = CRGB::DarkBlue;
|
||||
snprintf(result, sizeof(result), "%lu / %lu, %lu timed out", tagcount, tagDB.size(), timeoutcount);
|
||||
} else {
|
||||
if (apInfo.state == AP_STATE_ONLINE && apInfo.isOnline == true) rgbIdleColor = CRGB::Green;
|
||||
snprintf(result, sizeof(result), "%lu / %lu", tagcount, tagDB.size());
|
||||
}
|
||||
setVarDB("ap_tagcount", result);
|
||||
@@ -185,9 +188,8 @@ uint8_t wsClientCount() {
|
||||
|
||||
void init_web() {
|
||||
wsMutex = xSemaphoreCreateMutex();
|
||||
Storage.begin();
|
||||
WiFi.mode(WIFI_STA);
|
||||
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.setTxPower(static_cast<wifi_power_t>(config.wifiPower));
|
||||
|
||||
wm.connectToWifi();
|
||||
@@ -623,16 +625,19 @@ void init_web() {
|
||||
}
|
||||
|
||||
void doImageUpload(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) {
|
||||
if (config.runStatus != RUNSTATUS_RUN) {
|
||||
request->send(409, "text/plain", "come back later");
|
||||
return;
|
||||
}
|
||||
static bool imageUploadBusy = false;
|
||||
if (!index) {
|
||||
if (config.runStatus != RUNSTATUS_RUN || imageUploadBusy) {
|
||||
request->send(409, "text/plain", "Come back later");
|
||||
return;
|
||||
}
|
||||
if (request->hasParam("mac", true)) {
|
||||
filename = request->getParam("mac", true)->value() + ".jpg";
|
||||
} else {
|
||||
filename = "unknown.jpg";
|
||||
}
|
||||
imageUploadBusy = true;
|
||||
logLine("http imageUpload " + filename);
|
||||
xSemaphoreTake(fsMutex, portMAX_DELAY);
|
||||
request->_tempFile = contentFS->open("/" + filename, "w");
|
||||
}
|
||||
@@ -668,6 +673,7 @@ void doImageUpload(AsyncWebServerRequest *request, String filename, size_t index
|
||||
} else {
|
||||
request->send(400, "text/plain", "parameters incomplete");
|
||||
}
|
||||
imageUploadBusy = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,6 @@ function processTags(tagArray) {
|
||||
if (!alias) alias = tagmac.replace(/^0{1,4}/, '');
|
||||
if ($('#tag' + tagmac + ' .alias').innerHTML != alias) {
|
||||
$('#tag' + tagmac + ' .alias').innerHTML = alias;
|
||||
//GroupSortFilter();
|
||||
}
|
||||
|
||||
let contentDefObj = getContentDefById(element.contentMode);
|
||||
@@ -1023,10 +1022,18 @@ $('#activefilter').addEventListener('click', (event) => {
|
||||
});
|
||||
|
||||
async function getTagtype(hwtype) {
|
||||
if (tagTypes[hwtype]) {
|
||||
if (tagTypes[hwtype] && tagTypes[hwtype].busy == false) {
|
||||
return tagTypes[hwtype];
|
||||
}
|
||||
|
||||
// nice, but no possibility to invalidate this cache yet.
|
||||
/*
|
||||
const storedData = JSON.parse(localStorage.getItem("tagTypes"));
|
||||
if (storedData && storedData[hwtype]) {
|
||||
return storedData[hwtype];
|
||||
}
|
||||
*/
|
||||
|
||||
if (getTagtypeBusy) {
|
||||
await new Promise(resolve => {
|
||||
const checkBusy = setInterval(() => {
|
||||
@@ -1045,7 +1052,7 @@ async function getTagtype(hwtype) {
|
||||
clearInterval(checkBusy);
|
||||
resolve();
|
||||
}
|
||||
}, 10);
|
||||
}, 50);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1054,8 +1061,8 @@ async function getTagtype(hwtype) {
|
||||
}
|
||||
|
||||
try {
|
||||
tagTypes[hwtype] = { busy: true };
|
||||
getTagtypeBusy = true;
|
||||
tagTypes[hwtype] = { busy: true };
|
||||
const response = await fetch('/tagtypes/' + hwtype.toString(16).padStart(2, '0').toUpperCase() + '.json');
|
||||
if (!response.ok) {
|
||||
let data = { name: 'unknown id ' + hwtype, width: 0, height: 0, bpp: 0, rotatebuffer: 0, colortable: [], busy: false };
|
||||
|
||||
@@ -104,7 +104,7 @@ function startPainter(mac, width, height) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '/imgupload');
|
||||
xhr.send(formData);
|
||||
$('#configbox').style.display = 'none';
|
||||
$('#configbox').close();
|
||||
});
|
||||
|
||||
$("#buttonbar").appendChild(blackButton);
|
||||
|
||||
Reference in New Issue
Block a user