Skip to content

Commit

Permalink
firmware: devices: Fixing buffer declaration and adding variables copy
Browse files Browse the repository at this point in the history
  • Loading branch information
andrempmattos committed Aug 12, 2021
1 parent cf2258a commit 01ac76f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
11 changes: 6 additions & 5 deletions firmware/devices/obdh/obdh.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* \author Andre M. P. de Mattos <andre.mattos@spacelab.ufsc.br>
* \author Augusto Cezar Boldori Vassoler <augustovassoler@gmail.com>
*
* \version 0.2.7
* \version 0.2.29
*
* \date 05/07/2021
*
Expand Down Expand Up @@ -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];
Expand Down
11 changes: 6 additions & 5 deletions firmware/devices/ttc/ttc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* \author André M. P. de Mattos <andre.mattos@spacelab.ufsc.br>
* \author Augusto Cezar Boldori Vassoler <augustovassoler@gmail.com>
*
* \version 0.2.6
* \version 0.2.29
*
* \date 22/04/2021
*
Expand Down Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions firmware/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* \author Gabriel Mariano Marcelino <gabriel.mm8@gmail.com>
*
* \version 0.2.28
* \version 0.2.29
*
* \date 2020/10/21
*
Expand All @@ -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"

Expand Down

0 comments on commit 01ac76f

Please sign in to comment.