Merge most stable version with new features

This commit is contained in:
Djuri Baars 2023-11-04 21:51:24 +01:00
parent aa6c09e9aa
commit ac306cb473
4 changed files with 93 additions and 14 deletions

View file

@ -35,16 +35,16 @@ jobs:
run: pip install --upgrade platformio
- name: Build BTClock firmware
run: pio run -e esp32wemos-s3-mini_BW
run: pio run -e default
- name: Build BTClock filesystem
run: pio run -e esp32wemos-s3-mini_BW --target buildfs
run: pio run -e default --target buildfs
- name: Install esptools.py
run: pip install --upgrade esptool
- name: Create merged firmware binary
run: mkdir -p output && esptool.py --chip esp32s3 merge_bin -o output/full-firmware.bin --flash_mode dio 0x0000 .pio/build/esp32wemos-s3-mini_BW/bootloader.bin 0x8000 .pio/build/esp32wemos-s3-mini_BW/partitions.bin 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/esp32wemos-s3-mini_BW/firmware.bin 0x330000 .pio/build/esp32wemos-s3-mini_BW/spiffs.bin
run: mkdir -p output && esptool.py --chip esp32s3 merge_bin -o output/full-firmware.bin --flash_mode dio 0x0000 .pio/build/default/bootloader.bin 0x8000 .pio/build/default/partitions.bin 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/default/firmware.bin 0x330000 .pio/build/default/spiffs.bin
- name: Create checksum for merged binary
run: shasum -a 256 output/full-firmware.bin | awk '{print $1}' > output/full-firmware.sha256
@ -59,14 +59,14 @@ jobs:
uses: actions/upload-artifact@v3
with:
path: |
.pio/build/esp32wemos-s3-mini_BW/*.bin
.pio/build/default/*.bin
output/full-firmware.bin
output/full-firmware.sha256
- name: Create release
uses: ncipollo/release-action@v1
with:
name: release-${{ steps.dateAndTime.outputs.dateAndTime }}
artifacts: "output/full-firmware.bin,output/full-firmware.sha256,.pio/build/esp32wemos-s3-mini_BW/*.bin"
artifacts: "output/full-firmware.bin,output/full-firmware.sha256,.pio/build/default/*.bin"
allowUpdates: true
removeArtifacts: true
- name: Pushes full-firmware.bin to web flasher

View file

@ -19,21 +19,19 @@ upload_speed = 921600
monitor_filters = esp32_exception_decoder, colorize
extra_scripts = post:scripts/extra_script.py
build_flags = !python scripts/git_rev.py
lib_deps =
bblanchon/ArduinoJson@^6.21.2
fbiego/ESP32Time@^2.0.1
https://github.com/dsbaars/GxEPD2#universal_pin
https://github.com/dsbaars/universal_pin
adafruit/Adafruit MCP23017 Arduino Library@^2.3.0
adafruit/Adafruit NeoPixel@^1.11.0
https://github.com/me-no-dev/ESPAsyncWebServer.git
https://github.com/tzapu/WiFiManager.git#v2.0.16-rc.2
[esp32wemos-s3-mini_BW_base]
platform = espressif32
framework = arduino
board = lolin_s3_mini
board_build.partitions = partition.csv
lib_deps =
bblanchon/ArduinoJson@^6.21.2
fbiego/ESP32Time@^2.0.1
adafruit/Adafruit MCP23017 Arduino Library@^2.3.0
adafruit/Adafruit NeoPixel@^1.11.0
https://github.com/me-no-dev/ESPAsyncWebServer.git
https://github.com/tzapu/WiFiManager.git#v2.0.16-rc.2
build_flags =
!python scripts/git_rev.py
-DLAST_BUILD_TIME=$UNIX_TIME
@ -51,14 +49,30 @@ build_flags =
-DPIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS
build_unflags = -fno-exceptions
zinggjm/GxEPD2@^1.5.2
[env:esp32wemos-s3-mini_BW]
extends = esp32wemos-s3-mini_BW_base
build_flags =
${esp32wemos-s3-mini_BW_base.build_flags}
https://github.com/dsbaars/GxEPD2#universal_pin
https://github.com/dsbaars/universal_pin
-DUSE_UNIVERSAL_PIN
-D NUM_SCREENS=7
lib_deps =
${esp32wemos-s3-mini_BW_base.lib_deps}
[env:esp32wemos-s3-mini_BW_9disp]
extends = esp32wemos-s3-mini_BW_base
build_flags =
${esp32wemos-s3-mini_BW_base.build_flags}
-D NUM_SCREENS=9
[env:default]
extends = esp32wemos-s3-mini_BW_base
build_flags =
${esp32wemos-s3-mini_BW_base.build_flags}
-D NUM_SCREENS=7
lib_deps =
${esp32wemos-s3-mini_BW_base.lib_deps}
zinggjm/GxEPD2@^1.5.2

View file

@ -1,6 +1,7 @@
#include "epd.hpp"
#ifdef IS_S3
#ifdef USE_UNIVERSAL_PIN
Native_Pin EPD_CS[NUM_SCREENS] = {
Native_Pin(2),
Native_Pin(4),
@ -66,7 +67,25 @@ GxEPD2_BW<GxEPD2_213_B74, GxEPD2_213_B74::HEIGHT> displays[NUM_SCREENS] = {
GxEPD2_213_B74(&EPD9_CS, &EPD_DC, &EPD_RESET_MPD[8], &EPD9_BUSY),
#endif
};
#else
// Non Universal Pin
const char EPD_CS[NUM_SCREENS] = {2, 4, 6, 10, 33, 21, 17};
const char EPD_BUSY[NUM_SCREENS] = {3, 5, 7, 9, 37, 18, 16};
const char EPD_RESET_MPD[NUM_SCREENS] = {8, 9, 10, 11, 12, 13, 14};
const char EPD_DC = 14;
const char RST_PIN = 15;
GxEPD2_BW<GxEPD2_213_B74, GxEPD2_213_B74::HEIGHT> displays[NUM_SCREENS] = {
GxEPD2_213_B74(EPD_CS[0], EPD_DC, /*RST=*/-1, EPD_BUSY[0]),
GxEPD2_213_B74(EPD_CS[1], EPD_DC, /*RST=*/-1, EPD_BUSY[1]),
GxEPD2_213_B74(EPD_CS[2], EPD_DC, /*RST=*/-1, EPD_BUSY[2]),
GxEPD2_213_B74(EPD_CS[3], EPD_DC, /*RST=*/-1, EPD_BUSY[3]),
GxEPD2_213_B74(EPD_CS[4], EPD_DC, /*RST=*/-1, EPD_BUSY[4]),
GxEPD2_213_B74(EPD_CS[5], EPD_DC, /*RST=*/-1, EPD_BUSY[5]),
GxEPD2_213_B74(EPD_CS[6], EPD_DC, /*RST=*/-1, EPD_BUSY[6]),
};
#endif
const int SEM_WAIT_TIME = 10000;
#endif
@ -85,9 +104,21 @@ void setupDisplays()
void initDisplays()
{
#ifndef USE_UNIVERSAL_PIN
resetAllDisplays();
#endif
for (uint i = 0; i < NUM_SCREENS; i++)
{
#ifndef USE_UNIVERSAL_PIN
mcp.pinMode(EPD_RESET_MPD[i], OUTPUT);
#endif
displays[i].init();
#ifndef USE_UNIVERSAL_PIN
resetSingleDisplay(i);
#endif
}
for (uint i = 0; i < NUM_SCREENS; i++)
@ -122,6 +153,24 @@ void initDisplays()
vTaskDelay(pdMS_TO_TICKS(displays[0].epd2.full_refresh_time));
}
void resetAllDisplays()
{
for (int i = 0; i < NUM_SCREENS; i++)
{
resetSingleDisplay(i);
}
}
void resetSingleDisplay(int i)
{
mcp.digitalWrite(EPD_RESET_MPD[i], HIGH);
delay(20);
mcp.digitalWrite(EPD_RESET_MPD[i], LOW);
delay(20);
mcp.digitalWrite(EPD_RESET_MPD[i], HIGH);
delay(200);
}
void taskEpd(void *pvParameters)
{
while (1)
@ -254,6 +303,8 @@ void showDigit(const uint dispNum, char chr, bool partial, const GFXfont *font)
void fullRefresh(void *pvParameters)
{
resetAllDisplays();
for (uint i = 0; i < NUM_SCREENS; i++)
{
lastFullRefresh[i] = NULL;
@ -275,6 +326,10 @@ extern "C" void updateDisplay(void *pvParameters) noexcept
if (epdContent[epdIndex].compareTo(currentEpdContent[epdIndex]) != 0)
{
displays[epdIndex].init(0, false, 20); // Little longer reset duration because of MCP
#ifndef USE_UNIVERSAL_PIN
resetSingleDisplay(epdIndex);
#endif
bool updatePartial = true;
// Full Refresh every half hour
@ -295,6 +350,7 @@ extern "C" void updateDisplay(void *pvParameters) noexcept
showDigit(epdIndex, epdContent[epdIndex].c_str()[0], updatePartial, &FONT_BIG);
}
#ifdef USE_UNIVERSAL_PIN
char tries = 0;
while (tries < 3)
{
@ -308,6 +364,11 @@ extern "C" void updateDisplay(void *pvParameters) noexcept
delay(100);
tries++;
}
#else
displays[epdIndex].display(updatePartial);
displays[epdIndex].hibernate();
currentEpdContent[epdIndex] = epdContent[epdIndex];
#endif
#endif
}

View file

@ -15,9 +15,11 @@
#include "screens/countdown.hpp"
#include "screens/custom_text.hpp"
#include "screens/halvingcountdown.hpp"
#ifdef USE_UNIVERSAL_PIN
#include <native_pin.hpp>
#include <mcp23x17_pin.hpp>
#include <universal_pin.hpp>
#endif
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
@ -37,6 +39,8 @@ void taskEpd(void *pvParameters);
std::array<String, NUM_SCREENS> getCurrentEpdContent();
void resetAllDisplays();
void resetSingleDisplay(int i);
void setEpdContent(std::array<String, NUM_SCREENS> newEpdContent);
void splitText(const uint dispNum, String top, String bottom, bool partial);
void showDigit(const uint dispNum, char chr, bool partial, const GFXfont *font);