Skip to content

Commit 625d89e

Browse files
author
JeromeGalan
authored
Merge pull request #173 from Luos-io/release/rc/2.3.0
Release Luos Engine 2.3.0
2 parents e39f862 + cf6cbb8 commit 625d89e

23 files changed

+437
-85
lines changed

.github/workflows/build.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ jobs:
6969
platformio run -d Projects/l0/Gate_SerialCom
7070
platformio run -d Projects/l0/Gpio
7171
platformio run -d Projects/l0/Imu
72+
platformio run -d Projects/l0/Inspector_SerialCom
7273
platformio run -d Projects/l0/Led
7374
platformio run -d Projects/l0/Led_strip
7475
platformio run -d Projects/l0/Light_sensor
@@ -82,23 +83,30 @@ jobs:
8283
# arduino
8384
platformio run -d Projects/Arduino/Button
8485
platformio run -d Projects/Arduino/Gate_SerialCom
86+
platformio run -d Projects/Arduino/Inspector_SerialCom
87+
8588
# NUCLEO-L432KC
8689
platformio run -d Projects/NUCLEO-L432KC/Button
8790
platformio run -d Projects/NUCLEO-L432KC/Gate_SerialCom
91+
platformio run -d Projects/NUCLEO-L432KC/Inspector_SerialCom
8892
platformio run -d Projects/NUCLEO-L432KC/Led
8993
# STM32F4-discovery
9094
platformio run -d Projects/STM32F4-discovery/Button
9195
platformio run -d Projects/STM32F4-discovery/Gate_SerialCom
96+
platformio run -d Projects/NUCLEO-F401RE/Inspector_SerialCom
97+
9298
# NUCLEO-F401RE
9399
platformio run -d Projects/NUCLEO-F401RE/Button
94100
platformio run -d Projects/NUCLEO-F401RE/Gate_SerialCom
101+
platformio run -d Projects/NUCLEO-F410RB/Inspector_SerialCom
95102
platformio run -d Projects/NUCLEO-F401RE/Led
96103
# NUCLEO-F401RB
97104
platformio run -d Projects/NUCLEO-F410RB/Button
98105
platformio run -d Projects/NUCLEO-F410RB/Gate_SerialCom
99106
# NUCLEO-G431KB
100107
platformio run -d Projects/NUCLEO-G431KB/Button
101108
platformio run -d Projects/NUCLEO-G431KB/Gate_SerialCom
109+
platformio run -d Projects/NUCLEO-G431KB/Inspector_SerialCom
102110
103111
- name: Run PlatformIO Unit Tests
104112
env:
@@ -111,8 +119,10 @@ jobs:
111119
platformio run -t clean -c .\test\msg_alloc\config\platformio.ini
112120
platformio run -t clean -c .\test\luos\config\platformio.ini
113121
platformio run -t clean -c .\test\routing_table\config\platformio.ini
122+
platformio run -t clean -c .\test\timestamp\config\platformio.ini
114123
115124
# Run Unit tests
116125
platformio test -e native -c .\test\msg_alloc\config\platformio.ini -f msg_alloc --verbose
117126
platformio test -e native -c .\test\luos\config\platformio.ini -f luos --verbose
118-
platformio test -e native -c .\test\routing_table\config\platformio.ini -f routing_table --verbose
127+
platformio test -e native -c .\test\routing_table\config\platformio.ini -f routing_table --verbose
128+
platformio test -e native -c .\test\timestamp\config\platformio.ini -f timestamp --verbose

.github/workflows/dev-build.yml

+12
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
platformio run -d Projects/l0/Gate_SerialCom
9393
platformio run -d Projects/l0/Gpio
9494
platformio run -d Projects/l0/Imu
95+
platformio run -d Projects/l0/Inspector_SerialCom
9596
platformio run -d Projects/l0/Led
9697
platformio run -d Projects/l0/Led_strip
9798
platformio run -d Projects/l0/Light_sensor
@@ -102,26 +103,35 @@ jobs:
102103
platformio run -d Projects/l0/Stepper
103104
platformio run -d Projects/l0/Bike_alarm/Alarm_controller
104105
platformio run -d Projects/l0/Bike_alarm/Start_controller
106+
105107
# arduino
106108
platformio run -d Projects/Arduino/Button
107109
platformio run -d Projects/Arduino/Gate_SerialCom
110+
platformio run -d Projects/Arduino/Inspector_SerialCom
111+
108112
# NUCLEO-L432KC
109113
platformio run -d Projects/NUCLEO-L432KC/Button
110114
platformio run -d Projects/NUCLEO-L432KC/Gate_SerialCom
115+
platformio run -d Projects/NUCLEO-L432KC/Inspector_SerialCom
111116
platformio run -d Projects/NUCLEO-L432KC/Led
112117
# STM32F4-discovery
113118
platformio run -d Projects/STM32F4-discovery/Button
114119
platformio run -d Projects/STM32F4-discovery/Gate_SerialCom
120+
platformio run -d Projects/NUCLEO-F401RE/Inspector_SerialCom
121+
115122
# NUCLEO-F401RE
116123
platformio run -d Projects/NUCLEO-F401RE/Button
117124
platformio run -d Projects/NUCLEO-F401RE/Gate_SerialCom
125+
platformio run -d Projects/NUCLEO-F410RB/Inspector_SerialCom
118126
platformio run -d Projects/NUCLEO-F401RE/Led
119127
# NUCLEO-F401RB
120128
platformio run -d Projects/NUCLEO-F410RB/Button
121129
platformio run -d Projects/NUCLEO-F410RB/Gate_SerialCom
130+
122131
# NUCLEO-G431KB
123132
platformio run -d Projects/NUCLEO-G431KB/Button
124133
platformio run -d Projects/NUCLEO-G431KB/Gate_SerialCom
134+
platformio run -d Projects/NUCLEO-G431KB/Inspector_SerialCom
125135
126136
- name: Run PlatformIO Unit Tests
127137
env:
@@ -134,8 +144,10 @@ jobs:
134144
platformio run -t clean -c .\test\msg_alloc\config\platformio.ini
135145
platformio run -t clean -c .\test\luos\config\platformio.ini
136146
platformio run -t clean -c .\test\routing_table\config\platformio.ini
147+
platformio run -t clean -c .\test\timestamp\config\platformio.ini
137148
138149
# Run Unit tests
139150
platformio test -e native -c .\test\msg_alloc\config\platformio.ini -f msg_alloc --verbose
140151
platformio test -e native -c .\test\luos\config\platformio.ini -f luos --verbose
141152
platformio test -e native -c .\test\routing_table\config\platformio.ini -f routing_table --verbose
153+
platformio test -e native -c .\test\timestamp\config\platformio.ini -f timestamp --verbose

Profiles/State/profile_state.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ void ProfileState_Handler(service_t *service, msg_t *msg)
2929
if (Timestamp_GetToken(&profile_state->state))
3030
{
3131
Timestamp_EncodeMsg(&pub_msg, &profile_state->state);
32+
Luos_SendTimestampMsg(service, &pub_msg);
33+
}
34+
else
35+
{
36+
// send message on the network
37+
Luos_SendMsg(service, &pub_msg);
3238
}
33-
34-
// send message on the network
35-
Luos_SendMsg(service, &pub_msg);
3639
}
3740
break;
3841
case IO_STATE:

Robus/inc/robus_struct.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ typedef struct __attribute__((__packed__))
6565
{
6666
struct __attribute__((__packed__))
6767
{
68-
uint16_t protocol : 4; /*!< Protocol version. */
68+
uint16_t config : 4; /*!< Protocol version. */
6969
uint16_t target : 12; /*!< Target address, it can be (ID, Multicast/Broadcast, Type). */
7070
uint16_t target_mode : 4; /*!< Select targeting mode (ID, ID+ACK, Multicast/Broadcast, Type). */
7171
uint16_t source : 12; /*!< Source address, it can be (ID, Multicast/Broadcast, Type). */
@@ -157,6 +157,13 @@ typedef enum
157157
ROBUS_PROTOCOL_NB = 13,
158158
} robus_cmd_t;
159159

160+
typedef enum
161+
{
162+
// Protocol version
163+
BASE_PROCOTOL = PROTOCOL_REVISION,
164+
TIMESTAMP_PROTOCOL,
165+
} robus_protocol_t;
166+
160167
typedef void (*RX_CB)(ll_service_t *ll_service, msg_t *msg);
161168
/*******************************************************************************
162169
* Variables

Robus/inc/timestamp.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
******************************************************************************/
1717
typedef struct timestamp_token
1818
{
19-
uint64_t timestamp;
19+
int64_t timestamp;
2020
void *target;
2121
struct timestamp_token *next;
2222
} timestamp_token_t;
@@ -37,6 +37,7 @@ timestamp_token_t *Timestamp_GetToken(void *target);
3737
bool Timestamp_IsTimestampMsg(msg_t *msg);
3838
void Timestamp_TagMsg(msg_t *msg);
3939
void Timestamp_EncodeMsg(msg_t *msg, void *target);
40-
void Timestamp_DecodeMsg(msg_t *msg, uint64_t *timestamp);
40+
void Timestamp_DecodeMsg(msg_t *msg, int64_t *timestamp);
41+
void Timestamp_CreateEvent(int64_t, timestamp_token_t *, void *);
4142

4243
#endif /* _TIMESTAMP_H_ */

Robus/src/reception.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
/*******************************************************************************
3333
* Variables
3434
******************************************************************************/
35-
uint16_t data_count = 0;
36-
uint16_t data_size = 0;
37-
uint16_t crc_val = 0;
38-
static uint64_t ll_rx_timestamp = 0;
39-
uint16_t large_data_num = 0;
35+
uint16_t data_count = 0;
36+
uint16_t data_size = 0;
37+
uint16_t crc_val = 0;
38+
static int64_t ll_rx_timestamp = 0;
39+
uint16_t large_data_num = 0;
4040

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

170170
if (Recep_IsAckNeeded())

Robus/src/robus.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,6 @@ error_return_t Robus_SendMsg(ll_service_t *ll_service, msg_t *msg)
178178
}
179179

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

207205
if (Timestamp_IsTimestampMsg(msg))
208206
{
209-
crc_max_index = full_size - (sizeof(uint64_t) + sizeof(uint8_t));
207+
crc_max_index = full_size - sizeof(int64_t);
210208
}
211209
else
212210
{

0 commit comments

Comments
 (0)