Compare commits

..

No commits in common. "main" and "0.0.1-beta.1" have entirely different histories.

17 changed files with 56 additions and 493 deletions

View file

@ -1,136 +0,0 @@
name: "BTClock CI"
on:
push:
tags:
- "*"
workflow_dispatch:
jobs:
build:
runs-on: docker
container:
image: ghcr.io/catthehacker/ubuntu:js-22.04
permissions:
contents: write
checks: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
cache-dependency-path: "**/yarn.lock"
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
~/data/node_modules
.pio
data/node_modules
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- name: Get current date
id: dateAndTime
shell: bash
run: echo "dateAndTime=$(date +'%Y-%m-%d-%H:%M')" >> $GITHUB_OUTPUT
- name: Install PlatformIO Core
shell: bash
run: pip install --upgrade platformio
- name: Build BTClock firmware
shell: bash
run: pio run
- name: Build BTClock filesystem
shell: bash
run: pio run --target buildfs
- name: Copy bootloader to output folder
run: cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin .pio
- name: Upload artifacts
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
include-hidden-files: true
retention-days: 1
name: prepared-outputs
path: .pio/**/*.bin
merge:
runs-on: docker
container:
image: ghcr.io/catthehacker/ubuntu:js-22.04
permissions:
contents: write
checks: write
needs: build
continue-on-error: true
strategy:
matrix:
chip:
- name: lolin_s2_mini
version: esp32s2
- name: lolin_s3_mini
version: esp32s3
- name: orangeclock
version: esp32s3
epd_variant: [213epd, 29epd]
exclude:
- chip: { name: orangeclock, version: esp32s3 }
epd_variant: 213epd
steps:
- uses: https://code.forgejo.org/forgejo/download-artifact@v4
with:
name: prepared-outputs
path: .pio
- name: Install esptools.py
run: pip install --upgrade esptool
- name: Create merged firmware binary
run: mkdir -p ${{ matrix.chip.name }}_${{ matrix.epd_variant }} && 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 0x0000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/bootloader.bin 0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin 0xe000 .pio/boot_app0.bin 0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin 0x369000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin
- 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
- name: Create checksum for merged binary
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 }}.sha256
- name: Upload artifacts
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: build-${{ matrix.chip.name }}-${{ matrix.epd_variant }}
path: |
${{ matrix.chip.name }}_${{ matrix.epd_variant }}/*.bin
${{ matrix.chip.name }}_${{ matrix.epd_variant }}/*.sha256
release:
runs-on: docker
permissions:
contents: write
checks: write
needs: merge
steps:
- name: Download matrix outputs
uses: https://code.forgejo.org/forgejo/download-artifact@v4
with:
pattern: build-*
merge-multiple: false
path: temp
- name: Copy files
run: |
mkdir -p release
find temp -type f \( -name "*.bin" -o -name "*.sha256" \) -exec cp -f {} release/ \;
- name: Create release
uses: https://code.forgejo.org/actions/forgejo-release@v2.4.0
with:
url: "https://git.btclock.dev"
repo: "${{ github.repository }}"
direction: upload
tag: "${{ github.ref_name }}"
sha: "${{ github.sha }}"
release-dir: release
token: ${{ secrets.TOKEN }}
override: ${{ github.ref_type != 'tag' && github.ref_name != 'main' }}
prerelease: ${{ github.ref_type != 'tag' && github.ref_name != 'main' }}
release-notes-assistant: false

View file

@ -4,11 +4,11 @@ description: "Install and build"
runs: runs:
using: "composite" using: "composite"
steps: steps:
- uses: actions/setup-node@v4 # - uses: actions/setup-node@v4
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@v3 - uses: actions/cache@v3
with: with:
path: | path: |

View file

@ -31,17 +31,12 @@ jobs:
continue-on-error: true continue-on-error: true
strategy: strategy:
matrix: matrix:
epd_variant: [213epd, 29epd]
chip: chip:
- name: lolin_s2_mini - name: lolin_s2_mini
version: esp32s2 version: esp32s2
- name: lolin_s3_mini - name: lolin_s3_mini
version: esp32s3 version: esp32s3
- name: orangeclock
version: esp32s3
epd_variant: [213epd, 29epd]
exclude:
- chip: orangeclock
epd_variant: 213epd
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write

2
.gitmodules vendored
View file

@ -1,3 +1,3 @@
[submodule "data"] [submodule "data"]
path = data path = data
url = https://git.btclock.dev/btclock/oc-webui.git url = https://github.com/btclock/oc-webui.git

View file

@ -1,13 +0,0 @@
# OrangeBTClock (working title)
[![BTClock CI](https://github.com/btclock/OrangeBTClock/actions/workflows/tagging.yml/badge.svg)](https://github.com/btclock/OrangeBTClock/actions/workflows/tagging.yml)
Firmware for cheap ESP32-S2/S3 hardware combined with a eInk display
See releases for prebuilt binaries, ready to flash (e.g. with the [esphome web flasher](https://web.esphome.io/))
## Development
- [PlatformIO](https://platformio.org/platformio-ide).
- [Node.js](https://nodejs.org/en) and [yarn](https://yarnpkg.com/).

View file

@ -1,62 +0,0 @@
{
"build": {
"arduino":{
"ldscript": "esp32s3_out.ld",
"partitions": "default_8MB.csv",
"memory_type": "qio_opi"
},
"core": "esp32",
"extra_flags": [
"-DBOARD_HAS_PSRAM",
"-DARDUINO_ORANGECLOCK",
"-DARDUINO_ESP32S3_DEV",
"-DIS_ORANGECLOCK",
"-DARDUINO_USB_MODE=0",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1",
"-DARDUINO_USB_CDC_ON_BOOT=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"psram_type": "opi",
"espidf": {
"sdkconfig_path": "boards"
},
"hwids": [
[
"0x303A",
"0x1001"
]
],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": [
"bluetooth",
"wifi"
],
"debug": {
"default_tool": "esp-builtin",
"onboard_tools": [
"esp-builtin"
],
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "OrangeClock",
"upload": {
"flash_size": "8MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"use_1200bps_touch": true,
"wait_for_upload_port": true,
"require_upload_port": true,
"speed": 460800
},
"url": "http://github.com/btclock",
"vendor": "BTClock"
}

2
data

@ -1 +1 @@
Subproject commit 8332fec4a1ec0045d91f063617bb441914e7b67a Subproject commit bd12ce4362f0b665a33e1f637136870a667dbdfc

View file

@ -10,12 +10,11 @@
[platformio] [platformio]
data_dir = data/build_gz data_dir = data/build_gz
default_envs = lolin_s2_mini_213epd, lolin_s2_mini_29epd, lolin_s3_mini_213epd, lolin_s3_mini_29epd, orangeclock_29epd default_envs = lolin_s2_mini_213epd, lolin_s2_mini_29epd, lolin_s3_mini_213epd, lolin_s3_mini_29epd
[btclock_base] [btclock_base]
platform = espressif32 platform = espressif32
framework = arduino framework = arduino
platform_packages = platformio/framework-arduinoespressif32
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
@ -25,11 +24,12 @@ build_flags =
!python scripts/git_rev.py !python scripts/git_rev.py
-DLAST_BUILD_TIME=$UNIX_TIME -DLAST_BUILD_TIME=$UNIX_TIME
lib_deps = lib_deps =
zinggjm/GxEPD2@^1.6.1 zinggjm/GxEPD2@^1.5.6
https://github.com/tzapu/WiFiManager.git#v2.0.17 https://github.com/tzapu/WiFiManager.git#v2.0.17
bblanchon/ArduinoJson@^7.2.1 bblanchon/ArduinoJson@^7.0.3
mathieucarbou/ESP Async WebServer@^3.0.6 mathieucarbou/ESP Async WebServer
fastled/FastLED@^3.9.6 gilmaimon/ArduinoWebsockets@^0.5.3
[env:lolin_s2_mini] [env:lolin_s2_mini]
extends = btclock_base extends = btclock_base
board = lolin_s2_mini board = lolin_s2_mini
@ -61,14 +61,3 @@ extends = env:lolin_s3_mini
build_flags = build_flags =
${btclock_base.build_flags} ${btclock_base.build_flags}
-D VERSION_EPD_2_9 -D VERSION_EPD_2_9
[env:orangeclock_29epd]
extends = btclock_base
board = orangeclock
build_flags =
${btclock_base.build_flags}
-D VERSION_EPD_2_9
-D IS_ORANGECLOCK
-D BUTTON_PIN=45
-D NUM_LEDS=2

View file

@ -1,81 +0,0 @@
#pragma once
#include <pgmspace.h>
// 'oclogo', 250x37px
const unsigned char epd_bitmap_oclogo [] PROGMEM = {
0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1f, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7f, 0xc3, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xfc, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0xf0, 0x0c, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0xe3, 0x9c, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0xc7, 0x9c, 0x03, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00,
0x0f, 0x8f, 0x9c, 0x01, 0xe0, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00,
0x0f, 0x07, 0x9c, 0x00, 0xf0, 0x00, 0x1f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xc0, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00,
0x1e, 0x63, 0x9c, 0x00, 0x78, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00,
0x1e, 0x71, 0x9c, 0x00, 0x78, 0x00, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00,
0x3c, 0xf8, 0x9c, 0x00, 0x38, 0x01, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00,
0x3c, 0xfc, 0x1c, 0x00, 0x3c, 0x01, 0xfc, 0x1f, 0xe1, 0xf3, 0xc3, 0xfc, 0x03, 0xe7, 0xe0, 0x03,
0xf3, 0xe0, 0x1f, 0xc0, 0x3f, 0xc1, 0xf0, 0xf8, 0x07, 0xf0, 0x00, 0x7f, 0x03, 0xf0, 0x7e, 0x00,
0x39, 0xfe, 0x1c, 0x00, 0x1c, 0x03, 0xf8, 0x07, 0xe1, 0xff, 0xdf, 0xff, 0x03, 0xff, 0xf0, 0x0f,
0xff, 0xe0, 0x7f, 0xf0, 0x3f, 0x80, 0x40,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c, 0x78, 0x00, 0x7f, 0xff, 0x81, 0xf8, 0x1f, 0xff, 0xc3, 0xe0, 0x7e, 0x0f,
0xff, 0xe0, 0xff, 0xfc, 0x0f, 0xff, 0xf0, 0xf8, 0x3f, 0xff, 0x03, 0xff, 0xe3, 0xf0, 0xfe, 0x00,
0x0f, 0x07, 0xe7, 0x1c, 0xf0, 0x00, 0x3f, 0xff, 0x01, 0xf8, 0x1f, 0xff, 0xc3, 0xe0, 0x7e, 0x03,
0xf3, 0xe0, 0x7f, 0xf8, 0x03, 0xff, 0xe0, 0xf8, 0x1f, 0xfe, 0x01, 0xff, 0xc3, 0xf0, 0x7e, 0x00,
0x0f, 0x8f, 0xe7, 0x81, 0xe0, 0x00, 0x0f, 0xfc, 0x01, 0xf8, 0x07, 0xe7, 0xc3, 0xe0, 0x7e, 0x00,
0x03, 0xe0, 0x1f, 0xf0, 0x01, 0xff, 0x80, 0xf8, 0x07, 0xf8, 0x00, 0x7f, 0x83, 0xf0, 0x7f, 0x00,
0x07, 0xc7, 0xe7, 0xe3, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x07, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0xe3, 0xe7, 0x87, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
0x1f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0xf0, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xfc, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f,
0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7f, 0xc3, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1f, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

View file

@ -6,9 +6,6 @@ const char *ntpServer = "pool.ntp.org";
// const long gmtOffset_sec = 0; // const long gmtOffset_sec = 0;
const int daylightOffset_sec = 3600; const int daylightOffset_sec = 3600;
TaskHandle_t OTAHandle = NULL; TaskHandle_t OTAHandle = NULL;
SemaphoreHandle_t xButtonSemaphore = NULL;
const TickType_t debounceDelay = pdMS_TO_TICKS(500);
TickType_t lastButtonPressTime = 0;
#define STA_SSID "" #define STA_SSID ""
#define STA_PASS "" #define STA_PASS ""
@ -90,11 +87,11 @@ void setupWifi()
randomSeed(seed); randomSeed(seed);
// WiFi.begin(, "); // WiFi.begin(, ");
WiFi.setAutoConnect(true);
WiFi.setAutoReconnect(true); WiFi.setAutoReconnect(true);
WiFiManager wm; WiFiManager wm;
#ifndef ARDUINO_ORANGECLOCK
// Touch pin 14 to reset // Touch pin 14 to reset
if (touchRead(14) > 9000) if (touchRead(14) > 9000)
{ {
@ -111,7 +108,6 @@ void setupWifi()
wm.resetSettings(); wm.resetSettings();
} }
} }
#endif
String softAP_SSID = String softAP_SSID =
String("OrangeBTClock"); String("OrangeBTClock");
@ -153,7 +149,6 @@ void setupWifi()
Serial.println("WiFi connected"); Serial.println("WiFi connected");
Serial.println("IP address: "); Serial.println("IP address: ");
Serial.println(WiFi.localIP()); Serial.println(WiFi.localIP());
epdShowIp();
// WiFi.setTxPower(WIFI_POWER_8_5dBm); // WiFi.setTxPower(WIFI_POWER_8_5dBm);
// enableWiFi(); // enableWiFi();
} }
@ -180,6 +175,7 @@ void wakeModemSleep()
void enableWiFi() void enableWiFi()
{ {
adc_power_on();
delay(200); delay(200);
WiFi.disconnect(false); // Reconnect the network WiFi.disconnect(false); // Reconnect the network
@ -204,6 +200,7 @@ void enableWiFi()
void disableWiFi() void disableWiFi()
{ {
adc_power_off();
WiFi.disconnect(true); // Disconnect from the network WiFi.disconnect(true); // Disconnect from the network
WiFi.mode(WIFI_OFF); // Switch WiFi off WiFi.mode(WIFI_OFF); // Switch WiFi off
Serial.println(""); Serial.println("");
@ -265,44 +262,6 @@ void OTAUpdateTask(void *pvParameters)
} }
} }
void HandleButtonTask(void *pvParameters)
{
for (;;)
{
if (xSemaphoreTake(xButtonSemaphore, portMAX_DELAY) == pdTRUE)
{
TickType_t currentTime = xTaskGetTickCount();
if ((currentTime - lastButtonPressTime) >= debounceDelay)
{
lastButtonPressTime = currentTime;
Serial.println("Button Pressed");
#ifdef NUM_LEDS
leds[0] = CRGB::SkyBlue;
leds[1] = CRGB::Black;
FastLED.show();
vTaskDelay(100);
leds[0] = CRGB::Black;
leds[1] = CRGB::DarkOrange;
FastLED.show();
vTaskDelay(100);
leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
FastLED.show();
#endif
}
}
}
}
char getCurrencyIcon() char getCurrencyIcon()
{ {
char ret; char ret;
@ -326,22 +285,3 @@ char getCurrencyIcon()
return ret; return ret;
} }
void IRAM_ATTR onButtonPress()
{
xSemaphoreGiveFromISR(xButtonSemaphore, NULL);
}
void setupButtonISR()
{
xButtonSemaphore = xSemaphoreCreateBinary();
xTaskCreatePinnedToCore(
HandleButtonTask, // Task function
"Button Task", // Task name
2048, // Stack size (bytes)
NULL, // Task parameters
1, // Priority (1 is default)
NULL, // Task handle
0); // Core to run the task (0 or 1)
}

View file

@ -3,6 +3,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <Preferences.h> #include <Preferences.h>
#include "shared.hpp" #include "shared.hpp"
#include "driver/adc.h"
#include <WiFiManager.h> #include <WiFiManager.h>
#include <base64.h> #include <base64.h>
#include "epd.hpp" #include "epd.hpp"
@ -21,5 +22,3 @@ void setModemSleep();
bool inPowerSaveMode(); bool inPowerSaveMode();
char getCurrencyIcon(); char getCurrencyIcon();
void IRAM_ATTR onButtonPress();
void setupButtonISR();

View file

@ -22,26 +22,17 @@ void setupDisplay()
display.setRotation(1); display.setRotation(1);
display.setFont(&Antonio_SemiBold20pt7b); display.setFont(&Antonio_SemiBold20pt7b);
display.setTextColor(GxEPD_WHITE); display.setTextColor(GxEPD_WHITE);
// int16_t tbx, tby; int16_t tbx, tby;
// uint16_t tbw, tbh; uint16_t tbw, tbh;
// display.getTextBounds("OrangeBTClock", 0, 0, &tbx, &tby, &tbw, &tbh); display.getTextBounds("OrangeBTClock", 0, 0, &tbx, &tby, &tbw, &tbh);
// // center the bounding box by transposition of the origin: // center the bounding box by transposition of the origin:
// uint16_t x = ((display.width() - tbw) / 2) - tbx; uint16_t x = ((display.width() - tbw) / 2) - tbx;
// uint16_t y = ((display.height() - tbh) / 2) - tby; uint16_t y = ((display.height() - tbh) / 2) - tby;
display.fillScreen(GxEPD_BLACK); display.fillScreen(GxEPD_BLACK);
// display.setCursor(x, y); display.setCursor(x, y);
// display.print("OrangeBTClock"); display.print("OrangeBTClock");
// display.drawImage(epd_bitmap_allArray[0], GxEPD_WHITE, 0,0 250,37);
int xPos = (display.width() - 250) / 2;
int yPos = (display.height() - 37) / 2;
display.drawBitmap(xPos,yPos, epd_bitmap_oclogo, 250, 37, GxEPD_WHITE);
display.display(false); display.display(false);
display.setCursor(0, 37);
// display.fillScreen(GxEPD_WHITE); // display.fillScreen(GxEPD_WHITE);
// display.drawLine(0, 10, display.width(), 10, GxEPD_BLACK); // display.drawLine(0, 10, display.width(), 10, GxEPD_BLACK);
// display.drawLine(0, row2, display.width(), row2, GxEPD_BLACK); // display.drawLine(0, row2, display.width(), row2, GxEPD_BLACK);
@ -56,11 +47,11 @@ void setupDisplay()
// display.display(true); // display.display(true);
// display.setRotation(1); display.setRotation(1);
// // display.fillRect(0, row1, display.width(), 54, GxEPD_BLACK); // display.fillRect(0, row1, display.width(), 54, GxEPD_BLACK);
// display.displayWindow(0, row1, display.width(), row2); display.displayWindow(0, row1, display.width(), row2);
// display.display(false); display.display(true);
// display.fillRect(0, row2, display.width(), 54, GxEPD_BLACK); // display.fillRect(0, row2, display.width(), 54, GxEPD_BLACK);
// display.displayWindow(0, row2, display.width(), 54); // display.displayWindow(0, row2, display.width(), 54);
@ -73,22 +64,6 @@ void setupDisplay()
// display.display(true); // display.display(true);
} }
void epdShowIp() {
display.setRotation(1);
display.setFont(&LibreFranklin_SemiBold10pt7b);
display.setTextColor(GxEPD_WHITE);
String ipStr = WiFi.localIP().toString();
int16_t tbx, tby;
uint16_t tbw, tbh;
display.getTextBounds(ipStr, 0, 0, &tbx, &tby, &tbw, &tbh);
// center the bounding box by transposition of the origin:
uint16_t x = ((display.width() - tbw) / 2) - tbx;
uint16_t y = ((display.height() - tbh) / 2) - tby + 37;
display.setCursor(x, y);
display.println(WiFi.localIP());
display.display(true);
}
void updateRow2(String c, char icon) void updateRow2(String c, char icon)
{ {
if (c.equals(currentRow2) && icon == currentIcon2) if (c.equals(currentRow2) && icon == currentIcon2)

View file

@ -2,7 +2,7 @@
#include "shared.hpp" #include "shared.hpp"
#include "fonts/fonts.hpp" #include "fonts/fonts.hpp"
#include "bitmap.hpp"
void setupDisplay(); void setupDisplay();
void showSetupText(String t); void showSetupText(String t);
@ -10,4 +10,3 @@ void updateRow1(String c, char icon);
void updateRow2(String c, char icon); void updateRow2(String c, char icon);
void updateRow3(String c, char icon); void updateRow3(String c, char icon);
void updateRows(String row1Content, String row2Content, String row3Content); void updateRows(String row1Content, String row2Content, String row3Content);
void epdShowIp();

View file

@ -21,44 +21,23 @@ GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> display = EPD_CLASS(4, 2, 3, 1);
GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> display = EPD_CLASS(5, 3, 2, 1); GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> display = EPD_CLASS(5, 3, 2, 1);
#endif #endif
#ifdef ARDUINO_ORANGECLOCK
GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> display = EPD_CLASS(5, 3, 1, 2);
#endif
typedef void (*MethodPtr)(String, char); typedef void (*MethodPtr)(String, char);
MethodPtr methods[] = {nullptr, updateRow1, updateRow2, updateRow3}; MethodPtr methods[] = {nullptr, updateRow1, updateRow2, updateRow3};
WiFiClient client; WiFiClientSecure client;
uint currentPrice = 0; uint currentPrice = 0;
String currentBlock = ""; String currentBlock = "";
String currentFees = ""; String currentFees = "";
#ifdef NUM_LEDS
CRGB leds[NUM_LEDS];
#endif
void setup() void setup()
{ {
// setCpuFrequencyMhz(40); // setCpuFrequencyMhz(40);
Serial.begin(115200); Serial.begin(115200);
#ifndef IS_ORANGECLOCK
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH); digitalWrite(LED_BUILTIN, HIGH);
#else
pinMode(BUTTON_PIN, INPUT_PULLUP);
attachInterrupt(BUTTON_PIN, onButtonPress, FALLING);
FastLED.addLeds<WS2812B, 48, GRB>(leds, NUM_LEDS);
leds[0] = CRGB::GreenYellow;
leds[1] = CRGB::OrangeRed;
FastLED.show();
setupButtonISR();
#endif
setupPreferences(); setupPreferences();
setupDisplay(); setupDisplay();
@ -71,20 +50,9 @@ void setup()
setupWebserver(); setupWebserver();
setupOTA(); setupOTA();
} }
// client.setInsecure(); client.setInsecure();
#ifndef IS_ORANGECLOCK
digitalWrite(LED_BUILTIN, LOW); digitalWrite(LED_BUILTIN, LOW);
#else
leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
FastLED.show();
delay(100);
#endif
display.setFullWindow();
display.clearScreen(GxEPD_WHITE);
display.display(true);
} }
void loop() void loop()
@ -103,28 +71,28 @@ void loop()
return; return;
} }
// client.setInsecure(); client.setInsecure();
// //
// IPAddress res; IPAddress res;
// uint result = WiFi.hostByName("mempool.space", res); uint result = WiFi.hostByName("mempool.space", res);
// if (result >= 0) if (result >= 0)
// { {
// Serial.print("SUCCESS!"); Serial.print("SUCCESS!");
// Serial.println(res.toString()); Serial.println(res.toString());
// } }
// else else
// { {
// WiFi.reconnect(); WiFi.reconnect();
// while (WiFi.status() != WL_CONNECTED) while (WiFi.status() != WL_CONNECTED)
// { {
// Serial.print('.'); Serial.print('.');
// delay(1000); delay(1000);
// } }
// } }
for (uint i = 1; i <= 3; i++) for (uint i = 1; i <= 3; i++)
{ {

View file

@ -1,3 +1,2 @@
#include "shared.hpp" #include "shared.hpp"
volatile bool buttonPressed = false;

View file

@ -1,16 +1,12 @@
#pragma once #pragma once
#include <Arduino.h> #include <Arduino.h>
#include <WiFiClient.h> #include <WiFiClientSecure.h>
#include <Preferences.h> #include <Preferences.h>
#include <GxEPD2.h> #include <GxEPD2.h>
#include <GxEPD2_BW.h> #include <GxEPD2_BW.h>
#include "utils.hpp" #include "utils.hpp"
#include "fonts/fonts.hpp" #include "fonts/fonts.hpp"
#include <FastLED.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <WiFi.h>
#ifdef VERSION_EPD_2_13 #ifdef VERSION_EPD_2_13
#define EPD_CLASS GxEPD2_213_B74 #define EPD_CLASS GxEPD2_213_B74
@ -92,7 +88,7 @@ const int LINE_DATE = 100;
#define CURRENCY_AUD "AUD" #define CURRENCY_AUD "AUD"
#define CURRENCY_JPY "JPY" #define CURRENCY_JPY "JPY"
extern WiFiClient client; extern WiFiClientSecure client;
extern GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> display; extern GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> display;
extern Preferences preferences; extern Preferences preferences;
extern bool isUpdating; extern bool isUpdating;
@ -105,7 +101,3 @@ extern char currentIcon1;
extern char currentIcon2; extern char currentIcon2;
extern char currentIcon3; extern char currentIcon3;
#ifdef NUM_LEDS
extern CRGB leds[NUM_LEDS];
#endif
extern volatile bool buttonPressed;

View file

@ -4,7 +4,6 @@
#include <Arduino.h> #include <Arduino.h>
#include <ArduinoJson.hpp> #include <ArduinoJson.hpp>
#include "shared.hpp" #include "shared.hpp"
#include <esp_mac.h>
namespace ArduinoJson { namespace ArduinoJson {
template <> template <>