diff --git a/firmware/devices/obdh/obdh.c b/firmware/devices/obdh/obdh.c index f7b86ab..845215d 100644 --- a/firmware/devices/obdh/obdh.c +++ b/firmware/devices/obdh/obdh.c @@ -26,7 +26,7 @@ * \author Andre M. P. de Mattos * \author Augusto Cezar Boldori Vassoler * - * \version 0.2.7 + * \version 0.2.29 * * \date 05/07/2021 * @@ -107,16 +107,17 @@ int obdh_init(void) int obdh_decode(uint8_t *adr, uint32_t *val, uint8_t *cmd) { - uint8_t buf[i2c_received_data_size]; + uint8_t buf[I2C_RX_BUFFER_MAX_SIZE]; + uint8_t received_size = i2c_received_data_size; - for (int i = 0; i < i2c_received_data_size; i++) + for (int i = 0; i < received_size; i++) { buf[i] = i2c_rx_buffer[i]; } - if(obdh_check_crc(buf, i2c_received_data_size, buf[i2c_received_data_size-1]) == true) + if(obdh_check_crc(buf, received_size, buf[received_size-1]) == true) { - switch(i2c_received_data_size) + switch(received_size) { case OBDH_COMMAND_WRITE_SIZE: *adr = buf[0]; diff --git a/firmware/devices/ttc/ttc.c b/firmware/devices/ttc/ttc.c index 2cb57c7..480520e 100644 --- a/firmware/devices/ttc/ttc.c +++ b/firmware/devices/ttc/ttc.c @@ -26,7 +26,7 @@ * \author André M. P. de Mattos * \author Augusto Cezar Boldori Vassoler * - * \version 0.2.6 + * \version 0.2.29 * * \date 22/04/2021 * @@ -100,16 +100,17 @@ int ttc_init(void) int ttc_decode(uint8_t *adr, uint32_t *val, uint8_t *cmd) { - uint8_t buf[uart_received_data_size]; + uint8_t buf[UART_RX_BUFFER_MAX_SIZE]; + uint8_t received_size = uart_received_data_size; - for (int i = 0; i < uart_received_data_size; i++) + for (int i = 0; i < received_size; i++) { buf[i] = uart_rx_buffer[i]; } - if(ttc_check_crc(buf, uart_received_data_size, buf[uart_received_data_size-1]) == true) + if(ttc_check_crc(buf, received_size, buf[received_size-1]) == true) { - switch(uart_received_data_size) + switch(received_size) { case TTC_COMMAND_WRITE_SIZE: *adr = buf[0]; diff --git a/firmware/version.h b/firmware/version.h index a125369..da7bf45 100644 --- a/firmware/version.h +++ b/firmware/version.h @@ -25,7 +25,7 @@ * * \author Gabriel Mariano Marcelino * - * \version 0.2.28 + * \version 0.2.29 * * \date 2020/10/21 * @@ -36,7 +36,7 @@ #ifndef VERSION_H_ #define VERSION_H_ -#define FIRMWARE_VERSION "0.2.28" +#define FIRMWARE_VERSION "0.2.29" #define FIRMWARE_STATUS "Development"