Remove manual reset methods

This commit is contained in:
Djuri Baars 2023-10-30 22:52:22 +01:00
parent f18219964e
commit 3a6be5868d
3 changed files with 4 additions and 55 deletions

View File

@ -49,7 +49,6 @@ void setup()
setupComponents(); setupComponents();
setupPreferences(); setupPreferences();
#ifndef NO_DISPLAY #ifndef NO_DISPLAY
resetAllDisplays();
initDisplays(); initDisplays();
#endif #endif
setupWifi(); setupWifi();

View File

@ -91,56 +91,17 @@ SemaphoreHandle_t epdUpdateSemaphore[NUM_SCREENS];
// int *qrcode = (int *) ps_malloc(qrcodegen_BUFFER_LEN_MAX * sizeof(uint8_t)); // int *qrcode = (int *) ps_malloc(qrcodegen_BUFFER_LEN_MAX * sizeof(uint8_t));
void setupDisplays() void setupDisplays()
{ {
handleScreenTasks(getCurrentScreen()); handleScreenTasks(getCurrentScreen());
xTaskCreate(taskEpd, "epd_task", 2048, NULL, 1, NULL); xTaskCreate(taskEpd, "epd_task", 2048, NULL, 1, NULL);
} }
void resetAllDisplays()
{
#ifdef NO_MCP
digitalWrite(RST_PIN, HIGH);
pinMode(RST_PIN, OUTPUT);
delay(20);
digitalWrite(RST_PIN, LOW);
delay(20);
digitalWrite(RST_PIN, HIGH);
delay(200);
#else
for (int i = 0; i < NUM_SCREENS; i++)
{
resetSingleDisplay(i);
}
#endif
}
void resetSingleDisplay(int i)
{
#ifndef NO_MCP
EPD_RESET_MPD[i].digitalWrite(HIGH);
delay(20);
EPD_RESET_MPD[i].digitalWrite(LOW);
delay(20);
EPD_RESET_MPD[i].digitalWrite(HIGH);
delay(200);
#endif
}
void initDisplays() void initDisplays()
{ {
for (uint i = 0; i < NUM_SCREENS; i++) for (uint i = 0; i < NUM_SCREENS; i++)
{ {
#ifndef NO_MCP
EPD_RESET_MPD[i].pinMode(OUTPUT);
#endif
displays[i].init(); displays[i].init();
#ifndef NO_MCP
resetSingleDisplay(i);
#endif
// displays[i].epd2.init(SW_SCK, SW_MOSI, 115200, true, 20, false);
} }
for (uint i = 0; i < NUM_SCREENS; i++) for (uint i = 0; i < NUM_SCREENS; i++)
@ -200,9 +161,6 @@ void taskEpd(void *pvParameters)
{ {
if (!updatedThisCycle) if (!updatedThisCycle)
{ {
#ifdef NO_MCP
resetAllDisplays();
#endif
updatedThisCycle = true; updatedThisCycle = true;
} }
@ -298,8 +256,6 @@ void showDigit(const uint dispNum, char chr, bool partial, const GFXfont *font)
void fullRefresh(void *pvParameters) void fullRefresh(void *pvParameters)
{ {
resetAllDisplays();
for (uint i = 0; i < NUM_SCREENS; i++) for (uint i = 0; i < NUM_SCREENS; i++)
{ {
lastFullRefresh[i] = NULL; lastFullRefresh[i] = NULL;
@ -321,10 +277,7 @@ void updateDisplay(void *pvParameters)
if (epdContent[epdIndex].compareTo(currentEpdContent[epdIndex]) != 0) if (epdContent[epdIndex].compareTo(currentEpdContent[epdIndex]) != 0)
{ {
currentEpdContent[epdIndex] = epdContent[epdIndex]; currentEpdContent[epdIndex] = epdContent[epdIndex];
#ifndef NO_MCP
displays[epdIndex].init(0, false);
resetSingleDisplay(epdIndex);
#endif
// displays[epdIndex].init(0, false); // displays[epdIndex].init(0, false);
bool updatePartial = true; bool updatePartial = true;
@ -353,4 +306,3 @@ void updateDisplay(void *pvParameters)
xSemaphoreGive(epdUpdateSemaphore[epdIndex]); xSemaphoreGive(epdUpdateSemaphore[epdIndex]);
} }
} }

View File

@ -33,8 +33,6 @@ typedef struct {
void setupDisplays(); void setupDisplays();
void initDisplays(); void initDisplays();
void taskEpd(void *pvParameters); void taskEpd(void *pvParameters);
void resetAllDisplays();
void resetSingleDisplay(int i);
std::array<String, 7> getCurrentEpdContent(); std::array<String, 7> getCurrentEpdContent();