Skip to content

Commit

Permalink
Merge pull request #173 from Luos-io/release/rc/2.3.0
Browse files Browse the repository at this point in the history
Release Luos Engine 2.3.0
  • Loading branch information
JeromeGalan authored Mar 22, 2022
2 parents e39f862 + cf6cbb8 commit 625d89e
Show file tree
Hide file tree
Showing 23 changed files with 437 additions and 85 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
platformio run -d Projects/l0/Gate_SerialCom
platformio run -d Projects/l0/Gpio
platformio run -d Projects/l0/Imu
platformio run -d Projects/l0/Inspector_SerialCom
platformio run -d Projects/l0/Led
platformio run -d Projects/l0/Led_strip
platformio run -d Projects/l0/Light_sensor
Expand All @@ -82,23 +83,30 @@ jobs:
# arduino
platformio run -d Projects/Arduino/Button
platformio run -d Projects/Arduino/Gate_SerialCom
platformio run -d Projects/Arduino/Inspector_SerialCom
# NUCLEO-L432KC
platformio run -d Projects/NUCLEO-L432KC/Button
platformio run -d Projects/NUCLEO-L432KC/Gate_SerialCom
platformio run -d Projects/NUCLEO-L432KC/Inspector_SerialCom
platformio run -d Projects/NUCLEO-L432KC/Led
# STM32F4-discovery
platformio run -d Projects/STM32F4-discovery/Button
platformio run -d Projects/STM32F4-discovery/Gate_SerialCom
platformio run -d Projects/NUCLEO-F401RE/Inspector_SerialCom
# NUCLEO-F401RE
platformio run -d Projects/NUCLEO-F401RE/Button
platformio run -d Projects/NUCLEO-F401RE/Gate_SerialCom
platformio run -d Projects/NUCLEO-F410RB/Inspector_SerialCom
platformio run -d Projects/NUCLEO-F401RE/Led
# NUCLEO-F401RB
platformio run -d Projects/NUCLEO-F410RB/Button
platformio run -d Projects/NUCLEO-F410RB/Gate_SerialCom
# NUCLEO-G431KB
platformio run -d Projects/NUCLEO-G431KB/Button
platformio run -d Projects/NUCLEO-G431KB/Gate_SerialCom
platformio run -d Projects/NUCLEO-G431KB/Inspector_SerialCom
- name: Run PlatformIO Unit Tests
env:
Expand All @@ -111,8 +119,10 @@ jobs:
platformio run -t clean -c .\test\msg_alloc\config\platformio.ini
platformio run -t clean -c .\test\luos\config\platformio.ini
platformio run -t clean -c .\test\routing_table\config\platformio.ini
platformio run -t clean -c .\test\timestamp\config\platformio.ini
# Run Unit tests
platformio test -e native -c .\test\msg_alloc\config\platformio.ini -f msg_alloc --verbose
platformio test -e native -c .\test\luos\config\platformio.ini -f luos --verbose
platformio test -e native -c .\test\routing_table\config\platformio.ini -f routing_table --verbose
platformio test -e native -c .\test\routing_table\config\platformio.ini -f routing_table --verbose
platformio test -e native -c .\test\timestamp\config\platformio.ini -f timestamp --verbose
12 changes: 12 additions & 0 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
platformio run -d Projects/l0/Gate_SerialCom
platformio run -d Projects/l0/Gpio
platformio run -d Projects/l0/Imu
platformio run -d Projects/l0/Inspector_SerialCom
platformio run -d Projects/l0/Led
platformio run -d Projects/l0/Led_strip
platformio run -d Projects/l0/Light_sensor
Expand All @@ -102,26 +103,35 @@ jobs:
platformio run -d Projects/l0/Stepper
platformio run -d Projects/l0/Bike_alarm/Alarm_controller
platformio run -d Projects/l0/Bike_alarm/Start_controller
# arduino
platformio run -d Projects/Arduino/Button
platformio run -d Projects/Arduino/Gate_SerialCom
platformio run -d Projects/Arduino/Inspector_SerialCom
# NUCLEO-L432KC
platformio run -d Projects/NUCLEO-L432KC/Button
platformio run -d Projects/NUCLEO-L432KC/Gate_SerialCom
platformio run -d Projects/NUCLEO-L432KC/Inspector_SerialCom
platformio run -d Projects/NUCLEO-L432KC/Led
# STM32F4-discovery
platformio run -d Projects/STM32F4-discovery/Button
platformio run -d Projects/STM32F4-discovery/Gate_SerialCom
platformio run -d Projects/NUCLEO-F401RE/Inspector_SerialCom
# NUCLEO-F401RE
platformio run -d Projects/NUCLEO-F401RE/Button
platformio run -d Projects/NUCLEO-F401RE/Gate_SerialCom
platformio run -d Projects/NUCLEO-F410RB/Inspector_SerialCom
platformio run -d Projects/NUCLEO-F401RE/Led
# NUCLEO-F401RB
platformio run -d Projects/NUCLEO-F410RB/Button
platformio run -d Projects/NUCLEO-F410RB/Gate_SerialCom
# NUCLEO-G431KB
platformio run -d Projects/NUCLEO-G431KB/Button
platformio run -d Projects/NUCLEO-G431KB/Gate_SerialCom
platformio run -d Projects/NUCLEO-G431KB/Inspector_SerialCom
- name: Run PlatformIO Unit Tests
env:
Expand All @@ -134,8 +144,10 @@ jobs:
platformio run -t clean -c .\test\msg_alloc\config\platformio.ini
platformio run -t clean -c .\test\luos\config\platformio.ini
platformio run -t clean -c .\test\routing_table\config\platformio.ini
platformio run -t clean -c .\test\timestamp\config\platformio.ini
# Run Unit tests
platformio test -e native -c .\test\msg_alloc\config\platformio.ini -f msg_alloc --verbose
platformio test -e native -c .\test\luos\config\platformio.ini -f luos --verbose
platformio test -e native -c .\test\routing_table\config\platformio.ini -f routing_table --verbose
platformio test -e native -c .\test\timestamp\config\platformio.ini -f timestamp --verbose
9 changes: 6 additions & 3 deletions Profiles/State/profile_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ void ProfileState_Handler(service_t *service, msg_t *msg)
if (Timestamp_GetToken(&profile_state->state))
{
Timestamp_EncodeMsg(&pub_msg, &profile_state->state);
Luos_SendTimestampMsg(service, &pub_msg);
}
else
{
// send message on the network
Luos_SendMsg(service, &pub_msg);
}

// send message on the network
Luos_SendMsg(service, &pub_msg);
}
break;
case IO_STATE:
Expand Down
9 changes: 8 additions & 1 deletion Robus/inc/robus_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ typedef struct __attribute__((__packed__))
{
struct __attribute__((__packed__))
{
uint16_t protocol : 4; /*!< Protocol version. */
uint16_t config : 4; /*!< Protocol version. */
uint16_t target : 12; /*!< Target address, it can be (ID, Multicast/Broadcast, Type). */
uint16_t target_mode : 4; /*!< Select targeting mode (ID, ID+ACK, Multicast/Broadcast, Type). */
uint16_t source : 12; /*!< Source address, it can be (ID, Multicast/Broadcast, Type). */
Expand Down Expand Up @@ -157,6 +157,13 @@ typedef enum
ROBUS_PROTOCOL_NB = 13,
} robus_cmd_t;

typedef enum
{
// Protocol version
BASE_PROCOTOL = PROTOCOL_REVISION,
TIMESTAMP_PROTOCOL,
} robus_protocol_t;

typedef void (*RX_CB)(ll_service_t *ll_service, msg_t *msg);
/*******************************************************************************
* Variables
Expand Down
5 changes: 3 additions & 2 deletions Robus/inc/timestamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
******************************************************************************/
typedef struct timestamp_token
{
uint64_t timestamp;
int64_t timestamp;
void *target;
struct timestamp_token *next;
} timestamp_token_t;
Expand All @@ -37,6 +37,7 @@ timestamp_token_t *Timestamp_GetToken(void *target);
bool Timestamp_IsTimestampMsg(msg_t *msg);
void Timestamp_TagMsg(msg_t *msg);
void Timestamp_EncodeMsg(msg_t *msg, void *target);
void Timestamp_DecodeMsg(msg_t *msg, uint64_t *timestamp);
void Timestamp_DecodeMsg(msg_t *msg, int64_t *timestamp);
void Timestamp_CreateEvent(int64_t, timestamp_token_t *, void *);

#endif /* _TIMESTAMP_H_ */
20 changes: 10 additions & 10 deletions Robus/src/reception.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
/*******************************************************************************
* Variables
******************************************************************************/
uint16_t data_count = 0;
uint16_t data_size = 0;
uint16_t crc_val = 0;
static uint64_t ll_rx_timestamp = 0;
uint16_t large_data_num = 0;
uint16_t data_count = 0;
uint16_t data_size = 0;
uint16_t crc_val = 0;
static int64_t ll_rx_timestamp = 0;
uint16_t large_data_num = 0;

/*******************************************************************************
* Function
Expand Down Expand Up @@ -92,7 +92,7 @@ void Recep_GetHeader(volatile uint8_t *data)
case (sizeof(header_t)): // Process at the header
#ifdef DEBUG
printf("*******header data*******\n");
printf("protocol : 0x%04x\n", current_msg->header.protocol); /*!< Protocol version. */
printf("protocol : 0x%04x\n", current_msg->header.config); /*!< Protocol version. */
printf("target : 0x%04x\n", current_msg->header.target); /*!< Target address, it can be (ID, Multicast/Broadcast, Type). */
printf("target_mode : 0x%04x\n", current_msg->header.target_mode); /*!< Select targeting mode (ID, ID+ACK, Multicast/Broadcast, Type). */
printf("source : 0x%04x\n", current_msg->header.source); /*!< Source address, it can be (ID, Multicast/Broadcast, Type). */
Expand Down Expand Up @@ -159,12 +159,12 @@ void Recep_GetData(volatile uint8_t *data)
// if message is timestamped, update the timestamp
if (Timestamp_IsTimestampMsg((msg_t *)current_msg))
{
uint64_t latency = 0;
int64_t latency = 0;
// get timestamp in message stream
// timestamp is placed at the end of the payload, just before the crc.
memcpy(&latency, (msg_t *)&current_msg->data[current_msg->header.size - sizeof(uint64_t)], sizeof(uint64_t));
ll_rx_timestamp = (ll_rx_timestamp >= latency) ? ll_rx_timestamp - latency : 0;
memcpy((msg_t *)&current_msg->data[current_msg->header.size - sizeof(uint64_t)], &ll_rx_timestamp, sizeof(uint64_t));
memcpy(&latency, (msg_t *)&current_msg->data[current_msg->header.size - sizeof(int64_t)], sizeof(int64_t));
ll_rx_timestamp = (ll_rx_timestamp + latency > 0) ? ll_rx_timestamp + latency : 0;
memcpy((msg_t *)&current_msg->data[current_msg->header.size - sizeof(int64_t)], &ll_rx_timestamp, sizeof(int64_t));
}

if (Recep_IsAckNeeded())
Expand Down
4 changes: 1 addition & 3 deletions Robus/src/robus.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ error_return_t Robus_SendMsg(ll_service_t *ll_service, msg_t *msg)
}

// ********** Prepare the message ********************
// Set protocol revision and source ID on the message
msg->header.protocol = PROTOCOL_REVISION;
if (ll_service->id != 0)
{
msg->header.source = ll_service->id;
Expand All @@ -206,7 +204,7 @@ error_return_t Robus_SendMsg(ll_service_t *ll_service, msg_t *msg)

if (Timestamp_IsTimestampMsg(msg))
{
crc_max_index = full_size - (sizeof(uint64_t) + sizeof(uint8_t));
crc_max_index = full_size - sizeof(int64_t);
}
else
{
Expand Down
Loading

0 comments on commit 625d89e

Please sign in to comment.