update files
This commit is contained in:
parent
e1d9cbb6c2
commit
6e891f1a5f
@ -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-2432S028R 2,8" ([Aliexpress link](https://s.click.aliexpress.com/e/_DdXkvLv))
|
||||||
- ESP32-cam [Board Info](https://lastminuteengineers.com/getting-started-with-esp32-cam/)
|
- ESP32-cam [Board Info](https://lastminuteengineers.com/getting-started-with-esp32-cam/)
|
||||||
|
|
||||||
* affiliate link
|
|
||||||
|
|
||||||
### Flash firmware
|
### Flash firmware
|
||||||
#### microMiners Flashtool [Recommended]
|
#### microMiners Flashtool [Recommended]
|
||||||
Easyiest way to flash firmware. Build your own miner using the folowing firwmare flash tool:
|
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)
|
#### SD card (if available)
|
||||||
|
|
||||||
1. Format a SD card using Fat32.
|
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",
|
"SSID": "myWifiSSID",
|
||||||
"PW": "myWifiPassword",
|
"PW": "myWifiPassword",
|
||||||
"PoolUrl": "public-pool.io",
|
"PoolUrl": "public-pool.io",
|
||||||
"PoolPort": 21496,
|
"PoolPort": 21496,
|
||||||
"BtcWallet": "walletID",
|
"BtcWallet": "walletID",
|
||||||
"Timezone": 2
|
"Timezone": 2,
|
||||||
|
"saveStats": false
|
||||||
}
|
}
|
||||||
1. Insert the SD card.
|
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.
|
1. Hold down the "reset configurations" button as described below to reset the configurations and/or boot without settings in your nvmemory.
|
||||||
|
@ -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"
|
#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()
|
SDCard::SDCard()
|
||||||
{
|
{
|
||||||
@ -58,6 +68,8 @@ bool SDCard::loadConfigFile(TSettings* Settings)
|
|||||||
Settings->PoolPort = json[JSON_KEY_POOLPORT].as<int>();
|
Settings->PoolPort = json[JSON_KEY_POOLPORT].as<int>();
|
||||||
if (json.containsKey(JSON_KEY_TIMEZONE))
|
if (json.containsKey(JSON_KEY_TIMEZONE))
|
||||||
Settings->Timezone = json[JSON_KEY_TIMEZONE].as<int>();
|
Settings->Timezone = json[JSON_KEY_TIMEZONE].as<int>();
|
||||||
|
if (json.containsKey(JSON_KEY_STATS2NV))
|
||||||
|
Settings->saveStats = json[JSON_KEY_STATS2NV].as<bool>();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef _SDCARD_H_
|
#ifndef _SDCARD_H_
|
||||||
#define _SDCARD_H_
|
#define _SDCARD_H_
|
||||||
|
|
||||||
|
#include "storage.h"
|
||||||
|
#include "nvMemory.h"
|
||||||
#include "..\devices\device.h"
|
#include "..\devices\device.h"
|
||||||
|
|
||||||
#if defined (SDMMC_D0) && defined (SDMMC_D1) && defined (SDMMC_D2) && defined (SDMMC_D3)
|
#if defined (SDMMC_D0) && defined (SDMMC_D1) && defined (SDMMC_D2) && defined (SDMMC_D3)
|
||||||
@ -13,12 +15,6 @@
|
|||||||
#warning SD card support disabled!
|
#warning SD card support disabled!
|
||||||
#endif
|
#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)
|
// Handles the transfer of settings from sd card to nv memory (wifi credentials are handled by wifimanager)
|
||||||
class SDCard
|
class SDCard
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
|
|
||||||
|
#include "..\devices\device.h"
|
||||||
|
#include "storage.h"
|
||||||
|
|
||||||
nvMemory::nvMemory()
|
nvMemory::nvMemory()
|
||||||
{
|
{
|
||||||
Initialized_ = false;
|
Initialized_ = false;
|
||||||
@ -30,7 +33,7 @@ bool nvMemory::saveConfig(TSettings* Settings)
|
|||||||
json[JSON_KEY_POOLPORT] = Settings->PoolPort;
|
json[JSON_KEY_POOLPORT] = Settings->PoolPort;
|
||||||
json[JSON_KEY_WALLETID] = Settings->BtcWallet;
|
json[JSON_KEY_WALLETID] = Settings->BtcWallet;
|
||||||
json[JSON_KEY_TIMEZONE] = Settings->Timezone;
|
json[JSON_KEY_TIMEZONE] = Settings->Timezone;
|
||||||
json[JSON_KEY_TIMEZONE] = Settings->saveStats;
|
json[JSON_KEY_STATS2NV] = Settings->saveStats;
|
||||||
|
|
||||||
// Open config file
|
// Open config file
|
||||||
File configFile = SPIFFS.open(JSON_CONFIG_FILE, "w");
|
File configFile = SPIFFS.open(JSON_CONFIG_FILE, "w");
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef _STORAGE_H_
|
#ifndef _STORAGE_H_
|
||||||
#define _STORAGE_H_
|
#define _STORAGE_H_
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
#define DEFAULT_SSID "NMAP"
|
#define DEFAULT_SSID "NMAP"
|
||||||
#define DEFAULT_WIFIPW "1234567890"
|
#define DEFAULT_WIFIPW "1234567890"
|
||||||
#define DEFAULT_POOLURL "public-pool.io"
|
#define DEFAULT_POOLURL "public-pool.io"
|
||||||
@ -17,7 +19,7 @@
|
|||||||
#define JSON_KEY_WALLETID "BtcWallet"
|
#define JSON_KEY_WALLETID "BtcWallet"
|
||||||
#define JSON_KEY_POOLPORT "PoolPort"
|
#define JSON_KEY_POOLPORT "PoolPort"
|
||||||
#define JSON_KEY_TIMEZONE "Timezone"
|
#define JSON_KEY_TIMEZONE "Timezone"
|
||||||
#define JSON_KEY_STATS2NV "saveStatsToNVS"
|
#define JSON_KEY_STATS2NV "saveStats"
|
||||||
|
|
||||||
struct TSettings
|
struct TSettings
|
||||||
{
|
{
|
||||||
|
@ -164,15 +164,15 @@ void init_WifiManager()
|
|||||||
wm.setConfigPortalBlocking(true); //Hacemos que el portal SI bloquee el firmware
|
wm.setConfigPortalBlocking(true); //Hacemos que el portal SI bloquee el firmware
|
||||||
drawSetupScreen();
|
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
|
//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));
|
strncpy(Settings.PoolAddress, pool_text_box.getValue(), sizeof(Settings.PoolAddress));
|
||||||
Settings.PoolPort = atoi(port_text_box_num.getValue());
|
Settings.PoolPort = atoi(port_text_box_num.getValue());
|
||||||
strncpy(Settings.BtcWallet, addr_text_box.getValue(), sizeof(Settings.BtcWallet));
|
strncpy(Settings.BtcWallet, addr_text_box.getValue(), sizeof(Settings.BtcWallet));
|
||||||
Settings.Timezone = atoi(time_text_box_num.getValue());
|
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);
|
Settings.saveStats = (strncmp(save_stats_to_nvs.getValue(), "T", 1) == 0);
|
||||||
|
|
||||||
nvMem.saveConfig(&Settings);
|
nvMem.saveConfig(&Settings);
|
||||||
@ -180,7 +180,7 @@ void init_WifiManager()
|
|||||||
//reset and try again, or maybe put it to deep sleep
|
//reset and try again, or maybe put it to deep sleep
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
delay(5000);
|
delay(5000);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user