diff --git a/src/mining.cpp b/src/mining.cpp index 1b22107..8e529a9 100644 --- a/src/mining.cpp +++ b/src/mining.cpp @@ -400,6 +400,13 @@ void saveStat() { 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) { diff --git a/src/mining.h b/src/mining.h index 2eff707..a1adf14 100644 --- a/src/mining.h +++ b/src/mining.h @@ -17,6 +17,8 @@ void runStratumWorker(void *name); void runMiner(void *name); String printLocalTime(void); +void resetStat(); + typedef struct{ uint8_t bytearray_target[32]; uint8_t bytearray_pooltarget[32]; diff --git a/src/wManager.cpp b/src/wManager.cpp index b52a3a1..9202df3 100644 --- a/src/wManager.cpp +++ b/src/wManager.cpp @@ -13,6 +13,7 @@ #include "drivers/storage/SDCard.h" #include "drivers/storage/nvMemory.h" #include "drivers/storage/storage.h" +#include "mining.h" #include "timeconst.h" @@ -54,6 +55,7 @@ void reset_configuration() { Serial.println("Erasing Config, restarting"); nvMem.deleteConfig(); + resetStat(); wm.resetSettings(); ESP.restart(); } @@ -153,7 +155,9 @@ void init_WifiManager() { 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 - Optionl", "Pool password", Settings.PoolPassword, 80); // Add all defined parameters wm.addParameter(&pool_text_box);