-
Notifications
You must be signed in to change notification settings - Fork 0
/
Settings.h
227 lines (189 loc) · 7.58 KB
/
Settings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
// Settings.h
#ifndef SETTINGS_H
#define SETTINGS_H
// ---------------------- General settings ---------------------- //
// Change the part in brackets to your Duino-Coin username
extern char *DUCO_USER = "";
// Change the part in brackets to your mining key (if you have set it in the wallet)
extern char *MINER_KEY = "";
// Change the part in brackets if you want to set a custom miner name
// Use Auto to autogenerate, None for no custom identifier
extern char *RIG_IDENTIFIER = "PiPicoW";
// Change the part in brackets to your WiFi name
extern const char SSID[] = "";
// Change the part in brackets to your WiFi password
extern const char PASSWORD[] = "";
// -------------------------------------------------------------- //
// -------------------- Advanced options ------------------------ //
// Uncomment if you want to host the dashboard page (available on ESPs IP address and mDNS)
//#define WEB_DASHBOARD
#define NUMBER_OF_CORES 1
// Comment out the line below if you wish to disable LED blinking
#define LED_BLINKING
// Uncomment if you want to use LAN8720. WLAN-credentials will be ignored using LAN
// Select correct Board in ArduinoIDE!!! Really!
// #define USE_LAN
// Comment out the line below if you wish to disable Serial printing
#define SERIAL_PRINTING
// Edit the line below if you wish to change the serial speed (low values may reduce performance but are less prone to interference)
#define SERIAL_BAUDRATE 500000
// ESP8266 WDT loop watchdog. Do not edit this value, but if you must - do not set it too low or it will falsely trigger during mining!
#define LWD_TIMEOUT 30000
// Uncomment to disable ESP32 brownout detector if you're suffering from faulty insufficient power detection
// #define DISABLE_BROWNOUT
// Uncomment to enable WiFiManager captive portal in AP mode
// The board will create its own network you connect to and change the settings
// #define CAPTIVE_PORTAL
// -------------------------------------------------------------- //
// ------------------------ Displays ---------------------------- //
// Uncomment to enable a SSD1306 OLED screen on the I2C bus to display mining info in real time
// Default connections (can be overriden by using a different u8g2 initializer, see line 140):
// GND - GND
// VCC - 5V or 3.3V depending on display
// SCL - GPIO22 (ESP32) or GPIO5 (D2 on ESP8266) or GPIO35 (ESP32-S2)
// SDA - GPIO21 (ESP32) or GPIO4 (D1 on ESP8266) or GPIO33 (ESP32-S2)
// #define DISPLAY_SSD1306
// Uncomment to enable a 16x2 LCD screen on a direct bus to display mining info in real time
// See line 150 for connections and initializer
// #define DISPLAY_16X2
// Uncomment if your device is a Duino BlushyBox device
// #define BLUSHYBOX
// -------------------------------------------------------------- //
// ---------------------- IoT examples -------------------------- //
// https://github.com/revoxhere/duino-coin/wiki/Duino's-take-on-the-Internet-of-Things
// Uncomment the line below if you wish to use the internal temperature sensor (Duino IoT example)
// Only ESP32-S2, -S3, -H2, -C2, -C3, -C6 and some old models have one!
// More info: https://www.espboards.dev/blog/esp32-inbuilt-temperature-sensor/
// NOTE: Mining performance will decrease by about 20 kH/s!
// #define USE_INTERNAL_SENSOR
// Uncomment the line below if you wish to use a DS18B20 temperature sensor (Duino IoT example)
// NOTE: Mining performance should stay the same
// #define USE_DS18B20
// Uncomment the line below if you wish to use a DHT11/22 temperature and humidity sensor (Duino IoT example)
// NOTE: Mining performance should stay the same
// #define USE_DHT
// Uncomment the line below if you wish to use a HSU07M sensor (Duino IoT Example)
// NOTE: Untested as of right now
// #define USE_HSU07M
// -------------------------------------------------------------- //
// ---------------- Variables and definitions ------------------- //
// You generally do not need to edit stuff below this line
// unless you're know what you're doing.
#if defined(ESP8266)
// ESP8266
#define LED_BUILTIN 2
#elif defined(CONFIG_FREERTOS_UNICORE)
#if defined(CONFIG_IDF_TARGET_ESP32C3)
// ESP32-C3
#define LED_BUILTIN 8
#else
// ESP32-S2
#define LED_BUILTIN 15
#endif
#else
// ESP32
#ifndef LED_BUILTIN
#define LED_BUILTIN 2
#endif
#if defined(BLUSHYBOX)
#define LED_BUILTIN 4
#endif
#endif
#define BLINK_SETUP_COMPLETE 2
#define BLINK_CLIENT_CONNECT 5
#define SOFTWARE_VERSION "4.3"
extern unsigned int hashrate = 0;
extern unsigned int hashrate_core_two = 0;
extern unsigned int difficulty = 0;
extern unsigned long share_count = 0;
extern unsigned long accepted_share_count = 0;
extern String node_id = "";
extern String WALLET_ID = "";
extern unsigned int ping = 0;
#if defined(USE_INTERNAL_SENSOR)
#include "driver/temp_sensor.h"
#endif
#if defined(USE_DS18B20)
// Install OneWire and DallasTemperature libraries if you get an error
#include <OneWire.h>
#include <DallasTemperature.h>
// Change 12 to the pin you've connected your sensor to
const int DSPIN = 12;
OneWire oneWire(DSPIN);
DallasTemperature extern sensors(&oneWire);
#endif
#if defined(USE_DHT)
// Install "DHT sensor library" if you get an error
#include <DHT.h>
// Change 12 to the pin you've connected your sensor to
#define DHTPIN 12
// Set DHT11 or DHT22 type accordingly
#define DHTTYPE DHT11
DHT extern dht(DHTPIN, DHTTYPE);
#endif
#if defined(DISPLAY_SSD1306)
// Install "u8g2" if you get an error
#include <U8g2lib.h>
#include <Wire.h>
// Display definition from the U8G2 library. Edit if you use a different display
// For software I2C, use ..._F_SW_I2C and define the pins in the initializer
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
#endif
#if defined(DISPLAY_16X2)
#include "Wire.h"
// Install "Adafruit_LiquidCrystal" if you get an error
#include "Adafruit_LiquidCrystal.h"
// initialize the library with the numbers of the interface pins
// RS E D4 D5 D6 D7
Adafruit_LiquidCrystal lcd(1, 2, 3, 4, 5, 6);
#endif
#if defined(USE_HSU07M)
#include "Wire.h"
#define HSU07M_ADDRESS 0x4B // Change this if your sensor has a different address
float read_hsu07m() {
Wire.beginTransmission(HSU07M_ADDRESS);
Wire.write(0x00);
Wire.endTransmission();
delay(100);
Wire.requestFrom(HSU07M_ADDRESS, 2);
if(Wire.available() >= 2) {
byte tempMSB = Wire.read();
byte tempLSB = Wire.read();
int tempRaw = (tempMSB << 8) | tempLSB;
float tempC = (tempRaw / 16.0) - 40.0;
return tempC;
}
return -1.0;
}
#endif
#if defined(BLUSHYBOX)
#define GAUGE_PIN 5
#define GAUGE_MAX 190
#define GAUGE_MIN 0
#if defined(ESP8266)
#define GAUGE_MAX_HR 80000
#else
#define GAUGE_MAX_HR 200000
#endif
extern float hashrate_old = 0.0;
void gauge_set(float hashrate) {
float old = hashrate_old;
float new_val = hashrate;
if (hashrate_old == 0) {
float delta = (new_val - old) / 50;
for (int x=0; x < 50; x++) {
analogWrite(5, map(old + x*delta, 0, GAUGE_MAX_HR, GAUGE_MIN, GAUGE_MAX) + random(0, 10));
delay(20);
}
} else {
float delta = (new_val - old) / 10;
for (int x=0; x < 10; x++) {
analogWrite(5, map(old + x*delta, 0, GAUGE_MAX_HR, GAUGE_MIN, GAUGE_MAX) + random(0, 10));
delay(10);
}
}
hashrate_old = hashrate;
}
#endif
IPAddress DNS_SERVER(1, 1, 1, 1); // Cloudflare DNS server
#endif // End of SETTINGS_H