Add support for OrangeClock PCB, add README

This commit is contained in:
Djuri Baars 2024-03-17 22:27:10 +01:00
parent a2b6f234f1
commit 4b0a31a2ed
7 changed files with 124 additions and 4 deletions

View file

@ -37,6 +37,11 @@ jobs:
version: esp32s2
- name: lolin_s3_mini
version: esp32s3
- name: orangeclock
version: esp32s3
exclude:
- chip: orangeclock
epd_variant: 213epd
runs-on: ubuntu-latest
permissions:
contents: write

13
README.md Normal file
View file

@ -0,0 +1,13 @@
# 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/).

62
boards/orangeclock.json Normal file
View file

@ -0,0 +1,62 @@
{
"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=1",
"-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"
}

View file

@ -10,7 +10,7 @@
[platformio]
data_dir = data/build_gz
default_envs = lolin_s2_mini_213epd, lolin_s2_mini_29epd, lolin_s3_mini_213epd, lolin_s3_mini_29epd
default_envs = lolin_s2_mini_213epd, lolin_s2_mini_29epd, lolin_s3_mini_213epd, lolin_s3_mini_29epd, orangeclock_29epd
[btclock_base]
platform = espressif32
@ -29,7 +29,7 @@ lib_deps =
bblanchon/ArduinoJson@^7.0.3
mathieucarbou/ESP Async WebServer
gilmaimon/ArduinoWebsockets@^0.5.3
fastled/FastLED@^3.6.0
[env:lolin_s2_mini]
extends = btclock_base
board = lolin_s2_mini
@ -60,4 +60,13 @@ build_flags =
extends = env:lolin_s3_mini
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

View file

@ -92,6 +92,7 @@ void setupWifi()
WiFiManager wm;
#ifndef ARDUINO_ORANGECLOCK
// Touch pin 14 to reset
if (touchRead(14) > 9000)
{
@ -108,6 +109,7 @@ void setupWifi()
wm.resetSettings();
}
}
#endif
String softAP_SSID =
String("OrangeBTClock");

View file

@ -51,7 +51,7 @@ void setupDisplay()
// display.fillRect(0, row1, display.width(), 54, GxEPD_BLACK);
display.displayWindow(0, row1, display.width(), row2);
display.display(true);
display.display(false);
// display.fillRect(0, row2, display.width(), 54, GxEPD_BLACK);
// display.displayWindow(0, row2, display.width(), 54);

View file

@ -8,6 +8,7 @@
#include "config.hpp"
#include "webserver.hpp"
#include <data.hpp>
#include <FastLED.h>
#define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP 5 /* Time ESP32 will go to sleep (in seconds) */
@ -21,6 +22,10 @@ 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);
#endif
#ifdef ARDUINO_ORANGECLOCK
GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> display = EPD_CLASS(5, 3, 1, 2);
#endif
typedef void (*MethodPtr)(String, char);
MethodPtr methods[] = {nullptr, updateRow1, updateRow2, updateRow3};
@ -30,14 +35,25 @@ uint currentPrice = 0;
String currentBlock = "";
String currentFees = "";
#define NUM_LEDS 2
CRGB leds[NUM_LEDS];
void setup()
{
// setCpuFrequencyMhz(40);
Serial.begin(115200);
#ifndef IS_ORANGECLOCK
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
#else
FastLED.addLeds<WS2812B, 48, GRB>(leds, NUM_LEDS);
leds[0] = CRGB::DarkOrange;
leds[1] = CRGB::OrangeRed;
FastLED.show();
#endif
setupPreferences();
setupDisplay();
@ -52,7 +68,20 @@ void setup()
}
client.setInsecure();
#ifndef IS_ORANGECLOCK
digitalWrite(LED_BUILTIN, LOW);
#else
leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
FastLED.show();
delay(100);
display.setFullWindow();
display.clearScreen(GxEPD_WHITE);
display.display(true);
#endif
}
void loop()