Merge branch 'dev' into feature/m5stick-cplus-support

This commit is contained in:
BitMaker 2025-01-13 14:51:13 +01:00 committed by GitHub
commit 9baf45b3e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 688 additions and 72 deletions

17
auto_firmware_version.py Normal file
View File

@ -0,0 +1,17 @@
import subprocess
Import("env")
def get_firmware_specifier_build_flag():
ret = subprocess.run(["git", "describe"], stdout=subprocess.PIPE, text=True) #Uses only annotated tags
#ret = subprocess.run(["git", "describe", "--tags"], stdout=subprocess.PIPE, text=True) #Uses any tags
build_version = ret.stdout.strip()
# fix unwanted and verbose tags
build_version = build_version.replace('Release', '')
build_flag = "-D AUTO_VERSION=\\\"" + build_version + "\\\""
print ("Firmware Revision: " + build_version)
return (build_flag)
env.Append(
BUILD_FLAGS=[get_firmware_specifier_build_flag()]
)

View File

@ -0,0 +1,38 @@
{
"build": {
"arduino": {
"ldscript": "esp32s3_out.ld",
"partitions": "default.csv"
},
"core": "esp32",
"extra_flags": [
"-DARDUINO_ESP32S3_DEV",
"-DARDUINO_USB_MODE=1",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [["0x239A", "0x811B"]],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": ["bluetooth", "wifi"],
"debug": {
"default_tool": "esp-builtin",
"onboard_tools": ["esp-builtin"],
"openocd_target": "esp32s3.cfg"
},
"frameworks": ["arduino", "espidf"],
"name": "ESP32 S3 0.42 OLED (4 MB QD, 2MB PSRAM)",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 532480,
"maximum_size": 4194304,
"require_upload_port": true,
"speed": 460800
},
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html",
"vendor": "Espressif"
}

View File

@ -0,0 +1,35 @@
{
"build": {
"arduino":{
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_M5Stick_C_Plus2",
"f_cpu": "240000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
"mcu": "esp32",
"variants_dir": "boards/variants",
"variant": "m5stick_c_plus2"
},
"connectivity": [
"wifi",
"bluetooth",
"ethernet",
"can"
],
"frameworks": [
"arduino",
"espidf"
],
"name": "M5Stick-С-Plus2",
"upload": {
"flash_size": "8MB",
"maximum_ram_size": 2095104,
"maximum_size": 8388608,
"require_upload_port": true,
"speed": 1500000
},
"url": "https://docs.m5stack.com/en/core/M5StickC%20PLUS2",
"vendor": "M5Stack"
}

View File

@ -0,0 +1,33 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#include <stdint.h>
static const uint8_t TX = 1;
static const uint8_t RX = 3;
static const uint8_t SDA = 32;
static const uint8_t SCL = 33;
static const uint8_t SS = 5;
static const uint8_t MOSI = 15;
static const uint8_t MISO = 36;
static const uint8_t SCK = 13;
static const uint8_t G9 = 9;
static const uint8_t G10 = 10;
static const uint8_t G37 = 37;
static const uint8_t G39 = 39;
static const uint8_t G32 = 32;
static const uint8_t G33 = 33;
static const uint8_t G26 = 26;
static const uint8_t G36 = 36;
static const uint8_t G0 = 0;
static const uint8_t DAC1 = 25;
static const uint8_t DAC2 = 26;
static const uint8_t ADC1 = 35;
static const uint8_t ADC2 = 36;
#endif /* Pins_Arduino_h */

View File

@ -134,7 +134,7 @@
#ifdef NERDMINERV2
#include <User_Setups/Setup206_LilyGo_T_Display_S3.h>
#endif
#ifdef NERMINER_S3_AMOLED
#ifdef NERDMINER_S3_AMOLED
#include <User_Setups/Setup206_LilyGo_T_Display_S3.h> //Just a stub. No driver implementation for S3 AMOLED in TFT_eSPI
#endif
#ifdef NERDMINER_T_HMI
@ -146,18 +146,21 @@
#ifdef LILYGO_S3_T_EMBED
#include <User_Setups/Setup210_LilyGo_T_Embed_S3.h> // For the LilyGo T-Embed S3 based ESP32S3 with ST7789 170 x 320 TFT
#endif
#ifdef NERMINER_T_QT
#ifdef NERDMINER_T_QT
#include <User_Setups/Setup211_LilyGo_T_QT_Pro_S3.h> // For the LilyGo T-QT Pro S3 based ESP32S3 with GC9A01 128 x 128 TFT
#endif
#ifdef NERMINER_S3_DONGLE
#ifdef NERDMINER_S3_DONGLE
#include <User_Setups/Setup209_LilyGo_T_Dongle_S3.h> // For the LilyGo T-Dongle S3 based ESP32 with ST7735 80 x 160 TFT
#endif
#ifdef ESP32_CAM
#include <User_Setups/Setup212_ESP32Cam_DongleDisplay.h> // For the LilyGo T-Dongle S3 based ESP32 with ST7735 80 x 160 TFT
#endif
#ifdef NERMINER_S3_GEEK
#ifdef NERDMINER_S3_GEEK
#include <User_Setups/Setup303_WaveShare ESP32S3_GEEK.h> // Setup file for Waveshare Setup303_WaveShare ESP32S3_GEEK with ST7789 135*240 TFT
#endif
#ifdef M5STICK_C_PLUS2
#include <User_Setups/Setup304_M5StickCPlus2.h> // Setup file for ESP32 configured for ST7735 128 x 128 animated eyes
#endif
//#include <User_Setups/Setup301_BW16_ST7735.h> // Setup file for Bw16-based boards with ST7735 160 x 80 TFT
//#include <User_Setups/SetupX_Template.h> // Template file for a setup

View File

@ -0,0 +1,65 @@
// ST7789 135 x 240 display
#define USER_SETUP_ID 304
// #define DISABLE_ALL_LIBRARY_WARNINGS
#define ST7789_DRIVER
#define TFT_WIDTH 135
#define TFT_HEIGHT 240
#define TFT_BL 27
#define TFT_BACKLIGHT_ON HIGH
#define TFT_MISO -1
#define TFT_MOSI 15
#define TFT_SCLK 13
#define TFT_CS 5
#define TFT_DC 14
#define TFT_RST 12
#define CGRAM_OFFSET // Library will add offsets required
//#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
//#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
//#define TFT_INVERSION_ON
//#define TFT_INVERSION_OFF
// DSTIKE stepup
//#define TFT_DC 23
//#define TFT_RST 32
//#define TFT_MOSI 26
//#define TFT_SCLK 27
// Generic ESP32 setup
//#define TFT_MISO 19
//#define TFT_MOSI 23
//#define TFT_SCLK 18
//#define TFT_CS -1 // Not connected
//#define TFT_DC 2
//#define TFT_RST 4 // Connect reset to ensure display initialises
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SMOOTH_FONT
// #define SPI_FREQUENCY 27000000
#define SPI_FREQUENCY 40000000
#define SPI_READ_FREQUENCY 20000000
#define SPI_TOUCH_FREQUENCY 2500000
// #define SUPPORT_TRANSACTIONS

View File

@ -11,12 +11,45 @@
[platformio]
globallib_dir = lib
default_envs = NerdminerV2-T-HMI, wt32-sc01, wt32-sc01-plus, han_m5stack, M5Stick-C, esp32cam, ESP32-2432S028R, ESP32_2432S028_2USB, NerminerV2, Lilygo-T-Embed, ESP32-devKitv1, NerminerV2-S3-DONGLE, NerminerV2-S3-GEEK, NerminerV2-S3-AMOLED, NerminerV2-S3-AMOLED-TOUCH, NerminerV2-T-QT, NerdminerV2-T-Display_V1, ESP32-2432S028R, M5-StampS3, ESP32-S3-devKitv1, ESP32-S3-mini-wemos, ESP32-S2-mini-wemos, ESP32-S3-mini-weact, ESP32-D0WD-V3-weact, ESP32-C3-devKitmv1, ESP32-C3-super-mini
default_envs = NerdminerV2-T-HMI, wt32-sc01, wt32-sc01-plus, han_m5stack, M5Stick-C, esp32cam, ESP32-2432S028R, ESP32_2432S028_2USB, NerdminerV2, Lilygo-T-Embed, ESP32-devKitv1, NerdminerV2-S3-DONGLE, NerdminerV2-S3-GEEK, NerdminerV2-S3-AMOLED, NerdminerV2-S3-AMOLED-TOUCH, NerdminerV2-T-QT, NerdminerV2-T-Display_V1, ESP32-2432S028R, M5-StampS3, ESP32-S3-devKitv1, ESP32-S3-mini-wemos, ESP32-S2-mini-wemos, ESP32-S3-mini-weact, ESP32-D0WD-V3-weact, ESP32-C3-devKitmv1, ESP32-C3-super-mini
[env:M5Stick-C-Plus2]
platform = espressif32@6.6.0
board = m5stick-c-plus2
framework = arduino
monitor_filters =
esp32_exception_decoder
time
log2file
;board_build.arduino.memory_type = qio_opi
monitor_speed = 115200
upload_speed = 1500000
# 2 x 4.5MB app, 6.875MB SPIFFS
board_build.partitions = huge_app.csv
build_flags =
-D M5STICK_C_PLUS2=1
;-D DEBUG_MINING=1
lib_deps =
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
https://github.com/takkaO/OpenFontRender#v1.2
mathertel/OneButton@^2.5.0
arduino-libraries/NTPClient@^3.2.1
m5stack/M5StickCPlus2
lib_ignore =
SD
SD_MMC
rm67162
HANSOLOminerv2
;--------------------------------------------------------------------
[env:M5Stick-C]
platform = espressif32@6.6.0
board = m5stick-c
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -32,7 +65,7 @@ build_flags =
lib_deps =
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
m5stack/M5StickC@^0.2.5
lib_ignore =
@ -80,6 +113,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = esp-wrover-kit
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -94,7 +129,7 @@ lib_deps =
lovyan03/LovyanGFX@^1.1.12
https://github.com/tzapu/WiFiManager.git#v2.0.17
arduino-libraries/NTPClient@^3.2.1
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
build_flags =
-D BOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
@ -112,6 +147,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = esp32-s3-devkitc-1
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -128,7 +165,7 @@ lib_deps =
lovyan03/LovyanGFX@^1.1.12
https://github.com/tzapu/WiFiManager.git#v2.0.17
arduino-libraries/NTPClient@^3.2.1
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
build_flags =
-D BOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
@ -147,6 +184,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = lolin_s3_mini
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -166,9 +205,9 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
fastled/FastLED@^3.6.0
fastled/FastLED@3.7.8
lib_ignore =
TFT_eSPI
HANSOLOminerv2
@ -179,6 +218,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = m5stack-core-esp32
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -195,7 +236,7 @@ build_flags =
lib_deps =
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
m5stack/M5Stack@^0.4.6
lib_ignore =
@ -209,6 +250,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = lolin_s2_mini
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -226,7 +269,7 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
lib_ignore =
TFT_eSPI
@ -238,6 +281,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = lolin_s3_mini
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -257,9 +302,9 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
fastled/FastLED@^3.6.0
fastled/FastLED@3.7.8
lib_ignore =
TFT_eSPI
HANSOLOminerv2
@ -273,6 +318,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = esp32dev
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -290,7 +337,7 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
lib_ignore =
TFT_eSPI
@ -302,6 +349,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = seeed_xiao_esp32c3
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -320,7 +369,7 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
lib_ignore =
TFT_eSPI
@ -332,6 +381,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = esp32-c3-devkitm-1
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -350,9 +401,67 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
fastled/FastLED@^3.6.0
fastled/FastLED@3.7.8
lib_ignore =
TFT_eSPI
HANSOLOminerv2
;--------------------------------------------------------------------
[env:ESP32-C3-042-OLED]
platform = espressif32@6.6.0
board = esp32-c3-devkitm-1
framework = arduino
monitor_filters =
esp32_exception_decoder
time
log2file
monitor_speed = 115200
upload_speed = 115200
board_build.partitions = huge_app.csv
build_flags =
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1
-D ESP32_C3_042_OLED
-D PIN_BUTTON_1=9
lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
olikraus/U8g2@^2.34.17
lib_ignore =
TFT_eSPI
HANSOLOminerv2
;--------------------------------------------------------------------
[env:ESP32-S3-042-OLED]
platform = espressif32@6.6.0
board = esp32-s3-0.42oled
framework = arduino
monitor_filters =
esp32_exception_decoder
time
log2file
monitor_speed = 115200
upload_speed = 115200
board_build.partitions = huge_app.csv
build_flags =
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1
-D ESP32_S3_042_OLED
-D PIN_BUTTON_1=0
lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
olikraus/U8g2@^2.34.17
lib_ignore =
TFT_eSPI
HANSOLOminerv2
@ -363,6 +472,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = esp32-s3-devkitc-1
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -382,19 +493,21 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
fastled/FastLED@^3.6.0
fastled/FastLED@3.7.8
lib_ignore =
TFT_eSPI
HANSOLOminerv2
;--------------------------------------------------------------------
[env:NerminerV2]
[env:NerdminerV2]
platform = espressif32@6.6.0
board = esp32-s3-devkitc-1
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -418,7 +531,7 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
lib_ignore =
HANSOLOminerv2
@ -429,6 +542,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = esp32-s3-devkitc-1
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -452,7 +567,7 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
lib_ignore =
HANSOLOminerv2
@ -463,6 +578,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = esp32dev
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -479,7 +596,7 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
lib_ignore =
HANSOLOminerv2
@ -490,6 +607,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = esp32dev ;esp-wrover-kit
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -509,20 +628,22 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
lib_ignore =
HANSOLOminerv2
;--------------------------------------------------------------------
[env:NerminerV2-S3-AMOLED]
[env:NerdminerV2-S3-AMOLED]
platform = espressif32@6.6.0
board = lilygo-t-amoled
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
board_build.partitions = huge_app.csv
build_flags =
-DNERMINER_S3_AMOLED
-DNERDMINER_S3_AMOLED
-DTOUCH=0
-DBOARD_HAS_PSRAM
-DARDUINO_USB_CDC_ON_BOOT
@ -530,7 +651,7 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
https://github.com/golden-guy/Arduino_wolfssl.git#v5.5.4
lib_ignore =
@ -538,13 +659,15 @@ lib_ignore =
;--------------------------------------------------------------------
[env:NerminerV2-S3-AMOLED-TOUCH]
[env:NerdminerV2-S3-AMOLED-TOUCH]
platform = espressif32@6.6.0
board = lilygo-t-amoled
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
board_build.partitions = huge_app.csv
build_flags =
-DNERMINER_S3_AMOLED
-DNERDMINER_S3_AMOLED
-DTOUCH=1
-DBOARD_HAS_PSRAM
-DARDUINO_USB_CDC_ON_BOOT
@ -552,7 +675,7 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
https://github.com/golden-guy/Arduino_wolfssl.git#v5.5.4
lib_ignore =
@ -560,36 +683,40 @@ lib_ignore =
;--------------------------------------------------------------------
[env:NerminerV2-S3-DONGLE]
[env:NerdminerV2-S3-DONGLE]
platform = espressif32@6.6.0
board = esp32-s3-devkitc-1
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
board_build.partitions = huge_app.csv
build_flags =
-DNERMINER_S3_DONGLE
-DNERDMINER_S3_DONGLE
-DBOARD_HAS_PSRAM
-DARDUINO_USB_CDC_ON_BOOT
-DTFT_BACKLIGHT_ON=LOW
-DTFT_BACKLIGHT_ON=HIGH
-DTFT_BL=38
lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
fastled/FastLED@^3.6.0
fastled/FastLED@3.7.8
lib_ignore =
HANSOLOminerv2
;--------------------------------------------------------------------
[env:NerminerV2-S3-GEEK]
[env:NerdminerV2-S3-GEEK]
platform = espressif32@6.6.0
board = esp32-s3-devkitc-1
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
board_build.partitions = huge_app.csv
build_flags =
-DNERMINER_S3_GEEK
-DNERDMINER_S3_GEEK
-DBOARD_HAS_PSRAM
-DARDUINO_USB_CDC_ON_BOOT
-DTFT_BACKLIGHT_ON=HIGH
@ -602,7 +729,7 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
lib_ignore =
HANSOLOminerv2
@ -613,6 +740,8 @@ lib_ignore =
platform = espressif32@6.6.0 ;(ESP32-D0WD-V3)
board = esp32cam
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -630,7 +759,7 @@ build_flags =
lib_deps =
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
https://github.com/takkaO/OpenFontRender#v1.2
lib_ignore =
@ -638,10 +767,12 @@ lib_ignore =
;--------------------------------------------------------------------
[env:NerminerV2-T-QT]
[env:NerdminerV2-T-QT]
platform = espressif32@6.6.0
board = esp32-s3-t-qt-pro
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -651,12 +782,12 @@ monitor_speed = 115200
upload_speed = 115200
build_flags =
-D BOARD_HAS_PSRAM
-D NERMINER_T_QT=1
-D NERDMINER_T_QT=1
lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
lib_ignore =
HANSOLOminerv2
@ -671,6 +802,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = esp32dev
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_speed = 115200
upload_speed = 921600
;build_type = debug
@ -706,7 +839,7 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
bodmer/TFT_eSPI@^2.5.43
https://github.com/achillhasler/TFT_eTouch
@ -719,6 +852,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = esp32dev
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_speed = 115200
monitor_filters =
esp32_exception_decoder
@ -759,7 +894,7 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
bodmer/TFT_eSPI@^2.5.43
https://github.com/achillhasler/TFT_eTouch
@ -772,6 +907,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = lilygo-t-hmi
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
board_build.partitions = default_16MB.csv
monitor_filters =
esp32_exception_decoder
@ -809,6 +946,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = ttgo-lora32-v1
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_speed = 115200
upload_speed = 115200
board_build.partitions = huge_app.csv
@ -819,7 +958,7 @@ lib_deps =
https://github.com/takkaO/OpenFontRender#v1.2
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
https://github.com/arduino-libraries/NTPClient@^3.2.1
lib_ignore =
HANSOLOminerv2
@ -830,6 +969,8 @@ lib_ignore =
platform = espressif32@6.6.0
board = m5stack-stamps3
framework = arduino
extra_scripts =
pre:auto_firmware_version.py
monitor_filters =
esp32_exception_decoder
time
@ -845,9 +986,9 @@ build_flags =
lib_deps =
bblanchon/ArduinoJson@^6.21.5
https://github.com/tzapu/WiFiManager.git#v2.0.17
mathertel/OneButton@^2.5.0
mathertel/oneButton@^2.6.1
arduino-libraries/NTPClient@^3.2.1
fastled/FastLED@^3.6.0
fastled/FastLED@3.7.8
lib_ignore =
TFT_eSPI
SD

View File

@ -127,7 +127,7 @@ void setup()
/******** CREATE STRATUM TASK *****/
sprintf(name, "(%s)", "Stratum");
#ifdef ESP32_2432S028R
#if defined(ESP32_2432S028R) || defined(ESP32_2432S028_2USB)
// Free a little bit of the heap to the screen
BaseType_t res2 = xTaskCreatePinnedToCore(runStratumWorker, "Stratum", 13500, (void*)name, 3, NULL,1);
#else
@ -157,7 +157,7 @@ void app_error_fault_handler(void *arg) {
char *stack = (char *)arg;
// Print the stack errors in the console
esp_log_write(ESP_LOG_ERROR, "APP_ERROR", "Pila de errores:\n%s", stack);
esp_log_write(ESP_LOG_ERROR, "APP_ERROR", "Error Stack Code:\n%s", stack);
// restart ESP32
esp_restart();

View File

@ -0,0 +1,10 @@
#ifndef _M5_STICK_C_PLUS2_H
#define _M5_STICK_C_PLUS2_H
#define PIN_BUTTON_1 37
#define PIN_BUTTON_2 39
#define LED_PIN 19
#define V1_DISPLAY
#endif

View File

@ -7,13 +7,19 @@
#include "M5Stick-C.h"
#elif defined(M5STICK_CPLUS)
#include "M5Stick-CPlus.h"
#elif defined(M5STICK_C_PLUS2)
#include "M5Stick-C-Plus2.h"
#elif defined(DEVKITV1)
#include "esp32DevKit.h"
#elif defined(ESP32_C3_042_OLED)
#include "esp32C3042OLED.h"
#elif defined(ESP32_S3_042_OLED)
#include "esp32S3042OLED.h"
#elif defined(TDISPLAY)
#include "lilygoS3TDisplay.h"
#elif defined(NERMINER_S3_AMOLED)
#elif defined(NERDMINER_S3_AMOLED)
#include "lilygoS3Amoled.h"
#elif defined(NERMINER_S3_DONGLE)
#elif defined(NERDMINER_S3_DONGLE)
#include "lilygoS3Dongle.h"
#elif defined(LILYGO_S3_T_EMBED)
#include "lilygoS3TEmbed.h"
@ -21,7 +27,7 @@
#include "esp322432s028r.h"
#elif defined(ESP32_2432S028_2USB) // For another type of ESP32_2432S028 version with 2 USB connectors
#include "esp322432s028r.h"
#elif defined(NERMINER_T_QT)
#elif defined(NERDMINER_T_QT)
#include "lilygoT_QT.h"
#elif defined(NERDMINER_T_DISPLAY_V1)
#include "lilygoV1TDisplay.h"
@ -41,7 +47,7 @@
#include "m5stack.h"
#elif defined(WT32_BOARD)
#include "wt32.h"
#elif defined(NERMINER_S3_GEEK)
#elif defined(NERDMINER_S3_GEEK)
#include "waveshareS3Geek.h"
#elif defined(NERDMINER_T_HMI)
#include "lilygoT_HMI.h"

View File

@ -32,4 +32,7 @@
#define SDSPI_MOSI 23
#define SDSPI_MISO 19
// calls api to retrieve worker metrics
#define SCREEN_WORKERS_ENABLE (1)
#endif

View File

@ -0,0 +1,14 @@
#ifndef _ESP32_C3_042_OLED_H
#define _ESP32_C3_042_OLED_H
#ifndef SDA_PIN
#define SDA_PIN 5
#endif
#ifndef SCL_PIN
#define SCL_PIN 6
#endif
#define OLED_042_DISPLAY
#endif

View File

@ -0,0 +1,14 @@
#ifndef _ESP32_S3_042_OLED_H
#define _ESP32_S3_042_OLED_H
#ifndef SDA_PIN
#define SDA_PIN 41
#endif
#ifndef SCL_PIN
#define SCL_PIN 40
#endif
#define OLED_042_DISPLAY
#endif

View File

@ -37,10 +37,15 @@
#define TOUCH_ENABLE (1)
#define SDMMC_1BIT_FIX (1)
#define SD_FREQUENCY (20000)
// calls api to retrieve worker metrics
#define SCREEN_WORKERS_ENABLE (1)
// retrieve current btc fees data
#define SCREEN_FEES_ENABLE (1)
#ifndef TFT_BL
// XXX - defined in User_Setups/Setup207_LilyGo_T_HMI.h:37
#define TFT_BL (38) // LED back-light
#endif
#endif

View File

@ -16,6 +16,10 @@ DisplayDriver *currentDisplayDriver = &wt32DisplayDriver;
DisplayDriver *currentDisplayDriver = &ledDisplayDriver;
#endif
#ifdef OLED_042_DISPLAY
DisplayDriver *currentDisplayDriver = &oled042DisplayDriver;
#endif
#ifdef T_DISPLAY
DisplayDriver *currentDisplayDriver = &tDisplayDriver;
#endif

View File

@ -32,6 +32,7 @@ extern DisplayDriver m5stackDisplayDriver;
extern DisplayDriver wt32DisplayDriver;
extern DisplayDriver noDisplayDriver;
extern DisplayDriver ledDisplayDriver;
extern DisplayDriver oled042DisplayDriver;
extern DisplayDriver tDisplayDriver;
extern DisplayDriver amoledDisplayDriver;
extern DisplayDriver dongleDisplayDriver;

View File

@ -116,6 +116,10 @@ void dongleDisplay_AlternateRotation(void)
void dongleDisplay_MinerScreen(unsigned long mElapsed)
{
if (digitalRead(TFT_BL))
{
return;
}
max_y = BUFFER_HEIGHT;
mining_data data = getMiningData(mElapsed);
@ -144,6 +148,10 @@ void dongleDisplay_MinerScreen(unsigned long mElapsed)
void dongleDisplay_LoadingScreen(void)
{
if (digitalRead(TFT_BL))
{
return;
}
CLEAR_SCREEN();
PRINT_STR("Initializing...");
PUSH_SCREEN();
@ -151,6 +159,10 @@ void dongleDisplay_LoadingScreen(void)
void dongleDisplay_SetupScreen(void)
{
if (digitalRead(TFT_BL))
{
return;
}
CLEAR_SCREEN();
PRINT_STR("Use WiFi for setup...");
PUSH_SCREEN();
@ -158,6 +170,10 @@ void dongleDisplay_SetupScreen(void)
void dongleDisplay_AnimateCurrentScreen(unsigned long frame)
{
if (digitalRead(TFT_BL))
{
return;
}
if (pos_y > max_y)
{
pos_y = 0;

View File

@ -75,6 +75,12 @@ void esp32_2432S028R_Init(void)
TFT_eTouchBase::Calibation calibation = { 233, 3785, 3731, 120, 2 };
touch.setCalibration(calibation);
// Configuring screen backlight brightness using ledcontrol channel 0.
// Using 5000Hz in 8bit resolution, which gives 0-255 possible duty cycle setting.
ledcSetup(0, 5000, 8);
ledcAttachPin(TFT_BL, 0);
ledcWrite(0, Settings.Brightness);
//background.createSprite(WIDTH, HEIGHT); // Background Sprite
//background.setSwapBytes(true);
@ -103,9 +109,14 @@ void esp32_2432S028R_Init(void)
void esp32_2432S028R_AlternateScreenState(void)
{
int screen_state = digitalRead(TFT_BL);
Serial.println("Switching display state");
digitalWrite(TFT_BL, !screen_state);
int screen_state_duty = ledcRead(0);
// Switching the duty cycle for the ledc channel, where the TFT_BL pin is attached.
if (screen_state_duty > 0) {
ledcWrite(0, 0);
} else {
ledcWrite(0, Settings.Brightness);
}
}
void esp32_2432S028R_AlternateRotation(void)
@ -533,6 +544,10 @@ void esp32_2432S028R_DoLedStuff(unsigned long frame)
if (((t_x > 109)&&(t_x < 211)) && ((t_y > 185)&&(t_y < 241))) {
bottomScreenBlue ^= true;
hasChangedScreen = true;
} else if((t_x > 235) && ((t_y > 0)&&(t_y < 16))) {
// Touching the top right corner of the screen, roughly in the gray status label.
// Disabling the screen backlight.
esp32_2432S028R_AlternateScreenState();
}
else
if (t_x > 160) {

View File

@ -0,0 +1,156 @@
#include "displayDriver.h"
#ifdef OLED_042_DISPLAY
#include <U8g2lib.h>
#include "monitor.h"
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
static uint8_t btc_icon[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0xFF, 0x3F, 0x00,
0x80, 0xFF, 0x7F, 0x00, 0xC0, 0xFF, 0xFF, 0x00, 0xE0, 0x3F, 0xFF, 0x01,
0xF0, 0x3F, 0xFF, 0x03, 0xF0, 0x0F, 0xFC, 0x03, 0xF0, 0x0F, 0xF8, 0x03,
0xF8, 0xCF, 0xF9, 0x07, 0xF8, 0xCF, 0xF9, 0x07, 0xF8, 0x0F, 0xFC, 0x07,
0xF8, 0x0F, 0xF8, 0x07, 0xF8, 0xCF, 0xF9, 0x07, 0xF8, 0xCF, 0xF9, 0x07,
0xF0, 0x0F, 0xF8, 0x03, 0xF0, 0x0F, 0xFC, 0x03, 0xF0, 0x3F, 0xFF, 0x03,
0xE0, 0x3F, 0xFF, 0x01, 0xC0, 0xFF, 0xFF, 0x00, 0x80, 0xFF, 0x7F, 0x00,
0x00, 0xFF, 0x3F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0xF0, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static uint8_t setup_icon[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xE0, 0x01, 0x00,
0x00, 0xF0, 0x03, 0x00, 0xC0, 0xF0, 0xC3, 0x00, 0xE0, 0xF9, 0xE3, 0x01,
0xF0, 0xFF, 0xFF, 0x03, 0xF0, 0xFF, 0xFF, 0x03, 0xE0, 0xFF, 0xFF, 0x01,
0xC0, 0xFF, 0xFF, 0x00, 0xC0, 0xFF, 0xFF, 0x00, 0xE0, 0x1F, 0xFE, 0x00,
0xF8, 0x0F, 0xFC, 0x07, 0xFE, 0x07, 0xF8, 0x1F, 0xFE, 0x07, 0xF8, 0x1F,
0xFE, 0x07, 0xF8, 0x1F, 0xFE, 0x07, 0xF8, 0x1F, 0xF8, 0x0F, 0xFC, 0x07,
0xE0, 0x1F, 0xFE, 0x00, 0xC0, 0xFF, 0xFF, 0x00, 0xC0, 0xFF, 0xFF, 0x00,
0xE0, 0xFF, 0xFF, 0x01, 0xF0, 0xFF, 0xFF, 0x03, 0xF0, 0xFF, 0xFF, 0x03,
0xE0, 0xF9, 0xE3, 0x01, 0xC0, 0xF0, 0xC3, 0x00, 0x00, 0xF0, 0x03, 0x00,
0x00, 0xE0, 0x01, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
};
U8G2_SSD1306_72X40_ER_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
void clearScreen(void) {
u8g2.clearBuffer();
u8g2.sendBuffer();
}
void serialPrint(unsigned long mElapsed) {
mining_data data = getMiningData(mElapsed);
// Print hashrate to serial
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
// Print extended data to serial for no display devices
Serial.printf(">>> Valid blocks: %s\n", data.valids.c_str());
Serial.printf(">>> Block templates: %s\n", data.templates.c_str());
Serial.printf(">>> Best difficulty: %s\n", data.bestDiff.c_str());
Serial.printf(">>> 32Bit shares: %s\n", data.completedShares.c_str());
Serial.printf(">>> Temperature: %s\n", data.temp.c_str());
Serial.printf(">>> Total MHashes: %s\n", data.totalMHashes.c_str());
Serial.printf(">>> Time mining: %s\n", data.timeMining.c_str());
}
void oledDisplay_Init(void)
{
Serial.println("OLED 0.42 display driver initialized");
Wire.begin(SDA_PIN, SCL_PIN);
u8g2.begin();
u8g2.clear();
u8g2.setFlipMode(1);
clearScreen();
}
void oledDisplay_AlternateScreenState(void)
{
Serial.println("Switching display state");
}
void oledDisplay_AlternateRotation(void)
{
}
void oledDisplay_Screen1(unsigned long mElapsed)
{
mining_data data = getMiningData(mElapsed);
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_helvB18_tf);
u8g2.drawStr(0, 20, data.currentHashRate.c_str());
u8g2.setFont(u8g2_font_helvB08_tf);
u8g2.drawStr(45, 36, "KH/s");
u8g2.sendBuffer();
serialPrint(mElapsed);
}
void oledDisplay_Screen2(unsigned long mElapsed)
{
mining_data data = getMiningData(mElapsed);
char temp[8];
sprintf(temp, "%s°c", data.temp.c_str());
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_helvB18_tf);
u8g2.drawUTF8(0, 20, temp);
u8g2.sendBuffer();
serialPrint(mElapsed);
}
void oledDisplay_LoadingScreen(void)
{
Serial.println("Initializing...");
u8g2.clearBuffer();
u8g2.drawXBMP(20,5,30,30, btc_icon);
u8g2.sendBuffer();
}
void oledDisplay_SetupScreen(void)
{
Serial.println("Setup...");
u8g2.clearBuffer();
u8g2.drawXBMP(20,0,30,30, setup_icon);
u8g2.setFont(u8g2_font_helvB08_tf);
u8g2.drawUTF8(20, 38, "Setup");
u8g2.sendBuffer();
}
void oledDisplay_DoLedStuff(unsigned long frame)
{
}
void oledDisplay_AnimateCurrentScreen(unsigned long frame)
{
}
CyclicScreenFunction oledDisplayCyclicScreens[] = {oledDisplay_Screen1, oledDisplay_Screen2};
DisplayDriver oled042DisplayDriver = {
oledDisplay_Init,
oledDisplay_AlternateScreenState,
oledDisplay_AlternateRotation,
oledDisplay_LoadingScreen,
oledDisplay_SetupScreen,
oledDisplayCyclicScreens,
oledDisplay_AnimateCurrentScreen,
oledDisplay_DoLedStuff,
SCREENS_ARRAY_SIZE(oledDisplayCyclicScreens),
0,
0,
0,
};
#endif

View File

@ -323,10 +323,12 @@ void wt32Display_NoScreen(unsigned long mElapsed)
void wt32Display_LoadingScreen(void)
{
Serial.println("Initializing...");
Serial.print("Firmware Version: ");
Serial.println(AUTO_VERSION);
lv_label_set_text(ui_lblssid, "SSID HanSoloAP");
lv_label_set_text(ui_lblpassword, "Password MineYourCoins");
lv_label_set_text(ui_lblversion, "Version 1.6.4 (RC1)");
_ui_screen_change(&ui_HomeScreen, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0, &ui_HomeScreen_screen_init);
lv_label_set_text(ui_lblversion, AUTO_VERSION);
_ui_screen_change(&ui_HomeScreen, LV_SCR_LOAD_ANIM_FADE_ON, 2000, 0, &ui_HomeScreen_screen_init);
}
void wt32Display_SetupScreen(void)

View File

@ -128,6 +128,11 @@ bool SDCard::loadConfigFile(TSettings* Settings)
} else {
Settings->invertColors = false;
}
if (json.containsKey(JSON_KEY_BRIGHTNESS)) {
Settings->Brightness = json[JSON_KEY_BRIGHTNESS].as<int>();
} else {
Settings->Brightness = 250;
}
// Serial.printf("Carteira Lida SD:%s\n", Settings.BtcWallet);
Serial.printf("Carteira Lida SDs:%s\n", Settings->BtcWallet);
return true;

View File

@ -36,6 +36,7 @@ bool nvMemory::saveConfig(TSettings* Settings)
json[JSON_SPIFFS_KEY_TIMEZONE] = Settings->Timezone;
json[JSON_SPIFFS_KEY_STATS2NV] = Settings->saveStats;
json[JSON_SPIFFS_KEY_INVCOLOR] = Settings->invertColors;
json[JSON_SPIFFS_KEY_BRIGHTNESS] = Settings->Brightness;
// Open config file
File configFile = SPIFFS.open(JSON_CONFIG_FILE, "w");
@ -103,6 +104,11 @@ bool nvMemory::loadConfig(TSettings* Settings)
} else {
Settings->invertColors = false;
}
if (json.containsKey(JSON_SPIFFS_KEY_BRIGHTNESS)) {
Settings->Brightness = json[JSON_SPIFFS_KEY_BRIGHTNESS].as<int>();
} else {
Settings->Brightness = 250;
}
return true;
}
else

View File

@ -19,6 +19,7 @@
#define DEFAULT_TIMEZONE 2
#define DEFAULT_SAVESTATS false
#define DEFAULT_INVERTCOLORS false
#define DEFAULT_BRIGHTNESS 250
// JSON config files
#define JSON_CONFIG_FILE "/config.json"
@ -33,6 +34,7 @@
#define JSON_KEY_TIMEZONE "Timezone"
#define JSON_KEY_STATS2NV "SaveStats"
#define JSON_KEY_INVCOLOR "invertColors"
#define JSON_KEY_BRIGHTNESS "Brightness"
// JSON config file SPIFFS (different for backward compatibility with existing devices)
#define JSON_SPIFFS_KEY_POOLURL "poolString"
@ -42,6 +44,7 @@
#define JSON_SPIFFS_KEY_TIMEZONE "gmtZone"
#define JSON_SPIFFS_KEY_STATS2NV "saveStatsToNVS"
#define JSON_SPIFFS_KEY_INVCOLOR "invertColors"
#define JSON_SPIFFS_KEY_BRIGHTNESS "Brightness"
// settings
struct TSettings
@ -55,6 +58,7 @@ struct TSettings
int Timezone{ DEFAULT_TIMEZONE };
bool saveStats{ DEFAULT_SAVESTATS };
bool invertColors{ DEFAULT_INVERTCOLORS };
int Brightness{ DEFAULT_BRIGHTNESS };
};
#endif // _STORAGE_H_

View File

@ -8,6 +8,7 @@
#include "utils.h"
#include "monitor.h"
#include "drivers/storage/storage.h"
#include "drivers/devices/device.h"
extern uint32_t templates;
extern uint32_t hashes;
@ -46,7 +47,7 @@ void setup_monitor(void){
timeClient.setTimeOffset(3600 * Settings.Timezone);
Serial.println("TimeClient setup done");
#ifdef NERDMINER_T_HMI
#ifdef SCREEN_WORKERS_ENABLE
poolAPIUrl = getPoolAPIUrl();
Serial.println("poolAPIUrl: " + poolAPIUrl);
#endif
@ -98,7 +99,7 @@ void updateGlobalData(void){
deserializeJson(doc, payload);
String temp = "";
if (doc.containsKey("halfHourFee")) gData.halfHourFee = doc["halfHourFee"].as<int>();
#ifdef NERDMINER_T_HMI
#ifdef SCREEN_FEES_ENABLE
if (doc.containsKey("fastestFee")) gData.fastestFee = doc["fastestFee"].as<int>();
if (doc.containsKey("hourFee")) gData.hourFee = doc["hourFee"].as<int>();
if (doc.containsKey("economyFee")) gData.economyFee = doc["economyFee"].as<int>();
@ -152,7 +153,7 @@ String getBTCprice(void){
if((mBTCUpdate == 0) || (millis() - mBTCUpdate > UPDATE_BTC_min * 60 * 1000)){
if (WiFi.status() != WL_CONNECTED) return (String(bitcoin_price) + "$");
if (WiFi.status() != WL_CONNECTED) return "$" + String(bitcoin_price);
HTTPClient http;
try {
@ -164,7 +165,7 @@ String getBTCprice(void){
DynamicJsonDocument doc(1024);
deserializeJson(doc, payload);
if (doc.containsKey("last_trade_price")) bitcoin_price = doc["last_trade_price"];
if (doc.containsKey("data") && doc["data"].containsKey("amount")) bitcoin_price = doc["data"]["amount"];
doc.clear();
@ -177,7 +178,7 @@ String getBTCprice(void){
}
}
return (String(bitcoin_price) + "$");
return "$" + String(bitcoin_price);
}
unsigned long mTriggerUpdate = 0;
@ -305,7 +306,7 @@ coin_data getCoinData(unsigned long mElapsed)
data.currentHashRate = getCurrentHashRate(mElapsed);
data.btcPrice = getBTCprice();
data.currentTime = getTime();
#ifdef NERDMINER_T_HMI
#ifdef SCREEN_FEES_ENABLE
data.hourFee = String(gData.hourFee);
data.fastestFee = String(gData.fastestFee);
data.economyFee = String(gData.economyFee);
@ -364,7 +365,7 @@ pool_data getPoolData(void){
String btcWallet = Settings.BtcWallet;
// Serial.println(btcWallet);
if (btcWallet.indexOf(".")>0) btcWallet = btcWallet.substring(0,btcWallet.indexOf("."));
#ifdef NERDMINER_T_HMI
#ifdef SCREEN_WORKERS_ENABLE
Serial.println("Pool API : " + poolAPIUrl+btcWallet);
http.begin(poolAPIUrl+btcWallet);
#else

View File

@ -13,7 +13,7 @@
#define UPDATE_PERIOD_h 5
//API BTC price (Update to USDT cus it's more liquidity and flow price updade)
#define getBTCAPI "https://api.blockchain.com/v3/exchange/tickers/BTC-USDT"
#define getBTCAPI "https://api.coinbase.com/v2/prices/BTC-USD/spot"
#define UPDATE_BTC_min 1
//API Block height

View File

@ -179,7 +179,7 @@ void init_WifiManager()
wm.addParameter(&time_text_box_num);
wm.addParameter(&features_html);
wm.addParameter(&save_stats_to_nvs);
#ifdef ESP32_2432S028R
#if defined(ESP32_2432S028R) || defined(ESP32_2432S028_2USB)
char checkboxParams2[24] = "type=\"checkbox\"";
if (Settings.invertColors)
{
@ -187,6 +187,13 @@ void init_WifiManager()
}
WiFiManagerParameter invertColors("inverColors", "Invert Display Colors (if the colors looks weird)", "T", 2, checkboxParams2, WFM_LABEL_AFTER);
wm.addParameter(&invertColors);
#endif
#if defined(ESP32_2432S028R) || defined(ESP32_2432S028_2USB)
char brightnessConvValue[2];
sprintf(brightnessConvValue, "%d", Settings.Brightness);
// Text box (Number) - 3 characters maximum
WiFiManagerParameter brightness_text_box_num("Brightness", "Screen backlight Duty Cycle (0-255)", brightnessConvValue, 3);
wm.addParameter(&brightness_text_box_num);
#endif
Serial.println("AllDone: ");
@ -208,9 +215,12 @@ void init_WifiManager()
Settings.Timezone = atoi(time_text_box_num.getValue());
//Serial.println(save_stats_to_nvs.getValue());
Settings.saveStats = (strncmp(save_stats_to_nvs.getValue(), "T", 1) == 0);
#ifdef ESP32_2432S028R
#if defined(ESP32_2432S028R) || defined(ESP32_2432S028_2USB)
Settings.invertColors = (strncmp(invertColors.getValue(), "T", 1) == 0);
#endif
#if defined(ESP32_2432S028R) || defined(ESP32_2432S028_2USB)
Settings.Brightness = atoi(brightness_text_box_num.getValue());
#endif
nvMem.saveConfig(&Settings);
delay(3*SECOND_MS);
//reset and try again, or maybe put it to deep sleep
@ -238,9 +248,12 @@ void init_WifiManager()
Settings.Timezone = atoi(time_text_box_num.getValue());
// Serial.println(save_stats_to_nvs.getValue());
Settings.saveStats = (strncmp(save_stats_to_nvs.getValue(), "T", 1) == 0);
#ifdef ESP32_2432S028R
#if defined(ESP32_2432S028R) || defined(ESP32_2432S028_2USB)
Settings.invertColors = (strncmp(invertColors.getValue(), "T", 1) == 0);
#endif
#if defined(ESP32_2432S028R) || defined(ESP32_2432S028_2USB)
Settings.Brightness = atoi(brightness_text_box_num.getValue());
#endif
nvMem.saveConfig(&Settings);
vTaskDelay(2000 / portTICK_PERIOD_MS);
}
@ -284,21 +297,30 @@ void init_WifiManager()
Serial.print("TimeZone fromUTC: ");
Serial.println(Settings.Timezone);
#ifdef ESP32_2432S028R
#if defined(ESP32_2432S028R) || defined(ESP32_2432S028_2USB)
Settings.invertColors = (strncmp(invertColors.getValue(), "T", 1) == 0);
Serial.print("Invert Colors: ");
Serial.println(Settings.invertColors);
#endif
#if defined(ESP32_2432S028R) || defined(ESP32_2432S028_2USB)
Settings.Brightness = atoi(brightness_text_box_num.getValue());
Serial.print("Brightness: ");
Serial.println(Settings.Brightness);
#endif
}
// Save the custom parameters to FS
if (shouldSaveConfig)
{
nvMem.saveConfig(&Settings);
#ifdef ESP32_2432S028R
#if defined(ESP32_2432S028R) || defined(ESP32_2432S028_2USB)
if (Settings.invertColors) ESP.restart();
#endif
#if defined(ESP32_2432S028R) || defined(ESP32_2432S028_2USB)
if (Settings.Brightness != 250) ESP.restart();
#endif
}
}