Detect freezing screens
This commit is contained in:
parent
8c77d5b5d7
commit
8cc99d2437
@ -227,7 +227,7 @@
|
||||
<script id="screens-template" type="text/x-handlebars-template">
|
||||
{{#each screens }}
|
||||
<div class="row">
|
||||
<div class=" col-sm-6">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="screen{{id}}" name="screen[{{id}}]" value="1" {{#if enabled}}checked{{/if}}>
|
||||
<label class="form-check-label" for="screen{{id}}">{{name}}</label>
|
||||
|
@ -47,6 +47,9 @@ build_flags =
|
||||
-D ARDUINO_USB_CDC_ON_BOOT
|
||||
-D HOSTNAME="\"btclock3\""
|
||||
-mfix-esp32-psram-cache-issue
|
||||
-fexceptions
|
||||
-DPIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS
|
||||
build_unflags = -fno-exceptions
|
||||
|
||||
[env:esp32wemos-s3-mini_BW]
|
||||
extends = esp32wemos-s3-mini_BW_base
|
||||
|
@ -2,27 +2,55 @@
|
||||
|
||||
#ifdef IS_S3
|
||||
Native_Pin EPD_CS[NUM_SCREENS] = {
|
||||
Native_Pin(2), Native_Pin(4), Native_Pin(6), Native_Pin(10), Native_Pin(33), Native_Pin(21), Native_Pin(17),
|
||||
#if NUM_SCREENS == 9
|
||||
Native_Pin(2),
|
||||
Native_Pin(4),
|
||||
Native_Pin(6),
|
||||
Native_Pin(10),
|
||||
Native_Pin(33),
|
||||
Native_Pin(21),
|
||||
Native_Pin(17),
|
||||
#if NUM_SCREENS == 9
|
||||
// MCP23X17_Pin(mcp2, 7),
|
||||
Native_Pin(-1),
|
||||
Native_Pin(-1),
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
Native_Pin EPD_BUSY[NUM_SCREENS] = {
|
||||
Native_Pin(3), Native_Pin(5), Native_Pin(7), Native_Pin(9), Native_Pin(37), Native_Pin(18), Native_Pin(16),
|
||||
#if NUM_SCREENS == 9
|
||||
Native_Pin(3),
|
||||
Native_Pin(5),
|
||||
Native_Pin(7),
|
||||
Native_Pin(9),
|
||||
Native_Pin(37),
|
||||
Native_Pin(18),
|
||||
Native_Pin(16),
|
||||
#if NUM_SCREENS == 9
|
||||
// MCP23X17_Pin(mcp2, 6),
|
||||
Native_Pin(-1),
|
||||
Native_Pin(-1),
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
MCP23X17_Pin EPD_RESET_MPD[NUM_SCREENS] = {
|
||||
MCP23X17_Pin(mcp, 8), MCP23X17_Pin(mcp, 9), MCP23X17_Pin(mcp, 10), MCP23X17_Pin(mcp, 11), MCP23X17_Pin(mcp, 12), MCP23X17_Pin(mcp, 13), MCP23X17_Pin(mcp, 14),
|
||||
#if NUM_SCREENS == 9
|
||||
MCP23X17_Pin(mcp, 15),
|
||||
MCP23X17_Pin(mcp, 16)
|
||||
#endif
|
||||
MCP23X17_Pin(mcp, 8),
|
||||
MCP23X17_Pin(mcp, 9),
|
||||
MCP23X17_Pin(mcp, 10),
|
||||
MCP23X17_Pin(mcp, 11),
|
||||
MCP23X17_Pin(mcp, 12),
|
||||
MCP23X17_Pin(mcp, 13),
|
||||
MCP23X17_Pin(mcp, 14),
|
||||
#if NUM_SCREENS == 9
|
||||
MCP23X17_Pin(mcp2, 2),
|
||||
MCP23X17_Pin(mcp2, 5),
|
||||
// MCP23X17_Pin(mcp, 15),
|
||||
// MCP23X17_Pin(mcp, 16)
|
||||
#endif
|
||||
};
|
||||
|
||||
#if NUM_SCREENS == 9
|
||||
MCP23X17_Pin EPD8_BUSY = MCP23X17_Pin(mcp2, 3);
|
||||
MCP23X17_Pin EPD8_CS = MCP23X17_Pin(mcp2, 4);
|
||||
MCP23X17_Pin EPD9_BUSY = MCP23X17_Pin(mcp2, 6);
|
||||
MCP23X17_Pin EPD9_CS = MCP23X17_Pin(mcp2, 7);
|
||||
#endif
|
||||
Native_Pin EPD_DC = Native_Pin(14);
|
||||
|
||||
GxEPD2_BW<GxEPD2_213_B74, GxEPD2_213_B74::HEIGHT> displays[NUM_SCREENS] = {
|
||||
@ -33,10 +61,10 @@ GxEPD2_BW<GxEPD2_213_B74, GxEPD2_213_B74::HEIGHT> displays[NUM_SCREENS] = {
|
||||
GxEPD2_213_B74(&EPD_CS[4], &EPD_DC, &EPD_RESET_MPD[4], &EPD_BUSY[4]),
|
||||
GxEPD2_213_B74(&EPD_CS[5], &EPD_DC, &EPD_RESET_MPD[5], &EPD_BUSY[5]),
|
||||
GxEPD2_213_B74(&EPD_CS[6], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[6]),
|
||||
#if NUM_SCREENS == 9
|
||||
GxEPD2_213_B74(&EPD_CS[7], &EPD_DC, &EPD_RESET_MPD[7], &EPD_BUSY[7]),
|
||||
GxEPD2_213_B74(&EPD_CS[8], &EPD_DC, &EPD_RESET_MPD[8], &EPD_BUSY[8]),
|
||||
#endif
|
||||
#if NUM_SCREENS == 9
|
||||
GxEPD2_213_B74(&EPD8_CS, &EPD_DC, &EPD_RESET_MPD[7], &EPD8_BUSY),
|
||||
GxEPD2_213_B74(&EPD9_CS, &EPD_DC, &EPD_RESET_MPD[8], &EPD9_BUSY),
|
||||
#endif
|
||||
};
|
||||
|
||||
const int SEM_WAIT_TIME = 10000;
|
||||
@ -74,7 +102,19 @@ void initDisplays()
|
||||
xTaskCreate(updateDisplay, "EpdUpd" + char(i), 4096, taskParam, 1, &tasks[i]); // create task
|
||||
// delay(1000);
|
||||
}
|
||||
epdContent = {"B", "T", "C", "L", "O", "C", "K"};
|
||||
epdContent = { "B",
|
||||
"T",
|
||||
"C",
|
||||
"L",
|
||||
"O",
|
||||
"C",
|
||||
"K"
|
||||
#if NUM_SCREENS == 9
|
||||
,
|
||||
"0",
|
||||
"9"
|
||||
#endif
|
||||
};
|
||||
for (uint i = 0; i < NUM_SCREENS; i++)
|
||||
{
|
||||
xTaskNotifyGive(tasks[i]);
|
||||
@ -222,7 +262,7 @@ void fullRefresh(void *pvParameters)
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
void updateDisplay(void *pvParameters)
|
||||
extern "C" void updateDisplay(void *pvParameters) noexcept
|
||||
{
|
||||
const int epdIndex = *(int *)pvParameters;
|
||||
delete (int *)pvParameters;
|
||||
@ -234,8 +274,6 @@ void updateDisplay(void *pvParameters)
|
||||
|
||||
if (epdContent[epdIndex].compareTo(currentEpdContent[epdIndex]) != 0)
|
||||
{
|
||||
currentEpdContent[epdIndex] = epdContent[epdIndex];
|
||||
|
||||
displays[epdIndex].init(0, false, 20); // Little longer reset duration because of MCP
|
||||
bool updatePartial = true;
|
||||
|
||||
@ -257,8 +295,20 @@ void updateDisplay(void *pvParameters)
|
||||
showDigit(epdIndex, epdContent[epdIndex].c_str()[0], updatePartial, &FONT_BIG);
|
||||
}
|
||||
|
||||
displays[epdIndex].display(updatePartial);
|
||||
char tries = 0;
|
||||
while (tries < 3)
|
||||
{
|
||||
if (displays[epdIndex].displayWithReturn(updatePartial))
|
||||
{
|
||||
displays[epdIndex].hibernate();
|
||||
currentEpdContent[epdIndex] = epdContent[epdIndex];
|
||||
break;
|
||||
}
|
||||
|
||||
delay(100);
|
||||
tries++;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
xSemaphoreGive(epdUpdateSemaphore[epdIndex]);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "screens/halvingcountdown.hpp"
|
||||
#include <native_pin.hpp>
|
||||
#include <mcp23x17_pin.hpp>
|
||||
#include <universal_pin.hpp>
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
@ -42,5 +43,5 @@ void showDigit(const uint dispNum, char chr, bool partial, const GFXfont *font);
|
||||
|
||||
void refreshDisplay(void *pvParameters);
|
||||
void fullRefresh(void *pvParameters);
|
||||
void updateDisplay(void *pvParameters);
|
||||
extern "C" void updateDisplay(void *pvParameters) noexcept;
|
||||
//void genQrCode(String text, uint8_t *qrcode[qrcodegen_BUFFER_LEN_MAX]);
|
||||
|
Loading…
Reference in New Issue
Block a user