Support ESP32devkit nerdMiner
This commit is contained in:
parent
3bbeb227a6
commit
f1394cd2c2
@ -75,7 +75,7 @@ Recommended low difficulty share pools:
|
||||
|
||||
| Pool URL | Port | Web URL | Status |
|
||||
|--- |--- |--- |--- |
|
||||
| public-pool.airdns.org | 21496 | https://public-pool.airdns.org:37273/ | Open Source Solo Bitcoin Mining Pool supporting open source miners |
|
||||
| web.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.airdns.org |
|
||||
| pool.nerdminer.io | 3333 | https://nerdminer.io | Mantained by CHMEX |
|
||||
| pool.vkbit.com | 3333 | https://vkbit.com/ | Mantained by djerfy |
|
||||
|
@ -81,9 +81,9 @@
|
||||
//#include <User_Setups/Setup44_TTGO_CameraPlus.h> // Setup file for ESP32 and TTGO T-CameraPlus ST7789 SPI bus TFT 240x240
|
||||
//#include <User_Setups/Setup45_TTGO_T_Watch.h> // Setup file for ESP32 and TTGO T-Watch ST7789 SPI bus TFT 240x240
|
||||
//#include <User_Setups/Setup46_GC9A01_ESP32.h> // Setup file for ESP32 and GC9A01 SPI bus TFT 240x240
|
||||
|
||||
//#include <User_Setups/Setup47_ST7735.h> // Setup file for ESP32 configured for ST7735 128 x 128 animated eyes
|
||||
|
||||
#ifdef DEVKITV1
|
||||
#include <User_Setups/Setup47_ST7735.h> // Setup file for ESP32 configured for ST7735 128 x 128 animated eyes
|
||||
#endif
|
||||
//#include <User_Setups/Setup50_SSD1963_Parallel.h> // Setup file for ESP32 and SSD1963 TFT display
|
||||
|
||||
//#include <User_Setups/Setup51_LilyPi_ILI9481.h> // Setup file for LilyGo LilyPi with ILI9481 display
|
||||
@ -127,9 +127,9 @@
|
||||
//#include <User_Setups/Setup204_ESP32_TouchDown.h> // Setup file for the ESP32 TouchDown based on ILI9488 480 x 320 TFT
|
||||
|
||||
//#include <User_Setups/Setup205_ESP32_TouchDown_S3.h> // Setup file for the ESP32 TouchDown S3 based on ILI9488 480 x 320 TFT
|
||||
|
||||
#ifdef NERDMINERV2
|
||||
#include <User_Setups/Setup206_LilyGo_T_Display_S3.h>
|
||||
|
||||
#endif
|
||||
//#include <User_Setups/Setup301_BW16_ST7735.h> // Setup file for Bw16-based boards with ST7735 160 x 80 TFT
|
||||
|
||||
//#include <User_Setups/SetupX_Template.h> // Template file for a setup
|
||||
|
@ -35,6 +35,7 @@ build_flags =
|
||||
-D BOARD_HAS_PSRAM
|
||||
-D ARDUINO_USB_MODE=1
|
||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-D NERDMINERV2=1
|
||||
;-D DEBUG_MINING=1
|
||||
lib_deps =
|
||||
https://github.com/takkaO/OpenFontRender
|
||||
@ -64,6 +65,7 @@ board_build.partitions = huge_app.csv
|
||||
;board_build.partitions = default.csv
|
||||
|
||||
build_flags =
|
||||
-D DEVKITV1=1
|
||||
;-D DEBUG_MINING=1
|
||||
lib_deps =
|
||||
https://github.com/takkaO/OpenFontRender
|
||||
@ -89,8 +91,9 @@ upload_speed = 115200
|
||||
# 2 x 4.5MB app, 6.875MB SPIFFS
|
||||
board_build.partitions = huge_app.csv
|
||||
|
||||
;build_flags =
|
||||
build_flags =
|
||||
;-D DEBUG_MINING=1
|
||||
-D TDISPLAY=1
|
||||
lib_deps =
|
||||
https://github.com/takkaO/OpenFontRender
|
||||
bblanchon/ArduinoJson@^6.21.2
|
||||
|
@ -38,10 +38,12 @@ const char* ntpServer = "pool.ntp.org";
|
||||
//void runMonitor(void *name);
|
||||
|
||||
void alternate_screen_state() {
|
||||
#ifdef NERDMINERV2
|
||||
int screen_state= digitalRead(TFT_BL);
|
||||
//Serial.printf("Screen state is '%s', switching to '%s'", screen_state, !screen_state);
|
||||
Serial.println("Switching display state");
|
||||
digitalWrite(TFT_BL, !screen_state);
|
||||
#endif
|
||||
}
|
||||
|
||||
void alternate_screen_rotation() {
|
||||
@ -64,21 +66,22 @@ void setup()
|
||||
//disableCore1WDT();
|
||||
|
||||
// Setup the buttons
|
||||
#ifdef NERDMINERV2
|
||||
// Button 1 (Boot)
|
||||
button1.setPressTicks(5000);
|
||||
button1.attachClick(alternate_screen_state);
|
||||
button1.attachDoubleClick(alternate_screen_rotation);
|
||||
// button1.attachLongPressStart([]{Serial.println("Button 1 started a long press");});
|
||||
// button1.attachLongPressStop([]{Serial.println("Button 1 stopped a long press");});
|
||||
// button1.attachDuringLongPress([]{Serial.println("Button 1 is being held down");});
|
||||
|
||||
// Button 2 (GPIO14)
|
||||
button2.setPressTicks(5000);
|
||||
button2.attachClick(changeScreen);
|
||||
// button2.attachDoubleClick([]{Serial.println("Button 2 was double clicked");});
|
||||
button2.attachLongPressStart(reset_configurations);
|
||||
// button2.attachLongPressStop(reset_configurations);
|
||||
// button2.attachDuringLongPress([]{Serial.println("Button 2 is being held down");});
|
||||
#elif defined(DEVKITV1)
|
||||
//Standard ESP32-devKit
|
||||
button1.setPressTicks(5000);
|
||||
button1.attachLongPressStart(reset_configurations);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/******** INIT NERDMINER ************/
|
||||
@ -122,7 +125,7 @@ void setup()
|
||||
|
||||
/******** CREATE STRATUM TASK *****/
|
||||
sprintf(name, "(%s)", "Stratum");
|
||||
BaseType_t res2 = xTaskCreatePinnedToCore(runStratumWorker, "Stratum", 20000, (void*)name, 3, NULL,1);
|
||||
BaseType_t res2 = xTaskCreatePinnedToCore(runStratumWorker, "Stratum", 15000, (void*)name, 3, NULL,1);
|
||||
|
||||
|
||||
/******** CREATE MINER TASKS *****/
|
||||
@ -130,19 +133,12 @@ void setup()
|
||||
// char *name = (char*) malloc(32);
|
||||
// sprintf(name, "(%d)", i);
|
||||
|
||||
// Start stratum tasks
|
||||
sprintf(name, "(%s)", "Miner0");
|
||||
//BaseType_t res = xTaskCreatePinnedToCore(runMiner, "0", 10000, (void*)name, 1, NULL, 0);
|
||||
//BaseType_t res3 = xTaskCreatePinnedToCore(runMiner, "0", 10000, (void*)name, 1,NULL, 0);
|
||||
//sprintf(name, "(%s)", "Miner1");
|
||||
//BaseType_t res4 = xTaskCreatePinnedToCore(runMiner, "1", 10000, (void*)name, 1,NULL, 0);
|
||||
//Serial.printf("Starting %s %s!\n", "1", res3 == pdPASS? "successful":"failed");
|
||||
|
||||
// Start mining tasks
|
||||
//BaseType_t res = xTaskCreate(runWorker, name, 35000, (void*)name, 1, NULL);
|
||||
TaskHandle_t minerTask1, minerTask2 = NULL;
|
||||
xTaskCreate(runMiner, "Miner0", 15000, (void*)0, 1, &minerTask1);
|
||||
xTaskCreate(runMiner, "Miner1", 15000, (void*)1, 1, &minerTask2);
|
||||
xTaskCreate(runMiner, "Miner0", 6000, (void*)0, 1, &minerTask1);
|
||||
xTaskCreate(runMiner, "Miner1", 6000, (void*)1, 1, &minerTask2);
|
||||
|
||||
esp_task_wdt_add(minerTask1);
|
||||
esp_task_wdt_add(minerTask2);
|
||||
|
||||
|
@ -233,6 +233,8 @@ void runMiner(void * task_id) {
|
||||
|
||||
unsigned int miner_id = (uint32_t)task_id;
|
||||
|
||||
Serial.printf("[MINER] %d Started runMiner Task!\n", miner_id);
|
||||
|
||||
while(1){
|
||||
|
||||
//Wait new job
|
||||
@ -393,6 +395,10 @@ void runMonitor(void *name){
|
||||
unsigned long mLastCheck = 0;
|
||||
mMonitor.screen = SCREEN_MINING;
|
||||
|
||||
#ifdef DEVKITV1
|
||||
mMonitor.screen = NO_SCREEN;
|
||||
#endif
|
||||
|
||||
while(1){
|
||||
|
||||
|
||||
@ -406,6 +412,7 @@ void runMonitor(void *name){
|
||||
case SCREEN_MINING: show_MinerScreen(mElapsed); break;
|
||||
case SCREEN_CLOCK: show_ClockScreen(mElapsed); break;
|
||||
case SCREEN_GLOBAL: show_GlobalHashScreen(mElapsed); break;
|
||||
case NO_SCREEN: show_NoScreen(mElapsed); break;
|
||||
}
|
||||
|
||||
//Monitor state when hashrate is 0.0
|
||||
|
@ -219,6 +219,16 @@ void changeScreen(void){
|
||||
mMonitor.screen++;
|
||||
if(mMonitor.screen> SCREEN_GLOBAL) mMonitor.screen = SCREEN_MINING;
|
||||
}
|
||||
|
||||
void show_NoScreen(unsigned long mElapsed){
|
||||
char CurrentHashrate[10] = {0};
|
||||
sprintf(CurrentHashrate, "%.2f", (1.0*(elapsedKHs*1000))/mElapsed);
|
||||
|
||||
//Print hashrate to serial
|
||||
Serial.printf(">>> Completed %d share(s), %d Khashes, avg. hashrate %s KH/s\n",
|
||||
shares, totalKHashes, CurrentHashrate);
|
||||
}
|
||||
|
||||
void show_MinerScreen(unsigned long mElapsed){
|
||||
|
||||
//Print background screen
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define SCREEN_MINING 0
|
||||
#define SCREEN_CLOCK 1
|
||||
#define SCREEN_GLOBAL 2
|
||||
#define NO_SCREEN 3 //Used when board has no TFT
|
||||
|
||||
//Time update period
|
||||
#define UPDATE_PERIOD_h 5
|
||||
@ -47,6 +48,7 @@ void setup_monitor(void);
|
||||
void show_MinerScreen(unsigned long mElapsed);
|
||||
void show_ClockScreen(unsigned long mElapsed);
|
||||
void show_GlobalHashScreen(unsigned long mElapsed);
|
||||
void show_NoScreen(unsigned long mElapsed);
|
||||
void changeScreen(void);
|
||||
|
||||
#endif //MONITOR_API_H
|
@ -146,11 +146,16 @@ void init_WifiManager()
|
||||
|
||||
// Change to true when testing to force configuration every time we run
|
||||
bool forceConfig = false;
|
||||
|
||||
#if !defined(DEVKITV1)
|
||||
// Check if button2 is pressed to enter configMode with actual configuration
|
||||
if(!digitalRead(PIN_BUTTON_2)){
|
||||
Serial.println(F("Button pressed to force start config mode"));
|
||||
forceConfig = true;
|
||||
wm.setBreakAfterConfig(true); //Set to detect config edition and save
|
||||
}
|
||||
#endif
|
||||
|
||||
bool spiffsSetup = loadConfigFile();
|
||||
if (!spiffsSetup)
|
||||
{
|
||||
|
@ -1,7 +1,15 @@
|
||||
//Botón configuración
|
||||
|
||||
#ifdef NERDMINERV2
|
||||
//Define config buttons for TTGO-TDisplay-s3
|
||||
#define PIN_BUTTON_1 0
|
||||
#define PIN_BUTTON_2 14
|
||||
#define PIN_ENABLE5V 15
|
||||
#elif defined(DEVKITV1)
|
||||
//Standard ESP32-devKit
|
||||
#define PIN_BUTTON_1 0
|
||||
#define PIN_BUTTON_2 19 //Not used
|
||||
#define PIN_ENABLE5V 21 //Not used
|
||||
#endif
|
||||
|
||||
void init_WifiManager();
|
||||
void wifiManagerProcess();
|
||||
|
Loading…
Reference in New Issue
Block a user