Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed fan speed web update #141 #222

Merged
merged 14 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ <h5>Power</h5>
<div class="card">
<h5>Heat</h5>
<div class="grid text-center">
<div class="col-6">
<div class="col-4">
<p-knob [min]="20" [max]="75" [readonly]="true" [(ngModel)]="info.temp"
valueTemplate="{value}C"></p-knob>
ASIC Temperature
Expand All @@ -142,8 +142,14 @@ <h5>Heat</h5>
<div class="col-4">
<p-knob [min]="0" [max]="100" [readonly]="true" [(ngModel)]="info.fanspeed"
valueTemplate="{value}%"></p-knob>
Fan
Fan %
</div>
<div class="col-4">
<p-knob [min]="0" [max]="20000" [readonly]="true" [(ngModel)]="info.fanrpm"
valueTemplate="{value}"></p-knob>
Fan RPM
</div>
<!--
<div class="col-6" *ngIf="info.boardtemp1">
<p-knob [min]="20" [max]="75" [readonly]="true" [(ngModel)]="info.boardtemp1"
valueTemplate="{value}C"></p-knob>
Expand All @@ -154,6 +160,7 @@ <h5>Heat</h5>
valueTemplate="{value}C"></p-knob>
Board Temp 2
</div>
-->
</div>
</div>
</div>
Expand Down Expand Up @@ -214,4 +221,4 @@ <h5>Pool Information</h5>
</div>


</ng-container>
</ng-container>
2 changes: 1 addition & 1 deletion main/http_server/axe-os/src/app/services/system.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export class SystemService {
power: 11.670000076293945,
voltage: 5208.75,
current: 2237.5,
fanSpeed: 82,
temp: 60,
vrTemp: 45,
hashRate: 475,
Expand Down Expand Up @@ -54,6 +53,7 @@ export class SystemService {
invertfanpolarity: 1,
autofanspeed: 1,
fanspeed: 100,
fanrpm: 0,

boardtemp1: 30,
boardtemp2: 40
Expand Down
4 changes: 2 additions & 2 deletions main/http_server/axe-os/src/models/ISystemInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export interface ISystemInfo {
power: number,
voltage: number,
current: number,
fanSpeed: number,
temp: number,
vrTemp: number,
hashRate: number,
Expand All @@ -33,8 +32,9 @@ export interface ISystemInfo {
invertfanpolarity: number,
autofanspeed: number,
fanspeed: number,
fanrpm: number,
coreVoltageActual: number,

boardtemp1?: number,
boardtemp2?: number
}
}
5 changes: 3 additions & 2 deletions main/http_server/http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ static esp_err_t GET_system_info(httpd_req_t * req)
cJSON_AddNumberToObject(root, "power", GLOBAL_STATE->POWER_MANAGEMENT_MODULE.power);
cJSON_AddNumberToObject(root, "voltage", GLOBAL_STATE->POWER_MANAGEMENT_MODULE.voltage);
cJSON_AddNumberToObject(root, "current", GLOBAL_STATE->POWER_MANAGEMENT_MODULE.current);
cJSON_AddNumberToObject(root, "fanSpeedRpm", GLOBAL_STATE->POWER_MANAGEMENT_MODULE.fan_speed);
cJSON_AddNumberToObject(root, "temp", GLOBAL_STATE->POWER_MANAGEMENT_MODULE.chip_temp_avg);
cJSON_AddNumberToObject(root, "vrTemp", GLOBAL_STATE->POWER_MANAGEMENT_MODULE.vr_temp);
cJSON_AddNumberToObject(root, "hashRate", GLOBAL_STATE->SYSTEM_MODULE.current_hashrate);
Expand Down Expand Up @@ -417,7 +416,9 @@ static esp_err_t GET_system_info(httpd_req_t * req)

cJSON_AddNumberToObject(root, "invertfanpolarity", nvs_config_get_u16(NVS_CONFIG_INVERT_FAN_POLARITY, 1));
cJSON_AddNumberToObject(root, "autofanspeed", nvs_config_get_u16(NVS_CONFIG_AUTO_FAN_SPEED, 1));
cJSON_AddNumberToObject(root, "fanspeed", GLOBAL_STATE->POWER_MANAGEMENT_MODULE.fan_percentage);

cJSON_AddNumberToObject(root, "fanspeed", GLOBAL_STATE->POWER_MANAGEMENT_MODULE.fan_perc);
cJSON_AddNumberToObject(root, "fanrpm", GLOBAL_STATE->POWER_MANAGEMENT_MODULE.fan_rpm);

free(ssid);
free(hostname);
Expand Down
2 changes: 1 addition & 1 deletion main/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ static void _update_system_info(GlobalState * GLOBAL_STATE)
if (OLED_status()) {

memset(module->oled_buf, 0, 20);
snprintf(module->oled_buf, 20, " Fan: %d RPM", power_management->fan_speed);
snprintf(module->oled_buf, 20, " Fan: %d RPM", power_management->fan_rpm);
OLED_writeString(0, 0, module->oled_buf);

memset(module->oled_buf, 0, 20);
Expand Down
19 changes: 14 additions & 5 deletions main/tasks/power_management_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ static double automatic_fan_speed(float chip_temp, GlobalState * GLOBAL_STATE)
case DEVICE_MAX:
case DEVICE_ULTRA:
case DEVICE_SUPRA:
EMC2101_set_fan_speed((float) result / 100);
float perc = (float) result / 100;
GLOBAL_STATE->POWER_MANAGEMENT_MODULE.fan_perc = perc;
EMC2101_set_fan_speed( perc );
break;
default:
}
Expand Down Expand Up @@ -133,7 +135,9 @@ void POWER_MANAGEMENT_task(void * pvParameters)
power_management->current = INA260_read_current();
power_management->power = INA260_read_power() / 1000;
}
power_management->fan_speed = EMC2101_get_fan_speed();

power_management->fan_rpm = EMC2101_get_fan_speed();

break;
default:
}
Expand Down Expand Up @@ -204,14 +208,19 @@ void POWER_MANAGEMENT_task(void * pvParameters)
}

if (auto_fan_speed == 1) {
power_management->fan_percentage = (float)automatic_fan_speed(power_management->chip_temp_avg, GLOBAL_STATE);

power_management->fan_perc = (float)automatic_fan_speed(power_management->chip_temp_avg, GLOBAL_STATE);

} else {
switch (GLOBAL_STATE->device_model) {
case DEVICE_MAX:
case DEVICE_ULTRA:
case DEVICE_SUPRA:
EMC2101_set_fan_speed((float) nvs_config_get_u16(NVS_CONFIG_FAN_SPEED, 100) / 100);
power_management->fan_percentage = (float)nvs_config_get_u16(NVS_CONFIG_FAN_SPEED, 100);

float fs = (float) nvs_config_get_u16(NVS_CONFIG_FAN_SPEED, 100);
power_management->fan_perc = fs;
EMC2101_set_fan_speed((float) fs / 100);

break;
default:
}
Expand Down
6 changes: 3 additions & 3 deletions main/tasks/power_management_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

typedef struct
{
uint16_t fan_speed;
float fan_percentage;
uint16_t fan_perc;
uint16_t fan_rpm;
float chip_temp[6];
float chip_temp_avg;
float vr_temp;
Expand All @@ -19,4 +19,4 @@ typedef struct

void POWER_MANAGEMENT_task(void * pvParameters);

#endif
#endif
Loading