From 3314237927b5286d2e814311a80934bb0f430587 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Sat, 5 Aug 2023 21:32:37 +0200 Subject: [PATCH] Increase watchdog timeout to 15 minutes Also increase nonce range to 25M to keep miner busy for up to 10 minutes. --- src/NerdMinerV2.ino.cpp | 4 ++-- src/mining.cpp | 6 +++--- src/mining.h | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/NerdMinerV2.ino.cpp b/src/NerdMinerV2.ino.cpp index 8c14847..bed50c3 100644 --- a/src/NerdMinerV2.ino.cpp +++ b/src/NerdMinerV2.ino.cpp @@ -20,8 +20,8 @@ //3 seconds WDT #define WDT_TIMEOUT 3 -//120 seconds WDT for miner task -#define WDT_MINER_TIMEOUT 120 +//15 minutes WDT for miner task +#define WDT_MINER_TIMEOUT 900 OneButton button1(PIN_BUTTON_1); OneButton button2(PIN_BUTTON_2); diff --git a/src/mining.cpp b/src/mining.cpp index b09e500..c1c1565 100644 --- a/src/mining.cpp +++ b/src/mining.cpp @@ -375,9 +375,9 @@ void runMiner(void * task_id) { mMiner.inRun = false; Serial.print(">>> Finished job waiting new data from pool"); - if(hashes>=MAX_NONCE) { - Mhashes=Mhashes+MAX_NONCE/1000000; - hashes=hashes-MAX_NONCE; + if(hashes>=MAX_NONCE_STEP) { + Mhashes=Mhashes+MAX_NONCE_STEP/1000000; + hashes=hashes-MAX_NONCE_STEP; } uint32_t duration = micros() - startT; diff --git a/src/mining.h b/src/mining.h index 4cb28f5..2eff707 100644 --- a/src/mining.h +++ b/src/mining.h @@ -3,7 +3,8 @@ #define MINING_API_H // Mining -#define MAX_NONCE 5000000U +#define MAX_NONCE_STEP 5000000U +#define MAX_NONCE 25000000U #define TARGET_NONCE 471136297U #define DEFAULT_DIFFICULTY 1e-4 #define KEEPALIVE_TIME_ms 30000