Merge pull request #266 from skot/master

update overheat branch
This commit is contained in:
WantClue 2024-08-01 23:00:41 +02:00 committed by GitHub
commit f3a344f2a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 57 additions and 24 deletions

View File

@ -166,7 +166,7 @@ void BM1366_send_hash_frequency(float target_freq)
if (fb_divider == 0) {
puts("Finding dividers failed, using default value (200Mhz)");
} else {
newf = 25.0 / (float) (ref_divider * fb_divider) / (float) (post_divider1 * post_divider2);
newf = 25.0 * (float) (fb_divider) / (float) (ref_divider * post_divider1 * post_divider2);
printf("final refdiv: %d, fbdiv: %d, postdiv1: %d, postdiv2: %d, min diff value: %f\n", ref_divider, fb_divider,
post_divider1, post_divider2, min_difference);

View File

@ -166,7 +166,7 @@ void BM1368_send_hash_frequency(float target_freq)
if (fb_divider == 0) {
puts("Finding dividers failed, using default value (200Mhz)");
} else {
newf = 25.0 / (float) (ref_divider * fb_divider) / (float) (post_divider1 * post_divider2);
newf = 25.0 * (float) (fb_divider) / (float) (ref_divider * post_divider1 * post_divider2);
printf("final refdiv: %d, fbdiv: %d, postdiv1: %d, postdiv2: %d, min diff value: %f\n", ref_divider, fb_divider,
post_divider1, post_divider2, min_difference);

View File

@ -19,7 +19,8 @@ typedef enum
STRATUM_RESULT,
STRATUM_RESULT_SETUP,
STRATUM_RESULT_VERSION_MASK,
STRATUM_RESULT_SUBSCRIBE
STRATUM_RESULT_SUBSCRIBE,
CLIENT_RECONNECT
} stratum_method;
static const int STRATUM_ID_SUBSCRIBE = 1;
@ -60,6 +61,8 @@ typedef struct
bool response_success;
} StratumApiV1Message;
void STRATUM_V1_reset_uid();
void STRATUM_V1_initialize_buffer();
char *STRATUM_V1_receive_jsonrpc_line(int sockfd);

View File

@ -26,6 +26,13 @@ static int send_uid = 1;
static void debug_stratum_tx(const char *);
int _parse_stratum_subscribe_result_message(const char * result_json_str, char ** extranonce, int * extranonce2_len);
void STRATUM_V1_reset_uid()
{
ESP_LOGI(TAG, "Resetting stratum uid");
send_uid = 1;
}
void STRATUM_V1_initialize_buffer()
{
json_rpc_buffer = malloc(BUFFER_SIZE);
@ -128,6 +135,8 @@ void STRATUM_V1_parse(StratumApiV1Message * message, const char * stratum_json)
result = MINING_SET_DIFFICULTY;
} else if (strcmp("mining.set_version_mask", method_json->valuestring) == 0) {
result = MINING_SET_VERSION_MASK;
} else if (strcmp("client.reconnect", method_json->valuestring) == 0) {
result = CLIENT_RECONNECT;
} else {
ESP_LOGI(TAG, "unhandled method in stratum message: %s", stratum_json);
}

View File

@ -121,7 +121,7 @@
<div class="card">
<h5>Heat</h5>
<div class="grid text-center">
<div class="col-4">
<div class="col-6">
<p-knob [min]="20" [max]="75" [readonly]="true" [(ngModel)]="info.temp"
valueTemplate="{value}C"></p-knob>
ASIC Temperature
@ -139,12 +139,12 @@
Danger:
High Temperature</span>
</div>
<div class="col-4">
<div class="col-6">
<p-knob [min]="0" [max]="100" [readonly]="true" [(ngModel)]="info.fanspeed"
valueTemplate="{value}%"></p-knob>
Fan %
</div>
<div class="col-4">
<div class="col-6">
<p-knob [min]="0" [max]="20000" [readonly]="true" [(ngModel)]="info.fanrpm"
valueTemplate="{value}"></p-knob>
Fan RPM
@ -191,26 +191,27 @@
<div class=" col-12 lg:col-6">
<div class="col-12 lg:col-6">
<div class="card">
<h5>Pool Information</h5>
<table *ngIf="info$ | async as info; else loading">
<tr *ngIf="quickLink$ | async as quickLink">
<td>Quick Link:</td>
<td><a style="color: white; text-decoration: underline;" [href]="quickLink"
target="_blank">{{quickLink}}</a></td>
<td style="word-break: break-all;">
<a style="color: white; text-decoration: underline;" [href]="quickLink" target="_blank">{{quickLink}}</a>
</td>
</tr>
<tr>
<td>URL:</td>
<td>{{info.stratumURL}}</td>
<td style="word-break: break-all;">{{info.stratumURL}}</td>
</tr>
<tr>
<td>Port:</td>
<td>{{info.stratumPort}}</td>
<td style="word-break: break-all;">{{info.stratumPort}}</td>
</tr>
<tr>
<td>User:</td>
<td>{{info.stratumUser}}</td>
<td style="word-break: break-all;">{{info.stratumUser}}</td>
</tr>
</table>

View File

@ -144,6 +144,12 @@ export class HomeComponent {
} else if (info.stratumURL.includes('ocean.xyz')) {
const address = info.stratumUser.split('.')[0]
return `https://ocean.xyz/stats/${address}`;
} else if (info.stratumURL.includes('solo.d-central.tech')) {
const address = info.stratumUser.split('.')[0]
return `https://solo.d-central.tech/#/app/${address}`;
} else if (info.stratumURL.includes('solo.ckpool.org')) {
const address = info.stratumUser.split('.')[0]
return `https://solostats.ckpool.org/stats/${address}`;
} else {
return undefined;
}

View File

@ -2,6 +2,7 @@
#define ASIC_TASK_H_
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "mining.h"
typedef struct
{
@ -15,4 +16,4 @@ typedef struct
void ASIC_task(void *pvParameters);
#endif
#endif

View File

@ -53,6 +53,19 @@ bool is_wifi_connected() {
}
}
void cleanQueue(GlobalState * GLOBAL_STATE) {
ESP_LOGI(TAG, "Clean Jobs: clearing queue");
GLOBAL_STATE->abandon_work = 1;
queue_clear(&GLOBAL_STATE->stratum_queue);
pthread_mutex_lock(&GLOBAL_STATE->valid_jobs_lock);
ASIC_jobs_queue_clear(&GLOBAL_STATE->ASIC_jobs_queue);
for (int i = 0; i < 128; i = i + 4) {
GLOBAL_STATE->valid_jobs[i] = 0;
}
pthread_mutex_unlock(&GLOBAL_STATE->valid_jobs_lock);
}
void stratum_task(void * pvParameters)
{
GlobalState * GLOBAL_STATE = (GlobalState *) pvParameters;
@ -136,6 +149,9 @@ void stratum_task(void * pvParameters)
continue;
}
STRATUM_V1_reset_uid();
cleanQueue(GLOBAL_STATE);
///// Start Stratum Action
// mining.subscribe - ID: 1
STRATUM_V1_subscribe(GLOBAL_STATE->sock, GLOBAL_STATE->asic_model_str);
@ -171,16 +187,7 @@ void stratum_task(void * pvParameters)
SYSTEM_notify_new_ntime(GLOBAL_STATE, stratum_api_v1_message.mining_notification->ntime);
if (stratum_api_v1_message.should_abandon_work &&
(GLOBAL_STATE->stratum_queue.count > 0 || GLOBAL_STATE->ASIC_jobs_queue.count > 0)) {
ESP_LOGI(TAG, "Clean Jobs: clearing queue");
GLOBAL_STATE->abandon_work = 1;
queue_clear(&GLOBAL_STATE->stratum_queue);
pthread_mutex_lock(&GLOBAL_STATE->valid_jobs_lock);
ASIC_jobs_queue_clear(&GLOBAL_STATE->ASIC_jobs_queue);
for (int i = 0; i < 128; i = i + 4) {
GLOBAL_STATE->valid_jobs[i] = 0;
}
pthread_mutex_unlock(&GLOBAL_STATE->valid_jobs_lock);
cleanQueue(GLOBAL_STATE);
}
if (GLOBAL_STATE->stratum_queue.count == QUEUE_SIZE) {
mining_notify * next_notify_json_str = (mining_notify *) queue_dequeue(&GLOBAL_STATE->stratum_queue);
@ -202,12 +209,18 @@ void stratum_task(void * pvParameters)
} else if (stratum_api_v1_message.method == STRATUM_RESULT_SUBSCRIBE) {
GLOBAL_STATE->extranonce_str = stratum_api_v1_message.extranonce_str;
GLOBAL_STATE->extranonce_2_len = stratum_api_v1_message.extranonce_2_len;
} else if (stratum_api_v1_message.method == CLIENT_RECONNECT) {
ESP_LOGE(TAG, "Pool requested client reconnect...");
shutdown(GLOBAL_STATE->sock, SHUT_RDWR);
close(GLOBAL_STATE->sock);
vTaskDelay(1000 / portTICK_PERIOD_MS); // Delay before attempting to reconnect
break;
} else if (stratum_api_v1_message.method == STRATUM_RESULT) {
if (stratum_api_v1_message.response_success) {
ESP_LOGI(TAG, "message result accepted");
SYSTEM_notify_accepted_share(GLOBAL_STATE);
} else {
ESP_LOGE(TAG, "message result rejected");
ESP_LOGW(TAG, "message result rejected");
SYSTEM_notify_rejected_share(GLOBAL_STATE);
}
} else if (stratum_api_v1_message.method == STRATUM_RESULT_SETUP) {