update files

This commit is contained in:
elmo128 2023-09-17 16:44:01 +02:00
parent e1d9cbb6c2
commit 6e891f1a5f
7 changed files with 31 additions and 19 deletions

View File

@ -46,8 +46,6 @@ Every time an stratum job notification is received miner update its current work
- ESP32-2432S028R 2,8" ([Aliexpress link](https://s.click.aliexpress.com/e/_DdXkvLv))
- ESP32-cam [Board Info](https://lastminuteengineers.com/getting-started-with-esp32-cam/)
* affiliate link
### Flash firmware
#### microMiners Flashtool [Recommended]
Easyiest way to flash firmware. Build your own miner using the folowing firwmare flash tool:
@ -89,14 +87,15 @@ After programming, you will only need to setup your Wifi and BTC address.
#### SD card (if available)
1. Format a SD card using Fat32.
1. Create a file named "config.json" in your card's root containing the the following structure. Adjust the settings to your needs:
1. Create a file named "config.json" in your card's root, containing the the following structure. Adjust the settings to your needs:
{
"SSID": "myWifiSSID",
"PW": "myWifiPassword",
"PoolUrl": "public-pool.io",
"PoolPort": 21496,
"BtcWallet": "walletID",
"Timezone": 2
"Timezone": 2,
"saveStats": false
}
1. Insert the SD card.
1. Hold down the "reset configurations" button as described below to reset the configurations and/or boot without settings in your nvmemory.

View File

@ -1,6 +1,16 @@
#include <FS.h>
#include <ArduinoJson.h>
#include <WiFi.h>
#include "storage.h"
#include "nvMemory.h"
#include "..\devices\device.h"
#include "SDCard.h"
#if defined (BUILD_SDMMC_1) || defined(BUILD_SDMMC_4) || defined (BUILD_SDSPI)
#if defined (BUILD_SDMMC_1) || defined(BUILD_SDMMC_4)
#include <SD_MMC.h>
SDCard::SDCard()
{
@ -58,6 +68,8 @@ bool SDCard::loadConfigFile(TSettings* Settings)
Settings->PoolPort = json[JSON_KEY_POOLPORT].as<int>();
if (json.containsKey(JSON_KEY_TIMEZONE))
Settings->Timezone = json[JSON_KEY_TIMEZONE].as<int>();
if (json.containsKey(JSON_KEY_STATS2NV))
Settings->saveStats = json[JSON_KEY_STATS2NV].as<bool>();
return true;
}
else

View File

@ -1,6 +1,8 @@
#ifndef _SDCARD_H_
#define _SDCARD_H_
#include "storage.h"
#include "nvMemory.h"
#include "..\devices\device.h"
#if defined (SDMMC_D0) && defined (SDMMC_D1) && defined (SDMMC_D2) && defined (SDMMC_D3)
@ -13,12 +15,6 @@
#warning SD card support disabled!
#endif
#include <FS.h>
#include <ArduinoJson.h>
#include "storage.h"
#include "nvMemory.h"
// Handles the transfer of settings from sd card to nv memory (wifi credentials are handled by wifimanager)
class SDCard
{

View File

@ -6,6 +6,9 @@
#include <FS.h>
#include <ArduinoJson.h>
#include "..\devices\device.h"
#include "storage.h"
nvMemory::nvMemory()
{
Initialized_ = false;
@ -30,7 +33,7 @@ bool nvMemory::saveConfig(TSettings* Settings)
json[JSON_KEY_POOLPORT] = Settings->PoolPort;
json[JSON_KEY_WALLETID] = Settings->BtcWallet;
json[JSON_KEY_TIMEZONE] = Settings->Timezone;
json[JSON_KEY_TIMEZONE] = Settings->saveStats;
json[JSON_KEY_STATS2NV] = Settings->saveStats;
// Open config file
File configFile = SPIFFS.open(JSON_CONFIG_FILE, "w");

View File

@ -1,6 +1,8 @@
#ifndef _STORAGE_H_
#define _STORAGE_H_
#include <inttypes.h>
#define DEFAULT_SSID "NMAP"
#define DEFAULT_WIFIPW "1234567890"
#define DEFAULT_POOLURL "public-pool.io"
@ -17,7 +19,7 @@
#define JSON_KEY_WALLETID "BtcWallet"
#define JSON_KEY_POOLPORT "PoolPort"
#define JSON_KEY_TIMEZONE "Timezone"
#define JSON_KEY_STATS2NV "saveStatsToNVS"
#define JSON_KEY_STATS2NV "saveStats"
struct TSettings
{

View File

@ -164,15 +164,15 @@ void init_WifiManager()
wm.setConfigPortalBlocking(true); //Hacemos que el portal SI bloquee el firmware
drawSetupScreen();
if (!wm.startConfigPortal(DEFAULT_SSID, DEFAULT_WIFIPW))
if (wm.startConfigPortal(DEFAULT_SSID, DEFAULT_WIFIPW))
{
Serial.println("failed to connect and hit timeout");
//Could be break forced after edditing, so save new config
Serial.println("failed to connect and hit timeout");
strncpy(Settings.PoolAddress, pool_text_box.getValue(), sizeof(Settings.PoolAddress));
Settings.PoolPort = atoi(port_text_box_num.getValue());
strncpy(Settings.BtcWallet, addr_text_box.getValue(), sizeof(Settings.BtcWallet));
Settings.Timezone = atoi(time_text_box_num.getValue());
Serial.println(save_stats_to_nvs.getValue());
Settings.saveStats = (strncmp(save_stats_to_nvs.getValue(), "T", 1) == 0);
nvMem.saveConfig(&Settings);
@ -180,7 +180,7 @@ void init_WifiManager()
//reset and try again, or maybe put it to deep sleep
ESP.restart();
delay(5000);
}
};
}
else
{