Merge branch 'master' into dev

This commit is contained in:
BitMaker 2023-11-27 23:45:20 +01:00
commit 25cf29f41a
24 changed files with 1802 additions and 1707 deletions

View File

@ -1,6 +1,9 @@
name: PlatformIO CI name: PlatformIO CI
on: [push] on:
push:
branches:
- master
jobs: jobs:
build: build:
@ -27,4 +30,4 @@ jobs:
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: builded artifacts name: builded artifacts
path: .pio/build/* path: .pio/build/*/*.bin

134
README.md
View File

@ -1,90 +1,106 @@
# NerdSoloMiner # NerdSoloMiner
**The NerdSoloMiner v2** **The NerdSoloMiner v2**
This is a **free and open source project** that let you try to reach a bitcoin block with a small piece of hardware. This is a **free and open source project** that let you try to reach a bitcoin block with a small piece of hardware.
The main aim of this project is to let you **learn more about minery** and to have a beautiful piece of hardware in your desktop. The main aim of this project is to let you **learn more about minery** and to have a beautiful piece of hardware in your desktop.
Original project https://github.com/valerio-vaccaro/HAN Original project https://github.com/valerio-vaccaro/HAN
![image](images/bgNerdMinerV2.png) ![image](images/bgNerdMinerV2.png)
## Requirements ## Requirements
- TTGO T-Display S3 or any supported boards (check Build tutorial 👇) - TTGO T-Display S3 or any supported boards (check Build tutorial 👇)
- 3D BOX [here](3d_files/) - 3D BOX [here](3d_files/)
### Project description ### Project description
**ESP32 implementing Stratum protocol** to mine on solo pool. Pool can be changed but originally works with Public-pool.io (where Nerdminers are supported).
**ESP32 implementing Stratum protocol** to mine on solo pool. Pool can be changed but originally works with [public-pool.io][https://web.public-pool.io] (where Nerdminers are supported).
This project was initialy developed using ESP32-S3, but currently support other boards. It uses WifiManager to modify miner settings and save them to SPIFF. This project was initialy developed using ESP32-S3, but currently support other boards. It uses WifiManager to modify miner settings and save them to SPIFF.
The microMiner comes with several screens to monitor it's working procedure and also to show you network mining stats. The microMiner comes with several screens to monitor it's working procedure and also to show you network mining stats.
Currently includes: Currently includes:
- NerdMiner Screen > Mining data of Nerdminer - NerdMiner Screen > Mining data of Nerdminer
- ClockMiner Screen > Fashion style clock miner - ClockMiner Screen > Fashion style clock miner
- GlobalStats Screen > Global minery stats and relevant data - GlobalStats Screen > Global minery stats and relevant data
This miner is multicore and multithreads, both cores are used to mine and several threads are used to implementing stratum work and wifi stuff. This miner is multicore and multithreads, both cores are used to mine and several threads are used to implementing stratum work and wifi stuff.
Every time an stratum job notification is received miner update its current work to not create stale shares. Every time an stratum job notification is received miner update its current work to not create stale shares.
**IMPORTANT** Miner is not seen by all standard pools due to its low share difficulty. You can check miner work remotely using specific pools specified down or seeing logs via UART. **IMPORTANT** Miner is not seen by all standard pools due to its low share difficulty. You can check miner work remotely using specific pools specified down or seeing logs via UART.
***Current project is still in developement and more features will be added*** **_Current project is still in developement and more features will be added_**
## Build Tutorial ## Build Tutorial
### Hardware requirements ### Hardware requirements
- LILYGO T-Display S3 (original one) or any other supported boards - LILYGO T-Display S3 (original one) or any other supported boards
- 3D BOX [here](3d_files/) - 3D BOX [here](3d_files/)
#### Current Supported Boards #### Current Supported Boards
- LILYGO T-Display S3 ([Aliexpress link*](https://s.click.aliexpress.com/e/_Ddy7739))
- ESP32-WROOM-32, ESP32-Devkit1.. ([Aliexpress link*](https://s.click.aliexpress.com/e/_DCzlUiX)) - LILYGO T-Display S3 ([Aliexpress link\*](https://s.click.aliexpress.com/e/_Ddy7739))
- LILYGO T-QT pro ([Aliexpress link*](https://s.click.aliexpress.com/e/_DBQIr43)) - ESP32-WROOM-32, ESP32-Devkit1.. ([Aliexpress link\*](https://s.click.aliexpress.com/e/_DCzlUiX))
- LILYGO T-Display 1.14 ([Aliexpress link*](https://s.click.aliexpress.com/e/_DEqGvSJ)) - LILYGO T-QT pro ([Aliexpress link\*](https://s.click.aliexpress.com/e/_DBQIr43))
- LILYGO T-Display S3 AMOLED ([Aliexpress link*](https://s.click.aliexpress.com/e/_DmOIK6j)) - LILYGO T-Display 1.14 ([Aliexpress link\*](https://s.click.aliexpress.com/e/_DEqGvSJ))
- LILYGO T-Dongle S3 ([Aliexpress link*](https://s.click.aliexpress.com/e/_DmQCPyj)) - LILYGO T-Display S3 AMOLED ([Aliexpress link\*](https://s.click.aliexpress.com/e/_DmOIK6j))
- ESP32-2432S028R 2,8" ([Aliexpress link*](https://s.click.aliexpress.com/e/_DdXkvLv) / Dev support: @nitroxgas / ⚡jadeddonald78@walletofsatoshi.com) - 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) - ESP32-cam ([Board Info](https://lastminuteengineers.com/getting-started-with-esp32-cam/) / Dev support: @elmo128)
*Affiliate links \*Affiliate links
### Flash firmware ### Flash firmware
#### microMiners Flashtool [Recommended] #### microMiners Flashtool [Recommended]
Easyiest way to flash firmware. Build your own miner using the folowing firwmare flash tool: Easyiest way to flash firmware. Build your own miner using the folowing firwmare flash tool:
1. Get a TTGO T-display S3 or any other supported board 1. Get a TTGO T-display S3 or any other supported board
1. Go to NM2 flasher online: https://bitmaker-hub.github.io/diyflasher/ 1. Go to NM2 flasher online: https://bitmaker-hub.github.io/diyflasher/
#### Standard tool #### Standard tool
Create your own miner using the online firwmare flash tool **ESPtool** and one of the **binary files** that you will find in the ``bin`` folder.
Create your own miner using the online firwmare flash tool **ESPtool** and one of the **binary files** that you will find in the `bin` folder.
If you want you can compile the entire project using Arduino, PlatformIO or Expressif IDF. If you want you can compile the entire project using Arduino, PlatformIO or Expressif IDF.
1. Get a TTGO T-display S3 or any supported board 1. Get a TTGO T-display S3 or any supported board
1. Download this repository 1. Download this repository
1. Go to ESPtool online: https://espressif.github.io/esptool-js/ 1. Go to ESPtool online: https://espressif.github.io/esptool-js/
1. Load the firmware with the binary from one of the sub-folders of ``bin`` corresponding to your board. 1. Load the firmware with the binary from one of the sub-folders of `bin` corresponding to your board.
1. Plug your board and select each file from the sub-folder (``.bin`` files). 1. Plug your board and select each file from the sub-folder (`.bin` files).
### Update firmware ### Update firmware
Update NerdMiner firmware following same flashing steps but only using the file 0x10000_firmware.bin. Update NerdMiner firmware following same flashing steps but only using the file 0x10000_firmware.bin.
#### Build troubleshooting #### Build troubleshooting
1. Online ESPtool works with chrome, chromium, brave 1. Online ESPtool works with chrome, chromium, brave
1. ESPtool recommendations: use 115200bps 1. ESPtool recommendations: use 115200bps
1. Build errors > If during firmware download upload stops, it's recommended to enter the board in boot mode. Unplug cable, hold right bottom button and then plug cable. Try programming 1. Build errors > If during firmware download upload stops, it's recommended to enter the board in boot mode. Unplug cable, hold right bottom button and then plug cable. Try programming
1. In extreme case you can "Erase all flash" on ESPtool to clean all current configuration before uploading firmware. There has been cases that experimented Wifi failures until this was made. 1. In extreme case you can "Erase all flash" on ESPtool to clean all current configuration before uploading firmware. There has been cases that experimented Wifi failures until this was made.
1. In case of ESP32-WROOM Boards, could be necessary to put your board on boot mode. Hold boot button, press reset button and then program. 1. In case of ESP32-WROOM Boards, could be necessary to put your board on boot mode. Hold boot button, press reset button and then program.
## NerdMiner configuration ## NerdMiner configuration
After programming, you will only need to setup your Wifi and BTC address. After programming, you will only need to setup your Wifi and BTC address.
#### Wifi Accesspoint #### Wifi Accesspoint
1. Connect to NerdMinerAP 1. Connect to NerdMinerAP
- AP: NerdMinerAP - AP: NerdMinerAP
- PASS: MineYourCoins - PASS: MineYourCoins
1. Setup your Wifi Network 1. Setup your Wifi Network
1. Add your BTCaddress 1. Add your BTCaddress
1. Change the password if needed
- If you are using public-pool.io and you want to set a custom name to your worker you can append a string with format _.yourworkername_ to the address
#### SD card (if available) #### SD card (if available)
@ -94,11 +110,13 @@ After programming, you will only need to setup your Wifi and BTC address.
"SSID": "myWifiSSID", "SSID": "myWifiSSID",
"WifiPW": "myWifiPassword", "WifiPW": "myWifiPassword",
"PoolUrl": "public-pool.io", "PoolUrl": "public-pool.io",
"PoolPort": 21496, "PoolPort": 21496,
"PoolPassword": "x",
"BtcWallet": "walletID", "BtcWallet": "walletID",
"Timezone": 2, "Timezone": 2,
"SaveStats": false "SaveStats": false
} }
1. Insert the SD card. 1. Insert the SD card.
1. Hold down the "reset configurations" button as described below to reset the configurations and/or boot without settings in your nvmemory. 1. Hold down the "reset configurations" button as described below to reset the configurations and/or boot without settings in your nvmemory.
1. Power down to remove the SD card. It is not needed for mining. 1. Power down to remove the SD card. It is not needed for mining.
@ -107,20 +125,20 @@ After programming, you will only need to setup your Wifi and BTC address.
Recommended low difficulty share pools: Recommended low difficulty share pools:
| Pool URL | Port | Web URL | Status | | Pool URL | Port | Web URL | Status |
|--- |--- |--- |--- | | ----------------- | ----- | -------------------------- | ------------------------------------------------------------------ |
| public-pool.io | 21496 | https://web.public-pool.io | Open Source Solo Bitcoin Mining Pool supporting open source miners | | public-pool.io | 21496 | https://web.public-pool.io | Open Source Solo Bitcoin Mining Pool supporting open source miners |
| nerdminers.org | | https://nerdminers.org | Team domain for future pool - Currently pointing to public-pool.io | | nerdminers.org | | https://nerdminers.org | Team domain for future pool - Currently pointing to public-pool.io |
| pool.nerdminer.io | 3333 | https://nerdminer.io | Mantained by CHMEX | | pool.nerdminer.io | 3333 | https://nerdminer.io | Mantained by CHMEX |
| pool.vkbit.com | 3333 | https://vkbit.com/ | Mantained by djerfy | | pool.vkbit.com | 3333 | https://vkbit.com/ | Mantained by djerfy |
Other standard pools not compatible with low difficulty share: Other standard pools not compatible with low difficulty share:
| Pool URL | Port | Web URL | | Pool URL | Port | Web URL |
|--- |--- |--- | | ------------------------ | ---- | ----------------------------------------- |
| solo.ckpool.org | 3333 | https://solo.ckpool.org/ | | solo.ckpool.org | 3333 | https://solo.ckpool.org/ |
| btc.zsolo.bid | 6057 | https://zsolo.bid/en/btc-solo-mining-pool | | btc.zsolo.bid | 6057 | https://zsolo.bid/en/btc-solo-mining-pool |
| eu.stratum.slushpool.com | 3333 | https://braiins.com/pool | | eu.stratum.slushpool.com | 3333 | https://braiins.com/pool |
### Buttons ### Buttons
@ -129,16 +147,17 @@ Other standard pools not compatible with low difficulty share:
- One click > change screen. - One click > change screen.
- Double click > change screen orientation. - Double click > change screen orientation.
- Tripple click > turn the screen off and on again. - Tripple click > turn the screen off and on again.
- Hold 5 seconds > **reset the configurations and reboot** your NerdMiner. - Hold 5 seconds > **reset the configurations and reboot** your NerdMiner.
#### Two button devices: #### Two button devices:
With the USB-C port to the right: With the USB-C port to the right:
**TOP BUTTON** **TOP BUTTON**
- One click > change screen.
- Hold 5 seconds > top right button to **reset the configurations and reboot** your NerdMiner.
- Hold and power up > enter **configuration mode** and edit current config via Wifi. You could change your settings or verify them.
- One click > change screen.
- Hold 5 seconds > top right button to **reset the configurations and reboot** your NerdMiner.
- Hold and power up > enter **configuration mode** and edit current config via Wifi. You could change your settings or verify them.
**BOTTOM BUTTON** **BOTTOM BUTTON**
@ -146,39 +165,46 @@ With the USB-C port to the right:
- Double click > change orientation (default is USB-C to the right) - Double click > change orientation (default is USB-C to the right)
#### Build video #### Build video
[![Ver video aquí](https://img.youtube.com/vi/POUT2R_opDs/0.jpg)](https://youtu.be/POUT2R_opDs) [![Ver video aquí](https://img.youtube.com/vi/POUT2R_opDs/0.jpg)](https://youtu.be/POUT2R_opDs)
## Developers ## Developers
### Project guidelines ### Project guidelines
- Current project was addapted to work with PlatformIO - Current project was addapted to work with PlatformIO
- Current project works with ESP32-S3 and ESP32-wroom. - Current project works with ESP32-S3 and ESP32-wroom.
- Partition squeme should be build as huge app - Partition squeme should be build as huge app
- All libraries needed shown on platform.ini - All libraries needed shown on platform.ini
### Job done ### Job done
- [x] Move project to platformIO
- [x] Bug rectangle on screen when 1milion shares - [x] Move project to platformIO
- [x] Bug memory leaks - [x] Bug rectangle on screen when 1milion shares
- [x] Bug Reboots when received JSON contains some null values - [x] Bug memory leaks
- [x] Implement midstate sha256 - [x] Bug Reboots when received JSON contains some null values
- [x] Bug Wificlient DNS unresolved on Wifi.h - [x] Implement midstate sha256
- [x] Code refactoring - [x] Bug Wificlient DNS unresolved on Wifi.h
- [x] Add blockHeight to screen - [x] Code refactoring
- [x] Add clock to show current time - [x] Add blockHeight to screen
- [x] Add new screen with global mining stats - [x] Add clock to show current time
- [x] Add pool support for low difficulty miners - [x] Add new screen with global mining stats
- [x] Add best difficulty on miner screen - [x] Add pool support for low difficulty miners
- [x] Add suport to standard ESP32 dev-kit / ESP32-WROOM - [x] Add best difficulty on miner screen
- [x] Code changes to support adding multiple boards - [x] Add suport to standard ESP32 dev-kit / ESP32-WROOM
- [x] Add support to TTGO T-display 1.14 - [x] Code changes to support adding multiple boards
- [x] Add support to Amoled - [x] Add support to TTGO T-display 1.14
- [x] Add support to Amoled
### On process ### On process
- [ ] Create a daisy chain protocol via UART or I2C to support ESP32 hashboards
- [ ] Create new screen like clockMiner but with BTC price - [ ] Create a daisy chain protocol via UART or I2C to support ESP32 hashboards
- [ ] Add support to control BM1397 - [ ] Create new screen like clockMiner but with BTC price
- [ ] Add support to control BM1397
- [ ] Add password field in web configuration form
### Donations/Project contributions ### Donations/Project contributions
If you would like to contribute and help dev team with this project you can send a donation to the following LN address ⚡teamnerdminer@getalby.com⚡ or using one of the affiliate links above. If you would like to contribute and help dev team with this project you can send a donation to the following LN address ⚡teamnerdminer@getalby.com⚡ or using one of the affiliate links above.
If you want to order a fully assembled Nerdminer you can contribute to my job at 🛒[bitronics.store](https://bitronics.store)🛒 If you want to order a fully assembled Nerdminer you can contribute to my job at 🛒[bitronics.store](https://bitronics.store)🛒

View File

@ -10,9 +10,9 @@
[platformio] [platformio]
globallib_dir = lib globallib_dir = lib
default_envs = esp32cam, ESP32-2432S028R, NerminerV2, ESP32-devKitv1, NerminerV2-S3-DONGLE, NerminerV2-S3-AMOLED, NerminerV2-T-QT, NerdminerV2-T-Display_V1, ESP32-2432S028R default_envs = esp32cam, ESP32-2432S028R, NerminerV2, ESP32-devKitv1, NerminerV2-S3-DONGLE, NerminerV2-S3-AMOLED, NerminerV2-T-QT, NerdminerV2-T-Display_V1, ESP32-2432S028R, M5-StampS3
;--------------------------------------------------------------------
[env:NerminerV2] [env:NerminerV2]
platform = espressif32 platform = espressif32
@ -126,6 +126,8 @@ build_flags =
-DNERMINER_S3_DONGLE -DNERMINER_S3_DONGLE
-DBOARD_HAS_PSRAM -DBOARD_HAS_PSRAM
-DARDUINO_USB_CDC_ON_BOOT -DARDUINO_USB_CDC_ON_BOOT
-DTFT_BACKLIGHT_ON=LOW
-DTFT_BL=38
lib_deps = lib_deps =
https://github.com/takkaO/OpenFontRender https://github.com/takkaO/OpenFontRender
bblanchon/ArduinoJson@^6.21.2 bblanchon/ArduinoJson@^6.21.2
@ -256,3 +258,29 @@ lib_deps =
https://github.com/tzapu/WiFiManager.git#v2.0.16-rc.2 https://github.com/tzapu/WiFiManager.git#v2.0.16-rc.2
mathertel/OneButton @ ^2.0.3 mathertel/OneButton @ ^2.0.3
https://github.com/arduino-libraries/NTPClient https://github.com/arduino-libraries/NTPClient
[env:M5-StampS3]
platform = espressif32
board = m5stack-stamps3
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 M5_STAMP_S3=1
lib_deps =
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
SD
rm67162
SPI

View File

@ -19,6 +19,8 @@
#include "lilygoV1TDisplay.h" #include "lilygoV1TDisplay.h"
#elif defined(ESP32_CAM) #elif defined(ESP32_CAM)
#include "esp32CAM.h" #include "esp32CAM.h"
#elif defined(M5_STAMP_S3)
#include "m5StampS3.h"
#else #else
#error "No device defined" #error "No device defined"

View File

@ -0,0 +1,9 @@
#ifndef _M5_STAMP_S3_H
#define _M5_STAMP_S3_H
#define PIN_BUTTON_1 0
#define LED_PIN 9
#define NO_DISPLAY
#endif

View File

@ -1,4 +1,4 @@
#include "DisplayDriver.h" #include "displayDriver.h"
#ifdef AMOLED_DISPLAY #ifdef AMOLED_DISPLAY
@ -243,4 +243,4 @@ DisplayDriver amoledDisplayDriver = {
0, 0,
WIDTH, WIDTH,
HEIGHT}; HEIGHT};
#endif #endif

View File

@ -1,7 +1,7 @@
#ifndef DISPLAY_H #ifndef DISPLAY_H
#define DISPLAY_H #define DISPLAY_H
#include "DisplayDriver.h" #include "displayDriver.h"
extern DisplayDriver *currentDisplayDriver; extern DisplayDriver *currentDisplayDriver;

View File

@ -1,7 +1,7 @@
#ifndef DISPLAYDRIVER_H_ #ifndef DISPLAYDRIVER_H_
#define DISPLAYDRIVER_H_ #define DISPLAYDRIVER_H_
#include "..\devices\device.h" #include "../devices/device.h"
typedef void (*AlternateFunction)(void); typedef void (*AlternateFunction)(void);
typedef void (*DriverInitFunction)(void); typedef void (*DriverInitFunction)(void);

View File

@ -1,4 +1,4 @@
#include "DisplayDriver.h" #include "displayDriver.h"
#ifdef DONGLE_DISPLAY #ifdef DONGLE_DISPLAY
@ -103,6 +103,9 @@ void dongleDisplay_Init(void)
void dongleDisplay_AlternateScreenState(void) void dongleDisplay_AlternateScreenState(void)
{ {
int screen_state = digitalRead(TFT_BL);
Serial.println("Switching display state");
digitalWrite(TFT_BL, !screen_state);
} }
void dongleDisplay_AlternateRotation(void) void dongleDisplay_AlternateRotation(void)
@ -216,4 +219,4 @@ DisplayDriver dongleDisplayDriver = {
WIDTH, WIDTH,
HEIGHT}; HEIGHT};
#endif #endif

View File

@ -1,4 +1,4 @@
#include "DisplayDriver.h" #include "displayDriver.h"
#ifdef ESP32_2432S028R #ifdef ESP32_2432S028R
@ -81,6 +81,8 @@ void printPoolData(){
background.setSwapBytes(true); background.setSwapBytes(true);
if (bottomScreenBlue) { if (bottomScreenBlue) {
background.pushImage(0, 0, 320, 70, bottonPoolScreen); background.pushImage(0, 0, 320, 70, bottonPoolScreen);
//background.fillRect(295,43,25,10,TFT_CYAN);
} else { } else {
background.pushImage(0, 0, 320, 70, bottonPoolScreen_g); background.pushImage(0, 0, 320, 70, bottonPoolScreen_g);
} }
@ -89,12 +91,12 @@ void printPoolData(){
render.setLineSpaceRatio(1); render.setLineSpaceRatio(1);
render.setFontSize(24); render.setFontSize(24);
render.cdrawString(String(pData.workersCount).c_str(), 160, 35, TFT_BLACK); render.cdrawString(String(pData.workersCount).c_str(), 155, 35, TFT_BLACK);
render.setFontSize(18); render.setFontSize(18);
render.setAlignment(Align::BottomRight); render.setAlignment(Align::BottomRight);
render.drawString(pData.workersHash.c_str(), 293, 51, TFT_BLACK); render.cdrawString(pData.workersHash.c_str(), 265, 34, TFT_BLACK);
render.setAlignment(Align::TopLeft); render.setAlignment(Align::BottomLeft);
render.cdrawString(pData.bestDifficulty.c_str(), 50, 34, TFT_BLACK); render.cdrawString(pData.bestDifficulty.c_str(), 54, 34, TFT_BLACK);
background.pushSprite(0,170); background.pushSprite(0,170);
background.deleteSprite(); background.deleteSprite();
@ -128,11 +130,15 @@ void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
//Print background screen //Print background screen
background.pushImage(-190, 0, MinerWidth, MinerHeight, MinerScreen); background.pushImage(-190, 0, MinerWidth, MinerHeight, MinerScreen);
// Total hashes // Total hashes
render.setFontSize(18); render.setFontSize(18);
render.rdrawString(data.totalMHashes.c_str(), 268-wdtOffset, 138, TFT_BLACK); render.rdrawString(data.totalMHashes.c_str(), 268-wdtOffset, 138, TFT_BLACK);
// Block templates // Block templates
render.setFontSize(18); render.setFontSize(18);
render.setAlignment(Align::TopLeft);
render.drawString(data.templates.c_str(), 189-wdtOffset, 20, 0xDEDB); render.drawString(data.templates.c_str(), 189-wdtOffset, 20, 0xDEDB);
// Best diff // Best diff
render.drawString(data.bestDiff.c_str(), 189-wdtOffset, 48, 0xDEDB); render.drawString(data.bestDiff.c_str(), 189-wdtOffset, 48, 0xDEDB);
@ -145,7 +151,8 @@ void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
// Valid Blocks // Valid Blocks
render.setFontSize(24); render.setFontSize(24);
render.drawString(data.valids.c_str(), 285-wdtOffset, 56, 0xDEDB); render.setAlignment(Align::TopCenter);
render.drawString(data.valids.c_str(), 290-wdtOffset, 56, 0xDEDB);
// Print Temp // Print Temp
render.setFontSize(10); render.setFontSize(10);
@ -383,7 +390,7 @@ void esp32_2432S028R_DoLedStuff(unsigned long frame)
{ {
int16_t t_x , t_y; // To store the touch coordinates int16_t t_x , t_y; // To store the touch coordinates
bool pressed = touch.getXY(t_x, t_y); bool pressed = touch.getXY(t_x, t_y);
if (pressed) { if (pressed) {
if (((t_x > 109)&&(t_x < 211)) && ((t_y > 185)&&(t_y < 241))) bottomScreenBlue ^= true; if (((t_x > 109)&&(t_x < 211)) && ((t_y > 185)&&(t_y < 241))) bottomScreenBlue ^= true;
else else
if (t_x > 160) { if (t_x > 160) {
@ -451,4 +458,4 @@ DisplayDriver esp32_2432S028RDriver = {
0, 0,
WIDTH, WIDTH,
HEIGHT}; HEIGHT};
#endif #endif

View File

@ -1,4 +1,4 @@
#include "DisplayDriver.h" #include "displayDriver.h"
#ifdef NO_DISPLAY #ifdef NO_DISPLAY
@ -101,4 +101,4 @@ DisplayDriver noDisplayDriver = {
0, 0,
0, 0,
}; };
#endif #endif

View File

@ -1,4 +1,4 @@
#include "DisplayDriver.h" #include "displayDriver.h"
#ifdef T_DISPLAY #ifdef T_DISPLAY
@ -231,4 +231,4 @@ DisplayDriver tDisplayDriver = {
0, 0,
WIDTH, WIDTH,
HEIGHT}; HEIGHT};
#endif #endif

View File

@ -1,4 +1,4 @@
#include "DisplayDriver.h" #include "displayDriver.h"
#ifdef V1_DISPLAY #ifdef V1_DISPLAY
@ -96,7 +96,6 @@ void tDisplay_MinerScreen(unsigned long mElapsed)
// Push prepared background to screen // Push prepared background to screen
background.pushSprite(0, 0); background.pushSprite(0, 0);
background.deleteSprite();
} }
void tDisplay_ClockScreen(unsigned long mElapsed) void tDisplay_ClockScreen(unsigned long mElapsed)
@ -135,7 +134,6 @@ void tDisplay_ClockScreen(unsigned long mElapsed)
// Push prepared background to screen // Push prepared background to screen
background.pushSprite(0, 0); background.pushSprite(0, 0);
background.deleteSprite();
} }
void tDisplay_GlobalHashScreen(unsigned long mElapsed) void tDisplay_GlobalHashScreen(unsigned long mElapsed)
@ -195,7 +193,6 @@ void tDisplay_GlobalHashScreen(unsigned long mElapsed)
// Push prepared background to screen // Push prepared background to screen
background.pushSprite(0, 0); background.pushSprite(0, 0);
background.deleteSprite();
} }
void tDisplay_LoadingScreen(void) void tDisplay_LoadingScreen(void)
@ -234,4 +231,4 @@ DisplayDriver tDisplayV1Driver = {
0, 0,
WIDTH, WIDTH,
HEIGHT}; HEIGHT};
#endif #endif

View File

@ -1,4 +1,4 @@
#include "DisplayDriver.h" #include "displayDriver.h"
#ifdef T_QT_DISPLAY #ifdef T_QT_DISPLAY
@ -177,4 +177,4 @@ DisplayDriver t_qtDisplayDriver = {
0, 0,
WIDTH, WIDTH,
HEIGHT}; HEIGHT};
#endif #endif

View File

@ -4,7 +4,7 @@
#include "storage.h" #include "storage.h"
#include "nvMemory.h" #include "nvMemory.h"
#include "..\devices\device.h" #include "../devices/device.h"
#include "SDCard.h" #include "SDCard.h"
#if defined (BUILD_SDMMC_1) || defined(BUILD_SDMMC_4) #if defined (BUILD_SDMMC_1) || defined(BUILD_SDMMC_4)
@ -100,6 +100,7 @@ bool SDCard::loadConfigFile(TSettings* Settings)
Settings->WifiSSID = json[JSON_KEY_SSID] | Settings->WifiSSID; Settings->WifiSSID = json[JSON_KEY_SSID] | Settings->WifiSSID;
Settings->WifiPW = json[JSON_KEY_PASW] | Settings->WifiPW; Settings->WifiPW = json[JSON_KEY_PASW] | Settings->WifiPW;
Settings->PoolAddress = json[JSON_KEY_POOLURL] | Settings->PoolAddress; Settings->PoolAddress = json[JSON_KEY_POOLURL] | Settings->PoolAddress;
strcpy(Settings->PoolPassword, json[JSON_KEY_POOLPASS] | Settings->PoolPassword);
strcpy(Settings->BtcWallet, json[JSON_KEY_WALLETID] | Settings->BtcWallet); strcpy(Settings->BtcWallet, json[JSON_KEY_WALLETID] | Settings->BtcWallet);
if (json.containsKey(JSON_KEY_POOLPORT)) if (json.containsKey(JSON_KEY_POOLPORT))
Settings->PoolPort = json[JSON_KEY_POOLPORT].as<int>(); Settings->PoolPort = json[JSON_KEY_POOLPORT].as<int>();

View File

@ -3,7 +3,7 @@
#include "storage.h" #include "storage.h"
#include "nvMemory.h" #include "nvMemory.h"
#include "..\devices\device.h" #include "../devices/device.h"
// configuration example and description in /devices/esp32cam.h // configuration example and description in /devices/esp32cam.h

View File

@ -6,7 +6,7 @@
#include <FS.h> #include <FS.h>
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include "..\devices\device.h" #include "../devices/device.h"
#include "storage.h" #include "storage.h"
nvMemory::nvMemory() : Initialized_(false){}; nvMemory::nvMemory() : Initialized_(false){};
@ -31,6 +31,7 @@ bool nvMemory::saveConfig(TSettings* Settings)
StaticJsonDocument<512> json; StaticJsonDocument<512> json;
json[JSON_SPIFFS_KEY_POOLURL] = Settings->PoolAddress; json[JSON_SPIFFS_KEY_POOLURL] = Settings->PoolAddress;
json[JSON_SPIFFS_KEY_POOLPORT] = Settings->PoolPort; json[JSON_SPIFFS_KEY_POOLPORT] = Settings->PoolPort;
json[JSON_SPIFFS_KEY_POOLPASS] = Settings->PoolPassword;
json[JSON_SPIFFS_KEY_WALLETID] = Settings->BtcWallet; json[JSON_SPIFFS_KEY_WALLETID] = Settings->BtcWallet;
json[JSON_SPIFFS_KEY_TIMEZONE] = Settings->Timezone; json[JSON_SPIFFS_KEY_TIMEZONE] = Settings->Timezone;
json[JSON_SPIFFS_KEY_STATS2NV] = Settings->saveStats; json[JSON_SPIFFS_KEY_STATS2NV] = Settings->saveStats;
@ -88,6 +89,7 @@ bool nvMemory::loadConfig(TSettings* Settings)
if (!error) if (!error)
{ {
Settings->PoolAddress = json[JSON_SPIFFS_KEY_POOLURL] | Settings->PoolAddress; Settings->PoolAddress = json[JSON_SPIFFS_KEY_POOLURL] | Settings->PoolAddress;
strcpy(Settings->PoolPassword, json[JSON_SPIFFS_KEY_POOLPASS] | Settings->PoolPassword);
strcpy(Settings->BtcWallet, json[JSON_SPIFFS_KEY_WALLETID] | Settings->BtcWallet); strcpy(Settings->BtcWallet, json[JSON_SPIFFS_KEY_WALLETID] | Settings->BtcWallet);
if (json.containsKey(JSON_SPIFFS_KEY_POOLPORT)) if (json.containsKey(JSON_SPIFFS_KEY_POOLPORT))
Settings->PoolPort = json[JSON_SPIFFS_KEY_POOLPORT].as<int>(); Settings->PoolPort = json[JSON_SPIFFS_KEY_POOLPORT].as<int>();

View File

@ -4,7 +4,7 @@
// we only have one implementation right now and nothing to choose from. // we only have one implementation right now and nothing to choose from.
#define NVMEM_SPIFFS #define NVMEM_SPIFFS
#include "..\devices\device.h" #include "../devices/device.h"
#include "storage.h" #include "storage.h"
// Handles load and store of user settings, except wifi credentials. Those are managed by the wifimanager. // Handles load and store of user settings, except wifi credentials. Those are managed by the wifimanager.

View File

@ -9,6 +9,7 @@
#define DEFAULT_SSID "NerdMinerAP" #define DEFAULT_SSID "NerdMinerAP"
#define DEFAULT_WIFIPW "MineYourCoins" #define DEFAULT_WIFIPW "MineYourCoins"
#define DEFAULT_POOLURL "public-pool.io" #define DEFAULT_POOLURL "public-pool.io"
#define DEFAULT_POOLPASS "x"
#define DEFAULT_WALLETID "yourBtcAddress" #define DEFAULT_WALLETID "yourBtcAddress"
#define DEFAULT_POOLPORT 21496 #define DEFAULT_POOLPORT 21496
#define DEFAULT_TIMEZONE 2 #define DEFAULT_TIMEZONE 2
@ -21,6 +22,7 @@
#define JSON_KEY_SSID "SSID" #define JSON_KEY_SSID "SSID"
#define JSON_KEY_PASW "WifiPW" #define JSON_KEY_PASW "WifiPW"
#define JSON_KEY_POOLURL "PoolUrl" #define JSON_KEY_POOLURL "PoolUrl"
#define JSON_KEY_POOLPASS "PoolPassword"
#define JSON_KEY_WALLETID "BtcWallet" #define JSON_KEY_WALLETID "BtcWallet"
#define JSON_KEY_POOLPORT "PoolPort" #define JSON_KEY_POOLPORT "PoolPort"
#define JSON_KEY_TIMEZONE "Timezone" #define JSON_KEY_TIMEZONE "Timezone"
@ -29,6 +31,7 @@
// JSON config file SPIFFS (different for backward compatibility with existing devices) // JSON config file SPIFFS (different for backward compatibility with existing devices)
#define JSON_SPIFFS_KEY_POOLURL "poolString" #define JSON_SPIFFS_KEY_POOLURL "poolString"
#define JSON_SPIFFS_KEY_POOLPORT "portNumber" #define JSON_SPIFFS_KEY_POOLPORT "portNumber"
#define JSON_SPIFFS_KEY_POOLPASS "poolPassword"
#define JSON_SPIFFS_KEY_WALLETID "btcString" #define JSON_SPIFFS_KEY_WALLETID "btcString"
#define JSON_SPIFFS_KEY_TIMEZONE "gmtZone" #define JSON_SPIFFS_KEY_TIMEZONE "gmtZone"
#define JSON_SPIFFS_KEY_STATS2NV "saveStatsToNVS" #define JSON_SPIFFS_KEY_STATS2NV "saveStatsToNVS"
@ -40,6 +43,7 @@ struct TSettings
String WifiPW{ DEFAULT_WIFIPW }; String WifiPW{ DEFAULT_WIFIPW };
String PoolAddress{ DEFAULT_POOLURL }; String PoolAddress{ DEFAULT_POOLURL };
char BtcWallet[80]{ DEFAULT_WALLETID }; char BtcWallet[80]{ DEFAULT_WALLETID };
char PoolPassword[80]{ DEFAULT_POOLPASS };
int PoolPort{ DEFAULT_POOLPORT }; int PoolPort{ DEFAULT_POOLPORT };
int Timezone{ DEFAULT_TIMEZONE }; int Timezone{ DEFAULT_TIMEZONE };
bool saveStats{ DEFAULT_SAVESTATS }; bool saveStats{ DEFAULT_SAVESTATS };

File diff suppressed because it is too large Load Diff

View File

@ -167,7 +167,7 @@ void runStratumWorker(void *name) {
} }
strcpy(mWorker.wName, Settings.BtcWallet); strcpy(mWorker.wName, Settings.BtcWallet);
strcpy(mWorker.wPass, "x"); strcpy(mWorker.wPass, Settings.PoolPassword);
// STEP 2: Pool authorize work (Block Info) // STEP 2: Pool authorize work (Block Info)
tx_mining_auth(client, mWorker.wName, mWorker.wPass); //Don't verifies authoritzation, TODO tx_mining_auth(client, mWorker.wName, mWorker.wPass); //Don't verifies authoritzation, TODO
//tx_mining_auth2(client, mWorker.wName, mWorker.wPass); //Don't verifies authoritzation, TODO //tx_mining_auth2(client, mWorker.wName, mWorker.wPass); //Don't verifies authoritzation, TODO

View File

@ -152,7 +152,7 @@ String getBTCprice(void){
DynamicJsonDocument doc(1024); DynamicJsonDocument doc(1024);
deserializeJson(doc, payload); deserializeJson(doc, payload);
if (doc.containsKey("bitcoin")) bitcoin_price = doc["bitcoin"]["usd"]; if (doc.containsKey("bitcoin")) bitcoin_price = doc["last_trade_price"];
doc.clear(); doc.clear();
@ -316,12 +316,15 @@ pool_data getPoolData(void){
const JsonArray& workers = doc["workers"].as<JsonArray>(); const JsonArray& workers = doc["workers"].as<JsonArray>();
float totalhashs = 0; float totalhashs = 0;
for (const JsonObject& worker : workers) { for (const JsonObject& worker : workers) {
totalhashs += worker["hashRate"].as<int>(); totalhashs += worker["hashRate"].as<double>();
/* Serial.print(worker["sessionId"].as<String>()+": "); /* Serial.print(worker["sessionId"].as<String>()+": ");
Serial.print(" - "+worker["hashRate"].as<String>()+": "); Serial.print(" - "+worker["hashRate"].as<String>()+": ");
Serial.println(totalhashs); */ Serial.println(totalhashs); */
} }
pData.workersHash = String(totalhashs/1000); char totalhashs_s[16] = {0};
suffix_string(totalhashs, totalhashs_s, 16, 0);
pData.workersHash = String(totalhashs_s);
double temp; double temp;
if (doc.containsKey("bestDifficulty")) { if (doc.containsKey("bestDifficulty")) {
temp = doc["bestDifficulty"].as<double>(); temp = doc["bestDifficulty"].as<double>();
@ -338,4 +341,4 @@ pool_data getPoolData(void){
} }
} }
return pData; return pData;
} }

View File

@ -13,8 +13,8 @@
#define UPDATE_PERIOD_h 5 #define UPDATE_PERIOD_h 5
//API BTC price //API BTC price
#define getBTCAPI "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd" #define getBTCAPI "https://api.blockchain.com/v3/exchange/tickers/BTC-USD"
#define UPDATE_BTC_min 5 #define UPDATE_BTC_min 1
//API Block height //API Block height
#define getHeightAPI "https://mempool.space/api/blocks/tip/height" #define getHeightAPI "https://mempool.space/api/blocks/tip/height"
@ -116,4 +116,4 @@ pool_data getPoolData(void);
clock_data_t getClockData_t(unsigned long mElapsed); clock_data_t getClockData_t(unsigned long mElapsed);
#endif //MONITOR_API_H #endif //MONITOR_API_H

View File

@ -134,6 +134,9 @@ void init_WifiManager()
// Text box (Number) - 7 characters maximum // Text box (Number) - 7 characters maximum
WiFiManagerParameter port_text_box_num("Poolport", "Pool port", convertedValue, 7); WiFiManagerParameter port_text_box_num("Poolport", "Pool port", convertedValue, 7);
// Text box (String) - 80 characters maximum
WiFiManagerParameter password_text_box("Poolpassword", "Pool password", Settings.PoolPassword, 80);
// Text box (String) - 80 characters maximum // Text box (String) - 80 characters maximum
WiFiManagerParameter addr_text_box("btcAddress", "Your BTC address", Settings.BtcWallet, 80); WiFiManagerParameter addr_text_box("btcAddress", "Your BTC address", Settings.BtcWallet, 80);
@ -154,6 +157,7 @@ void init_WifiManager()
// Add all defined parameters // Add all defined parameters
wm.addParameter(&pool_text_box); wm.addParameter(&pool_text_box);
wm.addParameter(&port_text_box_num); wm.addParameter(&port_text_box_num);
wm.addParameter(&password_text_box);
wm.addParameter(&addr_text_box); wm.addParameter(&addr_text_box);
wm.addParameter(&time_text_box_num); wm.addParameter(&time_text_box_num);
wm.addParameter(&features_html); wm.addParameter(&features_html);
@ -173,6 +177,7 @@ void init_WifiManager()
Serial.println("failed to connect and hit timeout"); Serial.println("failed to connect and hit timeout");
Settings.PoolAddress = pool_text_box.getValue(); Settings.PoolAddress = pool_text_box.getValue();
Settings.PoolPort = atoi(port_text_box_num.getValue()); Settings.PoolPort = atoi(port_text_box_num.getValue());
strncpy(Settings.PoolPassword, password_text_box.getValue(), sizeof(Settings.PoolPassword));
strncpy(Settings.BtcWallet, addr_text_box.getValue(), sizeof(Settings.BtcWallet)); strncpy(Settings.BtcWallet, addr_text_box.getValue(), sizeof(Settings.BtcWallet));
Settings.Timezone = atoi(time_text_box_num.getValue()); Settings.Timezone = atoi(time_text_box_num.getValue());
Serial.println(save_stats_to_nvs.getValue()); Serial.println(save_stats_to_nvs.getValue());
@ -223,6 +228,11 @@ void init_WifiManager()
Serial.print("portNumber: "); Serial.print("portNumber: ");
Serial.println(Settings.PoolPort); Serial.println(Settings.PoolPort);
// Copy the string value
strncpy(Settings.PoolPassword, password_text_box.getValue(), sizeof(Settings.PoolPassword));
Serial.print("poolPassword: ");
Serial.println(Settings.PoolPassword);
// Copy the string value // Copy the string value
strncpy(Settings.BtcWallet, addr_text_box.getValue(), sizeof(Settings.BtcWallet)); strncpy(Settings.BtcWallet, addr_text_box.getValue(), sizeof(Settings.BtcWallet));
Serial.print("btcString: "); Serial.print("btcString: ");