Merge branch 'master' into dev
This commit is contained in:
commit
865bf4f363
@ -143,9 +143,8 @@ 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 |
|
| pool.nerdminers.org | 3333 | https://nerdminers.org | The official Nerdminer pool site - Mantained by @golden-guy |
|
||||||
| 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 - public-pool fork |
|
|
||||||
| pool.pyblock.xyz | 3333 | https://pool.pyblock.xyz/ | Mantained by curly60e |
|
| pool.pyblock.xyz | 3333 | https://pool.pyblock.xyz/ | Mantained by curly60e |
|
||||||
| pool.sethforprivacy.com | 3333 | https://pool.sethforprivacy.com/ | Mantained by @sethforprivacy - public-pool fork |
|
| pool.sethforprivacy.com | 3333 | https://pool.sethforprivacy.com/ | Mantained by @sethforprivacy - public-pool fork |
|
||||||
|
|
||||||
|
BIN
bin/bin DUO/DUO_A/0x0000_bootloader.bin
Normal file
BIN
bin/bin DUO/DUO_A/0x0000_bootloader.bin
Normal file
Binary file not shown.
BIN
bin/bin DUO/DUO_A/0x10000_firmware.bin
Normal file
BIN
bin/bin DUO/DUO_A/0x10000_firmware.bin
Normal file
Binary file not shown.
BIN
bin/bin DUO/DUO_A/0xe000_boot_app0.bin
Normal file
BIN
bin/bin DUO/DUO_A/0xe000_boot_app0.bin
Normal file
Binary file not shown.
BIN
bin/bin DUO/DUO_B/0x0000_bootloader.bin
Normal file
BIN
bin/bin DUO/DUO_B/0x0000_bootloader.bin
Normal file
Binary file not shown.
BIN
bin/bin DUO/DUO_B/0x10000_firmware.bin
Normal file
BIN
bin/bin DUO/DUO_B/0x10000_firmware.bin
Normal file
Binary file not shown.
BIN
bin/bin DUO/DUO_B/0x8000_partitions.bin
Normal file
BIN
bin/bin DUO/DUO_B/0x8000_partitions.bin
Normal file
Binary file not shown.
BIN
bin/bin DUO/DUO_B/0xe000_boot_app0.bin
Normal file
BIN
bin/bin DUO/DUO_B/0xe000_boot_app0.bin
Normal file
Binary file not shown.
BIN
bin/bin ESP32-devKit- no pass/0x10000_firmware.bin
Normal file
BIN
bin/bin ESP32-devKit- no pass/0x10000_firmware.bin
Normal file
Binary file not shown.
BIN
bin/bin ESP32-devKit- no pass/0x1000_bootloader.bin
Normal file
BIN
bin/bin ESP32-devKit- no pass/0x1000_bootloader.bin
Normal file
Binary file not shown.
BIN
bin/bin ESP32-devKit- no pass/0x8000_partitions.bin
Normal file
BIN
bin/bin ESP32-devKit- no pass/0x8000_partitions.bin
Normal file
Binary file not shown.
BIN
bin/bin ESP32-devKit- no pass/0xe000_boot_app0.bin
Normal file
BIN
bin/bin ESP32-devKit- no pass/0xe000_boot_app0.bin
Normal file
Binary file not shown.
BIN
bin/bin LYLYGO TDisplay S3 - no pass/0x0000_bootloader.bin
Normal file
BIN
bin/bin LYLYGO TDisplay S3 - no pass/0x0000_bootloader.bin
Normal file
Binary file not shown.
BIN
bin/bin LYLYGO TDisplay S3 - no pass/0x10000_firmware.bin
Normal file
BIN
bin/bin LYLYGO TDisplay S3 - no pass/0x10000_firmware.bin
Normal file
Binary file not shown.
BIN
bin/bin LYLYGO TDisplay S3 - no pass/0x8000_partitions.bin
Normal file
BIN
bin/bin LYLYGO TDisplay S3 - no pass/0x8000_partitions.bin
Normal file
Binary file not shown.
BIN
bin/bin LYLYGO TDisplay S3 - no pass/0xe000_boot_app0.bin
Normal file
BIN
bin/bin LYLYGO TDisplay S3 - no pass/0xe000_boot_app0.bin
Normal file
Binary file not shown.
@ -4,16 +4,16 @@ efuse_err_halt = 1
|
|||||||
|
|
||||||
[DOWNLOAD PATH]
|
[DOWNLOAD PATH]
|
||||||
file_sel0 = 1
|
file_sel0 = 1
|
||||||
file_path0 = C:\Users\RogerPC\Desktop\CRYPTO\BITMAKER\Projectes\EN CURSO\SEEDER\Seeder\bin\0xe000_boot_app0.bin
|
file_path0 = C:\Users\RogerPC\Desktop\BITMAKER\BITMAKER\Projectes\EN CURSO\NERDMINERv2\NerdMinerV2\bin\bin ESP32-devKit- no pass\0x1000_bootloader.bin
|
||||||
file_offset0 = 0xe000
|
file_offset0 = 0x1000
|
||||||
file_sel1 = 1
|
file_sel1 = 1
|
||||||
file_path1 = C:\Users\RogerPC\Desktop\CRYPTO\BITMAKER\Projectes\EN CURSO\SEEDER\Seeder\bin\0x1000_bootloader_qio_80m.bin
|
file_path1 = C:\Users\RogerPC\Desktop\BITMAKER\BITMAKER\Projectes\EN CURSO\NERDMINERv2\NerdMinerV2\bin\bin ESP32-devKit- no pass\0xe000_boot_app0.bin
|
||||||
file_offset1 = 0x1000
|
file_offset1 = 0xe000
|
||||||
file_sel2 = 1
|
file_sel2 = 1
|
||||||
file_path2 = C:\Users\RogerPC\Desktop\CRYPTO\BITMAKER\Projectes\EN CURSO\SEEDER\Seeder\bin\0x8000_Seeder.ino.partitions.bin
|
file_path2 = C:\Users\RogerPC\Desktop\BITMAKER\BITMAKER\Projectes\EN CURSO\NERDMINERv2\NerdMinerV2\bin\bin ESP32-devKit- no pass\0x8000_partitions.bin
|
||||||
file_offset2 = 0x8000
|
file_offset2 = 0x8000
|
||||||
file_sel3 = 1
|
file_sel3 = 1
|
||||||
file_path3 = C:\Users\RogerPC\Desktop\CRYPTO\BITMAKER\Projectes\EN CURSO\SEEDER\Seeder\bin\0x10000_Seeder.ino.bin
|
file_path3 = C:\Users\RogerPC\Desktop\BITMAKER\BITMAKER\Projectes\EN CURSO\NERDMINERv2\NerdMinerV2\bin\bin ESP32-devKit- no pass\0x10000_firmware.bin
|
||||||
file_offset3 = 0x10000
|
file_offset3 = 0x10000
|
||||||
file_sel4 = 0
|
file_sel4 = 0
|
||||||
file_path4 =
|
file_path4 =
|
||||||
@ -45,12 +45,12 @@ file_offset12 =
|
|||||||
file_sel13 = 0
|
file_sel13 = 0
|
||||||
file_path13 =
|
file_path13 =
|
||||||
file_offset13 =
|
file_offset13 =
|
||||||
default_path = C:\Users\RogerPC\Desktop\CRYPTO\BITMAKER\Projectes\EN CURSO\SEEDER\Seeder\bin
|
default_path = C:\Users\RogerPC\Desktop\BITMAKER\BITMAKER\Projectes\EN CURSO\NERDMINERv2\NerdMinerV2\bin\bin ESP32-devKit- no pass
|
||||||
|
|
||||||
[FLASH_CRYSTAL]
|
[FLASH_CRYSTAL]
|
||||||
spicfgdis = 0
|
spicfgdis = 0
|
||||||
spispeed = 3
|
spispeed = 3
|
||||||
spimode = 0
|
spimode = 2
|
||||||
|
|
||||||
[MAC SAVE]
|
[MAC SAVE]
|
||||||
mac_save_enable = False
|
mac_save_enable = False
|
||||||
@ -84,7 +84,7 @@ flash_write_size = 1024
|
|||||||
|
|
||||||
[DOWNLOAD]
|
[DOWNLOAD]
|
||||||
autostart1 = 0
|
autostart1 = 0
|
||||||
com_port1 = COM4
|
com_port1 = COM157
|
||||||
baudrate1 = 4
|
baudrate1 = 4
|
||||||
checkmac1 = 1
|
checkmac1 = 1
|
||||||
erase_flash_en = True
|
erase_flash_en = True
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -462,14 +462,17 @@ monitor_filters =
|
|||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
time
|
time
|
||||||
log2file
|
log2file
|
||||||
board_build.arduino.memory_type = qio_opi
|
# Commenting out 'board_build.arduino.memory_type' fixes missing 'sdkconfig.h' errors:
|
||||||
|
;board_build.arduino.memory_type = qio_opi
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
upload_speed = 115200
|
upload_speed = 115200
|
||||||
# 2 x 4.5MB app, 6.875MB SPIFFS
|
# 2 x 4.5MB app, 6.875MB SPIFFS
|
||||||
board_build.partitions = huge_app.csv
|
board_build.partitions = huge_app.csv
|
||||||
build_flags =
|
build_flags =
|
||||||
;-D DEBUG_MINING=1
|
;-D DEBUG_MINING=1
|
||||||
-D TDISPLAY=1
|
# Switching from 'TDISPLAY' to 'NERDMINER_T_DISPLAY_V1' fixes font related compile errors
|
||||||
|
;-D TDISPLAY=1
|
||||||
|
-D NERDMINER_T_DISPLAY_V1=1
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/takkaO/OpenFontRender#v1.2
|
https://github.com/takkaO/OpenFontRender#v1.2
|
||||||
bblanchon/ArduinoJson@^6.21.5
|
bblanchon/ArduinoJson@^6.21.5
|
||||||
@ -685,6 +688,11 @@ platform = espressif32@6.6.0
|
|||||||
board = esp32dev
|
board = esp32dev
|
||||||
framework = arduino
|
framework = arduino
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
monitor_filters =
|
||||||
|
esp32_exception_decoder
|
||||||
|
time
|
||||||
|
colorize
|
||||||
|
;debug
|
||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
;build_type = debug
|
;build_type = debug
|
||||||
board_build.partitions = huge_app.csv
|
board_build.partitions = huge_app.csv
|
||||||
@ -714,6 +722,7 @@ build_flags =
|
|||||||
-DSPI_FREQUENCY=55000000
|
-DSPI_FREQUENCY=55000000
|
||||||
-DSPI_READ_FREQUENCY=20000000
|
-DSPI_READ_FREQUENCY=20000000
|
||||||
-DSPI_TOUCH_FREQUENCY=2500000
|
-DSPI_TOUCH_FREQUENCY=2500000
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/takkaO/OpenFontRender#v1.2
|
https://github.com/takkaO/OpenFontRender#v1.2
|
||||||
bblanchon/ArduinoJson@^6.21.5
|
bblanchon/ArduinoJson@^6.21.5
|
||||||
|
@ -115,8 +115,12 @@ void setup()
|
|||||||
|
|
||||||
/******** CREATE STRATUM TASK *****/
|
/******** CREATE STRATUM TASK *****/
|
||||||
sprintf(name, "(%s)", "Stratum");
|
sprintf(name, "(%s)", "Stratum");
|
||||||
|
#ifdef ESP32_2432S028R
|
||||||
|
// Free a little bit of the heap to the screen
|
||||||
|
BaseType_t res2 = xTaskCreatePinnedToCore(runStratumWorker, "Stratum", 13500, (void*)name, 3, NULL,1);
|
||||||
|
#else
|
||||||
BaseType_t res2 = xTaskCreatePinnedToCore(runStratumWorker, "Stratum", 15000, (void*)name, 3, NULL,1);
|
BaseType_t res2 = xTaskCreatePinnedToCore(runStratumWorker, "Stratum", 15000, (void*)name, 3, NULL,1);
|
||||||
|
#endif
|
||||||
|
|
||||||
/******** CREATE MINER TASKS *****/
|
/******** CREATE MINER TASKS *****/
|
||||||
//for (size_t i = 0; i < THREADS; i++) {
|
//for (size_t i = 0; i < THREADS; i++) {
|
||||||
|
@ -3,9 +3,22 @@
|
|||||||
|
|
||||||
#define PIN_BUTTON_1 0
|
#define PIN_BUTTON_1 0
|
||||||
//#define PIN_BUTTON_2 22 // Not used
|
//#define PIN_BUTTON_2 22 // Not used
|
||||||
#define PIN_ENABLE5V 21 // Not used
|
// #define PIN_ENABLE5V 21 // Not used
|
||||||
#define LED_PIN 4 // Red pin
|
#define LED_PIN 4 // Red pin
|
||||||
#define LED_PIN_G 17 // Green pin
|
#define LED_PIN_G 16 // Green pin
|
||||||
|
#define LED_PIN_B 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 <SPI.h>)
|
||||||
|
// setup SPI pins.
|
||||||
|
|
||||||
|
#define SDSPI_CS 5
|
||||||
|
#define SDSPI_CLK 18
|
||||||
|
#define SDSPI_MOSI 23
|
||||||
|
#define SDSPI_MISO 19
|
||||||
|
|
||||||
// Pin defines for the SD card interface
|
// Pin defines for the SD card interface
|
||||||
// This is working for both, ESP32 2432S028R and ESP 2432S028_2USB boards
|
// This is working for both, ESP32 2432S028R and ESP 2432S028_2USB boards
|
||||||
|
@ -13,10 +13,14 @@
|
|||||||
#include "OpenFontRender.h"
|
#include "OpenFontRender.h"
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include "rotation.h"
|
#include "rotation.h"
|
||||||
|
#include "drivers/storage/nvMemory.h"
|
||||||
|
#include "drivers/storage/storage.h"
|
||||||
|
|
||||||
#define WIDTH 130 //320
|
#define WIDTH 130 //320
|
||||||
#define HEIGHT 170
|
#define HEIGHT 170
|
||||||
|
|
||||||
|
extern nvMemory nvMem;
|
||||||
|
|
||||||
OpenFontRender render;
|
OpenFontRender render;
|
||||||
TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in platformio.ini
|
TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in platformio.ini
|
||||||
TFT_eSprite background = TFT_eSprite(&tft); // Invoke library sprite
|
TFT_eSprite background = TFT_eSprite(&tft); // Invoke library sprite
|
||||||
@ -26,25 +30,46 @@ TFT_eTouch<TFT_eSPI> touch(tft, ETOUCH_CS, 0xFF, hSPI);
|
|||||||
extern monitor_data mMonitor;
|
extern monitor_data mMonitor;
|
||||||
extern pool_data pData;
|
extern pool_data pData;
|
||||||
extern DisplayDriver *currentDisplayDriver;
|
extern DisplayDriver *currentDisplayDriver;
|
||||||
|
extern bool invertColors;
|
||||||
|
extern TSettings Settings;
|
||||||
bool hasChangedScreen = true;
|
bool hasChangedScreen = true;
|
||||||
|
|
||||||
|
void getChipInfo(void){
|
||||||
|
Serial.print("Chip: ");
|
||||||
|
Serial.println(ESP.getChipModel());
|
||||||
|
Serial.print("ChipRevision: ");
|
||||||
|
Serial.println(ESP.getChipRevision());
|
||||||
|
Serial.print("Psram size: ");
|
||||||
|
Serial.print(ESP.getPsramSize() / 1024);
|
||||||
|
Serial.println("KB");
|
||||||
|
Serial.print("Flash size: ");
|
||||||
|
Serial.print(ESP.getFlashChipSize() / 1024);
|
||||||
|
Serial.println("KB");
|
||||||
|
Serial.print("CPU frequency: ");
|
||||||
|
Serial.print(ESP.getCpuFreqMHz());
|
||||||
|
Serial.println("MHz");
|
||||||
|
}
|
||||||
|
|
||||||
void esp32_2432S028R_Init(void)
|
void esp32_2432S028R_Init(void)
|
||||||
{
|
{
|
||||||
|
// getChipInfo();
|
||||||
tft.init();
|
tft.init();
|
||||||
tft.setRotation(ROTATION_90);
|
if (nvMem.loadConfig(&Settings))
|
||||||
#ifdef ESP32_2432S028_2USB
|
{
|
||||||
/*
|
// Serial.print("Invert Colors: ");
|
||||||
In addition to TFT_INVERSION this adjusts the gamma curve to have better
|
// Serial.println(Settings.invertColors);
|
||||||
picture quality for this type of ESP32_2432S028 TFT with for example two USB connectors
|
invertColors = Settings.invertColors;
|
||||||
*/
|
}
|
||||||
tft.writecommand(ILI9341_GAMMASET); // Gamma curve selected
|
tft.invertDisplay(invertColors);
|
||||||
tft.writedata(2);
|
tft.setRotation(1);
|
||||||
delay(120);
|
|
||||||
tft.writecommand(ILI9341_GAMMASET); // Gamma curve selected
|
|
||||||
tft.writedata(1);
|
|
||||||
#endif
|
|
||||||
tft.setSwapBytes(true); // Swap the colour byte order when rendering
|
tft.setSwapBytes(true); // Swap the colour byte order when rendering
|
||||||
|
if (invertColors) {
|
||||||
|
tft.writecommand(ILI9341_GAMMASET);
|
||||||
|
tft.writedata(2);
|
||||||
|
delay(120);
|
||||||
|
tft.writecommand(ILI9341_GAMMASET); //Gamma curve selected
|
||||||
|
tft.writedata(1);
|
||||||
|
}
|
||||||
hSPI.begin(TOUCH_CLK, TOUCH_MISO, TOUCH_MOSI, ETOUCH_CS);
|
hSPI.begin(TOUCH_CLK, TOUCH_MISO, TOUCH_MOSI, ETOUCH_CS);
|
||||||
touch.init();
|
touch.init();
|
||||||
|
|
||||||
@ -52,9 +77,9 @@ void esp32_2432S028R_Init(void)
|
|||||||
touch.setCalibration(calibation);
|
touch.setCalibration(calibation);
|
||||||
|
|
||||||
//background.createSprite(WIDTH, HEIGHT); // Background Sprite
|
//background.createSprite(WIDTH, HEIGHT); // Background Sprite
|
||||||
background.setSwapBytes(true);
|
//background.setSwapBytes(true);
|
||||||
render.setDrawer(background); // Link drawing object to background instance (so font will be rendered on background)
|
//render.setDrawer(background); // Link drawing object to background instance (so font will be rendered on background)
|
||||||
render.setLineSpaceRatio(0.9); // Espaciado entre texto
|
//render.setLineSpaceRatio(0.9); // Espaciado entre texto
|
||||||
|
|
||||||
// Load the font and check it can be read OK
|
// Load the font and check it can be read OK
|
||||||
// if (render.loadFont(NotoSans_Bold, sizeof(NotoSans_Bold)))
|
// if (render.loadFont(NotoSans_Bold, sizeof(NotoSans_Bold)))
|
||||||
@ -65,6 +90,11 @@ void esp32_2432S028R_Init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pinMode(LED_PIN, OUTPUT);
|
pinMode(LED_PIN, OUTPUT);
|
||||||
|
pinMode(LED_PIN_B, OUTPUT);
|
||||||
|
pinMode(LED_PIN_G, OUTPUT);
|
||||||
|
digitalWrite(LED_PIN, LOW);
|
||||||
|
digitalWrite(LED_PIN_B, HIGH);
|
||||||
|
digitalWrite(LED_PIN_G, HIGH);
|
||||||
pData.bestDifficulty = "0";
|
pData.bestDifficulty = "0";
|
||||||
pData.workersHash = "0";
|
pData.workersHash = "0";
|
||||||
pData.workersCount = 0;
|
pData.workersCount = 0;
|
||||||
@ -86,68 +116,108 @@ void esp32_2432S028R_AlternateRotation(void)
|
|||||||
|
|
||||||
bool bottomScreenBlue = true;
|
bool bottomScreenBlue = true;
|
||||||
|
|
||||||
void printPoolData(){
|
|
||||||
|
|
||||||
pData = getPoolData();
|
|
||||||
background.createSprite(320,70); //Background Sprite
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
//background.setTextDatum(MC_DATUM);
|
|
||||||
render.setDrawer(background); // Link drawing object to background instance (so font will be rendered on background)
|
|
||||||
render.setLineSpaceRatio(1);
|
|
||||||
|
|
||||||
render.setFontSize(24);
|
|
||||||
render.cdrawString(String(pData.workersCount).c_str(), 155, 35, TFT_BLACK);
|
|
||||||
render.setFontSize(18);
|
|
||||||
render.setAlignment(Align::BottomRight);
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
void printheap(){
|
void printheap(){
|
||||||
//Serial.print("============ Free Heap:");
|
Serial.print("$$ Free Heap:");
|
||||||
//Serial.println(ESP.getFreeHeap());
|
Serial.println(ESP.getFreeHeap());
|
||||||
|
// Serial.printf("### stack WMark usage: %d\n", uxTaskGetStackHighWaterMark(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
void createBackgroundSprite(int16_t wdt, int16_t hgt){ // Set the background and link the render, used multiple times to fit in heap
|
bool createBackgroundSprite(int16_t wdt, int16_t hgt){ // Set the background and link the render, used multiple times to fit in heap
|
||||||
background.createSprite(wdt, hgt) ; //Background Sprite
|
background.createSprite(wdt, hgt) ; //Background Sprite
|
||||||
printheap();
|
// printheap();
|
||||||
background.setColorDepth(16);
|
if (background.created()) {
|
||||||
background.setSwapBytes(true);
|
background.setColorDepth(16);
|
||||||
render.setDrawer(background); // Link drawing object to background instance (so font will be rendered on background)
|
background.setSwapBytes(true);
|
||||||
render.setLineSpaceRatio(0.9);
|
render.setDrawer(background); // Link drawing object to background instance (so font will be rendered on background)
|
||||||
|
render.setLineSpaceRatio(0.9);
|
||||||
|
} else {
|
||||||
|
Serial.println("#### Sprite Error ####");
|
||||||
|
Serial.printf("Size w:%d h:%d \n", wdt, hgt);
|
||||||
|
printheap();
|
||||||
|
}
|
||||||
|
return background.created();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern unsigned long mPoolUpdate;
|
||||||
|
|
||||||
|
void printPoolData(){
|
||||||
|
if ((hasChangedScreen) || (mPoolUpdate == 0) || (millis() - mPoolUpdate > UPDATE_POOL_min * 60 * 1000)){
|
||||||
|
if (Settings.PoolAddress != "tn.vkbit.com") {
|
||||||
|
pData = getPoolData();
|
||||||
|
background.createSprite(320,50); //Background Sprite
|
||||||
|
if (!background.created()) {
|
||||||
|
Serial.println("###### POOL SPRITE ERROR ######");
|
||||||
|
// Serial.printf("Pool data W:%d H:%s D:%s\n", pData.workersCount, pData.workersHash, pData.bestDifficulty);
|
||||||
|
printheap();
|
||||||
|
}
|
||||||
|
background.setSwapBytes(true);
|
||||||
|
if (bottomScreenBlue) {
|
||||||
|
background.pushImage(0, -20, 320, 70, bottonPoolScreen);
|
||||||
|
tft.pushImage(0,170,320,20,bottonPoolScreen);
|
||||||
|
} else {
|
||||||
|
background.pushImage(0, -20, 320, 70, bottonPoolScreen_g);
|
||||||
|
tft.pushImage(0,170,320,20,bottonPoolScreen_g);
|
||||||
|
}
|
||||||
|
|
||||||
|
render.setDrawer(background); // Link drawing object to background instance (so font will be rendered on background)
|
||||||
|
render.setLineSpaceRatio(1);
|
||||||
|
|
||||||
|
render.setFontSize(24);
|
||||||
|
render.cdrawString(String(pData.workersCount).c_str(), 157, 16, TFT_BLACK);
|
||||||
|
render.setFontSize(18);
|
||||||
|
render.setAlignment(Align::BottomRight);
|
||||||
|
render.cdrawString(pData.workersHash.c_str(), 265, 14, TFT_BLACK);
|
||||||
|
render.setAlignment(Align::BottomLeft);
|
||||||
|
render.cdrawString(pData.bestDifficulty.c_str(), 54, 14, TFT_BLACK);
|
||||||
|
background.pushSprite(0,190);
|
||||||
|
background.deleteSprite();
|
||||||
|
} else {
|
||||||
|
pData.bestDifficulty = "TESTNET";
|
||||||
|
pData.workersHash = "TESTNET";
|
||||||
|
pData.workersCount = 1;
|
||||||
|
tft.fillRect(0,170,320,70, TFT_DARKGREEN);
|
||||||
|
background.createSprite(320,40); //Background Sprite
|
||||||
|
background.fillSprite(TFT_DARKGREEN);
|
||||||
|
if (!background.created()) {
|
||||||
|
Serial.println("###### POOL SPRITE ERROR ######");
|
||||||
|
// Serial.printf("Pool data W:%d H:%s D:%s\n", pData.workersCount, pData.workersHash, pData.bestDifficulty);
|
||||||
|
printheap();
|
||||||
|
}
|
||||||
|
background.setFreeFont(FF24);
|
||||||
|
background.setTextDatum(TL_DATUM);
|
||||||
|
background.setTextSize(1);
|
||||||
|
background.setTextColor(TFT_WHITE, TFT_DARKGREEN);
|
||||||
|
background.drawString("TESTNET", 50, 0, GFXFF);
|
||||||
|
background.pushSprite(0,185);
|
||||||
|
mPoolUpdate = millis();
|
||||||
|
Serial.println("Testnet");
|
||||||
|
background.deleteSprite();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
|
void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
|
||||||
{
|
{
|
||||||
if (hasChangedScreen) tft.pushImage(0, 0, initWidth, initHeight, MinerScreen);
|
|
||||||
hasChangedScreen = false;
|
|
||||||
|
|
||||||
mining_data data = getMiningData(mElapsed);
|
mining_data data = getMiningData(mElapsed);
|
||||||
|
|
||||||
//Serial.println("Proximo sprite...");
|
printPoolData();
|
||||||
|
|
||||||
|
if (hasChangedScreen) tft.pushImage(0, 0, initWidth, initHeight, MinerScreen);
|
||||||
|
|
||||||
|
hasChangedScreen = false;
|
||||||
|
|
||||||
int wdtOffset = 190;
|
int wdtOffset = 190;
|
||||||
// Recreate sprite to the right side of the screen
|
// Recreate sprite to the right side of the screen
|
||||||
createBackgroundSprite(WIDTH-5, HEIGHT-7);
|
createBackgroundSprite(WIDTH-5, HEIGHT-7);
|
||||||
//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.setAlignment(Align::TopLeft);
|
||||||
@ -182,7 +252,7 @@ void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
|
|||||||
|
|
||||||
// Delete sprite to free the memory heap
|
// Delete sprite to free the memory heap
|
||||||
background.deleteSprite();
|
background.deleteSprite();
|
||||||
printheap();
|
// printheap();
|
||||||
|
|
||||||
//Serial.println("=========== Mining Display ==============") ;
|
//Serial.println("=========== Mining Display ==============") ;
|
||||||
// Create background sprite to print data at once
|
// Create background sprite to print data at once
|
||||||
@ -190,9 +260,6 @@ void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
|
|||||||
//Print background screen
|
//Print background screen
|
||||||
background.pushImage(0, -90, MinerWidth, MinerHeight, MinerScreen);
|
background.pushImage(0, -90, MinerWidth, MinerHeight, MinerScreen);
|
||||||
|
|
||||||
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
|
||||||
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
|
||||||
|
|
||||||
// Hashrate
|
// Hashrate
|
||||||
render.setFontSize(35);
|
render.setFontSize(35);
|
||||||
render.setCursor(19, 118);
|
render.setCursor(19, 118);
|
||||||
@ -204,9 +271,9 @@ void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
|
|||||||
|
|
||||||
// Delete sprite to free the memory heap
|
// Delete sprite to free the memory heap
|
||||||
background.deleteSprite();
|
background.deleteSprite();
|
||||||
//delay(50);
|
|
||||||
|
|
||||||
printPoolData();
|
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
||||||
|
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY
|
#ifdef DEBUG_MEMORY
|
||||||
// Print heap
|
// Print heap
|
||||||
@ -218,13 +285,13 @@ void esp32_2432S028R_ClockScreen(unsigned long mElapsed)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (hasChangedScreen) tft.pushImage(0, 0, minerClockWidth, minerClockHeight, minerClockScreen);
|
if (hasChangedScreen) tft.pushImage(0, 0, minerClockWidth, minerClockHeight, minerClockScreen);
|
||||||
|
|
||||||
|
printPoolData();
|
||||||
|
|
||||||
hasChangedScreen = false;
|
hasChangedScreen = false;
|
||||||
|
|
||||||
clock_data data = getClockData(mElapsed);
|
clock_data data = getClockData(mElapsed);
|
||||||
|
|
||||||
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
|
||||||
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
|
||||||
|
|
||||||
// Create background sprite to print data at once
|
// Create background sprite to print data at once
|
||||||
createBackgroundSprite(270,36);
|
createBackgroundSprite(270,36);
|
||||||
|
|
||||||
@ -267,9 +334,8 @@ void esp32_2432S028R_ClockScreen(unsigned long mElapsed)
|
|||||||
// Delete sprite to free the memory heap
|
// Delete sprite to free the memory heap
|
||||||
background.deleteSprite();
|
background.deleteSprite();
|
||||||
|
|
||||||
#ifdef ESP32_2432S028R
|
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
||||||
printPoolData();
|
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY
|
#ifdef DEBUG_MEMORY
|
||||||
// Print heap
|
// Print heap
|
||||||
@ -280,17 +346,17 @@ void esp32_2432S028R_ClockScreen(unsigned long mElapsed)
|
|||||||
void esp32_2432S028R_GlobalHashScreen(unsigned long mElapsed)
|
void esp32_2432S028R_GlobalHashScreen(unsigned long mElapsed)
|
||||||
{
|
{
|
||||||
if (hasChangedScreen) tft.pushImage(0, 0, globalHashWidth, globalHashHeight, globalHashScreen);
|
if (hasChangedScreen) tft.pushImage(0, 0, globalHashWidth, globalHashHeight, globalHashScreen);
|
||||||
|
|
||||||
|
printPoolData();
|
||||||
|
|
||||||
hasChangedScreen = false;
|
hasChangedScreen = false;
|
||||||
|
|
||||||
coin_data data = getCoinData(mElapsed);
|
coin_data data = getCoinData(mElapsed);
|
||||||
|
|
||||||
// Create background sprite to print data at once
|
// Create background sprite to print data at once
|
||||||
createBackgroundSprite(169,105);
|
createBackgroundSprite(169,105);
|
||||||
// Print background screen
|
// Print background screen
|
||||||
background.pushImage(-160, -3, minerClockWidth, minerClockHeight, globalHashScreen);
|
background.pushImage(-160, -3, minerClockWidth, minerClockHeight, globalHashScreen);
|
||||||
//background.fillScreen(TFT_BLUE);
|
|
||||||
|
|
||||||
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
|
||||||
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
|
||||||
|
|
||||||
// Print BTC Price
|
// Print BTC Price
|
||||||
background.setFreeFont(FSSB9);
|
background.setFreeFont(FSSB9);
|
||||||
@ -359,9 +425,9 @@ void esp32_2432S028R_GlobalHashScreen(unsigned long mElapsed)
|
|||||||
background.pushSprite(5, 100);
|
background.pushSprite(5, 100);
|
||||||
// Delete sprite to free the memory heap
|
// Delete sprite to free the memory heap
|
||||||
background.deleteSprite();
|
background.deleteSprite();
|
||||||
#ifdef ESP32_2432S028R
|
|
||||||
printPoolData();
|
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
||||||
#endif
|
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY
|
#ifdef DEBUG_MEMORY
|
||||||
// Print heap
|
// Print heap
|
||||||
@ -372,13 +438,11 @@ void esp32_2432S028R_BTCprice(unsigned long mElapsed)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (hasChangedScreen) tft.pushImage(0, 0, priceScreenWidth, priceScreenHeight, priceScreen);
|
if (hasChangedScreen) tft.pushImage(0, 0, priceScreenWidth, priceScreenHeight, priceScreen);
|
||||||
|
printPoolData();
|
||||||
hasChangedScreen = false;
|
hasChangedScreen = false;
|
||||||
|
|
||||||
clock_data data = getClockData(mElapsed);
|
clock_data data = getClockData(mElapsed);
|
||||||
|
|
||||||
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
|
||||||
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
|
||||||
|
|
||||||
// Create background sprite to print data at once
|
// Create background sprite to print data at once
|
||||||
createBackgroundSprite(270,36);
|
createBackgroundSprite(270,36);
|
||||||
|
|
||||||
@ -402,16 +466,17 @@ void esp32_2432S028R_BTCprice(unsigned long mElapsed)
|
|||||||
// Print background screen
|
// Print background screen
|
||||||
background.pushImage(-130, -3, priceScreenWidth, priceScreenHeight, priceScreen);
|
background.pushImage(-130, -3, priceScreenWidth, priceScreenHeight, priceScreen);
|
||||||
|
|
||||||
// Print BTC Price
|
// Print Hour
|
||||||
background.setFreeFont(FSSB9);
|
background.setFreeFont(FSSB9);
|
||||||
background.setTextSize(1);
|
background.setTextSize(1);
|
||||||
background.setTextDatum(TL_DATUM);
|
background.setTextDatum(TL_DATUM);
|
||||||
background.setTextColor(TFT_BLACK);
|
background.setTextColor(TFT_BLACK);
|
||||||
background.drawString(data.currentTime.c_str(), 202-130, 0, GFXFF);
|
background.drawString(data.currentTime.c_str(), 202-130, 0, GFXFF);
|
||||||
|
|
||||||
// Print Hour
|
// Print BTC Price
|
||||||
background.setFreeFont(FF22);
|
background.setFreeFont(FF24);
|
||||||
background.setTextSize(2);
|
background.setTextDatum(TL_DATUM);
|
||||||
|
background.setTextSize(1);
|
||||||
background.setTextColor(0xDEDB, TFT_BLACK);
|
background.setTextColor(0xDEDB, TFT_BLACK);
|
||||||
background.drawString(data.btcPrice.c_str(), 0, 50, GFXFF);
|
background.drawString(data.btcPrice.c_str(), 0, 50, GFXFF);
|
||||||
|
|
||||||
@ -421,9 +486,8 @@ void esp32_2432S028R_BTCprice(unsigned long mElapsed)
|
|||||||
// Delete sprite to free the memory heap
|
// Delete sprite to free the memory heap
|
||||||
background.deleteSprite();
|
background.deleteSprite();
|
||||||
|
|
||||||
#ifdef ESP32_2432S028R
|
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
||||||
printPoolData();
|
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY
|
#ifdef DEBUG_MEMORY
|
||||||
// Print heap
|
// Print heap
|
||||||
@ -437,13 +501,14 @@ void esp32_2432S028R_LoadingScreen(void)
|
|||||||
tft.pushImage(0, 33, initWidth, initHeight, initScreen);
|
tft.pushImage(0, 33, initWidth, initHeight, initScreen);
|
||||||
tft.setTextColor(TFT_BLACK);
|
tft.setTextColor(TFT_BLACK);
|
||||||
tft.drawString(CURRENT_VERSION, 24, 147, FONT2);
|
tft.drawString(CURRENT_VERSION, 24, 147, FONT2);
|
||||||
delay(2000);
|
// delay(2000);
|
||||||
tft.fillScreen(TFT_BLACK);
|
// tft.fillScreen(TFT_BLACK);
|
||||||
tft.pushImage(0, 0, initWidth, initHeight, MinerScreen);
|
// tft.pushImage(0, 0, initWidth, initHeight, MinerScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void esp32_2432S028R_SetupScreen(void)
|
void esp32_2432S028R_SetupScreen(void)
|
||||||
{
|
{
|
||||||
|
tft.fillScreen(TFT_BLACK);
|
||||||
tft.pushImage(0, 33, setupModeWidth, setupModeHeight, setupModeScreen);
|
tft.pushImage(0, 33, setupModeWidth, setupModeHeight, setupModeScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,24 +530,22 @@ 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;
|
||||||
|
hasChangedScreen = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if (t_x > 160) {
|
if (t_x > 160) {
|
||||||
// next screen
|
// next screen
|
||||||
Serial.print(t_x);
|
// Serial.printf("Next screen touch( x:%d y:%d )\n", t_x, t_y);
|
||||||
Serial.print(":x Próxima Tela y:");
|
|
||||||
Serial.println(t_y);
|
|
||||||
currentDisplayDriver->current_cyclic_screen = (currentDisplayDriver->current_cyclic_screen + 1) % currentDisplayDriver->num_cyclic_screens;
|
currentDisplayDriver->current_cyclic_screen = (currentDisplayDriver->current_cyclic_screen + 1) % currentDisplayDriver->num_cyclic_screens;
|
||||||
} else if (t_x < 160)
|
} else if (t_x < 160)
|
||||||
{
|
{
|
||||||
// Previus screen
|
// Previus screen
|
||||||
Serial.print(t_x);
|
// Serial.printf("Previus screen touch( x:%d y:%d )\n", t_x, t_y);
|
||||||
Serial.print(":x Tela anterior y:");
|
|
||||||
Serial.println(t_y);
|
|
||||||
/* Serial.println(currentDisplayDriver->current_cyclic_screen); */
|
/* Serial.println(currentDisplayDriver->current_cyclic_screen); */
|
||||||
currentDisplayDriver->current_cyclic_screen = currentDisplayDriver->current_cyclic_screen - 1;
|
currentDisplayDriver->current_cyclic_screen = currentDisplayDriver->current_cyclic_screen - 1;
|
||||||
if (currentDisplayDriver->current_cyclic_screen<0) currentDisplayDriver->current_cyclic_screen = currentDisplayDriver->num_cyclic_screens - 1;
|
if (currentDisplayDriver->current_cyclic_screen<0) currentDisplayDriver->current_cyclic_screen = currentDisplayDriver->num_cyclic_screens - 1;
|
||||||
Serial.println(currentDisplayDriver->current_cyclic_screen);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
previousTouchMillis = currentMillis;
|
previousTouchMillis = currentMillis;
|
||||||
@ -494,21 +557,25 @@ void esp32_2432S028R_DoLedStuff(unsigned long frame)
|
|||||||
switch (mMonitor.NerdStatus)
|
switch (mMonitor.NerdStatus)
|
||||||
{
|
{
|
||||||
case NM_waitingConfig:
|
case NM_waitingConfig:
|
||||||
digitalWrite(LED_PIN, HIGH); // LED encendido de forma continua
|
digitalWrite(LED_PIN, LOW); // LED encendido de forma continua
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NM_Connecting:
|
case NM_Connecting:
|
||||||
if (currentMillis - previousMillis >= 500)
|
if (currentMillis - previousMillis >= 500)
|
||||||
{ // 0.5sec blink
|
{ // 0.5sec blink
|
||||||
previousMillis = currentMillis;
|
previousMillis = currentMillis;
|
||||||
digitalWrite(LED_PIN, !digitalRead(LED_PIN)); // Cambia el estado del LED
|
// Serial.print("C");
|
||||||
|
digitalWrite(LED_PIN, HIGH);
|
||||||
|
digitalWrite(LED_PIN_B, !digitalRead(LED_PIN)); // Cambia el estado del LED
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NM_hashing:
|
case NM_hashing:
|
||||||
if (currentMillis - previousMillis >= 100)
|
if (currentMillis - previousMillis >= 500)
|
||||||
{ // 0.1sec blink
|
{ // 0.1sec blink
|
||||||
|
// Serial.print("h");
|
||||||
previousMillis = currentMillis;
|
previousMillis = currentMillis;
|
||||||
|
digitalWrite(LED_PIN_B, HIGH);
|
||||||
digitalWrite(LED_PIN, !digitalRead(LED_PIN)); // Cambia el estado del LED
|
digitalWrite(LED_PIN, !digitalRead(LED_PIN)); // Cambia el estado del LED
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -20,6 +20,12 @@ TFT_eSprite background = TFT_eSprite(&tft); // Invoke library sprite
|
|||||||
|
|
||||||
void tDisplay_Init(void)
|
void tDisplay_Init(void)
|
||||||
{
|
{
|
||||||
|
//Init pin 15 to eneble 5V external power (LilyGo bug)
|
||||||
|
#ifdef PIN_ENABLE5V
|
||||||
|
pinMode(PIN_ENABLE5V, OUTPUT);
|
||||||
|
digitalWrite(PIN_ENABLE5V, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
tft.init();
|
tft.init();
|
||||||
#ifdef LILYGO_S3_T_EMBED
|
#ifdef LILYGO_S3_T_EMBED
|
||||||
tft.setRotation(ROTATION_270);
|
tft.setRotation(ROTATION_270);
|
||||||
|
@ -67,14 +67,12 @@ void tDisplay_MinerScreen(unsigned long mElapsed)
|
|||||||
render.rdrawString(data.currentHashRate.c_str(), 96, 90, TFT_BLACK);
|
render.rdrawString(data.currentHashRate.c_str(), 96, 90, TFT_BLACK);
|
||||||
// Total hashes
|
// Total hashes
|
||||||
render.setFontSize(13);
|
render.setFontSize(13);
|
||||||
render.rdrawString(data.totalMHashes.c_str(), 200, 112, TFT_BLACK);
|
render.rdrawString(data.totalMHashes.c_str(), 200, 106, TFT_BLACK);
|
||||||
// Block templates
|
// Block templates
|
||||||
render.setFontSize(13);
|
|
||||||
render.drawString(data.templates.c_str(), 140, 15, 0xDEDB);
|
render.drawString(data.templates.c_str(), 140, 15, 0xDEDB);
|
||||||
// Best diff
|
// Best diff
|
||||||
render.drawString(data.bestDiff.c_str(), 140, 38, 0xDEDB);
|
render.drawString(data.bestDiff.c_str(), 140, 38, 0xDEDB);
|
||||||
// 32Bit shares
|
// 32Bit shares
|
||||||
render.setFontSize(13);
|
|
||||||
render.drawString(data.completedShares.c_str(), 140, 60, 0xDEDB);
|
render.drawString(data.completedShares.c_str(), 140, 60, 0xDEDB);
|
||||||
// Hores
|
// Hores
|
||||||
render.setFontSize(9);
|
render.setFontSize(9);
|
||||||
|
@ -57,6 +57,15 @@ bool SDCard::cardBusy()
|
|||||||
return cardBusy_;
|
return cardBusy_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief End the card to free heap space.
|
||||||
|
void SDCard::terminate()
|
||||||
|
{
|
||||||
|
iSD_->end();
|
||||||
|
#ifdef BUILD_SDSPI
|
||||||
|
ispi_->end();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief Transfer settings from config file on a SD card to the device.
|
/// @brief Transfer settings from config file on a SD card to the device.
|
||||||
/// @param nvMemory* where to save
|
/// @param nvMemory* where to save
|
||||||
/// @param TSettings* passing a struct is required, to save memory
|
/// @param TSettings* passing a struct is required, to save memory
|
||||||
@ -97,8 +106,12 @@ bool SDCard::loadConfigFile(TSettings* Settings)
|
|||||||
{
|
{
|
||||||
serializeJsonPretty(json, Serial);
|
serializeJsonPretty(json, Serial);
|
||||||
Serial.print('\n');
|
Serial.print('\n');
|
||||||
Settings->WifiSSID = json[JSON_KEY_SSID] | Settings->WifiSSID;
|
if (json.containsKey(JSON_KEY_SSID)) {
|
||||||
Settings->WifiPW = json[JSON_KEY_PASW] | Settings->WifiPW;
|
Settings->WifiSSID = json[JSON_KEY_SSID] | Settings->WifiSSID;
|
||||||
|
}
|
||||||
|
if (json.containsKey(JSON_KEY_PASW)) {
|
||||||
|
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->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);
|
||||||
@ -108,6 +121,13 @@ bool SDCard::loadConfigFile(TSettings* Settings)
|
|||||||
Settings->Timezone = json[JSON_KEY_TIMEZONE].as<int>();
|
Settings->Timezone = json[JSON_KEY_TIMEZONE].as<int>();
|
||||||
if (json.containsKey(JSON_KEY_STATS2NV))
|
if (json.containsKey(JSON_KEY_STATS2NV))
|
||||||
Settings->saveStats = json[JSON_KEY_STATS2NV].as<bool>();
|
Settings->saveStats = json[JSON_KEY_STATS2NV].as<bool>();
|
||||||
|
if (json.containsKey(JSON_KEY_INVCOLOR)) {
|
||||||
|
Settings->invertColors = json[JSON_KEY_INVCOLOR].as<bool>();
|
||||||
|
} else {
|
||||||
|
Settings->invertColors = false;
|
||||||
|
}
|
||||||
|
// Serial.printf("Carteira Lida SD:%s\n", Settings.BtcWallet);
|
||||||
|
Serial.printf("Carteira Lida SDs:%s\n", Settings->BtcWallet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -184,7 +204,6 @@ bool SDCard::initSDcard()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
SDCard::SDCard(int ID) {}
|
SDCard::SDCard(int ID) {}
|
||||||
SDCard::~SDCard() {}
|
SDCard::~SDCard() {}
|
||||||
void SDCard::SD2nvMemory(nvMemory* nvMem, TSettings* Settings) {};
|
void SDCard::SD2nvMemory(nvMemory* nvMem, TSettings* Settings) {};
|
||||||
@ -192,5 +211,5 @@ bool SDCard::loadConfigFile(TSettings* Settings) { return false; }
|
|||||||
bool SDCard::initSDcard() { return false; }
|
bool SDCard::initSDcard() { return false; }
|
||||||
bool SDCard::cardAvailable() { return false; }
|
bool SDCard::cardAvailable() { return false; }
|
||||||
bool SDCard::cardBusy() { return false; }
|
bool SDCard::cardBusy() { return false; }
|
||||||
|
void SDCard::terminate() {}
|
||||||
#endif //BUILD_SDMMC
|
#endif //BUILD_SDMMC
|
||||||
|
@ -58,6 +58,7 @@ public:
|
|||||||
bool loadConfigFile(TSettings* Settings);
|
bool loadConfigFile(TSettings* Settings);
|
||||||
bool cardAvailable();
|
bool cardAvailable();
|
||||||
bool cardBusy();
|
bool cardBusy();
|
||||||
|
void terminate();
|
||||||
private:
|
private:
|
||||||
bool initSDcard();
|
bool initSDcard();
|
||||||
bool cardInitialized_;
|
bool cardInitialized_;
|
||||||
|
@ -35,6 +35,7 @@ bool nvMemory::saveConfig(TSettings* Settings)
|
|||||||
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;
|
||||||
|
json[JSON_SPIFFS_KEY_INVCOLOR] = Settings->invertColors;
|
||||||
|
|
||||||
// Open config file
|
// Open config file
|
||||||
File configFile = SPIFFS.open(JSON_CONFIG_FILE, "w");
|
File configFile = SPIFFS.open(JSON_CONFIG_FILE, "w");
|
||||||
@ -97,6 +98,11 @@ bool nvMemory::loadConfig(TSettings* Settings)
|
|||||||
Settings->Timezone = json[JSON_SPIFFS_KEY_TIMEZONE].as<int>();
|
Settings->Timezone = json[JSON_SPIFFS_KEY_TIMEZONE].as<int>();
|
||||||
if (json.containsKey(JSON_SPIFFS_KEY_STATS2NV))
|
if (json.containsKey(JSON_SPIFFS_KEY_STATS2NV))
|
||||||
Settings->saveStats = json[JSON_SPIFFS_KEY_STATS2NV].as<bool>();
|
Settings->saveStats = json[JSON_SPIFFS_KEY_STATS2NV].as<bool>();
|
||||||
|
if (json.containsKey(JSON_SPIFFS_KEY_INVCOLOR)) {
|
||||||
|
Settings->invertColors = json[JSON_SPIFFS_KEY_INVCOLOR].as<bool>();
|
||||||
|
} else {
|
||||||
|
Settings->invertColors = false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#define DEFAULT_POOLPORT 21496
|
#define DEFAULT_POOLPORT 21496
|
||||||
#define DEFAULT_TIMEZONE 2
|
#define DEFAULT_TIMEZONE 2
|
||||||
#define DEFAULT_SAVESTATS false
|
#define DEFAULT_SAVESTATS false
|
||||||
|
#define DEFAULT_INVERTCOLORS false
|
||||||
|
|
||||||
// JSON config files
|
// JSON config files
|
||||||
#define JSON_CONFIG_FILE "/config.json"
|
#define JSON_CONFIG_FILE "/config.json"
|
||||||
@ -31,6 +32,7 @@
|
|||||||
#define JSON_KEY_POOLPORT "PoolPort"
|
#define JSON_KEY_POOLPORT "PoolPort"
|
||||||
#define JSON_KEY_TIMEZONE "Timezone"
|
#define JSON_KEY_TIMEZONE "Timezone"
|
||||||
#define JSON_KEY_STATS2NV "SaveStats"
|
#define JSON_KEY_STATS2NV "SaveStats"
|
||||||
|
#define JSON_KEY_INVCOLOR "invertColors"
|
||||||
|
|
||||||
// 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"
|
||||||
@ -39,6 +41,7 @@
|
|||||||
#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"
|
||||||
|
#define JSON_SPIFFS_KEY_INVCOLOR "invertColors"
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
struct TSettings
|
struct TSettings
|
||||||
@ -51,6 +54,7 @@ struct TSettings
|
|||||||
int PoolPort{ DEFAULT_POOLPORT };
|
int PoolPort{ DEFAULT_POOLPORT };
|
||||||
int Timezone{ DEFAULT_TIMEZONE };
|
int Timezone{ DEFAULT_TIMEZONE };
|
||||||
bool saveStats{ DEFAULT_SAVESTATS };
|
bool saveStats{ DEFAULT_SAVESTATS };
|
||||||
|
bool invertColors{ DEFAULT_INVERTCOLORS };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _STORAGE_H_
|
#endif // _STORAGE_H_
|
@ -142,7 +142,7 @@ const unsigned short setupModeScreen[0xFD20] PROGMEM = {
|
|||||||
|
|
||||||
// Icon width and height
|
// Icon width and height
|
||||||
const uint16_t MinerWidth = 240;
|
const uint16_t MinerWidth = 240;
|
||||||
const uint16_t MinerHeight = 128;
|
const uint16_t MinerHeight = 135;
|
||||||
|
|
||||||
|
|
||||||
const unsigned short MinerScreen[0x7800] PROGMEM = {
|
const unsigned short MinerScreen[0x7800] PROGMEM = {
|
||||||
|
@ -400,6 +400,13 @@ void saveStat() {
|
|||||||
nvs_set_u64(stat_handle, "upTime", upTime + (esp_timer_get_time()/1000000));
|
nvs_set_u64(stat_handle, "upTime", upTime + (esp_timer_get_time()/1000000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resetStat() {
|
||||||
|
Serial.printf("[MONITOR] Resetting NVS stats\n");
|
||||||
|
templates = hashes = Mhashes = totalKHashes = elapsedKHs = upTime = shares = valids = 0;
|
||||||
|
best_diff = 0.0;
|
||||||
|
saveStat();
|
||||||
|
}
|
||||||
|
|
||||||
void runMonitor(void *name)
|
void runMonitor(void *name)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@ void runStratumWorker(void *name);
|
|||||||
void runMiner(void *name);
|
void runMiner(void *name);
|
||||||
String printLocalTime(void);
|
String printLocalTime(void);
|
||||||
|
|
||||||
|
void resetStat();
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
uint8_t bytearray_target[32];
|
uint8_t bytearray_target[32];
|
||||||
uint8_t bytearray_pooltarget[32];
|
uint8_t bytearray_pooltarget[32];
|
||||||
|
@ -25,6 +25,7 @@ extern monitor_data mMonitor;
|
|||||||
|
|
||||||
//from saved config
|
//from saved config
|
||||||
extern TSettings Settings;
|
extern TSettings Settings;
|
||||||
|
bool invertColors = false;
|
||||||
|
|
||||||
WiFiUDP ntpUDP;
|
WiFiUDP ntpUDP;
|
||||||
NTPClient timeClient(ntpUDP, "europe.pool.ntp.org", 3600, 60000);
|
NTPClient timeClient(ntpUDP, "europe.pool.ntp.org", 3600, 60000);
|
||||||
@ -357,13 +358,12 @@ pool_data getPoolData(void){
|
|||||||
//pool_data pData;
|
//pool_data pData;
|
||||||
if((mPoolUpdate == 0) || (millis() - mPoolUpdate > UPDATE_POOL_min * 60 * 1000)){
|
if((mPoolUpdate == 0) || (millis() - mPoolUpdate > UPDATE_POOL_min * 60 * 1000)){
|
||||||
if (WiFi.status() != WL_CONNECTED) return pData;
|
if (WiFi.status() != WL_CONNECTED) return pData;
|
||||||
|
|
||||||
//Make first API call to get global hash and current difficulty
|
//Make first API call to get global hash and current difficulty
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
http.setReuse(true);
|
http.setReuse(true);
|
||||||
try {
|
try {
|
||||||
String btcWallet = Settings.BtcWallet;
|
String btcWallet = Settings.BtcWallet;
|
||||||
Serial.println(btcWallet);
|
// Serial.println(btcWallet);
|
||||||
if (btcWallet.indexOf(".")>0) btcWallet = btcWallet.substring(0,btcWallet.indexOf("."));
|
if (btcWallet.indexOf(".")>0) btcWallet = btcWallet.substring(0,btcWallet.indexOf("."));
|
||||||
#ifdef NERDMINER_T_HMI
|
#ifdef NERDMINER_T_HMI
|
||||||
Serial.println("Pool API : " + poolAPIUrl+btcWallet);
|
Serial.println("Pool API : " + poolAPIUrl+btcWallet);
|
||||||
@ -405,10 +405,28 @@ pool_data getPoolData(void){
|
|||||||
}
|
}
|
||||||
doc.clear();
|
doc.clear();
|
||||||
mPoolUpdate = millis();
|
mPoolUpdate = millis();
|
||||||
|
Serial.println("\n####### Pool Data OK!");
|
||||||
|
} else {
|
||||||
|
Serial.println("\n####### Pool Data HTTP Error!");
|
||||||
|
/* Serial.println(httpCode);
|
||||||
|
String payload = http.getString();
|
||||||
|
Serial.println(payload); */
|
||||||
|
// mPoolUpdate = millis();
|
||||||
|
pData.bestDifficulty = "P";
|
||||||
|
pData.workersHash = "E";
|
||||||
|
pData.workersCount = 0;
|
||||||
|
http.end();
|
||||||
|
return pData;
|
||||||
}
|
}
|
||||||
http.end();
|
http.end();
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
Serial.println("####### Pool Error!");
|
||||||
|
// mPoolUpdate = millis();
|
||||||
|
pData.bestDifficulty = "P";
|
||||||
|
pData.workersHash = "Error";
|
||||||
|
pData.workersCount = 0;
|
||||||
http.end();
|
http.end();
|
||||||
|
return pData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pData;
|
return pData;
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
//Time update period
|
//Time update period
|
||||||
#define UPDATE_PERIOD_h 5
|
#define UPDATE_PERIOD_h 5
|
||||||
|
|
||||||
//API BTC price
|
//API BTC price (Update to USDT cus it's more liquidity and flow price updade)
|
||||||
#define getBTCAPI "https://api.blockchain.com/v3/exchange/tickers/BTC-USD"
|
#define getBTCAPI "https://api.blockchain.com/v3/exchange/tickers/BTC-USDT"
|
||||||
#define UPDATE_BTC_min 1
|
#define UPDATE_BTC_min 1
|
||||||
|
|
||||||
//API Block height
|
//API Block height
|
||||||
@ -31,7 +31,7 @@
|
|||||||
#define getPublicPool "https://public-pool.io:40557/api/client/" // +btcString
|
#define getPublicPool "https://public-pool.io:40557/api/client/" // +btcString
|
||||||
#define UPDATE_POOL_min 1
|
#define UPDATE_POOL_min 1
|
||||||
|
|
||||||
#define NEXT_HALVING_EVENT 840000
|
#define NEXT_HALVING_EVENT 1050000 //840000
|
||||||
#define HALVING_BLOCKS 210000
|
#define HALVING_BLOCKS 210000
|
||||||
|
|
||||||
enum NMState {
|
enum NMState {
|
||||||
|
@ -136,21 +136,37 @@ bool checkValid(unsigned char* hash, unsigned char* target) {
|
|||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getNextExtranonce2(int extranonce2_size, char *extranonce2) {
|
/**
|
||||||
|
* get random extranonce2
|
||||||
|
*/
|
||||||
|
void getRandomExtranonce2(int extranonce2_size, char *extranonce2) {
|
||||||
|
uint8_t b0, b1, b2, b3;
|
||||||
|
|
||||||
|
b0 = rand() % 256;
|
||||||
|
b1 = rand() % 256;
|
||||||
|
b2 = rand() % 256;
|
||||||
|
b3 = rand() % 256;
|
||||||
|
|
||||||
|
unsigned long extranonce2_number = b3 << 24 | b2 << 16 | b1 << 8 | b0;
|
||||||
|
|
||||||
|
char format[] = "%00x";
|
||||||
|
|
||||||
|
sprintf(&format[1], "%02dx", extranonce2_size * 2);
|
||||||
|
sprintf(extranonce2, format, extranonce2_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get linear extranonce2
|
||||||
|
*/
|
||||||
|
void getNextExtranonce2(int extranonce2_size, char *extranonce2) {
|
||||||
unsigned long extranonce2_number = strtoul(extranonce2, NULL, 10);
|
unsigned long extranonce2_number = strtoul(extranonce2, NULL, 10);
|
||||||
|
|
||||||
extranonce2_number++;
|
extranonce2_number++;
|
||||||
|
|
||||||
memset(extranonce2, '0', 2 * extranonce2_size);
|
char format[] = "%00x";
|
||||||
if (extranonce2_number > long(pow(10, 2 * extranonce2_size))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char next_extranounce2[2 * extranonce2_size + 1];
|
sprintf(&format[1], "%02dx", extranonce2_size * 2);
|
||||||
memset(extranonce2, '0', 2 * extranonce2_size);
|
sprintf(extranonce2, format, extranonce2_number);
|
||||||
ultoa(extranonce2_number, next_extranounce2, 10);
|
|
||||||
memcpy(extranonce2 + (2 * extranonce2_size) - long(log10(extranonce2_number)) - 1 , next_extranounce2, strlen(next_extranounce2));
|
|
||||||
extranonce2[2 * extranonce2_size] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
miner_data init_miner_data(void){
|
miner_data init_miner_data(void){
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "drivers/storage/SDCard.h"
|
#include "drivers/storage/SDCard.h"
|
||||||
#include "drivers/storage/nvMemory.h"
|
#include "drivers/storage/nvMemory.h"
|
||||||
#include "drivers/storage/storage.h"
|
#include "drivers/storage/storage.h"
|
||||||
|
#include "mining.h"
|
||||||
#include "timeconst.h"
|
#include "timeconst.h"
|
||||||
|
|
||||||
|
|
||||||
@ -38,11 +39,19 @@ void saveConfigCallback()
|
|||||||
//wm.setConfigPortalBlocking(false);
|
//wm.setConfigPortalBlocking(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* void saveParamsCallback()
|
||||||
|
// Callback notifying us of the need to save configuration
|
||||||
|
{
|
||||||
|
Serial.println("Should save config");
|
||||||
|
shouldSaveConfig = true;
|
||||||
|
nvMem.saveConfig(&Settings);
|
||||||
|
} */
|
||||||
|
|
||||||
void configModeCallback(WiFiManager* myWiFiManager)
|
void configModeCallback(WiFiManager* myWiFiManager)
|
||||||
// Called when config mode launched
|
// Called when config mode launched
|
||||||
{
|
{
|
||||||
Serial.println("Entered Configuration Mode");
|
Serial.println("Entered Configuration Mode");
|
||||||
|
drawSetupScreen();
|
||||||
Serial.print("Config SSID: ");
|
Serial.print("Config SSID: ");
|
||||||
Serial.println(myWiFiManager->getConfigPortalSSID());
|
Serial.println(myWiFiManager->getConfigPortalSSID());
|
||||||
|
|
||||||
@ -54,6 +63,7 @@ void reset_configuration()
|
|||||||
{
|
{
|
||||||
Serial.println("Erasing Config, restarting");
|
Serial.println("Erasing Config, restarting");
|
||||||
nvMem.deleteConfig();
|
nvMem.deleteConfig();
|
||||||
|
resetStat();
|
||||||
wm.resetSettings();
|
wm.resetSettings();
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
@ -102,6 +112,9 @@ void init_WifiManager()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Free the memory from SDCard class
|
||||||
|
SDCrd.terminate();
|
||||||
|
|
||||||
// Reset settings (only for development)
|
// Reset settings (only for development)
|
||||||
//wm.resetSettings();
|
//wm.resetSettings();
|
||||||
|
|
||||||
@ -110,14 +123,15 @@ void init_WifiManager()
|
|||||||
|
|
||||||
// Set config save notify callback
|
// Set config save notify callback
|
||||||
wm.setSaveConfigCallback(saveConfigCallback);
|
wm.setSaveConfigCallback(saveConfigCallback);
|
||||||
|
wm.setSaveParamsCallback(saveConfigCallback);
|
||||||
|
|
||||||
// Set callback that gets called when connecting to previous WiFi fails, and enters Access Point mode
|
// Set callback that gets called when connecting to previous WiFi fails, and enters Access Point mode
|
||||||
wm.setAPCallback(configModeCallback);
|
wm.setAPCallback(configModeCallback);
|
||||||
|
|
||||||
//Advanced settings
|
//Advanced settings
|
||||||
wm.setConfigPortalBlocking(false); //Hacemos que el portal no bloquee el firmware
|
wm.setConfigPortalBlocking(false); //Hacemos que el portal no bloquee el firmware
|
||||||
wm.setConnectTimeout(50); // how long to try to connect for before continuing
|
wm.setConnectTimeout(40); // how long to try to connect for before continuing
|
||||||
//wm.setConfigPortalTimeout(30); // auto close configportal after n seconds
|
wm.setConfigPortalTimeout(180); // auto close configportal after n seconds
|
||||||
// wm.setCaptivePortalEnable(false); // disable captive portal redirection
|
// wm.setCaptivePortalEnable(false); // disable captive portal redirection
|
||||||
// wm.setAPClientCheck(true); // avoid timeout if client connected to softap
|
// wm.setAPClientCheck(true); // avoid timeout if client connected to softap
|
||||||
//wm.setTimeout(120);
|
//wm.setTimeout(120);
|
||||||
@ -136,7 +150,7 @@ void init_WifiManager()
|
|||||||
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
|
// Text box (String) - 80 characters maximum
|
||||||
WiFiManagerParameter password_text_box("Poolpassword", "Pool password (Optional)", Settings.PoolPassword, 80);
|
//WiFiManagerParameter password_text_box("Poolpassword", "Pool password (Optional)", 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);
|
||||||
@ -153,7 +167,9 @@ void init_WifiManager()
|
|||||||
{
|
{
|
||||||
strcat(checkboxParams, " checked");
|
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);
|
WiFiManagerParameter save_stats_to_nvs("SaveStatsToNVS", "Save mining statistics to flash memory.", "T", 2, checkboxParams, WFM_LABEL_AFTER);
|
||||||
|
// Text box (String) - 80 characters maximum
|
||||||
|
WiFiManagerParameter password_text_box("Poolpassword - Optional", "Pool password", Settings.PoolPassword, 80);
|
||||||
|
|
||||||
// Add all defined parameters
|
// Add all defined parameters
|
||||||
wm.addParameter(&pool_text_box);
|
wm.addParameter(&pool_text_box);
|
||||||
@ -163,6 +179,15 @@ void init_WifiManager()
|
|||||||
wm.addParameter(&time_text_box_num);
|
wm.addParameter(&time_text_box_num);
|
||||||
wm.addParameter(&features_html);
|
wm.addParameter(&features_html);
|
||||||
wm.addParameter(&save_stats_to_nvs);
|
wm.addParameter(&save_stats_to_nvs);
|
||||||
|
#ifdef ESP32_2432S028R
|
||||||
|
char checkboxParams2[24] = "type=\"checkbox\"";
|
||||||
|
if (Settings.invertColors)
|
||||||
|
{
|
||||||
|
strcat(checkboxParams2, " checked");
|
||||||
|
}
|
||||||
|
WiFiManagerParameter invertColors("inverColors", "Invert Display Colors (if the colors looks weird)", "T", 2, checkboxParams2, WFM_LABEL_AFTER);
|
||||||
|
wm.addParameter(&invertColors);
|
||||||
|
#endif
|
||||||
|
|
||||||
Serial.println("AllDone: ");
|
Serial.println("AllDone: ");
|
||||||
if (forceConfig)
|
if (forceConfig)
|
||||||
@ -171,8 +196,8 @@ void init_WifiManager()
|
|||||||
//No configuramos timeout al modulo
|
//No configuramos timeout al modulo
|
||||||
wm.setConfigPortalBlocking(true); //Hacemos que el portal SI bloquee el firmware
|
wm.setConfigPortalBlocking(true); //Hacemos que el portal SI bloquee el firmware
|
||||||
drawSetupScreen();
|
drawSetupScreen();
|
||||||
|
mMonitor.NerdStatus = NM_Connecting;
|
||||||
if (wm.startConfigPortal(DEFAULT_SSID, DEFAULT_WIFIPW))
|
if (!wm.startConfigPortal(DEFAULT_SSID, DEFAULT_WIFIPW))
|
||||||
{
|
{
|
||||||
//Could be break forced after edditing, so save new config
|
//Could be break forced after edditing, so save new config
|
||||||
Serial.println("failed to connect and hit timeout");
|
Serial.println("failed to connect and hit timeout");
|
||||||
@ -181,33 +206,48 @@ void init_WifiManager()
|
|||||||
strncpy(Settings.PoolPassword, password_text_box.getValue(), sizeof(Settings.PoolPassword));
|
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());
|
||||||
Settings.saveStats = (strncmp(save_stats_to_nvs.getValue(), "T", 1) == 0);
|
Settings.saveStats = (strncmp(save_stats_to_nvs.getValue(), "T", 1) == 0);
|
||||||
|
#ifdef ESP32_2432S028R
|
||||||
|
Settings.invertColors = (strncmp(invertColors.getValue(), "T", 1) == 0);
|
||||||
|
#endif
|
||||||
nvMem.saveConfig(&Settings);
|
nvMem.saveConfig(&Settings);
|
||||||
delay(3*SECOND_MS);
|
delay(3*SECOND_MS);
|
||||||
//reset and try again, or maybe put it to deep sleep
|
//reset and try again, or maybe put it to deep sleep
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
delay(5*SECOND_MS);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Tratamos de conectar con la configuración inicial ya almacenada
|
//Tratamos de conectar con la configuración inicial ya almacenada
|
||||||
mMonitor.NerdStatus = NM_Connecting;
|
mMonitor.NerdStatus = NM_Connecting;
|
||||||
wm.setCaptivePortalEnable(false); // disable captive portal redirection
|
// disable captive portal redirection
|
||||||
if (!wm.autoConnect(Settings.WifiSSID.c_str(), Settings.WifiPW.c_str()))
|
wm.setCaptivePortalEnable(true);
|
||||||
|
wm.setConfigPortalBlocking(true);
|
||||||
|
wm.setEnableConfigPortal(true);
|
||||||
|
// if (!wm.autoConnect(Settings.WifiSSID.c_str(), Settings.WifiPW.c_str()))
|
||||||
|
if (!wm.autoConnect(DEFAULT_SSID, DEFAULT_WIFIPW))
|
||||||
{
|
{
|
||||||
Serial.println("Failed to connect and hit timeout");
|
Serial.println("Failed to connect to configured WIFI, and hit timeout");
|
||||||
//delay(3000);
|
if (shouldSaveConfig) {
|
||||||
// if we still have not connected restart and try all over again
|
// Save new config
|
||||||
//ESP.restart();
|
Settings.PoolAddress = pool_text_box.getValue();
|
||||||
//delay(5000);
|
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());
|
||||||
|
Settings.saveStats = (strncmp(save_stats_to_nvs.getValue(), "T", 1) == 0);
|
||||||
|
#ifdef ESP32_2432S028R
|
||||||
|
Settings.invertColors = (strncmp(invertColors.getValue(), "T", 1) == 0);
|
||||||
|
#endif
|
||||||
|
nvMem.saveConfig(&Settings);
|
||||||
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
ESP.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mMonitor.NerdStatus = NM_Connecting;
|
|
||||||
|
|
||||||
//Conectado a la red Wifi
|
//Conectado a la red Wifi
|
||||||
if (WiFi.status() == WL_CONNECTED) {
|
if (WiFi.status() == WL_CONNECTED) {
|
||||||
//tft.pushImage(0, 0, MinerWidth, MinerHeight, MinerScreen);
|
//tft.pushImage(0, 0, MinerWidth, MinerHeight, MinerScreen);
|
||||||
@ -244,12 +284,21 @@ void init_WifiManager()
|
|||||||
Serial.print("TimeZone fromUTC: ");
|
Serial.print("TimeZone fromUTC: ");
|
||||||
Serial.println(Settings.Timezone);
|
Serial.println(Settings.Timezone);
|
||||||
|
|
||||||
|
#ifdef ESP32_2432S028R
|
||||||
|
Settings.invertColors = (strncmp(invertColors.getValue(), "T", 1) == 0);
|
||||||
|
Serial.print("Invert Colors: ");
|
||||||
|
Serial.println(Settings.invertColors);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the custom parameters to FS
|
// Save the custom parameters to FS
|
||||||
if (shouldSaveConfig)
|
if (shouldSaveConfig)
|
||||||
{
|
{
|
||||||
nvMem.saveConfig(&Settings);
|
nvMem.saveConfig(&Settings);
|
||||||
|
#ifdef ESP32_2432S028R
|
||||||
|
if (Settings.invertColors) ESP.restart();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user