Fixed suffixes to large pool hash rates.

This commit is contained in:
George Alexandre Silva 2023-10-04 09:04:07 -03:00
parent 5911e0d873
commit 5b67cb4430
3 changed files with 1630 additions and 1620 deletions

View File

@ -81,6 +81,8 @@ void printPoolData(){
background.setSwapBytes(true); background.setSwapBytes(true);
if (bottomScreenBlue) { if (bottomScreenBlue) {
background.pushImage(0, 0, 320, 70, bottonPoolScreen); background.pushImage(0, 0, 320, 70, bottonPoolScreen);
//background.fillRect(295,43,25,10,TFT_CYAN);
} else { } else {
background.pushImage(0, 0, 320, 70, bottonPoolScreen_g); background.pushImage(0, 0, 320, 70, bottonPoolScreen_g);
} }
@ -89,12 +91,12 @@ void printPoolData(){
render.setLineSpaceRatio(1); render.setLineSpaceRatio(1);
render.setFontSize(24); render.setFontSize(24);
render.cdrawString(String(pData.workersCount).c_str(), 160, 35, TFT_BLACK); render.cdrawString(String(pData.workersCount).c_str(), 155, 35, TFT_BLACK);
render.setFontSize(18); render.setFontSize(18);
render.setAlignment(Align::BottomRight); render.setAlignment(Align::BottomRight);
render.drawString(pData.workersHash.c_str(), 293, 51, TFT_BLACK); render.cdrawString(pData.workersHash.c_str(), 265, 34, TFT_BLACK);
render.setAlignment(Align::TopLeft); render.setAlignment(Align::BottomLeft);
render.cdrawString(pData.bestDifficulty.c_str(), 50, 34, TFT_BLACK); render.cdrawString(pData.bestDifficulty.c_str(), 54, 34, TFT_BLACK);
background.pushSprite(0,170); background.pushSprite(0,170);
background.deleteSprite(); background.deleteSprite();
@ -128,11 +130,15 @@ void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
//Print background screen //Print background screen
background.pushImage(-190, 0, MinerWidth, MinerHeight, MinerScreen); background.pushImage(-190, 0, MinerWidth, MinerHeight, MinerScreen);
// Total hashes // Total hashes
render.setFontSize(18); render.setFontSize(18);
render.rdrawString(data.totalMHashes.c_str(), 268-wdtOffset, 138, TFT_BLACK); render.rdrawString(data.totalMHashes.c_str(), 268-wdtOffset, 138, TFT_BLACK);
// Block templates // Block templates
render.setFontSize(18); render.setFontSize(18);
render.setAlignment(Align::TopLeft);
render.drawString(data.templates.c_str(), 189-wdtOffset, 20, 0xDEDB); render.drawString(data.templates.c_str(), 189-wdtOffset, 20, 0xDEDB);
// Best diff // Best diff
render.drawString(data.bestDiff.c_str(), 189-wdtOffset, 48, 0xDEDB); render.drawString(data.bestDiff.c_str(), 189-wdtOffset, 48, 0xDEDB);
@ -145,7 +151,8 @@ void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
// Valid Blocks // Valid Blocks
render.setFontSize(24); render.setFontSize(24);
render.drawString(data.valids.c_str(), 285-wdtOffset, 56, 0xDEDB); render.setAlignment(Align::TopCenter);
render.drawString(data.valids.c_str(), 290-wdtOffset, 56, 0xDEDB);
// Print Temp // Print Temp
render.setFontSize(10); render.setFontSize(10);
@ -383,7 +390,7 @@ void esp32_2432S028R_DoLedStuff(unsigned long frame)
{ {
int16_t t_x , t_y; // To store the touch coordinates int16_t t_x , t_y; // To store the touch coordinates
bool pressed = touch.getXY(t_x, t_y); bool pressed = touch.getXY(t_x, t_y);
if (pressed) { if (pressed) {
if (((t_x > 109)&&(t_x < 211)) && ((t_y > 185)&&(t_y < 241))) bottomScreenBlue ^= true; if (((t_x > 109)&&(t_x < 211)) && ((t_y > 185)&&(t_y < 241))) bottomScreenBlue ^= true;
else else
if (t_x > 160) { if (t_x > 160) {

File diff suppressed because it is too large Load Diff

View File

@ -316,12 +316,15 @@ pool_data getPoolData(void){
const JsonArray& workers = doc["workers"].as<JsonArray>(); const JsonArray& workers = doc["workers"].as<JsonArray>();
float totalhashs = 0; float totalhashs = 0;
for (const JsonObject& worker : workers) { for (const JsonObject& worker : workers) {
totalhashs += worker["hashRate"].as<int>(); totalhashs += worker["hashRate"].as<double>();
/* Serial.print(worker["sessionId"].as<String>()+": "); /* Serial.print(worker["sessionId"].as<String>()+": ");
Serial.print(" - "+worker["hashRate"].as<String>()+": "); Serial.print(" - "+worker["hashRate"].as<String>()+": ");
Serial.println(totalhashs); */ Serial.println(totalhashs); */
} }
pData.workersHash = String(totalhashs/1000); char totalhashs_s[16] = {0};
suffix_string(totalhashs, totalhashs_s, 16, 0);
pData.workersHash = String(totalhashs_s);
double temp; double temp;
if (doc.containsKey("bestDifficulty")) { if (doc.containsKey("bestDifficulty")) {
temp = doc["bestDifficulty"].as<double>(); temp = doc["bestDifficulty"].as<double>();