Merge pull request #68 from alcar21/feature/add_pool_url_and_days_to_screen

added pool url and days, hours:minutes:seconds to main screen.
This commit is contained in:
BitMaker 2023-06-27 13:18:20 +02:00 committed by GitHub
commit 864b54cc18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@
#include "utils.h" #include "utils.h"
#include "monitor.h" #include "monitor.h"
extern char poolString[80];
extern unsigned long templates; extern unsigned long templates;
extern unsigned long hashes; extern unsigned long hashes;
extern unsigned long Mhashes; extern unsigned long Mhashes;
@ -247,18 +248,21 @@ void show_MinerScreen(unsigned long mElapsed){
render.setFontSize(36); render.setFontSize(36);
render.drawString(String(shares).c_str(), 186, 76, 0xDEDB); render.drawString(String(shares).c_str(), 186, 76, 0xDEDB);
//Hores //Hores
unsigned long secElapsed=millis()/1000; char timeMining[15];
int hr = secElapsed/3600; //Number of seconds in an hour unsigned long secElapsed = millis() / 1000;
int mins = (secElapsed-(hr*3600))/60; //Remove the number of hours and calculate the minutes. int days = secElapsed / 86400;
int sec = secElapsed-(hr*3600)-(mins*60); int hours = (secElapsed - (days * 86400)) / 3600; //Number of seconds in an hour
render.setFontSize(36); int mins = (secElapsed - (days * 86400) - (hours * 3600)) / 60; //Remove the number of hours and calculate the minutes.
render.rdrawString(String(hr).c_str(), 208, 99, 0xDEDB); int secs = secElapsed - (days * 86400) - (hours * 3600) - (mins * 60);
sprintf(timeMining, "%01d,%02d:%02d:%02d", days, hours, mins, secs);
render.setFontSize(33);
render.rdrawString(String(timeMining).c_str(), 315, 102, 0xDEDB);
//Minutss //Minutss
render.setFontSize(36); //render.setFontSize(36);
render.rdrawString(String(mins).c_str(), 253, 99, 0xDEDB); //render.rdrawString(String(mins).c_str(), 253, 99, 0xDEDB);
//Segons //Segons
render.setFontSize(36); //render.setFontSize(36);
render.rdrawString(String(sec).c_str(), 298, 99, 0xDEDB); //render.rdrawString(String(sec).c_str(), 298, 99, 0xDEDB);
//Valid Blocks //Valid Blocks
render.setFontSize(48); render.setFontSize(48);
render.drawString(String(valids).c_str(), 285, 56, 0xDEDB); render.drawString(String(valids).c_str(), 285, 56, 0xDEDB);
@ -275,6 +279,12 @@ void show_MinerScreen(unsigned long mElapsed){
render.setFontSize(20); render.setFontSize(20);
render.rdrawString(getTime().c_str(), 286, 1, TFT_BLACK); render.rdrawString(getTime().c_str(), 286, 1, TFT_BLACK);
// pool url
background.setTextSize(1);
background.setTextDatum(MC_DATUM);
background.setTextColor(0xDEDB);
background.drawString(String(poolString), 59, 85, FONT2);
//Push prepared background to screen //Push prepared background to screen
background.pushSprite(0,0); background.pushSprite(0,0);
} }