Commit a98dc5b9 authored by Alén Arias Vázquez's avatar Alén Arias Vázquez 😎

- main.c: change type to float

- main.c: equalize when error linear value to 0xFFFF
parent 972b05bc
Pipeline #4875 passed with stage
in 1 minute and 16 seconds
...@@ -53,12 +53,12 @@ static uint16_t fan_ramp_up_count __xMR = 0; ...@@ -53,12 +53,12 @@ static uint16_t fan_ramp_up_count __xMR = 0;
#endif #endif
/* MAX Speed Datasheet: 3600.0 */ /* MAX Speed Datasheet: 3600.0 */
#define FAN_MAX_RPMS 1500.0 #define FAN_MAX_RPMS 1500.0f
#define FAN_MAX_FAIL_CNT 100 #define FAN_MAX_FAIL_CNT 100
#define FAN_DEAD_WORD 0xFFFF #define FAN_DEAD_WORD 0xFFFF
static volatile uint16_t tacho_cnt[3] __xMR; static volatile uint16_t tacho_cnt[3] __xMR;
static volatile uint16_t tacho_rpm[3] __xMR; static volatile float tacho_rpm[3] __xMR;
static volatile uint16_t tacho_rpm_prev[3] __xMR; static volatile float tacho_rpm_prev[3] __xMR;
static volatile uint16_t tacho_rpm_fail_cnt[3] __xMR; static volatile uint16_t tacho_rpm_fail_cnt[3] __xMR;
// when fan_cmdrpm is 0, setfrpms and temp_curve_points_y represent // when fan_cmdrpm is 0, setfrpms and temp_curve_points_y represent
...@@ -247,7 +247,7 @@ void __xMR update_rpm() ...@@ -247,7 +247,7 @@ void __xMR update_rpm()
} else { } else {
tacho_rpm_fail_cnt[0]++; tacho_rpm_fail_cnt[0]++;
if (tacho_rpm_fail_cnt[0] >= FAN_MAX_FAIL_CNT) { if (tacho_rpm_fail_cnt[0] >= FAN_MAX_FAIL_CNT) {
frpms_lin[0] = float_to_linear(FAN_DEAD_WORD); frpms_lin[0] = FAN_DEAD_WORD;
} else { } else {
frpms_lin[0] = float_to_linear(tacho_rpm_prev[0]); frpms_lin[0] = float_to_linear(tacho_rpm_prev[0]);
} }
...@@ -270,7 +270,7 @@ void __xMR update_rpm() ...@@ -270,7 +270,7 @@ void __xMR update_rpm()
} else { } else {
tacho_rpm_fail_cnt[1]++; tacho_rpm_fail_cnt[1]++;
if (tacho_rpm_fail_cnt[1] >= FAN_MAX_FAIL_CNT) { if (tacho_rpm_fail_cnt[1] >= FAN_MAX_FAIL_CNT) {
frpms_lin[1] = float_to_linear(FAN_DEAD_WORD); frpms_lin[1] = FAN_DEAD_WORD;
} else { } else {
frpms_lin[1] = float_to_linear(tacho_rpm_prev[1]); frpms_lin[1] = float_to_linear(tacho_rpm_prev[1]);
} }
...@@ -293,7 +293,7 @@ void __xMR update_rpm() ...@@ -293,7 +293,7 @@ void __xMR update_rpm()
} else { } else {
tacho_rpm_fail_cnt[2]++; tacho_rpm_fail_cnt[2]++;
if (tacho_rpm_fail_cnt[2] >= FAN_MAX_FAIL_CNT) { if (tacho_rpm_fail_cnt[2] >= FAN_MAX_FAIL_CNT) {
frpms_lin[2] = float_to_linear(FAN_DEAD_WORD); frpms_lin[2] = FAN_DEAD_WORD;
} else { } else {
frpms_lin[2] = float_to_linear(tacho_rpm_prev[2]); frpms_lin[2] = float_to_linear(tacho_rpm_prev[2]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment