-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathESP8266_3.1_version_monitor.ino
703 lines (601 loc) · 23.7 KB
/
ESP8266_3.1_version_monitor.ino
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
//ido
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// If using software SPI (the default case):
#define OLED_MOSI 13 //D1
#define OLED_CLK 14 //D0
#define OLED_DC 2
#define OLED_CS 15
#define OLED_RESET 16
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
/*
____ __ __ ____ _ _ _____ ___ _____ ____ _ _
( _ \( )( )(_ _)( \( )( _ )___ / __)( _ )(_ _)( \( )
)(_) ))(__)( _)(_ ) ( )(_)((___)( (__ )(_)( _)(_ ) (
(____/(______)(____)(_)\_)(_____) \___)(_____)(____)(_)\_)
Official code for ESP8266 boards version 3.1
Duino-Coin Team & Community 2019-2022 © MIT Licensed
https://duinocoin.com
https://github.com/revoxhere/duino-coin
If you don't know where to start, visit official website and navigate to
the Getting Started page. Have fun mining!
*/
/* If optimizations cause problems, change them to -O0 (the default)
NOTE: For even better optimizations also edit your Crypto.h file.
On linux that file can be found in the following location:
~/.arduino15//packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/ */
#pragma GCC optimize ("-Ofast")
/* If during compilation the line below causes a
"fatal error: arduinoJson.h: No such file or directory"
message to occur; it means that you do NOT have the
ArduinoJSON library installed. To install it,
go to the below link and follow the instructions:
https://github.com/revoxhere/duino-coin/issues/832 */
#include <ArduinoJson.h>
/* If during compilation the line below causes a
"fatal error: Crypto.h: No such file or directory"
message to occur; it means that you do NOT have the
latest version of the ESP8266/Arduino Core library.
To install/upgrade it, go to the below link and
follow the instructions of the readme file:
https://github.com/esp8266/Arduino */
#include <bearssl/bearssl.h>
#include <TypeConversion.h>
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
#include <Ticker.h>
#include <ESP8266WebServer.h>
namespace {
// Change the part in brackets to your WiFi name
const char* SSID = "RIG2";
// Change the part in brackets to your WiFi password
const char* PASSWORD = "pradikaa";
// Change the part in brackets to your Duino-Coin username
const char* USERNAME = "Jeffsandy";
// Change the part in brackets if you want to set a custom miner name (use Auto to autogenerate, None for no name)
const char* RIG_IDENTIFIER = "ESP-01";
// Change the part in brackets to your mining key (if you enabled it in the wallet)
const char* MINER_KEY = "JEFF";
// Change false to true if using 160 MHz clock mode to not get the first share rejected
const bool USE_HIGHER_DIFF = true;
// Change true to false if you don't want to host the dashboard page
const bool WEB_DASHBOARD = true;
// Change false to true if you want to update hashrate in browser without reloading page
const bool WEB_HASH_UPDATER = true;
// Change true to false if you want to disable led blinking(But the LED will work in the beginning until esp connects to the pool)
const bool LED_BLINKING = true;
const String ducoUser = "Jeffsandy"; // Change this to your Duino-Coin username
const String ducoReportJsonUrl = "https://server.duinocoin.com/v2/users/" + ducoUser + "?limit=1";
const int run_in_ms = 5000;
float lastAverageHash = 0.0;
float lastTotalHash = 0.0;
/* Do not change the lines below. These lines are static and dynamic variables
that will be used by the program for counters and measurements. */
const char * DEVICE = "ESP8266";
const char * POOLPICKER_URL[] = {"https://server.duinocoin.com/getPool"};
const char * MINER_BANNER = "Official ESP8266 Miner";
const char * MINER_VER = "3.1";
unsigned int share_count = 0;
unsigned int port = 0;
unsigned int difficulty = 0;
float hashrate = 0;
String AutoRigName = "";
String host = "";
String node_id = "";
const char WEBSITE[] PROGMEM = R"=====(
<!DOCTYPE html>
<html>
<!--
Duino-Coin self-hosted dashboard
MIT licensed
Duino-Coin official 2019-2022
https://github.com/revoxhere/duino-coin
https://duinocoin.com
-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Duino-Coin @@DEVICE@@ dashboard</title>
<link rel="stylesheet" href="https://server.duinocoin.com/assets/css/mystyles.css">
<link rel="shortcut icon" href="https://github.com/revoxhere/duino-coin/blob/master/Resources/duco.png?raw=true">
<link rel="icon" type="image/png" href="https://github.com/revoxhere/duino-coin/blob/master/Resources/duco.png?raw=true">
</head>
<body>
<section class="section">
<div class="container">
<h1 class="title">
<img class="icon" src="https://github.com/revoxhere/duino-coin/blob/master/Resources/duco.png?raw=true">
@@DEVICE@@ <small>(@@ID@@)</small>
</h1>
<p class="subtitle">
Self-hosted, lightweight, official dashboard for your <strong>Duino-Coin</strong> miner
</p>
</div>
<br>
<div class="container">
<div class="columns">
<div class="column">
<div class="box">
<p class="subtitle">
Mining statistics
</p>
<div class="columns is-multiline">
<div class="column" style="min-width:15em">
<div class="title is-size-5 mb-0">
<span id="hashratex">@@HASHRATE@@</span>kH/s
</div>
<div class="heading is-size-5">
Hashrate
</div>
</div>
<div class="column" style="min-width:15em">
<div class="title is-size-5 mb-0">
@@DIFF@@
</div>
<div class="heading is-size-5">
Difficulty
</div>
</div>
<div class="column" style="min-width:15em">
<div class="title is-size-5 mb-0">
@@SHARES@@
</div>
<div class="heading is-size-5">
Shares
</div>
</div>
<div class="column" style="min-width:15em">
<div class="title is-size-5 mb-0">
@@NODE@@
</div>
<div class="heading is-size-5">
Node
</div>
</div>
</div>
</div>
</div>
<div class="column">
<div class="box">
<p class="subtitle">
Device information
</p>
<div class="columns is-multiline">
<div class="column" style="min-width:15em">
<div class="title is-size-5 mb-0">
@@DEVICE@@
</div>
<div class="heading is-size-5">
Device type
</div>
</div>
<div class="column" style="min-width:15em">
<div class="title is-size-5 mb-0">
@@ID@@
</div>
<div class="heading is-size-5">
Device ID
</div>
</div>
<div class="column" style="min-width:15em">
<div class="title is-size-5 mb-0">
@@MEMORY@@
</div>
<div class="heading is-size-5">
Free memory
</div>
</div>
<div class="column" style="min-width:15em">
<div class="title is-size-5 mb-0">
@@VERSION@@
</div>
<div class="heading is-size-5">
Miner version
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="has-text-centered">
<div class="title is-size-6 mb-0">
Hosted on
<a href="http://@@IP_ADDR@@">
http://<b>@@IP_ADDR@@</b>
</a>
•
<a href="https://duinocoin.com">
duinocoin.com
</a>
•
<a href="https://github.com/revoxhere/duino-coin">
github.com/revoxhere/duino-coin
</a>
</div>
</div>
</div>
<script>
setInterval(function(){
getData();
}, 3000);
function getData() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("hashratex").innerHTML = this.responseText;
}
};
xhttp.open("GET", "hashrateread", true);
xhttp.send();
}
</script>
</section>
</body>
</html>
)=====";
ESP8266WebServer server(80);
void hashupdater(){ //update hashrate every 3 sec in browser without reloading page
server.send(200, "text/plane", String(hashrate / 1000));
Serial.println("Update hashrate on page");
};
void UpdateHostPort(String input) {
// Thanks @ricaun for the code
DynamicJsonDocument doc(256);
deserializeJson(doc, input);
const char* name = doc["name"];
host = String((const char*)doc["ip"]);
port = int(doc["port"]);
node_id = String(name);
Serial.println("Poolpicker selected the best mining node: " + node_id);
}
String httpGetString(String URL) {
String payload = "";
WiFiClientSecure client;
client.setInsecure();
HTTPClient http;
if (http.begin(client, URL)) {
int httpCode = http.GET();
if (httpCode == HTTP_CODE_OK) payload = http.getString();
else Serial.printf("Error fetching node from poolpicker: %s\n", http.errorToString(httpCode).c_str());
http.end();
}
return payload;
}
void UpdatePool() {
String input = "";
int waitTime = 1;
int poolIndex = 0;
int poolSize = sizeof(POOLPICKER_URL) / sizeof(char*);
while (input == "") {
Serial.println("Fetching mining node from the poolpicker in " + String(waitTime) + "s");
input = httpGetString(POOLPICKER_URL[poolIndex]);
poolIndex += 1;
// Check if pool index needs to roll over
if( poolIndex >= poolSize ){
poolIndex %= poolSize;
delay(waitTime * 1000);
// Increase wait time till a maximum of 32 seconds (addresses: Limit connection requests on failure in ESP boards #1041)
waitTime *= 2;
if( waitTime > 32 )
waitTime = 32;
}
}
// Setup pool with new input
UpdateHostPort(input);
}
WiFiClient client;
String client_buffer = "";
String chipID = "";
String START_DIFF = "";
// Loop WDT... please don't feed me...
// See lwdtcb() and lwdtFeed() below
Ticker lwdTimer;
#define LWD_TIMEOUT 60000
unsigned long lwdCurrentMillis = 0;
unsigned long lwdTimeOutMillis = LWD_TIMEOUT;
#define END_TOKEN '\n'
#define SEP_TOKEN ','
#define LED_BUILTIN 2
#define BLINK_SHARE_FOUND 1
#define BLINK_SETUP_COMPLETE 2
#define BLINK_CLIENT_CONNECT 3
#define BLINK_RESET_DEVICE 5
void SetupWifi() {
Serial.println("Connecting to: " + String(SSID));
WiFi.mode(WIFI_STA); // Setup ESP in client mode
WiFi.setSleepMode(WIFI_NONE_SLEEP);
WiFi.begin(SSID, PASSWORD);
int wait_passes = 0;
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
delay(500);
Serial.print(".");
if (++wait_passes >= 10) {
WiFi.begin(SSID, PASSWORD);
wait_passes = 0;
}
}
Serial.println("\n\nnSuccessfully connected to WiFi");
Serial.println("Local IP address: " + WiFi.localIP().toString());
Serial.println("Rig name: " + String(RIG_IDENTIFIER));
Serial.println();
UpdatePool();
}
void SetupOTA() {
// Prepare OTA handler
ArduinoOTA.onStart([]() {
Serial.println("Start");
});
ArduinoOTA.onEnd([]() {
Serial.println("\nEnd");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
ArduinoOTA.setHostname(RIG_IDENTIFIER); // Give port a name not just address
ArduinoOTA.begin();
}
void blink(uint8_t count, uint8_t pin = LED_BUILTIN) {
if (LED_BLINKING){
uint8_t state = HIGH;
for (int x = 0; x < (count << 1); ++x) {
digitalWrite(pin, state ^= HIGH);
delay(50);
}
}
}
void RestartESP(String msg) {
Serial.println(msg);
Serial.println("Restarting ESP...");
blink(BLINK_RESET_DEVICE);
ESP.reset();
}
// Our new WDT to help prevent freezes
// code concept taken from https://sigmdel.ca/michel/program/esp8266/arduino/watchdogs2_en.html
void ICACHE_RAM_ATTR lwdtcb(void) {
if ((millis() - lwdCurrentMillis > LWD_TIMEOUT) || (lwdTimeOutMillis - lwdCurrentMillis != LWD_TIMEOUT))
RestartESP("Loop WDT Failed!");
}
void lwdtFeed(void) {
lwdCurrentMillis = millis();
lwdTimeOutMillis = lwdCurrentMillis + LWD_TIMEOUT;
}
void VerifyWifi() {
while (WiFi.status() != WL_CONNECTED || WiFi.localIP() == IPAddress(0, 0, 0, 0))
WiFi.reconnect();
}
void handleSystemEvents(void) {
VerifyWifi();
ArduinoOTA.handle();
yield();
}
// https://stackoverflow.com/questions/9072320/split-string-into-string-array
String getValue(String data, char separator, int index)
{
int found = 0;
int strIndex[] = {0, -1};
int max_index = data.length() - 1;
for (int i = 0; i <= max_index && found <= index; i++) {
if (data.charAt(i) == separator || i == max_index) {
found++;
strIndex[0] = strIndex[1] + 1;
strIndex[1] = (i == max_index) ? i + 1 : i;
}
}
return found > index ? data.substring(strIndex[0], strIndex[1]) : "";
}
void waitForClientData(void) {
client_buffer = "";
while (client.connected()) {
if (client.available()) {
client_buffer = client.readStringUntil(END_TOKEN);
if (client_buffer.length() == 1 && client_buffer[0] == END_TOKEN)
client_buffer = "???\n"; // NOTE: Should never happen
break;
}
handleSystemEvents();
}
}
void ConnectToServer() {
if (client.connected())
return;
Serial.println("\n\nConnecting to the Duino-Coin server...");
while (!client.connect(host, port));
waitForClientData();
Serial.println("Connected to the server. Server version: " + client_buffer );
blink(BLINK_CLIENT_CONNECT); // Sucessfull connection with the server
}
bool max_micros_elapsed(unsigned long current, unsigned long max_elapsed) {
static unsigned long _start = 0;
if ((current - _start) > max_elapsed) {
_start = current;
return true;
}
return false;
}
void dashboard() {
Serial.println("Handling HTTP client");
String s = WEBSITE;
s.replace("@@IP_ADDR@@", WiFi.localIP().toString());
s.replace("@@HASHRATE@@", String(hashrate / 1000));
s.replace("@@DIFF@@", String(difficulty / 100));
s.replace("@@SHARES@@", String(share_count));
s.replace("@@NODE@@", String(node_id));
s.replace("@@DEVICE@@", String(DEVICE));
s.replace("@@ID@@", String(RIG_IDENTIFIER));
s.replace("@@MEMORY@@", String(ESP.getFreeHeap()));
s.replace("@@VERSION@@", String(MINER_VER));
server.send(200, "text/html", s);
}
} // namespace
void setup() {
display.setCursor(0,0);
display.setTextSize(1);
Serial.begin(500000);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Address 0x3C for 128x32
display.clearDisplay(); //Pulisce il buffer da inviare al display
display.display();
display.setTextSize(2); //Imposta la grandezza del testo
display.setTextColor(SSD1306_WHITE);
display.setCursor(0,10); //Imposta la posizione del cursore (Larghezza,Altezza)
display.print("JERRY WANG");
display.display();
delay(2000);
display.setTextSize(0); //Imposta la grandezza del testo
display.display();
Serial.println("\nDuino-Coin " + String(MINER_VER));
pinMode(LED_BUILTIN, OUTPUT);
// Autogenerate ID if required
chipID = String(ESP.getChipId(), HEX);
if( strcmp(RIG_IDENTIFIER, "Auto") == 0 ){
AutoRigName = "ESP8266-" + chipID;
AutoRigName.toUpperCase();
RIG_IDENTIFIER = AutoRigName.c_str();
}
SetupWifi();
SetupOTA();
lwdtFeed();
lwdTimer.attach_ms(LWD_TIMEOUT, lwdtcb);
if (USE_HIGHER_DIFF) START_DIFF = "ESP8266H";
else START_DIFF = "ESP8266";
if(WEB_DASHBOARD) {
if (!MDNS.begin(RIG_IDENTIFIER)) {
Serial.println("mDNS unavailable");
}
MDNS.addService("http", "tcp", 80);
Serial.print("Configured mDNS for dashboard on http://"
+ String(RIG_IDENTIFIER)
+ ".local (or http://"
+ WiFi.localIP().toString()
+ ")");
server.on("/", dashboard);
if (WEB_HASH_UPDATER) server.on("/hashrateread", hashupdater);
server.begin();
}
blink(BLINK_SETUP_COMPLETE);
}
void loop() {
br_sha1_context sha1_ctx, sha1_ctx_base;
uint8_t hashArray[20];
String duco_numeric_result_str;
// 1 minute watchdog
lwdtFeed();
float totalHashrate = 0.0;
float avgHashrate = 0.0;
int total_miner = 0;
String input = httpGetString(ducoReportJsonUrl);
DynamicJsonDocument doc (10000);
DeserializationError error = deserializeJson(doc, input);
if (error) {
Serial.print("deserializeJson() failed: ");
Serial.println(error.c_str());
return;
}
JsonObject result = doc["result"];
JsonObject result_balance = result["balance"];
double result_balance_balance = result_balance["balance"];
const char *result_balance_created = result_balance["created"];
const char *result_balance_username = result_balance["username"];
const char *result_balance_verified = result_balance["verified"];
for (JsonObject result_miner : result["miners"].as<JsonArray>()) {
float result_miner_hashrate = result_miner["hashrate"];
totalHashrate = totalHashrate + result_miner_hashrate;
total_miner++;
}
avgHashrate = totalHashrate / long(total_miner);
long run_span = run_in_ms / 1000;
// OTA handlers
VerifyWifi();
ArduinoOTA.handle();
if(WEB_DASHBOARD) server.handleClient();
ConnectToServer();
Serial.println("Asking for a new job for user: " + String(USERNAME));
client.print("JOB," + String(USERNAME) + "," + String(START_DIFF) + "," + String(MINER_KEY));
waitForClientData();
String last_block_hash = getValue(client_buffer, SEP_TOKEN, 0);
String expected_hash = getValue(client_buffer, SEP_TOKEN, 1);
difficulty = getValue(client_buffer, SEP_TOKEN, 2).toInt() * 100 + 1;
int job_len = last_block_hash.length() + expected_hash.length() + String(difficulty).length();
Serial.println("Received a correct job with size of " + String(job_len) + " bytes");
Serial.println("result_balance_username : " + String(result_balance_username));
Serial.println("result_balance_balance : " + String(result_balance_balance));
Serial.println("totalHashrate : " + String(totalHashrate));
Serial.println("avgHashrate kH/s : " + String(avgHashrate));
Serial.println("total_miner : " + String(total_miner));
expected_hash.toUpperCase();
br_sha1_init(&sha1_ctx_base);
br_sha1_update(&sha1_ctx_base, last_block_hash.c_str(), last_block_hash.length());
float start_time = micros();
max_micros_elapsed(start_time, 0);
String Result = "";
digitalWrite(LED_BUILTIN, HIGH);
for (unsigned int duco_numeric_result = 0; duco_numeric_result < difficulty; duco_numeric_result++) {
// Difficulty loop
sha1_ctx = sha1_ctx_base;
duco_numeric_result_str = String(duco_numeric_result);
br_sha1_update(&sha1_ctx, duco_numeric_result_str.c_str(), duco_numeric_result_str.length());
br_sha1_out(&sha1_ctx, hashArray);
Result = experimental::TypeConversion::uint8ArrayToHexString(hashArray, 20);
if (Result == expected_hash) {
// If result is found
unsigned long elapsed_time = micros() - start_time;
float elapsed_time_s = elapsed_time * .000001f;
hashrate = duco_numeric_result / elapsed_time_s;
share_count++;
blink(BLINK_SHARE_FOUND);
client.print(String(duco_numeric_result)
+ ","
+ String(hashrate)
+ ","
+ String(MINER_BANNER)
+ " "
+ String(MINER_VER)
+ ","
+ String(RIG_IDENTIFIER)
+ ",DUCOID"
+ String(chipID));
waitForClientData();
Serial.println(client_buffer
+ " share #"
+ String(share_count)
+ " (" + String(duco_numeric_result) + ")"
+ " hashrate: "
+ String(hashrate / 1000, 2)
+ " kH/s ("
+ String(elapsed_time_s)
+ "s)");
break;
}
if (max_micros_elapsed(micros(), 500000))
{
handleSystemEvents();
}
else
{
delay(0);
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.println("User : " + String(result_balance_username));
display.println("Total Miner : " + String(total_miner));
display.println("Balance : " + String(result_balance_balance));
display.println("kH/s (" + String(run_span) + "s): " + String(totalHashrate));
display.display();
}
}
}