-
Notifications
You must be signed in to change notification settings - Fork 0
/
acquisinators_tasks.c.bak
96 lines (92 loc) · 5.25 KB
/
acquisinators_tasks.c.bak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#if ACQUISINATOR_ID == ACQUISINATOR_ID_0
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {
float top_left_ntc_temperature =
acquisinatore_ntc_from_V_to_degrees_celsius((ch1 / 2.0f) + *o1); // air temperature of radiator entrance
float link_deformation = acquisinatore_link_deformation_from_V_to_elongation(ch2 + *o2);
if (link_deformation_calibration_check(ch2, o1, o2) != HAL_OK) {
acquisinatore_set_led_code(acquisinatore_led_code_read_write_flash);
}
if ((get_timestamp_ms() - calibration_values_last_send) > SECONDARY_ACQUISINATOR_CALIBRATIONS_OFFSETS_CYCLE_TIME_MS) {
calibration_values_last_send = get_timestamp_ms();
acquisinatore_send_calibration_offsets(*o1, *o2);
}
// CAN SEND
if ((get_timestamp_ms() - *pts) > NTC_COOLING_DELAY_MS) {
*pts = get_timestamp_ms();
acquisinatore_send_air_cooling_temp(top_left_ntc_temperature);
}
acquisinatore_send_strain_gauge_val_rr_wheel(0, link_deformation);
}
#elif ACQUISINATOR_ID == ACQUISINATOR_ID_1
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {
// top_right_ntc_temperature => exit from the radiators (but please check every time)
float top_right_ntc_temperature = acquisinatore_ntc_from_V_to_degrees_celsius((ch1 / 2.0f) + *o1);
// bottom_right_ntc_temperature => entrance of the radiators (but please check every time)
float bottom_right_ntc_temperature = acquisinatore_ntc_from_V_to_degrees_celsius(((ch2 - 0.8f) / 2.0f) + *o2);
if ((get_timestamp_ms() - calibration_values_last_send) > SECONDARY_ACQUISINATOR_CALIBRATIONS_OFFSETS_CYCLE_TIME_MS) {
calibration_values_last_send = get_timestamp_ms();
acquisinatore_send_calibration_offsets(*o1, *o2);
}
if ((get_timestamp_ms() - *pts) > NTC_COOLING_DELAY_MS) {
acquisinatore_send_water_cooling_temp(bottom_right_ntc_temperature, top_right_ntc_temperature);
*pts = get_timestamp_ms();
}
}
#elif ACQUISINATOR_ID == ACQUISINATOR_ID_2
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {
static uint32_t calibration_values_last_send = 0;
float link_deformation = acquisinatore_link_deformation_from_V_to_elongation(ch2 + *o2);
if (link_deformation_calibration_check(ch2, o1, o2) != HAL_OK) {
acquisinatore_set_led_code(acquisinatore_led_code_read_write_flash);
}
if ((get_timestamp_ms() - calibration_values_last_send) > SECONDARY_ACQUISINATOR_CALIBRATIONS_OFFSETS_CYCLE_TIME_MS) {
calibration_values_last_send = get_timestamp_ms();
acquisinatore_send_calibration_offsets(*o1, *o2);
}
acquisinatore_send_strain_gauge_val_fl_wheel(0, link_deformation);
}
#elif ACQUISINATOR_ID == ACQUISINATOR_ID_3
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {
static uint32_t calibration_values_last_send = 0;
float link_deformation = acquisinatore_link_deformation_from_V_to_elongation(ch2 + *o2);
if (link_deformation_calibration_check(ch2, o1, o2) != HAL_OK) {
acquisinatore_set_led_code(acquisinatore_led_code_read_write_flash);
}
if ((get_timestamp_ms() - calibration_values_last_send) > SECONDARY_ACQUISINATOR_CALIBRATIONS_OFFSETS_CYCLE_TIME_MS) {
calibration_values_last_send = get_timestamp_ms();
acquisinatore_send_calibration_offsets(*o1, *o2);
}
acquisinatore_send_strain_gauge_val_fr_wheel(0, link_deformation);
}
#elif ACQUISINATOR_ID == ACQUISINATOR_ID_4
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {
static uint32_t calibration_values_last_send = 0;
float link_deformation = acquisinatore_link_deformation_from_V_to_elongation(ch2 + *o2);
if (link_deformation_calibration_check(ch2, o1, o2) != HAL_OK) {
acquisinatore_set_led_code(acquisinatore_led_code_read_write_flash);
}
if ((get_timestamp_ms() - calibration_values_last_send) > SECONDARY_ACQUISINATOR_CALIBRATIONS_OFFSETS_CYCLE_TIME_MS) {
calibration_values_last_send = get_timestamp_ms();
acquisinatore_send_calibration_offsets(*o1, *o2);
}
acquisinatore_send_strain_gauge_val_rl_wheel(0, link_deformation);
}
#elif ACQUISINATOR_ID == ACQUISINATOR_ID_5
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {}
#elif ACQUISINATOR_ID == ACQUISINATOR_ID_6
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {}
#elif ACQUISINATOR_ID == ACQUISINATOR_ID_7
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {}
#elif ACQUISINATOR_ID == ACQUISINATOR_ID_8
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {}
#elif ACQUISINATOR_ID == ACQUISINATOR_ID_9
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {}
#elif ACQUISINATOR_ID == ACQUISINATOR_ID_10
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {}
#elif ACQUISINATOR_ID == ACQUISINATOR_ID_11
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {}
#elif ACQUISINATOR_ID == ACQUISINATOR_ID_12
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {}
#else
void acquisinator_task(float ch1, float ch2, float *o1, float *o2, uint32_t *pts) {}
#endif