diff --git a/.gitignore b/.gitignore index f7eadc5..5db995f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea/ .pio .vscode .vs diff --git a/3d_files/NerdMinerv2_SecurePins.stl b/3d_files/NerdMinerv2_SecurePins.stl new file mode 100644 index 0000000..e5c41f2 Binary files /dev/null and b/3d_files/NerdMinerv2_SecurePins.stl differ diff --git a/README.md b/README.md index 811fe96..3d30a3c 100644 --- a/README.md +++ b/README.md @@ -48,10 +48,19 @@ Every time an stratum job notification is received miner update its current work - LILYGO T-QT pro ([Aliexpress link\*](https://s.click.aliexpress.com/e/_DBQIr43)) - LILYGO T-Display 1.14 ([Aliexpress link\*](https://s.click.aliexpress.com/e/_DEqGvSJ)) - LILYGO T-Display S3 AMOLED ([Aliexpress link\*](https://s.click.aliexpress.com/e/_DmOIK6j)) +- LILYGO T-Display S3 AMOLED Touch ([Board Info](https://www.lilygo.cc/products/t-display-s3-amoled?variant=43532279939253)) - LILYGO T-Dongle S3 ([Aliexpress link\*](https://s.click.aliexpress.com/e/_DmQCPyj)) - ESP32-2432S028R 2,8" ([Aliexpress link\*](https://s.click.aliexpress.com/e/_DdXkvLv) / Dev support: @nitroxgas / ⚡jadeddonald78@walletofsatoshi.com) - ESP32-cam ([Board Info](https://lastminuteengineers.com/getting-started-with-esp32-cam/) / Dev support: @elmo128) - M5-StampS3 ([Aliexpress link\*](https://s.click.aliexpress.com/e/_DevABY3) / Dev support: @gyengus) +- Wemos Lolin S3 Mini ([Board Info](https://docs.platformio.org/en/latest/boards/espressif32/lolin_s3_mini.html)) +- Wemos Lolin S2 Mini ([Board Info](https://docs.platformio.org/en/latest/boards/espressif32/lolin_s2_mini.html)) +- Weact S3 Mini ([Board Info](https://github.com/WeActStudio/WeActStudio.ESP32S3-MINI)) +- Weact ESP32-D0WD-V3 ([Board Info](https://github.com/WeActStudio/WeActStudio.ESP32CoreBoard)) +- ESP32-S3 Devkit ([Board Info](https://docs.platformio.org/en/latest/boards/espressif32/esp32-s3-devkitm-1.html)) +- ESP32-C3 Devkit ([Board Info](https://docs.platformio.org/en/latest/boards/espressif32/esp32-c3-devkitm-1.html)) +- ESP32-C3 Super Mini ([Board Info](https://docs.platformio.org/en/latest/boards/espressif32/seeed_xiao_esp32c3.html)) +- Waveshare ESP32-S3-GEEK ([Board Info](https://www.waveshare.com/wiki/ESP32-S3-GEEK)) \*Affiliate links diff --git a/bin/bin ESP32-C3-devKitmv1/0x10000_firmware.bin b/bin/bin ESP32-C3-devKitmv1/0x10000_firmware.bin new file mode 100644 index 0000000..5217412 Binary files /dev/null and b/bin/bin ESP32-C3-devKitmv1/0x10000_firmware.bin differ diff --git a/bin/bin ESP32-C3-devKitmv1/0x1000_bootloader.bin b/bin/bin ESP32-C3-devKitmv1/0x1000_bootloader.bin new file mode 100644 index 0000000..46eca11 Binary files /dev/null and b/bin/bin ESP32-C3-devKitmv1/0x1000_bootloader.bin differ diff --git a/bin/bin ESP32-C3-devKitmv1/0x8000_partitions.bin b/bin/bin ESP32-C3-devKitmv1/0x8000_partitions.bin new file mode 100644 index 0000000..1954582 Binary files /dev/null and b/bin/bin ESP32-C3-devKitmv1/0x8000_partitions.bin differ diff --git a/bin/bin ESP32-C3-devKitmv1/0xe000_boot_app0.bin b/bin/bin ESP32-C3-devKitmv1/0xe000_boot_app0.bin new file mode 100644 index 0000000..13562ca Binary files /dev/null and b/bin/bin ESP32-C3-devKitmv1/0xe000_boot_app0.bin differ diff --git a/bin/bin ESP32-C3-super-mini/0x10000_firmware.bin b/bin/bin ESP32-C3-super-mini/0x10000_firmware.bin new file mode 100644 index 0000000..ba272db Binary files /dev/null and b/bin/bin ESP32-C3-super-mini/0x10000_firmware.bin differ diff --git a/bin/bin ESP32-C3-super-mini/0x1000_bootloader.bin b/bin/bin ESP32-C3-super-mini/0x1000_bootloader.bin new file mode 100644 index 0000000..46eca11 Binary files /dev/null and b/bin/bin ESP32-C3-super-mini/0x1000_bootloader.bin differ diff --git a/bin/bin ESP32-C3-super-mini/0x8000_partitions.bin b/bin/bin ESP32-C3-super-mini/0x8000_partitions.bin new file mode 100644 index 0000000..1954582 Binary files /dev/null and b/bin/bin ESP32-C3-super-mini/0x8000_partitions.bin differ diff --git a/bin/bin ESP32-C3-super-mini/0xe000_boot_app0.bin b/bin/bin ESP32-C3-super-mini/0xe000_boot_app0.bin new file mode 100644 index 0000000..13562ca Binary files /dev/null and b/bin/bin ESP32-C3-super-mini/0xe000_boot_app0.bin differ diff --git a/bin/bin ESP32-D0WD-V3-weact/0x10000_firmware.bin b/bin/bin ESP32-D0WD-V3-weact/0x10000_firmware.bin new file mode 100644 index 0000000..87ae58f Binary files /dev/null and b/bin/bin ESP32-D0WD-V3-weact/0x10000_firmware.bin differ diff --git a/bin/bin ESP32-D0WD-V3-weact/0x1000_bootloader.bin b/bin/bin ESP32-D0WD-V3-weact/0x1000_bootloader.bin new file mode 100644 index 0000000..c854f40 Binary files /dev/null and b/bin/bin ESP32-D0WD-V3-weact/0x1000_bootloader.bin differ diff --git a/bin/bin ESP32-D0WD-V3-weact/0x8000_partitions.bin b/bin/bin ESP32-D0WD-V3-weact/0x8000_partitions.bin new file mode 100644 index 0000000..1954582 Binary files /dev/null and b/bin/bin ESP32-D0WD-V3-weact/0x8000_partitions.bin differ diff --git a/bin/bin ESP32-D0WD-V3-weact/0xe000_boot_app0.bin b/bin/bin ESP32-D0WD-V3-weact/0xe000_boot_app0.bin new file mode 100644 index 0000000..13562ca Binary files /dev/null and b/bin/bin ESP32-D0WD-V3-weact/0xe000_boot_app0.bin differ diff --git a/bin/bin ESP32-S2-mini-wemos/0x10000_firmware.bin b/bin/bin ESP32-S2-mini-wemos/0x10000_firmware.bin new file mode 100644 index 0000000..ffc2ab0 Binary files /dev/null and b/bin/bin ESP32-S2-mini-wemos/0x10000_firmware.bin differ diff --git a/bin/bin ESP32-S2-mini-wemos/0x1000_bootloader.bin b/bin/bin ESP32-S2-mini-wemos/0x1000_bootloader.bin new file mode 100644 index 0000000..d757bc3 Binary files /dev/null and b/bin/bin ESP32-S2-mini-wemos/0x1000_bootloader.bin differ diff --git a/bin/bin ESP32-S2-mini-wemos/0x8000_partitions.bin b/bin/bin ESP32-S2-mini-wemos/0x8000_partitions.bin new file mode 100644 index 0000000..1954582 Binary files /dev/null and b/bin/bin ESP32-S2-mini-wemos/0x8000_partitions.bin differ diff --git a/bin/bin ESP32-S2-mini-wemos/0xe000_boot_app0.bin b/bin/bin ESP32-S2-mini-wemos/0xe000_boot_app0.bin new file mode 100644 index 0000000..13562ca Binary files /dev/null and b/bin/bin ESP32-S2-mini-wemos/0xe000_boot_app0.bin differ diff --git a/bin/bin ESP32-S3-devKitv1/0x10000_firmware.bin b/bin/bin ESP32-S3-devKitv1/0x10000_firmware.bin new file mode 100644 index 0000000..f45a5af Binary files /dev/null and b/bin/bin ESP32-S3-devKitv1/0x10000_firmware.bin differ diff --git a/bin/bin ESP32-S3-devKitv1/0x1000_bootloader.bin b/bin/bin ESP32-S3-devKitv1/0x1000_bootloader.bin new file mode 100644 index 0000000..27d593a Binary files /dev/null and b/bin/bin ESP32-S3-devKitv1/0x1000_bootloader.bin differ diff --git a/bin/bin ESP32-S3-devKitv1/0x8000_partitions.bin b/bin/bin ESP32-S3-devKitv1/0x8000_partitions.bin new file mode 100644 index 0000000..1954582 Binary files /dev/null and b/bin/bin ESP32-S3-devKitv1/0x8000_partitions.bin differ diff --git a/bin/bin ESP32-S3-devKitv1/0xe000_boot_app0.bin b/bin/bin ESP32-S3-devKitv1/0xe000_boot_app0.bin new file mode 100644 index 0000000..13562ca Binary files /dev/null and b/bin/bin ESP32-S3-devKitv1/0xe000_boot_app0.bin differ diff --git a/bin/bin ESP32-S3-mini-weact/0x10000_firmware.bin b/bin/bin ESP32-S3-mini-weact/0x10000_firmware.bin new file mode 100644 index 0000000..064b50b Binary files /dev/null and b/bin/bin ESP32-S3-mini-weact/0x10000_firmware.bin differ diff --git a/bin/bin ESP32-S3-mini-weact/0x1000_bootloader.bin b/bin/bin ESP32-S3-mini-weact/0x1000_bootloader.bin new file mode 100644 index 0000000..3f49ba6 Binary files /dev/null and b/bin/bin ESP32-S3-mini-weact/0x1000_bootloader.bin differ diff --git a/bin/bin ESP32-S3-mini-weact/0x8000_partitions.bin b/bin/bin ESP32-S3-mini-weact/0x8000_partitions.bin new file mode 100644 index 0000000..1954582 Binary files /dev/null and b/bin/bin ESP32-S3-mini-weact/0x8000_partitions.bin differ diff --git a/bin/bin ESP32-S3-mini-weact/0xe000_boot_app0.bin b/bin/bin ESP32-S3-mini-weact/0xe000_boot_app0.bin new file mode 100644 index 0000000..13562ca Binary files /dev/null and b/bin/bin ESP32-S3-mini-weact/0xe000_boot_app0.bin differ diff --git a/bin/bin ESP32-S3-mini-wemos/0x10000_firmware.bin b/bin/bin ESP32-S3-mini-wemos/0x10000_firmware.bin new file mode 100644 index 0000000..3ad9a7a Binary files /dev/null and b/bin/bin ESP32-S3-mini-wemos/0x10000_firmware.bin differ diff --git a/bin/bin ESP32-S3-mini-wemos/0x1000_bootloader.bin b/bin/bin ESP32-S3-mini-wemos/0x1000_bootloader.bin new file mode 100644 index 0000000..3f49ba6 Binary files /dev/null and b/bin/bin ESP32-S3-mini-wemos/0x1000_bootloader.bin differ diff --git a/bin/bin ESP32-S3-mini-wemos/0x8000_partitions.bin b/bin/bin ESP32-S3-mini-wemos/0x8000_partitions.bin new file mode 100644 index 0000000..1954582 Binary files /dev/null and b/bin/bin ESP32-S3-mini-wemos/0x8000_partitions.bin differ diff --git a/bin/bin ESP32-S3-mini-wemos/0xe000_boot_app0.bin b/bin/bin ESP32-S3-mini-wemos/0xe000_boot_app0.bin new file mode 100644 index 0000000..13562ca Binary files /dev/null and b/bin/bin ESP32-S3-mini-wemos/0xe000_boot_app0.bin differ diff --git a/bin/bin LILYGO TDisplay-AMOLED-TOUCH/0x0000_bootloader.bin b/bin/bin LILYGO TDisplay-AMOLED-TOUCH/0x0000_bootloader.bin new file mode 100644 index 0000000..fcf755e Binary files /dev/null and b/bin/bin LILYGO TDisplay-AMOLED-TOUCH/0x0000_bootloader.bin differ diff --git a/bin/bin LILYGO TDisplay-AMOLED-TOUCH/0x10000_firmware.bin b/bin/bin LILYGO TDisplay-AMOLED-TOUCH/0x10000_firmware.bin new file mode 100644 index 0000000..887e07d Binary files /dev/null and b/bin/bin LILYGO TDisplay-AMOLED-TOUCH/0x10000_firmware.bin differ diff --git a/bin/bin LILYGO TDisplay-AMOLED-TOUCH/0x8000_partitions.bin b/bin/bin LILYGO TDisplay-AMOLED-TOUCH/0x8000_partitions.bin new file mode 100644 index 0000000..1954582 Binary files /dev/null and b/bin/bin LILYGO TDisplay-AMOLED-TOUCH/0x8000_partitions.bin differ diff --git a/bin/bin LILYGO TDisplay-AMOLED-TOUCH/0xe000_boot_app0.bin b/bin/bin LILYGO TDisplay-AMOLED-TOUCH/0xe000_boot_app0.bin new file mode 100644 index 0000000..13562ca Binary files /dev/null and b/bin/bin LILYGO TDisplay-AMOLED-TOUCH/0xe000_boot_app0.bin differ diff --git a/bin/bin Waveshare S3 Geek/0x0000_bootloader.bin b/bin/bin Waveshare S3 Geek/0x0000_bootloader.bin new file mode 100644 index 0000000..27d593a Binary files /dev/null and b/bin/bin Waveshare S3 Geek/0x0000_bootloader.bin differ diff --git a/bin/bin Waveshare S3 Geek/0x10000_firmware.bin b/bin/bin Waveshare S3 Geek/0x10000_firmware.bin new file mode 100644 index 0000000..0727ae5 Binary files /dev/null and b/bin/bin Waveshare S3 Geek/0x10000_firmware.bin differ diff --git a/bin/bin Waveshare S3 Geek/0x8000_partitions.bin b/bin/bin Waveshare S3 Geek/0x8000_partitions.bin new file mode 100644 index 0000000..1954582 Binary files /dev/null and b/bin/bin Waveshare S3 Geek/0x8000_partitions.bin differ diff --git a/bin/bin Waveshare S3 Geek/0xe000_boot_app0.bin b/bin/bin Waveshare S3 Geek/0xe000_boot_app0.bin new file mode 100644 index 0000000..13562ca Binary files /dev/null and b/bin/bin Waveshare S3 Geek/0xe000_boot_app0.bin differ diff --git a/lib/TFT_eSPI/User_Setup_Select.h b/lib/TFT_eSPI/User_Setup_Select.h index a96ff51..f9ca1b7 100644 --- a/lib/TFT_eSPI/User_Setup_Select.h +++ b/lib/TFT_eSPI/User_Setup_Select.h @@ -154,6 +154,9 @@ #ifdef ESP32_CAM #include // For the LilyGo T-Dongle S3 based ESP32 with ST7735 80 x 160 TFT #endif +#ifdef NERMINER_S3_GEEK +#include // Setup file for Waveshare Setup303_WaveShare ESP32S3_GEEK with ST7789 135*240 TFT +#endif //#include // Setup file for Bw16-based boards with ST7735 160 x 80 TFT //#include // Template file for a setup diff --git a/lib/TFT_eSPI/User_Setups/Setup303_WaveShare ESP32S3_GEEK.h b/lib/TFT_eSPI/User_Setups/Setup303_WaveShare ESP32S3_GEEK.h new file mode 100644 index 0000000..399f38c --- /dev/null +++ b/lib/TFT_eSPI/User_Setups/Setup303_WaveShare ESP32S3_GEEK.h @@ -0,0 +1,41 @@ +// ST7789 135 x 240 display + +#define USER_SETUP_ID 303 + +#define ST7789_DRIVER // Configure all registers + +#define TFT_WIDTH 135 +#define TFT_HEIGHT 240 + +#define CGRAM_OFFSET // Library will add offsets required + +#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red + +#define TFT_INVERSION_ON + +// Generic ESP32 setup +//#define TFT_MISO 19 +#define TFT_MOSI 11 +#define TFT_SCLK 12 +#define TFT_CS 10 +#define TFT_DC 8 +#define TFT_RST 9 +#define TFT_BL 7 + + +#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 SUPPORT_TRANSACTIONS diff --git a/platformio.ini b/platformio.ini index 61db0fb..b7bdce1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -11,7 +11,7 @@ [platformio] globallib_dir = lib -default_envs = wt32-sc01, wt32-sc01-plus, han_m5stack, M5Stick-C, esp32cam, ESP32-2432S028R, NerminerV2, ESP32-devKitv1, NerminerV2-S3-DONGLE, NerminerV2-S3-AMOLED, NerminerV2-T-QT, NerdminerV2-T-Display_V1, ESP32-2432S028R, M5-StampS3, ESP32-S3-devKitv1, ESP32-S3-mini-wemos, ESP32-S3-mini-weact +default_envs = 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 [env:M5Stick-C] platform = espressif32 @@ -170,6 +170,35 @@ lib_ignore = TFT_eSPI HANSOLOminerv2 + +;-------------------------------------------------------------------- + +[env:ESP32-S2-mini-wemos] +platform = espressif32 +board = lolin_s2_mini +framework = arduino +monitor_filters = + esp32_exception_decoder + time + log2file +monitor_speed = 115200 +upload_speed = 115200 +board_build.partitions = huge_app.csv +build_flags = + -D BOARD_HAS_PSRAM + -D DEVKITV1=1 + -D PIN_BUTTON_1=0 + -D LED_PIN=15 + ;-D DEBUG_MINING=1 +lib_deps = + https://github.com/takkaO/OpenFontRender + bblanchon/ArduinoJson@^6.21.2 + https://github.com/tzapu/WiFiManager.git#v2.0.16-rc.2 + mathertel/OneButton @ ^2.0.3 + arduino-libraries/NTPClient +lib_ignore = + TFT_eSPI + ;-------------------------------------------------------------------- [env:ESP32-S3-mini-weact] @@ -202,6 +231,37 @@ lib_ignore = TFT_eSPI HANSOLOminerv2 + + + +;-------------------------------------------------------------------- + +[env:ESP32-D0WD-V3-weact] +platform = espressif32 +board = esp32dev +framework = arduino +monitor_filters = + esp32_exception_decoder + time + log2file +monitor_speed = 115200 +upload_speed = 115200 +board_build.partitions = huge_app.csv +build_flags = + -D DEVKITV1=1 + -D PIN_BUTTON_1=0 + -D LED_PIN=22 + -D ACTIVE_LED=LOW + -D INACTIVE_LED=HIGH +lib_deps = + https://github.com/takkaO/OpenFontRender + bblanchon/ArduinoJson@^6.21.2 + https://github.com/tzapu/WiFiManager.git#v2.0.16-rc.2 + mathertel/OneButton @ ^2.0.3 + arduino-libraries/NTPClient +lib_ignore = + TFT_eSPI + ;-------------------------------------------------------------------- [env:ESP32-C3-super-mini] @@ -216,7 +276,6 @@ monitor_speed = 115200 upload_speed = 115200 board_build.partitions = huge_app.csv build_flags = - -D BOARD_HAS_PSRAM -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=1 -D DEVKITV1=1 @@ -247,7 +306,6 @@ monitor_speed = 115200 upload_speed = 115200 board_build.partitions = huge_app.csv build_flags = - -D BOARD_HAS_PSRAM -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=1 -D ESP32RGB=1 @@ -431,6 +489,27 @@ framework = arduino board_build.partitions = huge_app.csv build_flags = -DNERMINER_S3_AMOLED + -DTOUCH=0 + -DBOARD_HAS_PSRAM + -DARDUINO_USB_CDC_ON_BOOT +lib_deps = + https://github.com/takkaO/OpenFontRender + bblanchon/ArduinoJson@^6.21.2 + https://github.com/tzapu/WiFiManager.git#v2.0.16-rc.2 + mathertel/OneButton @ ^2.0.3 + arduino-libraries/NTPClient + https://github.com/golden-guy/Arduino_wolfssl.git#v5.5.4 + +;-------------------------------------------------------------------- + +[env:NerminerV2-S3-AMOLED-TOUCH] +platform = espressif32 +board = lilygo-t-amoled +framework = arduino +board_build.partitions = huge_app.csv +build_flags = + -DNERMINER_S3_AMOLED + -DTOUCH=1 -DBOARD_HAS_PSRAM -DARDUINO_USB_CDC_ON_BOOT lib_deps = @@ -469,6 +548,27 @@ lib_ignore = ;-------------------------------------------------------------------- +[env:NerminerV2-S3-GEEK] +platform = espressif32 +board = esp32-s3-devkitc-1 +framework = arduino +board_build.partitions = huge_app.csv +build_flags = + -DNERMINER_S3_GEEK + -DBOARD_HAS_PSRAM + -DARDUINO_USB_CDC_ON_BOOT + -DTFT_BACKLIGHT_ON=HIGH +lib_deps = + https://github.com/takkaO/OpenFontRender + bblanchon/ArduinoJson@^6.21.2 + https://github.com/tzapu/WiFiManager.git#v2.0.16-rc.2 + mathertel/OneButton @ ^2.0.3 + arduino-libraries/NTPClient + ;https://github.com/golden-guy/Arduino_wolfssl.git#v5.5.4 + + +;-------------------------------------------------------------------- + [env:esp32cam] platform = espressif32 ;(ESP32-D0WD-V3) board = esp32cam diff --git a/src/NerdMinerV2.ino.cpp b/src/NerdMinerV2.ino.cpp index f6b6ce7..c2be3f8 100644 --- a/src/NerdMinerV2.ino.cpp +++ b/src/NerdMinerV2.ino.cpp @@ -13,6 +13,7 @@ #include "monitor.h" #include "drivers/displays/display.h" #include "drivers/storage/SDCard.h" +#include "timeconst.h" //3 seconds WDT #define WDT_TIMEOUT 3 @@ -54,7 +55,7 @@ void setup() #endif //MONITOR_SPEED Serial.setTimeout(0); - delay(100); + delay(SECOND_MS/10); esp_task_wdt_init(WDT_MINER_TIMEOUT, true); // Idle task that would reset WDT never runs, because core 0 gets fully utilized @@ -63,7 +64,7 @@ void setup() // Setup the buttons #if defined(PIN_BUTTON_1) && !defined(PIN_BUTTON_2) //One button device - button1.setPressTicks(5000); + button1.setPressMs(5*SECOND_MS); button1.attachClick(switchToNextScreen); button1.attachDoubleClick(alternateScreenRotation); button1.attachLongPressStart(reset_configuration); @@ -71,13 +72,13 @@ void setup() #endif #if defined(PIN_BUTTON_1) && defined(PIN_BUTTON_2) //Button 1 of two button device - button1.setPressTicks(5000); + button1.setPressMs(5*SECOND_MS); button1.attachClick(alternateScreenState); button1.attachDoubleClick(alternateScreenRotation); #endif #if defined(PIN_BUTTON_2) //Button 2 of two button device - button2.setPressTicks(5000); + button2.setPressMs(5*SECOND_MS); button2.attachClick(switchToNextScreen); button2.attachLongPressStart(reset_configuration); #endif @@ -90,7 +91,7 @@ void setup() /******** PRINT INIT SCREEN *****/ drawLoadingScreen(); - delay(2000); + delay(2*SECOND_MS); /******** SHOW LED INIT STATUS (devices without screen) *****/ mMonitor.NerdStatus = NM_waitingConfig; diff --git a/src/drivers/devices/device.h b/src/drivers/devices/device.h index d04e297..cdcf7c5 100644 --- a/src/drivers/devices/device.h +++ b/src/drivers/devices/device.h @@ -39,6 +39,9 @@ #include "m5stack.h" #elif defined(WT32_BOARD) #include "wt32.h" +#elif defined(NERMINER_S3_GEEK) +#include "waveshareS3Geek.h" + #else #error "No device defined" #endif diff --git a/src/drivers/devices/esp322432s028r.h b/src/drivers/devices/esp322432s028r.h index 73d6911..aa6d1a0 100644 --- a/src/drivers/devices/esp322432s028r.h +++ b/src/drivers/devices/esp322432s028r.h @@ -7,4 +7,16 @@ #define LED_PIN 4 // Red pin #define LED_PIN_G 17 // Green pin +// Pin defines for the SD card interface +// This is working for both, ESP32 2432S028R and ESP 2432S028_2USB boards +// -------------------------------------- +// use SPI interface +// (default SPI unit provided by ) +// setup SPI pins. + +#define SDSPI_CS 5 +#define SDSPI_CLK 18 +#define SDSPI_MOSI 23 +#define SDSPI_MISO 19 + #endif diff --git a/src/drivers/devices/esp32CAM.h b/src/drivers/devices/esp32CAM.h index c8c1634..a2a0933 100644 --- a/src/drivers/devices/esp32CAM.h +++ b/src/drivers/devices/esp32CAM.h @@ -4,6 +4,9 @@ #define PIN_BUTTON_1 0 #define LED_PIN 33 +#define ACTIVE_LED HIGH +#define INACTIVE_LED LOW + #define NO_DISPLAY // example how to configure SD card. diff --git a/src/drivers/devices/esp32DevKit.h b/src/drivers/devices/esp32DevKit.h index b10aa61..324b46c 100644 --- a/src/drivers/devices/esp32DevKit.h +++ b/src/drivers/devices/esp32DevKit.h @@ -5,6 +5,14 @@ #define PIN_BUTTON_1 0 #endif +#ifndef ACTIVE_LED +#define ACTIVE_LED HIGH +#endif + +#ifndef INACTIVE_LED +#define INACTIVE_LED LOW +#endif + #ifndef LED_PIN #define LED_PIN 2 #endif diff --git a/src/drivers/devices/waveshareS3Geek.h b/src/drivers/devices/waveshareS3Geek.h new file mode 100644 index 0000000..f9cb225 --- /dev/null +++ b/src/drivers/devices/waveshareS3Geek.h @@ -0,0 +1,7 @@ +#ifndef _WAVESHARE_S3_GEEK_H +#define _WAVESHARE_S3_GEEK_H + +#define PIN_BUTTON_1 0 +#define V1_DISPLAY + +#endif \ No newline at end of file diff --git a/src/drivers/displays/amoledDisplayDriver.cpp b/src/drivers/displays/amoledDisplayDriver.cpp index 67fb27c..08b8604 100644 --- a/src/drivers/displays/amoledDisplayDriver.cpp +++ b/src/drivers/displays/amoledDisplayDriver.cpp @@ -1,5 +1,6 @@ #include "displayDriver.h" + #ifdef AMOLED_DISPLAY #include @@ -10,6 +11,7 @@ #include "version.h" #include "monitor.h" #include "OpenFontRender.h" +#include "rotation.h" #define WIDTH 536 #define HEIGHT 240 @@ -29,8 +31,12 @@ TFT_eSprite background = TFT_eSprite(&tft); void amoledDisplay_Init(void) { +#if TOUCH + pinMode(38, OUTPUT); + digitalWrite(38, OUTPUT); +#endif rm67162_init(); - lcd_setRotation(1); + lcd_setRotation(LANDSCAPE); background.createSprite(WIDTH, HEIGHT); background.setSwapBytes(true); @@ -51,11 +57,11 @@ void amoledDisplay_AlternateScreenState(void) screen_state ^= 1; } -int screen_rotation = 1; +int screen_rotation = LANDSCAPE; void amoledDisplay_AlternateRotation(void) { - screen_rotation == 1 ? lcd_setRotation(3) : lcd_setRotation(1); - screen_rotation ^= 1; + screen_rotation = flipRotation(screen_rotation); + screen_rotation ^= 1; } void amoledDisplay_MinerScreen(unsigned long mElapsed) diff --git a/src/drivers/displays/dongleDisplayDriver.cpp b/src/drivers/displays/dongleDisplayDriver.cpp index e790eb9..7a71df5 100644 --- a/src/drivers/displays/dongleDisplayDriver.cpp +++ b/src/drivers/displays/dongleDisplayDriver.cpp @@ -9,6 +9,7 @@ #include "version.h" #include "monitor.h" #include "OpenFontRender.h" +#include "rotation.h" #ifdef USE_LED #include @@ -85,7 +86,7 @@ void dongleDisplay_Init(void) #endif // USE_LED tft.init(); - tft.setRotation(3); + tft.setRotation(LANDSCAPE_INVERTED); tft.setSwapBytes(true); background.createSprite(BUFFER_WIDTH, BUFFER_HEIGHT); background.setSwapBytes(true); @@ -110,7 +111,7 @@ void dongleDisplay_AlternateScreenState(void) void dongleDisplay_AlternateRotation(void) { - tft.getRotation() == 1 ? tft.setRotation(3) : tft.setRotation(1); + tft.setRotation( flipRotation(tft.getRotation()) ); } void dongleDisplay_MinerScreen(unsigned long mElapsed) diff --git a/src/drivers/displays/esp23_2432s028r.cpp b/src/drivers/displays/esp23_2432s028r.cpp index ec9431f..8c55c08 100644 --- a/src/drivers/displays/esp23_2432s028r.cpp +++ b/src/drivers/displays/esp23_2432s028r.cpp @@ -12,6 +12,7 @@ #include "monitor.h" #include "OpenFontRender.h" #include +#include "rotation.h" #define WIDTH 130 //320 #define HEIGHT 170 @@ -31,7 +32,7 @@ bool hasChangedScreen = true; void esp32_2432S028R_Init(void) { tft.init(); - tft.setRotation(1); + tft.setRotation(ROTATION_90); #ifdef ESP32_2432S028_2USB /* In addition to TFT_INVERSION this adjusts the gamma curve to have better @@ -79,7 +80,7 @@ void esp32_2432S028R_AlternateScreenState(void) void esp32_2432S028R_AlternateRotation(void) { - tft.getRotation() == 1 ? tft.setRotation(3) : tft.setRotation(1); + tft.setRotation( flipRotation(tft.getRotation()) ); hasChangedScreen = true; } diff --git a/src/drivers/displays/m5stickCDriver.cpp b/src/drivers/displays/m5stickCDriver.cpp index c18ace3..3cf98d5 100644 --- a/src/drivers/displays/m5stickCDriver.cpp +++ b/src/drivers/displays/m5stickCDriver.cpp @@ -9,6 +9,7 @@ #include "media/Free_Fonts.h" #include "version.h" #include "monitor.h" +#include "rotation.h" #define WIDTH 80 #define HEIGHT 160 @@ -21,7 +22,7 @@ int screen_state = 1; void m5stickCDriver_Init(void) { M5.begin(); - M5.Lcd.setRotation(1); + M5.Lcd.setRotation(LANDSCAPE); M5.Lcd.setTextSize(1); M5.Lcd.fillScreen(BLACK); M5.Axp.ScreenBreath(10); //screen brightness 7-15 @@ -42,8 +43,7 @@ void m5stickCDriver_AlternateScreenState(void) void m5stickCDriver_AlternateRotation(void) { - if (M5.Lcd.getRotation() == 3) M5.Lcd.setRotation(1); - else M5.Lcd.setRotation(3); + M5.Lcd.setRotation( flipRotation(M5.Lcd.getRotation()) ); } void m5stickCDriver_MinerScreen(unsigned long mElapsed) diff --git a/src/drivers/displays/noDisplayDriver.cpp b/src/drivers/displays/noDisplayDriver.cpp index cc42812..d68d5ce 100644 --- a/src/drivers/displays/noDisplayDriver.cpp +++ b/src/drivers/displays/noDisplayDriver.cpp @@ -7,6 +7,7 @@ #include "wManager.h" extern monitor_data mMonitor; +bool ledOn = false; void noDisplay_Init(void) { @@ -16,6 +17,8 @@ void noDisplay_Init(void) void noDisplay_AlternateScreenState(void) { + Serial.println("Switching display state"); + ledOn = !ledOn; } void noDisplay_AlternateRotation(void) @@ -56,11 +59,17 @@ void noDisplay_DoLedStuff(unsigned long frame) { unsigned long currentMillis = millis(); + if (!ledOn) + { + digitalWrite(LED_PIN, INACTIVE_LED); + return; + } + switch (mMonitor.NerdStatus) { case NM_waitingConfig: - digitalWrite(LED_PIN, HIGH); // LED encendido de forma continua + digitalWrite(LED_PIN, ACTIVE_LED); // LED encendido de forma continua break; case NM_Connecting: diff --git a/src/drivers/displays/rotation.h b/src/drivers/displays/rotation.h new file mode 100644 index 0000000..f931df6 --- /dev/null +++ b/src/drivers/displays/rotation.h @@ -0,0 +1,42 @@ +// +// Rotation can be 0, 90, 180 or 270 degrees, but TFT_eSPI cryptically +// identifies these as 0, 1, 2, and 3. ?!?!?!?!?!? +// +// Created by dwight on 3/14/24. +// + +#ifndef NERDMINER_V2_ROTATION_H + +// Rotation value 0 sets the display to a portrait (tall) mode, with the USB jack at the top right. +#define ROTATION_0 0 +#define PORTRAIT ROTATION_0 + +// Rotation 1 is landscape (wide) mode, with the USB jack at the bottom right. +#define ROTATION_90 1 +#define LANDSCAPE ROTATION_90 + +// Rotation value 2 is also a portrait mode, with the USB jack at the bottom left. +#define ROTATION_180 2 +#define PORTRAIT_INVERTED ROTATION_180 + +// Rotation 3 is also landscape, but with the USB jack at the top left. +#define ROTATION_270 3 +#define LANDSCAPE_INVERTED ROTATION_270 + +// Helper function to rotate display left (-90 deg) +int rotationLeft(int d) { + return (d-ROTATION_90) % 4; +} + +// Helper function to rotate display right (90 deg) +int rotationRight(int d) { + return (d+ROTATION_90) % 4; +} + +// Helper function to rotate display 180 deg +int flipRotation(int d) { + return (d+ROTATION_180) % 4; +} + +#define NERDMINER_V2_ROTATION_H +#endif //NERDMINER_V2_ROTATION_H diff --git a/src/drivers/displays/tDisplayDriver.cpp b/src/drivers/displays/tDisplayDriver.cpp index e78d00d..88c0344 100644 --- a/src/drivers/displays/tDisplayDriver.cpp +++ b/src/drivers/displays/tDisplayDriver.cpp @@ -9,6 +9,7 @@ #include "version.h" #include "monitor.h" #include "OpenFontRender.h" +#include "rotation.h" #define WIDTH 340 #define HEIGHT 170 @@ -21,9 +22,9 @@ void tDisplay_Init(void) { tft.init(); #ifdef LILYGO_S3_T_EMBED - tft.setRotation(3); + tft.setRotation(ROTATION_270); #else - tft.setRotation(1); + tft.setRotation(ROTATION_90); #endif tft.setSwapBytes(true); // Swap the colour byte order when rendering background.createSprite(WIDTH, HEIGHT); // Background Sprite @@ -49,7 +50,7 @@ void tDisplay_AlternateScreenState(void) void tDisplay_AlternateRotation(void) { - tft.getRotation() == 1 ? tft.setRotation(3) : tft.setRotation(1); + tft.setRotation( flipRotation(tft.getRotation()) ); } void tDisplay_MinerScreen(unsigned long mElapsed) diff --git a/src/drivers/displays/tDisplayV1Driver.cpp b/src/drivers/displays/tDisplayV1Driver.cpp index 8c8fee2..080a1a7 100644 --- a/src/drivers/displays/tDisplayV1Driver.cpp +++ b/src/drivers/displays/tDisplayV1Driver.cpp @@ -9,6 +9,7 @@ #include "version.h" #include "monitor.h" #include "OpenFontRender.h" +#include "rotation.h" #define WIDTH 240 #define HEIGHT 135 @@ -20,7 +21,7 @@ TFT_eSprite background = TFT_eSprite(&tft); // Invoke library sprite void tDisplay_Init(void) { tft.init(); - tft.setRotation(1); + tft.setRotation(ROTATION_90); tft.setSwapBytes(true); // Swap the colour byte order when rendering background.createSprite(WIDTH, HEIGHT); // Background Sprite background.setSwapBytes(true); @@ -45,7 +46,7 @@ void tDisplay_AlternateScreenState(void) void tDisplay_AlternateRotation(void) { - tft.getRotation() == 1 ? tft.setRotation(3) : tft.setRotation(1); + tft.setRotation( flipRotation(tft.getRotation()) ); } void tDisplay_MinerScreen(unsigned long mElapsed) diff --git a/src/drivers/displays/t_qtDisplayDriver.cpp b/src/drivers/displays/t_qtDisplayDriver.cpp index 453bbf2..9cd8338 100644 --- a/src/drivers/displays/t_qtDisplayDriver.cpp +++ b/src/drivers/displays/t_qtDisplayDriver.cpp @@ -9,6 +9,7 @@ #include "version.h" #include "monitor.h" #include "OpenFontRender.h" +#include "rotation.h" #define WIDTH 128 #define HEIGHT 128 @@ -20,7 +21,7 @@ TFT_eSprite background = TFT_eSprite(&tft); // Invoke library sprite void t_qtDisplay_Init(void) { tft.init(); - tft.setRotation(1); + tft.setRotation(LANDSCAPE); tft.setSwapBytes(true); // Swap the colour byte order when rendering background.createSprite(WIDTH, HEIGHT); // Background Sprite background.setSwapBytes(true); @@ -45,7 +46,7 @@ void t_qtDisplay_AlternateScreenState(void) void t_qtDisplay_AlternateRotation(void) { - tft.setRotation((tft.getRotation()+1) % 4); + tft.setRotation( rotationRight(tft.getRotation()) ); } void t_qtDisplay_MinerScreen(unsigned long mElapsed) diff --git a/src/mining.cpp b/src/mining.cpp index f292edf..1b22107 100644 --- a/src/mining.cpp +++ b/src/mining.cpp @@ -10,6 +10,7 @@ #include "mining.h" #include "utils.h" #include "monitor.h" +#include "timeconst.h" #include "drivers/displays/display.h" #include "drivers/storage/storage.h" @@ -43,7 +44,7 @@ monitor_data mMonitor; bool isMinerSuscribed = false; unsigned long mLastTXtoPool = millis(); -int saveIntervals[7] = {5 * 60, 15 * 60, 30 * 60, 1 * 360, 3 * 360, 6 * 360, 12 * 360}; +int saveIntervals[7] = {5 * 60, 15 * 60, 30 * 60, 1 * 3600, 3 * 3600, 6 * 3600, 12 * 3600}; int saveIntervalsSize = sizeof(saveIntervals)/sizeof(saveIntervals[0]); int currentIntervalIndex = 0; diff --git a/src/timeconst.h b/src/timeconst.h new file mode 100644 index 0000000..6f26155 --- /dev/null +++ b/src/timeconst.h @@ -0,0 +1,17 @@ +// +// Created by dwight on 3/14/24. +// + +#ifndef NERDMINER_V2_TIMECONST_H +#define NERDMINER_V2_TIMECONST_H + +#define SECOND_MS 1000 +#define SECOND 1 +#define MINUTE 60*SECOND // 60 Seconds +#define HOUR 60*MINUTE // 3,600 Seconds +#define DAY 24*HOUR // 86,400 Seconds +#define WEEK 7*DAY // 604,800 Seconds +#define MONTH 30*DAY // 2,592,000 Seconds +#define YEAR 365*DAY // 31,536,000 Seconds + +#endif //NERDMINER_V2_TIMECONST_H diff --git a/src/wManager.cpp b/src/wManager.cpp index 6b7e98f..be196e1 100644 --- a/src/wManager.cpp +++ b/src/wManager.cpp @@ -13,6 +13,7 @@ #include "drivers/storage/SDCard.h" #include "drivers/storage/nvMemory.h" #include "drivers/storage/storage.h" +#include "timeconst.h" // Flag for saving data @@ -134,6 +135,9 @@ void init_WifiManager() // Text box (Number) - 7 characters maximum WiFiManagerParameter port_text_box_num("Poolport", "Pool port", convertedValue, 7); + // Text box (String) - 80 characters maximum + WiFiManagerParameter password_text_box("Poolpassword", "Pool password (Optional)", Settings.PoolPassword, 80); + // Text box (String) - 80 characters maximum WiFiManagerParameter addr_text_box("btcAddress", "Your BTC address", Settings.BtcWallet, 80); @@ -150,8 +154,6 @@ void init_WifiManager() strcat(checkboxParams, " checked"); } WiFiManagerParameter save_stats_to_nvs("SaveStatsToNVS", "Track Uptime, Best Diff, Total Hashes in device Flash memory. (Experimental)", "T", 2, checkboxParams, WFM_LABEL_AFTER); - // Text box (String) - 80 characters maximum - WiFiManagerParameter password_text_box("Poolpassword - Optionl", "Pool password", Settings.PoolPassword, 80); // Add all defined parameters wm.addParameter(&pool_text_box); @@ -183,10 +185,10 @@ void init_WifiManager() Settings.saveStats = (strncmp(save_stats_to_nvs.getValue(), "T", 1) == 0); nvMem.saveConfig(&Settings); - delay(3000); + delay(3*SECOND_MS); //reset and try again, or maybe put it to deep sleep ESP.restart(); - delay(5000); + delay(5*SECOND_MS); }; } else