accept/reject share count

This commit is contained in:
Ben 2023-06-05 13:17:20 -04:00 committed by johnny9
parent b1651ed97c
commit 20eb6ab92e
3 changed files with 15 additions and 6 deletions

View File

@ -170,7 +170,7 @@ static void ASIC_task(void * pvParameters)
//print_hex((uint8_t *)&job, sizeof(struct job_packet), sizeof(struct job_packet), "job: ");
submit_share(sock, STRATUM_USER, active_jobs[nonce.job_id]->jobid, active_jobs[nonce.job_id]->ntime,
active_jobs[nonce.job_id]->extranonce2, nonce.nonce);
notify_system_submitted_share();
}
}
}
@ -343,8 +343,10 @@ static void stratum_task(void * pvParameters)
int16_t parsed_id;
if (parse_stratum_result_message(line, &parsed_id)) {
ESP_LOGI(TAG, "message id %d result accepted", parsed_id);
notify_system_accepted_share();
} else {
ESP_LOGI(TAG, "message id %d result rejected", parsed_id);
notify_system_rejected_share();
}
} else {
free(line);

View File

@ -23,7 +23,8 @@ static const char *TAG = "system";
static char oled_buf[20];
static int screen_page = 0;
static int shares_submitted = 0;
static uint16_t shares_accepted = 0;
static uint16_t shares_rejected = 0;
static time_t start_time;
static double duration_start = 0;
@ -65,14 +66,19 @@ void update_shares(void){
}
OLED_clearLine(2);
memset(oled_buf, 0, 20);
snprintf(oled_buf, 20, "Shares: %i", shares_submitted);
snprintf(oled_buf, 20, "A/R: %u/%u", shares_accepted, shares_rejected);
OLED_writeString(0, 2, oled_buf);
}
void notify_system_submitted_share(void){
shares_submitted++;
void notify_system_accepted_share(void){
shares_accepted++;
update_shares();
}
void notify_system_rejected_share(void){
shares_rejected++;
update_shares();
}

View File

@ -4,7 +4,8 @@
void system_task(void *arg);
void init_system(void);
void get_stats(void);
void notify_system_submitted_share(void);
void notify_system_accepted_share(void);
void notify_system_rejected_share(void);
void notify_system_found_nonce(double nonce_diff);