fix return array

This commit is contained in:
Elp03 2024-03-19 14:02:10 +01:00
parent a8be04b583
commit bf4f3aaa81
2 changed files with 7 additions and 4 deletions

View File

@ -72,7 +72,7 @@ void write_data_point_in_EEPROM(uint8_t byte, uint8_t fan_num){
// Reads all the datapoints to the choosen data. // Reads all the datapoints to the choosen data.
// it writes the data points in the USART stream. // it writes the data points in the USART stream.
void read_data_point_speed_info(uint8_t fan_num){ uint8_t read_data_point_speed_info(uint8_t fan_num, uint8_t *array){
uint8_t byte = 0; uint8_t byte = 0;
if (fan_num == 1){ if (fan_num == 1){
@ -81,7 +81,8 @@ void read_data_point_speed_info(uint8_t fan_num){
check_eeprom_is_ready(); check_eeprom_is_ready();
for (uint8_t i = 0; i <len; i++){ for (uint8_t i = 0; i <len; i++){
byte = eeprom_read_byte(i); byte = eeprom_read_byte(i + start_address_fan1);
array[i] = byte;
printf("Fanspeed nr %u : %u", i, byte); printf("Fanspeed nr %u : %u", i, byte);
} }
} else if (fan_num == 2){ } else if (fan_num == 2){
@ -89,8 +90,10 @@ void read_data_point_speed_info(uint8_t fan_num){
check_eeprom_is_ready(); check_eeprom_is_ready();
for (uint8_t i = 0; i <len; i++){ for (uint8_t i = 0; i <len; i++){
byte = eeprom_read_byte(i); byte = eeprom_read_byte(i + start_address_fan2);
array[i] = byte;
printf("Fanspeed nr %u : %u", i, byte); printf("Fanspeed nr %u : %u", i, byte);
} }
} }
return sizeof(array);
} }

View File

@ -39,7 +39,7 @@ config_t read_struct_from_EEPROM();
void write_data_point_from_EEPROM(uint8_t byte, uint8_t fan_num); void write_data_point_from_EEPROM(uint8_t byte, uint8_t fan_num);
// Reads all the dataPoints form EEPROM // Reads all the dataPoints form EEPROM
void read_data_point_speed_info(uint8_t fan_num); uint8_t read_data_point_speed_info(uint8_t fan_num, uint8_t *array);
#ifdef __cplusplus #ifdef __cplusplus