Merge pull request #349 from dwightmulcahy/zerostats
zero out mining stats when a reset is done
This commit is contained in:
commit
a3e52ed25f
@ -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)
|
||||
{
|
||||
|
||||
|
@ -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];
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user