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);
if (bottomScreenBlue) {
background.pushImage(0, 0, 320, 70, bottonPoolScreen);
//background.fillRect(295,43,25,10,TFT_CYAN);
} else {
background.pushImage(0, 0, 320, 70, bottonPoolScreen_g);
}
@ -89,12 +91,12 @@ void printPoolData(){
render.setLineSpaceRatio(1);
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.setAlignment(Align::BottomRight);
render.drawString(pData.workersHash.c_str(), 293, 51, TFT_BLACK);
render.setAlignment(Align::TopLeft);
render.cdrawString(pData.bestDifficulty.c_str(), 50, 34, TFT_BLACK);
render.cdrawString(pData.workersHash.c_str(), 265, 34, TFT_BLACK);
render.setAlignment(Align::BottomLeft);
render.cdrawString(pData.bestDifficulty.c_str(), 54, 34, TFT_BLACK);
background.pushSprite(0,170);
background.deleteSprite();
@ -128,11 +130,15 @@ void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
//Print background screen
background.pushImage(-190, 0, MinerWidth, MinerHeight, MinerScreen);
// Total hashes
render.setFontSize(18);
render.rdrawString(data.totalMHashes.c_str(), 268-wdtOffset, 138, TFT_BLACK);
// Block templates
render.setFontSize(18);
render.setAlignment(Align::TopLeft);
render.drawString(data.templates.c_str(), 189-wdtOffset, 20, 0xDEDB);
// Best diff
render.drawString(data.bestDiff.c_str(), 189-wdtOffset, 48, 0xDEDB);
@ -145,7 +151,8 @@ void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
// Valid Blocks
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
render.setFontSize(10);

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>();
float totalhashs = 0;
for (const JsonObject& worker : workers) {
totalhashs += worker["hashRate"].as<int>();
totalhashs += worker["hashRate"].as<double>();
/* Serial.print(worker["sessionId"].as<String>()+": ");
Serial.print(" - "+worker["hashRate"].as<String>()+": ");
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;
if (doc.containsKey("bestDifficulty")) {
temp = doc["bestDifficulty"].as<double>();