Merge branch 'master' into dev
This commit is contained in:
commit
25cf29f41a
7
.github/workflows/main.yml
vendored
7
.github/workflows/main.yml
vendored
@ -1,6 +1,9 @@
|
||||
name: PlatformIO CI
|
||||
|
||||
on: [push]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -27,4 +30,4 @@ jobs:
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: builded artifacts
|
||||
path: .pio/build/*
|
||||
path: .pio/build/*/*.bin
|
||||
|
118
README.md
118
README.md
@ -1,25 +1,28 @@
|
||||
# NerdSoloMiner
|
||||
|
||||
**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.
|
||||
|
||||
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
|
||||
|
||||
![image](images/bgNerdMinerV2.png)
|
||||
|
||||
## Requirements
|
||||
|
||||
- TTGO T-Display S3 or any supported boards (check Build tutorial 👇)
|
||||
- 3D BOX [here](3d_files/)
|
||||
|
||||
### 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.
|
||||
The microMiner comes with several screens to monitor it's working procedure and also to show you network mining stats.
|
||||
Currently includes:
|
||||
|
||||
- NerdMiner Screen > Mining data of Nerdminer
|
||||
- ClockMiner Screen > Fashion style clock miner
|
||||
- GlobalStats Screen > Global minery stats and relevant data
|
||||
@ -29,46 +32,54 @@ Every time an stratum job notification is received miner update its current work
|
||||
|
||||
**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
|
||||
|
||||
### Hardware requirements
|
||||
|
||||
- LILYGO T-Display S3 (original one) or any other supported boards
|
||||
- 3D BOX [here](3d_files/)
|
||||
|
||||
#### 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-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-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)
|
||||
|
||||
- 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-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-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)
|
||||
|
||||
*Affiliate links
|
||||
\*Affiliate links
|
||||
|
||||
### Flash firmware
|
||||
|
||||
#### microMiners Flashtool [Recommended]
|
||||
|
||||
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. Go to NM2 flasher online: https://bitmaker-hub.github.io/diyflasher/
|
||||
|
||||
#### 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.
|
||||
|
||||
1. Get a TTGO T-display S3 or any supported board
|
||||
1. Download this repository
|
||||
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. Plug your board and select each file from the sub-folder (``.bin`` files).
|
||||
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).
|
||||
|
||||
### Update firmware
|
||||
|
||||
Update NerdMiner firmware following same flashing steps but only using the file 0x10000_firmware.bin.
|
||||
|
||||
#### Build troubleshooting
|
||||
|
||||
1. Online ESPtool works with chrome, chromium, brave
|
||||
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
|
||||
@ -76,15 +87,20 @@ Update NerdMiner firmware following same flashing steps but only using the file
|
||||
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
|
||||
|
||||
After programming, you will only need to setup your Wifi and BTC address.
|
||||
|
||||
#### Wifi Accesspoint
|
||||
|
||||
1. Connect to NerdMinerAP
|
||||
- AP: NerdMinerAP
|
||||
- PASS: MineYourCoins
|
||||
- AP: NerdMinerAP
|
||||
- PASS: MineYourCoins
|
||||
1. Setup your Wifi Network
|
||||
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)
|
||||
|
||||
@ -95,10 +111,12 @@ After programming, you will only need to setup your Wifi and BTC address.
|
||||
"WifiPW": "myWifiPassword",
|
||||
"PoolUrl": "public-pool.io",
|
||||
"PoolPort": 21496,
|
||||
"PoolPassword": "x",
|
||||
"BtcWallet": "walletID",
|
||||
"Timezone": 2,
|
||||
"SaveStats": false
|
||||
}
|
||||
|
||||
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. 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:
|
||||
|
||||
| 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 |
|
||||
| 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.vkbit.com | 3333 | https://vkbit.com/ | Mantained by djerfy |
|
||||
| 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 |
|
||||
| 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.vkbit.com | 3333 | https://vkbit.com/ | Mantained by djerfy |
|
||||
|
||||
Other standard pools not compatible with low difficulty share:
|
||||
|
||||
| Pool URL | Port | Web URL |
|
||||
|--- |--- |--- |
|
||||
| solo.ckpool.org | 3333 | https://solo.ckpool.org/ |
|
||||
| Pool URL | Port | Web URL |
|
||||
| ------------------------ | ---- | ----------------------------------------- |
|
||||
| solo.ckpool.org | 3333 | https://solo.ckpool.org/ |
|
||||
| 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
|
||||
|
||||
@ -132,53 +150,61 @@ Other standard pools not compatible with low difficulty share:
|
||||
- Hold 5 seconds > **reset the configurations and reboot** your NerdMiner.
|
||||
|
||||
#### Two button devices:
|
||||
|
||||
With the USB-C port to the right:
|
||||
|
||||
**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.
|
||||
|
||||
|
||||
**BOTTOM BUTTON**
|
||||
|
||||
- One Click > turn the screen off and on again
|
||||
- Double click > change orientation (default is USB-C to the right)
|
||||
|
||||
#### Build video
|
||||
|
||||
[![Ver video aquí](https://img.youtube.com/vi/POUT2R_opDs/0.jpg)](https://youtu.be/POUT2R_opDs)
|
||||
|
||||
## Developers
|
||||
|
||||
### Project guidelines
|
||||
|
||||
- Current project was addapted to work with PlatformIO
|
||||
- Current project works with ESP32-S3 and ESP32-wroom.
|
||||
- Partition squeme should be build as huge app
|
||||
- All libraries needed shown on platform.ini
|
||||
|
||||
### Job done
|
||||
- [x] Move project to platformIO
|
||||
- [x] Bug rectangle on screen when 1milion shares
|
||||
- [x] Bug memory leaks
|
||||
- [x] Bug Reboots when received JSON contains some null values
|
||||
- [x] Implement midstate sha256
|
||||
- [x] Bug Wificlient DNS unresolved on Wifi.h
|
||||
- [x] Code refactoring
|
||||
- [x] Add blockHeight to screen
|
||||
- [x] Add clock to show current time
|
||||
- [x] Add new screen with global mining stats
|
||||
- [x] Add pool support for low difficulty miners
|
||||
- [x] Add best difficulty on miner screen
|
||||
- [x] Add suport to standard ESP32 dev-kit / ESP32-WROOM
|
||||
- [x] Code changes to support adding multiple boards
|
||||
- [x] Add support to TTGO T-display 1.14
|
||||
- [x] Add support to Amoled
|
||||
|
||||
- [x] Move project to platformIO
|
||||
- [x] Bug rectangle on screen when 1milion shares
|
||||
- [x] Bug memory leaks
|
||||
- [x] Bug Reboots when received JSON contains some null values
|
||||
- [x] Implement midstate sha256
|
||||
- [x] Bug Wificlient DNS unresolved on Wifi.h
|
||||
- [x] Code refactoring
|
||||
- [x] Add blockHeight to screen
|
||||
- [x] Add clock to show current time
|
||||
- [x] Add new screen with global mining stats
|
||||
- [x] Add pool support for low difficulty miners
|
||||
- [x] Add best difficulty on miner screen
|
||||
- [x] Add suport to standard ESP32 dev-kit / ESP32-WROOM
|
||||
- [x] Code changes to support adding multiple boards
|
||||
- [x] Add support to TTGO T-display 1.14
|
||||
- [x] Add support to Amoled
|
||||
|
||||
### On process
|
||||
- [ ] Create a daisy chain protocol via UART or I2C to support ESP32 hashboards
|
||||
- [ ] Create new screen like clockMiner but with BTC price
|
||||
- [ ] Add support to control BM1397
|
||||
|
||||
- [ ] Create a daisy chain protocol via UART or I2C to support ESP32 hashboards
|
||||
- [ ] Create new screen like clockMiner but with BTC price
|
||||
- [ ] Add support to control BM1397
|
||||
- [ ] Add password field in web configuration form
|
||||
|
||||
### 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 want to order a fully assembled Nerdminer you can contribute to my job at 🛒[bitronics.store](https://bitronics.store)🛒
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
[platformio]
|
||||
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]
|
||||
platform = espressif32
|
||||
@ -126,6 +126,8 @@ build_flags =
|
||||
-DNERMINER_S3_DONGLE
|
||||
-DBOARD_HAS_PSRAM
|
||||
-DARDUINO_USB_CDC_ON_BOOT
|
||||
-DTFT_BACKLIGHT_ON=LOW
|
||||
-DTFT_BL=38
|
||||
lib_deps =
|
||||
https://github.com/takkaO/OpenFontRender
|
||||
bblanchon/ArduinoJson@^6.21.2
|
||||
@ -256,3 +258,29 @@ lib_deps =
|
||||
https://github.com/tzapu/WiFiManager.git#v2.0.16-rc.2
|
||||
mathertel/OneButton @ ^2.0.3
|
||||
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
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include "lilygoV1TDisplay.h"
|
||||
#elif defined(ESP32_CAM)
|
||||
#include "esp32CAM.h"
|
||||
#elif defined(M5_STAMP_S3)
|
||||
#include "m5StampS3.h"
|
||||
|
||||
#else
|
||||
#error "No device defined"
|
||||
|
9
src/drivers/devices/m5StampS3.h
Normal file
9
src/drivers/devices/m5StampS3.h
Normal 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
|
@ -1,4 +1,4 @@
|
||||
#include "DisplayDriver.h"
|
||||
#include "displayDriver.h"
|
||||
|
||||
#ifdef AMOLED_DISPLAY
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef DISPLAY_H
|
||||
#define DISPLAY_H
|
||||
|
||||
#include "DisplayDriver.h"
|
||||
#include "displayDriver.h"
|
||||
|
||||
extern DisplayDriver *currentDisplayDriver;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef DISPLAYDRIVER_H_
|
||||
#define DISPLAYDRIVER_H_
|
||||
|
||||
#include "..\devices\device.h"
|
||||
#include "../devices/device.h"
|
||||
|
||||
typedef void (*AlternateFunction)(void);
|
||||
typedef void (*DriverInitFunction)(void);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "DisplayDriver.h"
|
||||
#include "displayDriver.h"
|
||||
|
||||
#ifdef DONGLE_DISPLAY
|
||||
|
||||
@ -103,6 +103,9 @@ void dongleDisplay_Init(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)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "DisplayDriver.h"
|
||||
#include "displayDriver.h"
|
||||
|
||||
#ifdef ESP32_2432S028R
|
||||
|
||||
@ -81,6 +81,8 @@ void printPoolData(){
|
||||
background.setSwapBytes(true);
|
||||
if (bottomScreenBlue) {
|
||||
background.pushImage(0, 0, 320, 70, bottonPoolScreen);
|
||||
//background.fillRect(295,43,25,10,TFT_CYAN);
|
||||
|
||||
} else {
|
||||
background.pushImage(0, 0, 320, 70, bottonPoolScreen_g);
|
||||
}
|
||||
@ -89,12 +91,12 @@ void printPoolData(){
|
||||
render.setLineSpaceRatio(1);
|
||||
|
||||
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.setAlignment(Align::BottomRight);
|
||||
render.drawString(pData.workersHash.c_str(), 293, 51, TFT_BLACK);
|
||||
render.setAlignment(Align::TopLeft);
|
||||
render.cdrawString(pData.bestDifficulty.c_str(), 50, 34, TFT_BLACK);
|
||||
render.cdrawString(pData.workersHash.c_str(), 265, 34, TFT_BLACK);
|
||||
render.setAlignment(Align::BottomLeft);
|
||||
render.cdrawString(pData.bestDifficulty.c_str(), 54, 34, TFT_BLACK);
|
||||
|
||||
background.pushSprite(0,170);
|
||||
background.deleteSprite();
|
||||
@ -128,11 +130,15 @@ void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
|
||||
//Print background screen
|
||||
background.pushImage(-190, 0, MinerWidth, MinerHeight, MinerScreen);
|
||||
|
||||
|
||||
// Total hashes
|
||||
render.setFontSize(18);
|
||||
render.rdrawString(data.totalMHashes.c_str(), 268-wdtOffset, 138, TFT_BLACK);
|
||||
|
||||
|
||||
// Block templates
|
||||
render.setFontSize(18);
|
||||
render.setAlignment(Align::TopLeft);
|
||||
render.drawString(data.templates.c_str(), 189-wdtOffset, 20, 0xDEDB);
|
||||
// Best diff
|
||||
render.drawString(data.bestDiff.c_str(), 189-wdtOffset, 48, 0xDEDB);
|
||||
@ -145,7 +151,8 @@ void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
|
||||
|
||||
// Valid Blocks
|
||||
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
|
||||
render.setFontSize(10);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "DisplayDriver.h"
|
||||
#include "displayDriver.h"
|
||||
|
||||
#ifdef NO_DISPLAY
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "DisplayDriver.h"
|
||||
#include "displayDriver.h"
|
||||
|
||||
#ifdef T_DISPLAY
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "DisplayDriver.h"
|
||||
#include "displayDriver.h"
|
||||
|
||||
#ifdef V1_DISPLAY
|
||||
|
||||
@ -96,7 +96,6 @@ void tDisplay_MinerScreen(unsigned long mElapsed)
|
||||
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(0, 0);
|
||||
background.deleteSprite();
|
||||
}
|
||||
|
||||
void tDisplay_ClockScreen(unsigned long mElapsed)
|
||||
@ -135,7 +134,6 @@ void tDisplay_ClockScreen(unsigned long mElapsed)
|
||||
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(0, 0);
|
||||
background.deleteSprite();
|
||||
}
|
||||
|
||||
void tDisplay_GlobalHashScreen(unsigned long mElapsed)
|
||||
@ -195,7 +193,6 @@ void tDisplay_GlobalHashScreen(unsigned long mElapsed)
|
||||
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(0, 0);
|
||||
background.deleteSprite();
|
||||
}
|
||||
|
||||
void tDisplay_LoadingScreen(void)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "DisplayDriver.h"
|
||||
#include "displayDriver.h"
|
||||
|
||||
#ifdef T_QT_DISPLAY
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "storage.h"
|
||||
#include "nvMemory.h"
|
||||
#include "..\devices\device.h"
|
||||
#include "../devices/device.h"
|
||||
#include "SDCard.h"
|
||||
|
||||
#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->WifiPW = json[JSON_KEY_PASW] | Settings->WifiPW;
|
||||
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);
|
||||
if (json.containsKey(JSON_KEY_POOLPORT))
|
||||
Settings->PoolPort = json[JSON_KEY_POOLPORT].as<int>();
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "storage.h"
|
||||
#include "nvMemory.h"
|
||||
#include "..\devices\device.h"
|
||||
#include "../devices/device.h"
|
||||
|
||||
// configuration example and description in /devices/esp32cam.h
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <FS.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
#include "..\devices\device.h"
|
||||
#include "../devices/device.h"
|
||||
#include "storage.h"
|
||||
|
||||
nvMemory::nvMemory() : Initialized_(false){};
|
||||
@ -31,6 +31,7 @@ bool nvMemory::saveConfig(TSettings* Settings)
|
||||
StaticJsonDocument<512> json;
|
||||
json[JSON_SPIFFS_KEY_POOLURL] = Settings->PoolAddress;
|
||||
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_TIMEZONE] = Settings->Timezone;
|
||||
json[JSON_SPIFFS_KEY_STATS2NV] = Settings->saveStats;
|
||||
@ -88,6 +89,7 @@ bool nvMemory::loadConfig(TSettings* Settings)
|
||||
if (!error)
|
||||
{
|
||||
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);
|
||||
if (json.containsKey(JSON_SPIFFS_KEY_POOLPORT))
|
||||
Settings->PoolPort = json[JSON_SPIFFS_KEY_POOLPORT].as<int>();
|
||||
|
@ -4,7 +4,7 @@
|
||||
// we only have one implementation right now and nothing to choose from.
|
||||
#define NVMEM_SPIFFS
|
||||
|
||||
#include "..\devices\device.h"
|
||||
#include "../devices/device.h"
|
||||
#include "storage.h"
|
||||
|
||||
// Handles load and store of user settings, except wifi credentials. Those are managed by the wifimanager.
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define DEFAULT_SSID "NerdMinerAP"
|
||||
#define DEFAULT_WIFIPW "MineYourCoins"
|
||||
#define DEFAULT_POOLURL "public-pool.io"
|
||||
#define DEFAULT_POOLPASS "x"
|
||||
#define DEFAULT_WALLETID "yourBtcAddress"
|
||||
#define DEFAULT_POOLPORT 21496
|
||||
#define DEFAULT_TIMEZONE 2
|
||||
@ -21,6 +22,7 @@
|
||||
#define JSON_KEY_SSID "SSID"
|
||||
#define JSON_KEY_PASW "WifiPW"
|
||||
#define JSON_KEY_POOLURL "PoolUrl"
|
||||
#define JSON_KEY_POOLPASS "PoolPassword"
|
||||
#define JSON_KEY_WALLETID "BtcWallet"
|
||||
#define JSON_KEY_POOLPORT "PoolPort"
|
||||
#define JSON_KEY_TIMEZONE "Timezone"
|
||||
@ -29,6 +31,7 @@
|
||||
// JSON config file SPIFFS (different for backward compatibility with existing devices)
|
||||
#define JSON_SPIFFS_KEY_POOLURL "poolString"
|
||||
#define JSON_SPIFFS_KEY_POOLPORT "portNumber"
|
||||
#define JSON_SPIFFS_KEY_POOLPASS "poolPassword"
|
||||
#define JSON_SPIFFS_KEY_WALLETID "btcString"
|
||||
#define JSON_SPIFFS_KEY_TIMEZONE "gmtZone"
|
||||
#define JSON_SPIFFS_KEY_STATS2NV "saveStatsToNVS"
|
||||
@ -40,6 +43,7 @@ struct TSettings
|
||||
String WifiPW{ DEFAULT_WIFIPW };
|
||||
String PoolAddress{ DEFAULT_POOLURL };
|
||||
char BtcWallet[80]{ DEFAULT_WALLETID };
|
||||
char PoolPassword[80]{ DEFAULT_POOLPASS };
|
||||
int PoolPort{ DEFAULT_POOLPORT };
|
||||
int Timezone{ DEFAULT_TIMEZONE };
|
||||
bool saveStats{ DEFAULT_SAVESTATS };
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -167,7 +167,7 @@ void runStratumWorker(void *name) {
|
||||
}
|
||||
|
||||
strcpy(mWorker.wName, Settings.BtcWallet);
|
||||
strcpy(mWorker.wPass, "x");
|
||||
strcpy(mWorker.wPass, Settings.PoolPassword);
|
||||
// STEP 2: Pool authorize work (Block Info)
|
||||
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
|
||||
|
@ -152,7 +152,7 @@ String getBTCprice(void){
|
||||
|
||||
DynamicJsonDocument doc(1024);
|
||||
deserializeJson(doc, payload);
|
||||
if (doc.containsKey("bitcoin")) bitcoin_price = doc["bitcoin"]["usd"];
|
||||
if (doc.containsKey("bitcoin")) bitcoin_price = doc["last_trade_price"];
|
||||
|
||||
doc.clear();
|
||||
|
||||
@ -316,12 +316,15 @@ pool_data getPoolData(void){
|
||||
const JsonArray& workers = doc["workers"].as<JsonArray>();
|
||||
float totalhashs = 0;
|
||||
for (const JsonObject& worker : workers) {
|
||||
totalhashs += worker["hashRate"].as<int>();
|
||||
totalhashs += worker["hashRate"].as<double>();
|
||||
/* Serial.print(worker["sessionId"].as<String>()+": ");
|
||||
Serial.print(" - "+worker["hashRate"].as<String>()+": ");
|
||||
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;
|
||||
if (doc.containsKey("bestDifficulty")) {
|
||||
temp = doc["bestDifficulty"].as<double>();
|
||||
|
@ -13,8 +13,8 @@
|
||||
#define UPDATE_PERIOD_h 5
|
||||
|
||||
//API BTC price
|
||||
#define getBTCAPI "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd"
|
||||
#define UPDATE_BTC_min 5
|
||||
#define getBTCAPI "https://api.blockchain.com/v3/exchange/tickers/BTC-USD"
|
||||
#define UPDATE_BTC_min 1
|
||||
|
||||
//API Block height
|
||||
#define getHeightAPI "https://mempool.space/api/blocks/tip/height"
|
||||
|
@ -134,6 +134,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", Settings.PoolPassword, 80);
|
||||
|
||||
// Text box (String) - 80 characters maximum
|
||||
WiFiManagerParameter addr_text_box("btcAddress", "Your BTC address", Settings.BtcWallet, 80);
|
||||
|
||||
@ -154,6 +157,7 @@ void init_WifiManager()
|
||||
// Add all defined parameters
|
||||
wm.addParameter(&pool_text_box);
|
||||
wm.addParameter(&port_text_box_num);
|
||||
wm.addParameter(&password_text_box);
|
||||
wm.addParameter(&addr_text_box);
|
||||
wm.addParameter(&time_text_box_num);
|
||||
wm.addParameter(&features_html);
|
||||
@ -173,6 +177,7 @@ void init_WifiManager()
|
||||
Serial.println("failed to connect and hit timeout");
|
||||
Settings.PoolAddress = pool_text_box.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));
|
||||
Settings.Timezone = atoi(time_text_box_num.getValue());
|
||||
Serial.println(save_stats_to_nvs.getValue());
|
||||
@ -223,6 +228,11 @@ void init_WifiManager()
|
||||
Serial.print("portNumber: ");
|
||||
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
|
||||
strncpy(Settings.BtcWallet, addr_text_box.getValue(), sizeof(Settings.BtcWallet));
|
||||
Serial.print("btcString: ");
|
||||
|
Loading…
Reference in New Issue
Block a user