fan speed failsafe for bm1366

This commit is contained in:
Ben 2023-08-26 14:23:18 -04:00
parent 79430f6d3a
commit 8222b913a3

View File

@ -9,6 +9,7 @@
#include "INA260.h"
#include "math.h"
#include "serial.h"
#include "DS4432U.h"
#define POLL_RATE 5000
#define MAX_TEMP 90.0
@ -46,7 +47,7 @@ void POWER_MANAGEMENT_task(void *pvParameters)
power_management->voltage = INA260_read_voltage();
power_management->power = INA260_read_power() / 1000;
power_management->current = INA260_read_current();
power_management->fan_speed = EMC2101_get_fan_speed();
power_management->fan_speed = EMC2101_get_fan_speed() * 60;
if (strcmp(ASIC_MODEL, "BM1397") == 0)
{
@ -117,6 +118,14 @@ void POWER_MANAGEMENT_task(void *pvParameters)
}
}
}
else if (strcmp(ASIC_MODEL, "BM1366") == 0)
{
if (power_management->fan_speed < 1000)
{
ESP_LOGE(TAG, "Detected fan speed too slow, setting vCore to 0");
DS4432U_set_vcore(0);
}
}
// ESP_LOGI(TAG, "target %f, Freq %f, Volt %f, Power %f", target_frequency, power_management->frequency_value, power_management->voltage, power_management->power);
vTaskDelay(POLL_RATE / portTICK_PERIOD_MS);