zero out stats now when a reset is done
This commit is contained in:
parent
009c7941a3
commit
8eb1e3cc5b
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
.idea/
|
||||
.pio
|
||||
.vscode
|
||||
.vs
|
||||
|
@ -43,7 +43,7 @@ monitor_data mMonitor;
|
||||
bool isMinerSuscribed = false;
|
||||
unsigned long mLastTXtoPool = millis();
|
||||
|
||||
int saveIntervals[7] = {5 * 60, 15 * 60, 30 * 60, 1 * 360, 3 * 360, 6 * 360, 12 * 360};
|
||||
int saveIntervals[8] = {1 * 60, 5 * 60, 15 * 60, 30 * 60, 1 * 360, 3 * 360, 6 * 360, 12 * 360};
|
||||
int saveIntervalsSize = sizeof(saveIntervals)/sizeof(saveIntervals[0]);
|
||||
int currentIntervalIndex = 0;
|
||||
|
||||
@ -399,6 +399,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"
|
||||
|
||||
|
||||
// Flag for saving data
|
||||
@ -53,6 +54,7 @@ void reset_configuration()
|
||||
{
|
||||
Serial.println("Erasing Config, restarting");
|
||||
nvMem.deleteConfig();
|
||||
resetStat();
|
||||
wm.resetSettings();
|
||||
ESP.restart();
|
||||
}
|
||||
@ -149,7 +151,7 @@ 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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user