Add best diff to miner screen

This commit is contained in:
Stefan Berger 2023-07-24 21:33:15 +02:00
parent c0af3f03b1
commit faa77bfd39
2 changed files with 16 additions and 7 deletions

View File

@ -18,10 +18,12 @@ unsigned long Mhashes = 0;
unsigned long totalKHashes = 0;
unsigned long elapsedKHs = 0;
unsigned long halfshares; // increase if blockhash has 16 bits of zeroes
unsigned int shares; // increase if blockhash has 32 bits of zeroes
unsigned int valids; // increased if blockhash <= target
// Track best diff
double best_diff = 0.0;
// Variables to hold data from custom textboxes
extern char poolString[80];
extern int portNumber;
@ -301,14 +303,18 @@ void runMiner(void * task_id) {
nonce += 2;
continue;
}
halfshares++;
//Check target to submit
//Difficulty of 1 > 0x00000000FFFF0000000000000000000000000000000000000000000000000000
//NM2 pool diff 1e-9 > Target = diff_1 / diff_pool > 0x00003B9ACA00....00
//Swapping diff bytes little endian >>>>>>>>>>>>>>>> 0x0000DC59D300....00
//if((hash[29] <= 0xDC) && (hash[28] <= 0x59)) //0x00003B9ACA00 > diff value for 1e-9
double diff_hash = diff_from_target(hash);
// update best diff
if (diff_hash > best_diff)
best_diff = diff_hash;
if(diff_hash > mMiner.poolDifficulty)//(hash[29] <= 0x3B)//(diff_hash > 1e-9)
{
tx_mining_submit(client, mWorker, mJob, nonce);

View File

@ -19,9 +19,10 @@ extern unsigned long Mhashes;
extern unsigned long totalKHashes;
extern unsigned long elapsedKHs;
extern unsigned long halfshares; // increase if blockhash has 16 bits of zeroes
extern unsigned int shares; // increase if blockhash has 32 bits of zeroes
extern unsigned int valids; // increased if blockhash <= targethalfshares
extern unsigned int valids; // increased if blockhash <= target
extern double best_diff; // track best diff
extern OpenFontRender render;
extern TFT_eSprite background;
@ -243,9 +244,11 @@ void show_MinerScreen(unsigned long mElapsed){
//Block templates
render.setFontSize(36);
render.drawString(String(templates).c_str(), 186, 20, 0xDEDB);
//16Bit shares
//Best diff
char best_diff_string[8] = {0};
sprintf(best_diff_string, "%.4f", best_diff);
render.setFontSize(36);
render.drawString(String(halfshares).c_str(), 186, 48, 0xDEDB);
render.drawString(String(best_diff_string).c_str(), 186, 48, 0xDEDB);
//32Bit shares
render.setFontSize(36);
render.drawString(String(shares).c_str(), 186, 76, 0xDEDB);