forked from btclock/btclock_v3
Compare commits
5 commits
087dff98a0
...
5b0437a2e9
Author | SHA1 | Date | |
---|---|---|---|
5b0437a2e9 | |||
412e281033 | |||
2625dda8a1 | |||
e97bb7fa06 | |||
4e70df0706 |
14 changed files with 72 additions and 155 deletions
|
@ -1,4 +1,4 @@
|
||||||
name: "BTClock CI"
|
name: 'BTClock CI'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -22,7 +22,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
node-version: lts/*
|
node-version: lts/*
|
||||||
cache: yarn
|
cache: yarn
|
||||||
cache-dependency-path: "**/yarn.lock"
|
cache-dependency-path: '**/yarn.lock'
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
|
@ -34,8 +34,8 @@ jobs:
|
||||||
key: ${{ runner.os }}-pio
|
key: ${{ runner.os }}-pio
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.9"
|
python-version: '3.9'
|
||||||
cache: "pip"
|
cache: 'pip'
|
||||||
- name: Get current date
|
- name: Get current date
|
||||||
id: dateAndTime
|
id: dateAndTime
|
||||||
shell: bash
|
shell: bash
|
||||||
|
@ -81,9 +81,9 @@ jobs:
|
||||||
version: esp32s3
|
version: esp32s3
|
||||||
epd_variant: [213epd, 29epd]
|
epd_variant: [213epd, 29epd]
|
||||||
exclude:
|
exclude:
|
||||||
- chip: { name: btclock_rev_b, version: esp32s3 }
|
- chip: {name: btclock_rev_b, version: esp32s3}
|
||||||
epd_variant: 29epd
|
epd_variant: 29epd
|
||||||
- chip: { name: btclock_v8, version: esp32s3 }
|
- chip: {name: btclock_v8, version: esp32s3}
|
||||||
epd_variant: 29epd
|
epd_variant: 29epd
|
||||||
steps:
|
steps:
|
||||||
- uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
- uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
||||||
|
@ -93,10 +93,9 @@ jobs:
|
||||||
- name: Install esptools.py
|
- name: Install esptools.py
|
||||||
run: pip install --upgrade esptool
|
run: pip install --upgrade esptool
|
||||||
- name: Create merged firmware binary
|
- name: Create merged firmware binary
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ${{ matrix.chip.name }}_${{ matrix.epd_variant }}
|
|
||||||
if [ "${{ matrix.chip.name }}" == "btclock_v8" ]; then
|
if [ "${{ matrix.chip.name }}" == "btclock_v8" ]; then
|
||||||
|
mkdir -p ${{ matrix.chip.name }}_${{ matrix.epd_variant }} && \
|
||||||
esptool.py --chip ${{ matrix.chip.version }} merge_bin \
|
esptool.py --chip ${{ matrix.chip.version }} merge_bin \
|
||||||
-o ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin \
|
-o ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin \
|
||||||
--flash_mode dio \
|
--flash_mode dio \
|
||||||
|
@ -106,19 +105,10 @@ jobs:
|
||||||
0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin \
|
0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin \
|
||||||
0xe000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/ota_data_initial.bin \
|
0xe000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/ota_data_initial.bin \
|
||||||
0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin \
|
0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin \
|
||||||
0xDF0000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs_16MB.bin
|
0x810000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin;
|
||||||
elif [ "${{ matrix.chip.name }}" == "btclock_rev_b" ]; then
|
|
||||||
esptool.py --chip ${{ matrix.chip.version }} merge_bin \
|
|
||||||
-o ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin \
|
|
||||||
--flash_mode dio \
|
|
||||||
--flash_freq 80m \
|
|
||||||
--flash_size 8MB \
|
|
||||||
0x0000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/bootloader.bin \
|
|
||||||
0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin \
|
|
||||||
0xe000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/ota_data_initial.bin \
|
|
||||||
0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin \
|
|
||||||
0x6F0000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs_8MB.bin;
|
|
||||||
else
|
else
|
||||||
|
# Original command for other cases
|
||||||
|
mkdir -p ${{ matrix.chip.name }}_${{ matrix.epd_variant }} && \
|
||||||
esptool.py --chip ${{ matrix.chip.version }} merge_bin \
|
esptool.py --chip ${{ matrix.chip.version }} merge_bin \
|
||||||
-o ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin \
|
-o ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin \
|
||||||
--flash_mode dio \
|
--flash_mode dio \
|
||||||
|
@ -126,23 +116,19 @@ jobs:
|
||||||
0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin \
|
0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin \
|
||||||
0xe000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/ota_data_initial.bin \
|
0xe000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/ota_data_initial.bin \
|
||||||
0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin \
|
0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin \
|
||||||
0x380000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs_4MB.bin
|
0x370000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin
|
||||||
# Adjust the offset for littlefs or other files as needed for the original case
|
# Adjust the offset for littlefs or other files as needed for the original case
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Create checksum for firmware
|
- name: Create checksum for firmware
|
||||||
shell: bash
|
|
||||||
run: shasum -a 256 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin | awk '{print $1}' > ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}_firmware.bin.sha256
|
run: shasum -a 256 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin | awk '{print $1}' > ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}_firmware.bin.sha256
|
||||||
|
|
||||||
- name: Create checksum for merged binary
|
- name: Create checksum for merged binary
|
||||||
shell: bash
|
|
||||||
run: shasum -a 256 ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin | awk '{print $1}' > ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin.sha256
|
run: shasum -a 256 ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin | awk '{print $1}' > ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin.sha256
|
||||||
|
|
||||||
- name: Create checksum for littlefs partition
|
- name: Create checksum for littlefs partition
|
||||||
shell: bash
|
run: shasum -a 256 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin | awk '{print $1}' > ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin.sha256
|
||||||
run: |
|
|
||||||
fs_file=$(find .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }} -name "littlefs*.bin")
|
|
||||||
shasum -a 256 "$fs_file" | awk '{print $1}' > "${fs_file}.sha256"
|
|
||||||
- name: Copy all artifacts to output folder
|
- name: Copy all artifacts to output folder
|
||||||
run: cp .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/*.bin .pio/boot_app0.bin ${{ matrix.chip.name }}_${{ matrix.epd_variant }}
|
run: cp .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/*.bin .pio/boot_app0.bin ${{ matrix.chip.name }}_${{ matrix.epd_variant }}
|
||||||
|
|
||||||
|
@ -175,11 +161,11 @@ jobs:
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: https://code.forgejo.org/actions/forgejo-release@v2.4.0
|
uses: https://code.forgejo.org/actions/forgejo-release@v2.4.0
|
||||||
with:
|
with:
|
||||||
url: "https://git.btclock.dev"
|
url: 'https://git.btclock.dev'
|
||||||
repo: "${{ github.repository }}"
|
repo: '${{ github.repository }}'
|
||||||
direction: upload
|
direction: upload
|
||||||
tag: "${{ github.ref_name }}"
|
tag: '${{ github.ref_name }}'
|
||||||
sha: "${{ github.sha }}"
|
sha: '${{ github.sha }}'
|
||||||
release-dir: release
|
release-dir: release
|
||||||
token: ${{ secrets.TOKEN }}
|
token: ${{ secrets.TOKEN }}
|
||||||
override: ${{ github.ref_type != 'tag' && github.ref_name != 'main' }}
|
override: ${{ github.ref_type != 'tag' && github.ref_name != 'main' }}
|
||||||
|
|
|
@ -3,5 +3,5 @@ nvs, data, nvs, 0x9000, 0x5000,
|
||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
app0, app, ota_0, 0x10000, 0x1b8000,
|
app0, app, ota_0, 0x10000, 0x1b8000,
|
||||||
app1, app, ota_1, , 0x1b8000,
|
app1, app, ota_1, , 0x1b8000,
|
||||||
spiffs, data, spiffs, , 0x66C00,
|
spiffs, data, spiffs, , 0x66800,
|
||||||
coredump, data, coredump,, 0x10000,
|
coredump, data, coredump,, 0x10000,
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Name, Type, SubType, Offset, Size, Flags
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
nvs, data, nvs, 0x9000, 0x5000,
|
nvs, data, nvs, 36K, 20K,
|
||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 56K, 8K,
|
||||||
app0, app, ota_0, 0x10000, 0x6F0000,
|
app0, app, ota_0, 64K, 4096K,
|
||||||
app1, app, ota_1, , 0x6F0000,
|
app1, app, ota_1, , 4096K,
|
||||||
spiffs, data, spiffs, , 0x200000,
|
spiffs, data, spiffs, , 410K,
|
||||||
coredump, data, coredump,, 0x10000,
|
coredump, data, coredump,, 64K,
|
||||||
|
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Name, Type, SubType, Offset, Size, Flags
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
nvs, data, nvs, 0x9000, 0x5000,
|
nvs, data, nvs, 36K, 20K,
|
||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 56K, 8K,
|
||||||
app0, app, ota_0, 0x10000, 0x370000,
|
app0, app, ota_0, 64K, 2048K,
|
||||||
app1, app, ota_1, , 0x370000,
|
app1, app, ota_1, , 2048K,
|
||||||
spiffs, data, spiffs, , 0xCD000,
|
spiffs, data, spiffs, , 410K,
|
||||||
coredump, data, coredump,, 0x10000,
|
coredump, data, coredump,, 64K,
|
||||||
|
|
|
|
@ -20,9 +20,8 @@ framework = arduino, espidf
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
monitor_filters = esp32_exception_decoder, colorize
|
monitor_filters = esp32_exception_decoder, colorize
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
extra_scripts = pre:scripts/pre_script.py, post:scripts/extra_script.py
|
extra_scripts = post:scripts/extra_script.py
|
||||||
board_build.embed_files =
|
board_build.embed_files = x509_crt_bundle
|
||||||
x509_crt_bundle
|
|
||||||
build_flags =
|
build_flags =
|
||||||
!python scripts/git_rev.py
|
!python scripts/git_rev.py
|
||||||
-DLAST_BUILD_TIME=$UNIX_TIME
|
-DLAST_BUILD_TIME=$UNIX_TIME
|
||||||
|
@ -36,9 +35,10 @@ lib_deps =
|
||||||
https://github.com/joltwallet/esp_littlefs.git
|
https://github.com/joltwallet/esp_littlefs.git
|
||||||
bblanchon/ArduinoJson@^7.2.1
|
bblanchon/ArduinoJson@^7.2.1
|
||||||
mathieucarbou/ESPAsyncWebServer @ 3.3.23
|
mathieucarbou/ESPAsyncWebServer @ 3.3.23
|
||||||
robtillaart/MCP23017@^0.8.0
|
adafruit/Adafruit BusIO@^1.16.2
|
||||||
|
adafruit/Adafruit MCP23017 Arduino Library@^2.3.2
|
||||||
adafruit/Adafruit NeoPixel@^1.12.3
|
adafruit/Adafruit NeoPixel@^1.12.3
|
||||||
https://github.com/dsbaars/universal_pin#feature/mcp23017_rt
|
https://github.com/dsbaars/universal_pin
|
||||||
https://github.com/dsbaars/GxEPD2#universal_pin
|
https://github.com/dsbaars/GxEPD2#universal_pin
|
||||||
https://github.com/tzapu/WiFiManager.git#v2.0.17
|
https://github.com/tzapu/WiFiManager.git#v2.0.17
|
||||||
rblb/Nostrduino@1.2.8
|
rblb/Nostrduino@1.2.8
|
||||||
|
@ -64,7 +64,7 @@ build_unflags =
|
||||||
[env:btclock_rev_b]
|
[env:btclock_rev_b]
|
||||||
extends = btclock_base
|
extends = btclock_base
|
||||||
board = btclock_rev_b
|
board = btclock_rev_b
|
||||||
board_build.partitions = partition_8mb.csv
|
board_build.partitions = partition.csv
|
||||||
build_flags =
|
build_flags =
|
||||||
${btclock_base.build_flags}
|
${btclock_base.build_flags}
|
||||||
-D MCP_INT_PIN=8
|
-D MCP_INT_PIN=8
|
||||||
|
|
|
@ -5,9 +5,6 @@ from shutil import copyfileobj, rmtree
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
revision = (
|
revision = (
|
||||||
subprocess.check_output(["git", "rev-parse", "HEAD"])
|
subprocess.check_output(["git", "rev-parse", "HEAD"])
|
||||||
.strip()
|
.strip()
|
||||||
|
@ -46,15 +43,5 @@ def before_buildfs(source, target, env):
|
||||||
output_directory = 'data/build_gz'
|
output_directory = 'data/build_gz'
|
||||||
process_directory(input_directory, output_directory)
|
process_directory(input_directory, output_directory)
|
||||||
|
|
||||||
flash_size = env.BoardConfig().get("upload.flash_size", "4MB")
|
|
||||||
fs_image_name = f"littlefs_{flash_size}"
|
|
||||||
env.Replace(ESP32_FS_IMAGE_NAME=fs_image_name)
|
|
||||||
env.Replace(ESP8266_FS_IMAGE_NAME=fs_image_name)
|
|
||||||
|
|
||||||
os.environ["PUBLIC_BASE_URL"] = ""
|
os.environ["PUBLIC_BASE_URL"] = ""
|
||||||
fs_name = env.get("ESP32_FS_IMAGE_NAME", "littlefs.bin")
|
env.AddPreAction("$BUILD_DIR/littlefs.bin", before_buildfs)
|
||||||
# Or alternatively:
|
|
||||||
# fs_name = env.get("FSTOOLNAME", "littlefs.bin")
|
|
||||||
|
|
||||||
# Use the variable in the pre-action
|
|
||||||
env.AddPreAction(f"$BUILD_DIR/{fs_name}.bin", before_buildfs)
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
Import("env")
|
|
||||||
|
|
||||||
flash_size = env.BoardConfig().get("upload.flash_size", "4MB")
|
|
||||||
fs_image_name = f"littlefs_{flash_size}"
|
|
||||||
env.Replace(ESP32_FS_IMAGE_NAME=fs_image_name)
|
|
||||||
env.Replace(ESP8266_FS_IMAGE_NAME=fs_image_name)
|
|
||||||
|
|
|
@ -5,15 +5,15 @@ const TickType_t debounceDelay = pdMS_TO_TICKS(50);
|
||||||
TickType_t lastDebounceTime = 0;
|
TickType_t lastDebounceTime = 0;
|
||||||
|
|
||||||
#ifdef IS_BTCLOCK_V8
|
#ifdef IS_BTCLOCK_V8
|
||||||
#define BTN_1 256
|
#define BTN_1 0
|
||||||
#define BTN_2 512
|
#define BTN_2 1
|
||||||
#define BTN_3 1024
|
#define BTN_3 2
|
||||||
#define BTN_4 2048
|
#define BTN_4 3
|
||||||
#else
|
#else
|
||||||
#define BTN_1 2048
|
#define BTN_1 3
|
||||||
#define BTN_2 1024
|
#define BTN_2 2
|
||||||
#define BTN_3 512
|
#define BTN_3 1
|
||||||
#define BTN_4 256
|
#define BTN_4 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void buttonTask(void *parameter) {
|
void buttonTask(void *parameter) {
|
||||||
|
@ -22,12 +22,11 @@ void buttonTask(void *parameter) {
|
||||||
std::lock_guard<std::mutex> lock(mcpMutex);
|
std::lock_guard<std::mutex> lock(mcpMutex);
|
||||||
|
|
||||||
TickType_t currentTime = xTaskGetTickCount();
|
TickType_t currentTime = xTaskGetTickCount();
|
||||||
|
|
||||||
if ((currentTime - lastDebounceTime) >= debounceDelay) {
|
if ((currentTime - lastDebounceTime) >= debounceDelay) {
|
||||||
lastDebounceTime = currentTime;
|
lastDebounceTime = currentTime;
|
||||||
|
|
||||||
if (!digitalRead(MCP_INT_PIN)) {
|
if (!digitalRead(MCP_INT_PIN)) {
|
||||||
uint pin = mcp1.getInterruptFlagRegister();
|
uint pin = mcp1.getLastInterruptPin();
|
||||||
|
|
||||||
switch (pin) {
|
switch (pin) {
|
||||||
case BTN_1:
|
case BTN_1:
|
||||||
|
@ -44,12 +43,12 @@ void buttonTask(void *parameter) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mcp1.getInterruptCaptureRegister();
|
mcp1.clearInterrupts();
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
// Very ugly, but for some reason this is necessary
|
// Very ugly, but for some reason this is necessary
|
||||||
while (!digitalRead(MCP_INT_PIN)) {
|
while (!digitalRead(MCP_INT_PIN)) {
|
||||||
mcp1.getInterruptCaptureRegister();
|
mcp1.clearInterrupts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,10 @@
|
||||||
|
|
||||||
#define MAX_ATTEMPTS_WIFI_CONNECTION 20
|
#define MAX_ATTEMPTS_WIFI_CONNECTION 20
|
||||||
|
|
||||||
// zlib_turbo zt;
|
|
||||||
|
|
||||||
Preferences preferences;
|
Preferences preferences;
|
||||||
MCP23017 mcp1(0x20);
|
Adafruit_MCP23X17 mcp1;
|
||||||
#ifdef IS_BTCLOCK_V8
|
#ifdef IS_BTCLOCK_V8
|
||||||
MCP23017 mcp2(0x21);
|
Adafruit_MCP23X17 mcp2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_FRONTLIGHT
|
#ifdef HAS_FRONTLIGHT
|
||||||
|
@ -37,7 +35,7 @@ void setup()
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lockMcp(mcpMutex);
|
std::lock_guard<std::mutex> lockMcp(mcpMutex);
|
||||||
if (mcp1.read1(3) == LOW)
|
if (mcp1.digitalRead(3) == LOW)
|
||||||
{
|
{
|
||||||
preferences.putBool("wifiConfigured", false);
|
preferences.putBool("wifiConfigured", false);
|
||||||
preferences.remove("txPower");
|
preferences.remove("txPower");
|
||||||
|
@ -48,7 +46,7 @@ void setup()
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
if (mcp1.read1(0) == LOW)
|
if (mcp1.digitalRead(0) == LOW)
|
||||||
{
|
{
|
||||||
// Then loop forever to prevent anything else from writing to the screen
|
// Then loop forever to prevent anything else from writing to the screen
|
||||||
while (true)
|
while (true)
|
||||||
|
@ -56,7 +54,7 @@ void setup()
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mcp1.read1(1) == LOW)
|
else if (mcp1.digitalRead(1) == LOW)
|
||||||
{
|
{
|
||||||
preferences.clear();
|
preferences.clear();
|
||||||
queueLedEffect(LED_EFFECT_WIFI_ERASE_SETTINGS);
|
queueLedEffect(LED_EFFECT_WIFI_ERASE_SETTINGS);
|
||||||
|
@ -68,7 +66,6 @@ void setup()
|
||||||
}
|
}
|
||||||
|
|
||||||
setupWifi();
|
setupWifi();
|
||||||
// loadIcons();
|
|
||||||
|
|
||||||
setupWebserver();
|
setupWebserver();
|
||||||
|
|
||||||
|
@ -114,7 +111,6 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
forceFullRefresh();
|
forceFullRefresh();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupWifi()
|
void setupWifi()
|
||||||
|
@ -141,7 +137,7 @@ void setupWifi()
|
||||||
bool buttonPress = false;
|
bool buttonPress = false;
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lockMcp(mcpMutex);
|
std::lock_guard<std::mutex> lockMcp(mcpMutex);
|
||||||
buttonPress = (mcp1.read1(2) == LOW);
|
buttonPress = (mcp1.digitalRead(2) == LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -522,7 +518,7 @@ void setupHardware()
|
||||||
|
|
||||||
Wire.begin(I2C_SDA_PIN, I2C_SCK_PIN, 400000);
|
Wire.begin(I2C_SDA_PIN, I2C_SCK_PIN, 400000);
|
||||||
|
|
||||||
if (!mcp1.begin())
|
if (!mcp1.begin_I2C(0x20))
|
||||||
{
|
{
|
||||||
Serial.println(F("Error MCP23017 1"));
|
Serial.println(F("Error MCP23017 1"));
|
||||||
|
|
||||||
|
@ -532,20 +528,17 @@ void setupHardware()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pinMode(MCP_INT_PIN, INPUT_PULLUP);
|
pinMode(MCP_INT_PIN, INPUT_PULLUP);
|
||||||
// mcp1.setupInterrupts(false, false, LOW);
|
mcp1.setupInterrupts(false, false, LOW);
|
||||||
mcp1.enableControlRegister(MCP23x17_IOCR_ODR);
|
|
||||||
|
|
||||||
mcp1.mirrorInterrupts(true);
|
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
mcp1.pinMode1(i, INPUT_PULLUP);
|
mcp1.pinMode(i, INPUT_PULLUP);
|
||||||
mcp1.enableInterrupt(i, LOW);
|
mcp1.setupInterruptPin(i, LOW);
|
||||||
}
|
}
|
||||||
#ifndef IS_BTCLOCK_V8
|
#ifndef IS_BTCLOCK_V8
|
||||||
for (int i = 8; i <= 14; i++)
|
for (int i = 8; i <= 14; i++)
|
||||||
{
|
{
|
||||||
mcp1.pinMode1(i, OUTPUT);
|
mcp1.pinMode(i, OUTPUT);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -556,7 +549,7 @@ void setupHardware()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IS_BTCLOCK_V8
|
#ifdef IS_BTCLOCK_V8
|
||||||
if (!mcp2.begin())
|
if (!mcp2.begin_I2C(0x21))
|
||||||
{
|
{
|
||||||
Serial.println(F("Error MCP23017 2"));
|
Serial.println(F("Error MCP23017 2"));
|
||||||
|
|
||||||
|
@ -809,18 +802,3 @@ const char* getFirmwareFilename() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// void loadIcons() {
|
|
||||||
// size_t ocean_logo_size = 886;
|
|
||||||
|
|
||||||
// int iUncompSize = zt.gzip_info((uint8_t *)epd_compress_bitaxe, ocean_logo_size);
|
|
||||||
// Serial.printf("uncompressed size = %d\n", iUncompSize);
|
|
||||||
|
|
||||||
// uint8_t *pUncompressed;
|
|
||||||
// pUncompressed = (uint8_t *)malloc(iUncompSize+4);
|
|
||||||
// int rc = zt.gunzip((uint8_t *)epd_compress_bitaxe, ocean_logo_size, pUncompressed);
|
|
||||||
|
|
||||||
// if (rc == ZT_SUCCESS) {
|
|
||||||
// Serial.println("Decode success");
|
|
||||||
// }
|
|
||||||
// }
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <MCP23017.h>
|
#include <Adafruit_MCP23X17.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
#include <WiFiClientSecure.h>
|
#include <WiFiClientSecure.h>
|
||||||
|
@ -85,5 +85,3 @@ void addScreenMapping(int value, const char* name);
|
||||||
int findScreenIndexByValue(int value);
|
int findScreenIndexByValue(int value);
|
||||||
String replaceAmbiguousChars(String input);
|
String replaceAmbiguousChars(String input);
|
||||||
const char* getFirmwareFilename();
|
const char* getFirmwareFilename();
|
||||||
|
|
||||||
// void loadIcons();
|
|
|
@ -191,7 +191,7 @@ void setupDisplays()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hold lower button to enable "storage mode" (prevents burn-in of ePaper displays)
|
// Hold lower button to enable "storage mode" (prevents burn-in of ePaper displays)
|
||||||
if (mcp1.read1(0) == LOW)
|
if (mcp1.digitalRead(0) == LOW)
|
||||||
{
|
{
|
||||||
setFgColor(GxEPD_BLACK);
|
setFgColor(GxEPD_BLACK);
|
||||||
setBgColor(GxEPD_WHITE);
|
setBgColor(GxEPD_WHITE);
|
||||||
|
@ -620,19 +620,10 @@ void renderIcon(const uint dispNum, const String &text, bool partial)
|
||||||
iconIndex = 6;
|
iconIndex = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
displays[dispNum].drawInvertedBitmap(0,0, epd_icons_allArray[iconIndex], 122, 250, getFgColor());
|
displays[dispNum].drawInvertedBitmap(0,0, epd_icons_allArray[iconIndex], 122, 250, getFgColor());
|
||||||
|
|
||||||
|
|
||||||
// displays[dispNum].drawInvertedBitmap(0,0, getOceanIcon(), 122, 250, getFgColor());
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void renderQr(const uint dispNum, const String &text, bool partial)
|
void renderQr(const uint dispNum, const String &text, bool partial)
|
||||||
{
|
{
|
||||||
#ifdef USE_QR
|
#ifdef USE_QR
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <Fonts/FreeSansBold9pt7b.h>
|
#include <Fonts/FreeSansBold9pt7b.h>
|
||||||
#include <GxEPD2_BW.h>
|
#include <GxEPD2_BW.h>
|
||||||
|
|
||||||
|
|
||||||
#include <mcp23x17_pin.hpp>
|
#include <mcp23x17_pin.hpp>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <native_pin.hpp>
|
#include <native_pin.hpp>
|
||||||
|
|
|
@ -144,11 +144,3 @@ String calculateSHA256(WiFiClient *stream, size_t contentLength) {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// uint8_t* getOceanIcon() {
|
|
||||||
// zlib_turbo zt;
|
|
||||||
// int iUncompSize = zt.gzip_info((uint8_t *)ocean_logo_comp, ocean_logo_size);
|
|
||||||
// uint8_t *pUncompressed;
|
|
||||||
// pUncompressed = (uint8_t *)malloc(iUncompSize+4);
|
|
||||||
// zt.gunzip((uint8_t *)ocean_logo_comp, ocean_logo_size, pUncompressed);
|
|
||||||
// }
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "MCP23017.h"
|
#include <Adafruit_MCP23X17.h>
|
||||||
// #include <zlib_turbo.h>
|
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <WiFiClientSecure.h>
|
#include <WiFiClientSecure.h>
|
||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
|
@ -18,9 +17,9 @@
|
||||||
|
|
||||||
#include "defaults.hpp"
|
#include "defaults.hpp"
|
||||||
|
|
||||||
extern MCP23017 mcp1;
|
extern Adafruit_MCP23X17 mcp1;
|
||||||
#ifdef IS_BTCLOCK_V8
|
#ifdef IS_BTCLOCK_V8
|
||||||
extern MCP23017 mcp2;
|
extern Adafruit_MCP23X17 mcp2;
|
||||||
#endif
|
#endif
|
||||||
extern Preferences preferences;
|
extern Preferences preferences;
|
||||||
extern std::mutex mcpMutex;
|
extern std::mutex mcpMutex;
|
||||||
|
@ -77,12 +76,7 @@ const int usPerMinute = 60 * usPerSecond;
|
||||||
extern const char *isrg_root_x1cert;
|
extern const char *isrg_root_x1cert;
|
||||||
|
|
||||||
extern const uint8_t rootca_crt_bundle_start[] asm("_binary_x509_crt_bundle_start");
|
extern const uint8_t rootca_crt_bundle_start[] asm("_binary_x509_crt_bundle_start");
|
||||||
// extern const uint8_t ocean_logo_comp[] asm("_binary_ocean_gz_start");
|
|
||||||
// extern const uint8_t ocean_logo_comp_end[] asm("_binary_ocean_gz_end");
|
|
||||||
|
|
||||||
// uint8_t* getOceanIcon();
|
|
||||||
|
|
||||||
// const size_t ocean_logo_size = ocean_logo_comp_end - ocean_logo_comp;
|
|
||||||
|
|
||||||
const PROGMEM char UPDATE_FIRMWARE = U_FLASH;
|
const PROGMEM char UPDATE_FIRMWARE = U_FLASH;
|
||||||
const PROGMEM char UPDATE_WEBUI = U_SPIFFS;
|
const PROGMEM char UPDATE_WEBUI = U_SPIFFS;
|
||||||
|
|
Loading…
Reference in a new issue