Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any kind of network support, fix #428 #435

Merged
merged 150 commits into from
Sep 19, 2023
Merged
Changes from 1 commit
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
edcda13
Add the IO folder and source compilation.
nicolas-rabault Apr 3, 2023
c03ace3
Move msg_alloc from Robus to IO
nicolas-rabault Mar 23, 2023
090de1a
Move topic pub/sub management from Robus to IO
nicolas-rabault Mar 23, 2023
525651c
Create filter and luos_io files
Salem-Tho Jan 5, 2023
7496508
Add an engine level configuration file
Salem-Tho Jan 5, 2023
f5fcbc2
Rename and move the robus `config.h` file into `robus_config.h`
nicolas-rabault Mar 23, 2023
5ee1459
Move struct and configurations from Robus to IO
nicolas-rabault Mar 23, 2023
a1ebc8c
Move public timestamp functions into public Luos_engine.h
nicolas-rabault Mar 30, 2023
48d530e
Add an error in case of inclusion of luos.h
nicolas-rabault Mar 23, 2023
f752b60
Clean luos_engine.h and remove unused `Luos_SetExternId`
nicolas-rabault Mar 23, 2023
be861f9
Group all topic things on a pub_sub.c file on engine/core
nicolas-rabault Mar 28, 2023
fbba385
Group all streaming functions on streaming.c/.h
nicolas-rabault Mar 31, 2023
35ab161
Update Timestamp functions API
nicolas-rabault Mar 30, 2023
31b3cdd
Move general_stats_t from luos_engine.h to service_structs.h
nicolas-rabault Mar 28, 2023
7704b7a
Remove useless node_state_t struct
nicolas-rabault Mar 28, 2023
2b3338c
Remove dynamic baudrate management
nicolas-rabault Mar 28, 2023
0053566
Group all node functions on a node.c.h
nicolas-rabault Mar 31, 2023
c6bf09c
Create a script to compile all examples as fast as possible
nicolas-rabault Mar 31, 2023
f44d0bc
Make inspector use local Pipe during compilation
nicolas-rabault Mar 31, 2023
b45d472
Remove filters disableabilty and verbose mode.
nicolas-rabault Mar 31, 2023
938eb48
Group all filter functions in a filter file
nicolas-rabault Mar 31, 2023
9d6e04f
Remove all context usage on msg_alloc
nicolas-rabault Apr 3, 2023
7a41ddd
Create Service files
nicolas-rabault Apr 4, 2023
49619b9
Group all services function into service file.
nicolas-rabault Apr 6, 2023
358549d
Update .gitignore
nicolas-rabault Apr 4, 2023
ae237a6
Remove useless Luos_EmptyNode() function
nicolas-rabault Apr 4, 2023
8147a44
Small code improvement
nicolas-rabault Apr 4, 2023
664d284
Add type filtering on filter file
nicolas-rabault Apr 4, 2023
6812c05
Remove the redundant ll_service_number from robus context
nicolas-rabault Apr 4, 2023
000575a
Remove useless baudrate variable
nicolas-rabault Apr 4, 2023
07b8b3e
Move ll_service_t into Service_t, only one struct remain now.
nicolas-rabault Apr 5, 2023
9e1e024
Move robus init and loop things into IO
nicolas-rabault Apr 6, 2023
8944f80
Move topology management to LuosIO
nicolas-rabault Apr 6, 2023
7534573
Create a phy.h/c files defining phy structs
nicolas-rabault Apr 6, 2023
ab2035e
Move back rx and tx init into robus
nicolas-rabault Apr 6, 2023
dce8765
Manage phy instantiation
nicolas-rabault Apr 6, 2023
e3825c7
Move reception filtering into filter except for Robus exceptions
nicolas-rabault Apr 11, 2023
e4b83ff
Fix timestamp msg reception computation
nicolas-rabault Apr 11, 2023
f7439b1
Reshape reception and almost completely shortcut msg_tasks
nicolas-rabault Apr 12, 2023
b245d60
Assert if buffer full only on RX. TX can wait to load the buffer agai…
nicolas-rabault Apr 14, 2023
43a42b5
Fix addressing generation at detection start.
nicolas-rabault Apr 17, 2023
5f118f3
Fix double detection process occurring at the same time, fix #229
nicolas-rabault Apr 17, 2023
083b3b6
Fix collision management
nicolas-rabault Apr 18, 2023
5619724
[Gate] Add a small check if a service is excluded during detection.
nicolas-rabault Apr 18, 2023
b279fdf
Remove verbose mode
nicolas-rabault Apr 17, 2023
107c9a2
Do not allow RX dropping during reception
nicolas-rabault Apr 18, 2023
2d2ae1d
Fix data dropping occurring during re-init
nicolas-rabault Apr 18, 2023
a0ec64c
Fix multi-node detection
nicolas-rabault Apr 19, 2023
5c1a2c5
RX CRC optimization
nicolas-rabault Apr 19, 2023
2f3a122
Improve RX/TX comment on Robus
nicolas-rabault Apr 19, 2023
aaa6e43
Remove useless compiled files on SAMD21XPLAINED example
nicolas-rabault Apr 26, 2023
1e817d2
Move CRC_SIZE definition from Alloc to robus config
nicolas-rabault Apr 19, 2023
b9144c2
Engine TX is passed to LuosIO RX normal process
nicolas-rabault Apr 18, 2023
6a8f4c7
Improve unit tests organization
nicolas-rabault May 3, 2023
efd61c8
Add filter unit test
nicolas-rabault May 3, 2023
2610c1c
Add luos_phy unit test
nicolas-rabault May 3, 2023
1863887
Add luos_io unit test
nicolas-rabault May 5, 2023
a34d44d
Improve UNIT_TEST_RUN macro to correctly manage function name passing…
nicolas-rabault May 5, 2023
24753d3
Improve pub_sub unit tests
nicolas-rabault May 5, 2023
04aa844
Remove useless main.h Od tests files
nicolas-rabault May 29, 2023
fafe882
Improve timestamp unit tests
nicolas-rabault May 31, 2023
2062564
Improve routing table unit tests
nicolas-rabault May 31, 2023
df9d4a3
Add streaming unit test
nicolas-rabault May 31, 2023
1953b65
Add service unit test
nicolas-rabault Jun 1, 2023
02b1f2a
Add node unit test
nicolas-rabault Jun 1, 2023
b157634
Remove unused Luos_SetFilterState function
nicolas-rabault Jun 1, 2023
91cbec5
Fix some warnings
nicolas-rabault Jun 5, 2023
da5e7be
Move compilation error using `example_build.py` to err.log file
nicolas-rabault Jun 5, 2023
9c053e4
Fix some windows unit_test compilation optimization mistakes
nicolas-rabault Jun 6, 2023
c82d9c6
Improve luos_engine unit test
nicolas-rabault Jun 6, 2023
6405a1b
Exclude some test for windows because it fail to execute it
nicolas-rabault Jun 6, 2023
e9910d0
Enable test coverage report
nicolas-rabault Jun 5, 2023
51f8a9f
Minor code cleanup.
nicolas-rabault Jun 9, 2023
15819d3
Fix a missing node init in case of detection start message reception
nicolas-rabault Jun 9, 2023
2566b11
[Gate]Update data_manager to avoid to avoid hazardous function access…
nicolas-rabault Jun 9, 2023
a435647
Secure job removal
nicolas-rabault Jun 9, 2023
5eebf1d
Fix a memory leak in case of dead target
nicolas-rabault Jun 9, 2023
4399fb0
Separate allocation and referencing of the allocation avoiding memory…
nicolas-rabault Jun 9, 2023
89fc79d
Move data_ptr in alloc if there is no space for at least a header.
nicolas-rabault Jun 12, 2023
ba1cce5
Secure job.phy_data initialization avoiding data-race during the crea…
nicolas-rabault Jun 12, 2023
eb234a4
Avoid potential job removal when system have been reseted during a tr…
nicolas-rabault Jun 12, 2023
8b3d34a
Fix phy_data protection
nicolas-rabault Jun 12, 2023
4621de7
Avoid assert in case of corrupted message reception. Properly trash it.
nicolas-rabault Jun 12, 2023
5032229
Fix daisy chained detection infinite loop due to msg_dispatch recursi…
nicolas-rabault Jun 12, 2023
b63d8c3
!fix corrupted messages
nicolas-rabault Jun 12, 2023
c174d48
Modify job management to avoid any job pointer movement allowing to s…
nicolas-rabault Jun 13, 2023
2000d4b
Clear auto-refresh when we clear service IDs.
nicolas-rabault Jun 13, 2023
4323a23
Modify aloc slots management avoiding pointer movement and limiting I…
nicolas-rabault Jun 15, 2023
89ba9a0
Secure detection start occuring durring a transmission
nicolas-rabault Jun 16, 2023
db15778
Secure job and alloc slot management from dataraces and reduce IRQ of…
nicolas-rabault Jun 16, 2023
db96274
bootloader cleanup
nicolas-rabault Jun 16, 2023
ae73554
Separate Robus and Update detection allowing up to 254 phy with 254 p…
nicolas-rabault Jun 20, 2023
713ff72
Simplify bootloader to make it a standard service and be less intrica…
nicolas-rabault Jun 26, 2023
dbf29d9
Rename `bootloader_core` into `luos_bootloader`
nicolas-rabault Jun 26, 2023
baaa76a
Fix some typo
nicolas-rabault Jul 4, 2023
5f7044a
Change IRQ management allowing phy to reference specific IRQ manageme…
nicolas-rabault Jul 4, 2023
5973869
Make Robus an independant package
nicolas-rabault Jul 4, 2023
dc6f258
Modify master detection to be non-blocking. This allows networks to m…
nicolas-rabault Jul 5, 2023
8c7a6de
Add a Pure Arduino Luos HAL
nicolas-rabault Jul 10, 2023
ca15742
Secure Pipe using Serial for STM32G4 clock configuration
nicolas-rabault Jul 13, 2023
c1f8950
Optimize freeRTOS example to fit in RAM
nicolas-rabault Jul 17, 2023
0718163
Create a serial_network
nicolas-rabault Jul 4, 2023
c3ddb9b
OK serial test with Native gate and L0 button
nicolas-rabault Jul 7, 2023
5a721da
OK serial test with native gate and G474 and G431 button
nicolas-rabault Jul 11, 2023
d60e27e
OK serial test with Native gate and STM32L4 button
nicolas-rabault Jul 11, 2023
60f86af
OK serial test with Native gate and STM32F4 button
nicolas-rabault Jul 11, 2023
418b417
OK serial test with Native gate and Arduino button and led, fix #440
nicolas-rabault Jul 10, 2023
c4c7094
Improve Luos configuration parameters
nicolas-rabault Jul 18, 2023
e74f10a
Hide uselees routing function to users
nicolas-rabault Jul 18, 2023
80100f4
Improve Robus configuration flags naming
nicolas-rabault Jul 19, 2023
9815418
Add a serial_hal_config.h file
nicolas-rabault Jul 19, 2023
6ed4ed2
Improve luos_phy.h public interface and adapt robus and Serial
nicolas-rabault Jul 19, 2023
54d2280
!fix multi-phy
nicolas-rabault Aug 28, 2023
2383731
Improve C++ compatibility by making it natively compilable in a C++ env
nicolas-rabault Aug 28, 2023
1a0bf00
Remove networks from coverage, networks are very difficult to unit te…
nicolas-rabault Aug 2, 2023
085e496
Fix format
nicolas-rabault Aug 2, 2023
07c4998
Remove Inspector because we don't maintain it anymore.
nicolas-rabault Aug 3, 2023
9bac6bf
Make a clean BAUDRATE configuration for networks
nicolas-rabault Aug 28, 2023
8d2b30e
Improve native timestamping precision
nicolas-rabault Aug 4, 2023
c641f20
Enable multi-phy capabilities
nicolas-rabault Aug 11, 2023
45d11d1
Add a print for native assert
nicolas-rabault Aug 25, 2023
288875b
Add a trace print on Gate segfault to catch it one day perhaps.
nicolas-rabault Aug 25, 2023
b4034ba
Improve ST Serial reception by removing RX IRQ and improve function n…
nicolas-rabault Aug 25, 2023
1dae135
Remove telemetry
nicolas-rabault Aug 25, 2023
db34245
Manage multi-message in one Serial burst
nicolas-rabault Aug 25, 2023
a9af943
Allow synchronized nodes to manage timestamping without any different…
nicolas-rabault Aug 25, 2023
e25326c
[OD] rename the `_private` var into `raw` to explicitely allow users …
nicolas-rabault Aug 28, 2023
1e96760
Fix some OD warnings on `Controller_motor` example
nicolas-rabault Aug 28, 2023
82001f8
Add a user_context pointer on services and apply it on DXL example
nicolas-rabault Aug 28, 2023
1802b42
Fix Serial HAL for Native on Linux and windows, fix #442
nicolas-rabault Aug 29, 2023
f0de043
Improve compilation messaging presentation
nicolas-rabault Aug 31, 2023
38bc651
Remove some useless reset on detetion and increase some timing allowi…
nicolas-rabault Aug 31, 2023
e98e990
Fix the detection flag init
nicolas-rabault Aug 31, 2023
44c03ff
Fix and remove deprecated unit test
nicolas-rabault Aug 31, 2023
3174317
Fix some code format
nicolas-rabault Aug 31, 2023
43c9a08
Fix a typo
nicolas-rabault Sep 5, 2023
c152eaa
Secure Robus initialization by setting Callback before enabling the h…
nicolas-rabault Sep 5, 2023
7b83495
[Gate] Allow user to put custom conversion on project lib
nicolas-rabault Sep 5, 2023
c36ddac
Fix assert infinite re-entrance on Gate
nicolas-rabault Sep 11, 2023
bf0ac48
Avoid asserts appening sometime during the reset_detection
nicolas-rabault Sep 11, 2023
31943f2
Clean Native Serial HAL
nicolas-rabault Sep 11, 2023
85c0800
Secure potential RX segfault if the RX buffer is smaller than the rec…
nicolas-rabault Sep 11, 2023
6f958b4
Fix Gate compilation on windows
nicolas-rabault Sep 12, 2023
7fb6737
Fix a small datarace on RX
nicolas-rabault Sep 12, 2023
b32fa7c
Improve serial Loop on ST MCU
nicolas-rabault Sep 12, 2023
3c3e8ce
Fix Serial
nicolas-rabault Sep 12, 2023
23428f6
Fix Native Gate node_config
nicolas-rabault Sep 12, 2023
25f9ee3
Fix a Robus reception byte count mistake making big messages potentia…
nicolas-rabault Sep 14, 2023
a74df88
[SERIAL] Fix STM HAL DMA received size computation datarace in case o…
nicolas-rabault Sep 14, 2023
bd5778f
[SERIAL] Secure messy RX interpretation
nicolas-rabault Sep 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve Luos configuration parameters
nicolas-rabault committed Sep 18, 2023
commit c4c709481a9c2b3bba884a6bb3603498aeb1947d
12 changes: 6 additions & 6 deletions engine/IO/src/filter.c
Original file line number Diff line number Diff line change
@@ -67,8 +67,8 @@ void Filter_AddServiceId(uint16_t service_id, uint16_t service_number)
// Shift byte byte Mask of bit address

LUOS_ASSERT((service_id > 0)
&& (service_id <= 4096 - MAX_SERVICE_NUMBER)
&& (service_number <= MAX_SERVICE_NUMBER));
&& (service_id <= 4096 - MAX_LOCAL_SERVICE_NUMBER)
&& (service_number <= MAX_LOCAL_SERVICE_NUMBER));
Filter_IdInit();
uint16_t tempo = 0;
filter_ctx.IDShiftMask = (service_id - 1) / 8; // aligned to byte
@@ -88,7 +88,7 @@ void Filter_AddServiceId(uint16_t service_id, uint16_t service_number)
******************************************************************************/
void Filter_AddTopic(uint16_t topic_id)
{
LUOS_ASSERT(topic_id < LAST_TOPIC);
LUOS_ASSERT(topic_id < MAX_LOCAL_TOPIC_NUMBER);
// Add 1 to the bit corresponding to the topic in multicast mask
filter_ctx.TopicMask[(topic_id / 8)] |= 1 << (topic_id - ((int)(topic_id / 8)) * 8);
}
@@ -100,7 +100,7 @@ void Filter_AddTopic(uint16_t topic_id)
******************************************************************************/
void Filter_RmTopic(uint16_t topic_id)
{
LUOS_ASSERT(topic_id < LAST_TOPIC);
LUOS_ASSERT(topic_id < MAX_LOCAL_TOPIC_NUMBER);
// Remove 1 to the bit corresponding to the topic in multicast mask
filter_ctx.TopicMask[(topic_id / 8)] &= ~(1 << (topic_id - ((int)(topic_id / 8)) * 8));
}
@@ -116,7 +116,7 @@ _CRITICAL bool Filter_ServiceID(uint16_t service_id)
//--------------------------->|__________|
// Shift byte byte Mask of bit address
// In an node, service ID are consecutive
// MaskID is byte field wich have the size of MAX_SERVICE_NUMBER
// MaskID is byte field wich have the size of MAX_LOCAL_SERVICE_NUMBER
// Shift depend od ID of first service in Node (shift = NodeID/8)
LUOS_ASSERT(service_id <= 4096);
uint16_t compare = 0;
@@ -144,7 +144,7 @@ _CRITICAL bool Filter_Topic(uint16_t topic_id)
{
uint8_t compare = 0;
// Make sure there is a topic that can be received by the node
if (topic_id < LAST_TOPIC)
if (topic_id < MAX_LOCAL_TOPIC_NUMBER)
{
compare = topic_id - ((topic_id / 8) * 8);
// Search if topic exists in mask
10 changes: 5 additions & 5 deletions engine/core/inc/service.h
Original file line number Diff line number Diff line change
@@ -13,16 +13,16 @@
/*******************************************************************************
* Definitions
******************************************************************************/
#if (MAX_SERVICE_NUMBER <= 8)
#if (MAX_LOCAL_SERVICE_NUMBER <= 8)
typedef uint8_t service_filter_t;
#elif (MAX_SERVICE_NUMBER <= 16)
#elif (MAX_LOCAL_SERVICE_NUMBER <= 16)
typedef uint16_t service_filter_t;
#elif (MAX_SERVICE_NUMBER <= 32)
#elif (MAX_LOCAL_SERVICE_NUMBER <= 32)
typedef uint32_t service_filter_t;
#elif (MAX_SERVICE_NUMBER <= 64)
#elif (MAX_LOCAL_SERVICE_NUMBER <= 64)
typedef uint64_t service_filter_t;
#else
#error "MAX_SERVICE_NUMBER is too high"
#error "MAX_LOCAL_SERVICE_NUMBER is too high"
#endif

/*******************************************************************************
2 changes: 1 addition & 1 deletion engine/core/inc/struct_luos.h
Original file line number Diff line number Diff line change
@@ -212,7 +212,7 @@ typedef struct service_t

// Private Variables
uint16_t last_topic_position; /*!< Position pointer of the last topic added. */
uint16_t topic_list[LAST_TOPIC]; /*!< multicast target bank. */
uint16_t topic_list[MAX_LOCAL_TOPIC_NUMBER]; /*!< multicast target bank. */
timed_update_t auto_refresh; /*!< service auto refresh context. */
void *profile_context; /*!< Pointer to the profile context. */

6 changes: 3 additions & 3 deletions engine/core/src/luos_engine.c
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
* Variables
******************************************************************************/
const revision_t luos_version = {.major = 3, .minor = 0, .build = 0};
package_t package_table[MAX_SERVICE_NUMBER];
package_t package_table[MAX_LOCAL_SERVICE_NUMBER];
uint16_t package_number = 0;

/*******************************************************************************
@@ -347,8 +347,8 @@ void Luos_SendData(service_t *service, msg_t *msg, void *bin_data, uint16_t size
int Luos_ReceiveData(service_t *service, const msg_t *msg, void *bin_data)
{
// Manage buffer session (one per service)
static uint32_t data_size[MAX_SERVICE_NUMBER] = {0};
static uint32_t total_data_size[MAX_SERVICE_NUMBER] = {0};
static uint32_t data_size[MAX_LOCAL_SERVICE_NUMBER] = {0};
static uint32_t total_data_size[MAX_LOCAL_SERVICE_NUMBER] = {0};
static uint16_t last_msg_size = 0;

// When this function receive a data from a NULL service it is an error and we should reinit the reception state
4 changes: 2 additions & 2 deletions engine/core/src/profile_core.c
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
#include "profile_core.h"

// static initialization of profile table
profile_core_t profile_table[MAX_PROFILE_NUMBER];
profile_core_t profile_table[MAX_LOCAL_PROFILE_NUMBER];
uint16_t available_index = 0;
uint16_t head_profile_index = 0;

@@ -39,7 +39,7 @@ profile_core_t *ProfileCore_GetNew(bool profile_mode)
head_profile_index = available_index;

// update available profile index
LUOS_ASSERT(available_index <= (MAX_PROFILE_NUMBER - 1));
LUOS_ASSERT(available_index <= (MAX_LOCAL_PROFILE_NUMBER - 1));
available_index += 1;
new_profile = &profile_table[available_index - 1];

8 changes: 4 additions & 4 deletions engine/core/src/pub_sub.c
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
******************************************************************************/
uint8_t PubSub_IsTopicSubscribed(service_t *service, uint16_t topic_id)
{
LUOS_ASSERT((topic_id < LAST_TOPIC)
LUOS_ASSERT((topic_id < MAX_LOCAL_TOPIC_NUMBER)
&& (service != NULL));
unsigned char i;
for (i = 0; i < service->last_topic_position; i++)
@@ -50,14 +50,14 @@ uint8_t PubSub_IsTopicSubscribed(service_t *service, uint16_t topic_id)
error_return_t Luos_Subscribe(service_t *service, uint16_t topic)
{
// Assert if we add a topic that is greater than the max topic value
LUOS_ASSERT((topic < LAST_TOPIC)
LUOS_ASSERT((topic < MAX_LOCAL_TOPIC_NUMBER)
&& (service != 0));

// Put this topic in the multicast bank
Filter_AddTopic(topic);

// Check if target exists or if we reached the maximum topics number
if ((PubSub_IsTopicSubscribed(service, topic) == false) && (service->last_topic_position < LAST_TOPIC))
if ((PubSub_IsTopicSubscribed(service, topic) == false) && (service->last_topic_position < MAX_LOCAL_TOPIC_NUMBER))
{
service->topic_list[service->last_topic_position] = topic;
service->last_topic_position++;
@@ -74,7 +74,7 @@ error_return_t Luos_Subscribe(service_t *service, uint16_t topic)
******************************************************************************/
error_return_t Luos_Unsubscribe(service_t *service, uint16_t topic)
{
LUOS_ASSERT((topic < LAST_TOPIC)
LUOS_ASSERT((topic < MAX_LOCAL_TOPIC_NUMBER)
&& (service != 0));

error_return_t err = FAILED;
6 changes: 3 additions & 3 deletions engine/core/src/routing_table.c
Original file line number Diff line number Diff line change
@@ -186,14 +186,14 @@ static void RoutingTB_AddNumToAlias(char *alias, uint8_t num)
if (num > 99) // only 2 digit are alowed when add alias number
{
// This is probably a mistake, put an error into the alias
memset(alias, 0, ALIAS_SIZE);
memset(alias, 0, MAX_ALIAS_SIZE - 1);
memcpy(alias, "error", strlen("error"));
return;
}
// Change size to fit into 15 characters
if (strlen(alias) > (ALIAS_SIZE - intsize))
if (strlen(alias) > (MAX_ALIAS_SIZE - 1 - intsize))
{
alias[(ALIAS_SIZE - intsize)] = '\0';
alias[(MAX_ALIAS_SIZE - 1 - intsize)] = '\0';
}
else
{
8 changes: 4 additions & 4 deletions engine/core/src/service.c
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
******************************************************************************/
typedef struct
{
service_t list[MAX_SERVICE_NUMBER];
service_t list[MAX_LOCAL_SERVICE_NUMBER];
uint16_t number;
} service_ctx_t;

@@ -369,7 +369,7 @@ service_t *Luos_CreateService(SERVICE_CB service_cb, uint8_t type, const char *a
service->statistics.max_retry = 0;
// Clear topic number
service->last_topic_position = 0;
for (uint16_t i = 0; i < LAST_TOPIC; i++)
for (uint16_t i = 0; i < MAX_LOCAL_TOPIC_NUMBER; i++)
{
service->topic_list[i] = 0;
}
@@ -400,7 +400,7 @@ service_t *Luos_CreateService(SERVICE_CB service_cb, uint8_t type, const char *a
}

service_ctx.number++;
LUOS_ASSERT(service_ctx.number <= MAX_SERVICE_NUMBER);
LUOS_ASSERT(service_ctx.number <= MAX_LOCAL_SERVICE_NUMBER);
return service;
}

@@ -470,5 +470,5 @@ void Luos_ServicesClear(void)
service_ctx.number = 0;

// Clear service table
memset((void *)service_ctx.list, 0, sizeof(service_t) * MAX_SERVICE_NUMBER);
memset((void *)service_ctx.list, 0, sizeof(service_t) * MAX_LOCAL_SERVICE_NUMBER);
}
46 changes: 24 additions & 22 deletions engine/engine_config.h
Original file line number Diff line number Diff line change
@@ -10,51 +10,53 @@
/*******************************************************************************
* Definitions
******************************************************************************/
#define LUOS_LAST_RESERVED_CMD 42 // Last Luos reserved command
#define ALIAS_SIZE 15 // Number of max char for service alias
#define MAX_ALIAS_SIZE 16
#define DETECTION_TIMEOUT_MS 10000 // Timeout used to detect a failed detection
#define BOOT_TIMEOUT 1000
#define DEFAULTID 0x00
#define PROTOCOL_REVISION 0
#define BROADCAST_VAL 0x0FFF
#define LUOS_LAST_RESERVED_CMD 42 // Last Luos reserved command
#define MAX_ALIAS_SIZE 16 // Number of max char for service alias
#define DETECTION_TIMEOUT_MS 10000 // Timeout used to detect a failed detection
#define DEFAULTID 0x00 // The default ID of a Luos service
#define PROTOCOL_REVISION 0 // The Luos protocol revision
#define BROADCAST_VAL 0x0FFF // The broadcast target value
#define MAX_DATA_MSG_SIZE 128 // The maximum size of a data message

#define MAX_DATA_MSG_SIZE 128
#ifndef MAX_LOCAL_SERVICE_NUMBER
#define MAX_LOCAL_SERVICE_NUMBER 5 // The maximum number of local services
#endif

#ifndef MAX_SERVICE_NUMBER
#define MAX_SERVICE_NUMBER 5
#define MAX_SERVICE_NUMBER 20 // The maximum number of services in the complete architecture
#endif

#ifndef MAX_NODE_NUMBER
#define MAX_NODE_NUMBER 20
#define MAX_NODE_NUMBER 20 // The maximum number of nodes in the complete architecture
#endif

#ifndef MAX_RTB_ENTRY
#define MAX_RTB_ENTRY 40
#ifdef MAX_RTB_ENTRY
#error 'MAX_RTB_ENTRY' configuration is deprecated and have been replaced by MAX_NODE_NUMBER and MAX_SERVICE_NUMBER. MAX_RTB_ENTRY is now automatically calculated by the engine based on these values.
#endif
#define MAX_RTB_ENTRY (MAX_NODE_NUMBER + MAX_SERVICE_NUMBER)

#ifdef MAX_CONTAINER_NUMBER
#error 'MAX_CONTAINER_NUMBER' is deprecated since [email protected], replace it by 'MAX_SERVICE_NUMBER', see: www.github.com/Luos-io/luos_engine/releases/tag/2.0.0 for more information.
#error 'MAX_CONTAINER_NUMBER' is deprecated since [email protected], replace it by 'MAX_LOCAL_SERVICE_NUMBER', see: www.github.com/Luos-io/luos_engine/releases/tag/2.0.0 for more information.
#endif

#ifndef MAX_PROFILE_NUMBER
#define MAX_PROFILE_NUMBER MAX_SERVICE_NUMBER
#ifndef MAX_LOCAL_PROFILE_NUMBER
#define MAX_LOCAL_PROFILE_NUMBER MAX_LOCAL_SERVICE_NUMBER // The maximum number of profile in the node
#endif

#ifndef MSG_BUFFER_SIZE
#define MSG_BUFFER_SIZE 3 * sizeof(msg_t)
#define MSG_BUFFER_SIZE 3 * sizeof(msg_t) // The size of the message buffer
#endif

#ifndef MAX_MSG_NB
#define MAX_MSG_NB 2 * MAX_SERVICE_NUMBER
#define MAX_MSG_NB 2 * MAX_LOCAL_SERVICE_NUMBER // The maximum number of message referenced by Luos
#endif

#ifndef LAST_TOPIC
#define LAST_TOPIC 20
#ifndef MAX_LOCAL_TOPIC_NUMBER
#define MAX_LOCAL_TOPIC_NUMBER 20 // The maximum number of topic in the node
#endif

// Tab of byte. + 2 for overlap ID because aligned to byte
#define ID_MASK_SIZE ((MAX_SERVICE_NUMBER / 8) + 2)
#define TOPIC_MASK_SIZE ((LAST_TOPIC / 8) + 2)
#define ID_MASK_SIZE ((MAX_LOCAL_SERVICE_NUMBER / 8) + 2)
#define TOPIC_MASK_SIZE ((MAX_LOCAL_TOPIC_NUMBER / 8) + 2)

#endif /* _ENGINE_CONFIG_H_ */
9 changes: 5 additions & 4 deletions examples/projects/Arduino/bldc_simple_foc/node_config.h
Original file line number Diff line number Diff line change
@@ -37,16 +37,17 @@
*******************************************************************************
* Define | Default Value | Description
* :---------------------|------------------------------------------------------
* MAX_SERVICE_NUMBER | 5 | Service number in the node
* MAX_LOCAL_SERVICE_NUMBER | 5 | Service number in the node
* MAX_NODE_NUMBER. | 20 | Node number in the device
* MSG_BUFFER_SIZE | 3*SIZE_MSG_MAX (405 Bytes) | Size in byte of the Luos buffer TX and RX
* MAX_MSG_NB | 2*MAX_SERVICE_NUMBER | Message number in Luos buffer
* MAX_RTB_ENTRY | 40 | Max entries in the routing table
* MAX_MSG_NB | 2*MAX_LOCAL_SERVICE_NUMBER | Message number in Luos buffer
* MAX_NODE_NUMBER | 20 | Node number in the device
* MAX_SERVICE_NUMBER | 20 | Service number in the device
* NBR_PORT | 2 | PTP Branch number Max 8
* NBR_RETRY | 10 | Send Retry number in case of NACK or collision
******************************************************************************/

#define MAX_SERVICE_NUMBER 2
#define MAX_LOCAL_SERVICE_NUMBER 2
#define MAX_MSG_NB 5

#define ARDUINO_PTPA_PIN 19
9 changes: 5 additions & 4 deletions examples/projects/Arduino/button/node_config.h
Original file line number Diff line number Diff line change
@@ -37,16 +37,17 @@
*******************************************************************************
* Define | Default Value | Description
* :---------------------|------------------------------------------------------
* MAX_SERVICE_NUMBER | 5 | Service number in the node
* MAX_LOCAL_SERVICE_NUMBER | 5 | Service number in the node
* MAX_NODE_NUMBER. | 20 | Node number in the device
* MSG_BUFFER_SIZE | 3*SIZE_MSG_MAX (405 Bytes) | Size in byte of the Luos buffer TX and RX
* MAX_MSG_NB | 2*MAX_SERVICE_NUMBER | Message number in Luos buffer
* MAX_RTB_ENTRY | 40 | Max entries in the routing table
* MAX_MSG_NB | 2*MAX_LOCAL_SERVICE_NUMBER | Message number in Luos buffer
* MAX_NODE_NUMBER | 20 | Node number in the device
* MAX_SERVICE_NUMBER | 20 | Service number in the device
* NBR_PORT | 2 | PTP Branch number Max 8
* NBR_RETRY | 10 | Send Retry number in case of NACK or collision
******************************************************************************/

#define MAX_SERVICE_NUMBER 1
#define MAX_LOCAL_SERVICE_NUMBER 1
#define MAX_MSG_NB 5

/*******************************************************************************
9 changes: 5 additions & 4 deletions examples/projects/Arduino/fingerprint/node_config.h
Original file line number Diff line number Diff line change
@@ -37,16 +37,17 @@
*******************************************************************************
* Define | Default Value | Description
* :---------------------|------------------------------------------------------
* MAX_SERVICE_NUMBER | 5 | Service number in the node
* MAX_LOCAL_SERVICE_NUMBER | 5 | Service number in the node
* MAX_NODE_NUMBER. | 20 | Node number in the device
* MSG_BUFFER_SIZE | 3*SIZE_MSG_MAX (405 Bytes) | Size in byte of the Luos buffer TX and RX
* MAX_MSG_NB | 2*MAX_SERVICE_NUMBER | Message number in Luos buffer
* MAX_RTB_ENTRY | 40 | Max entries in the routing table
* MAX_MSG_NB | 2*MAX_LOCAL_SERVICE_NUMBER | Message number in Luos buffer
* MAX_NODE_NUMBER | 20 | Node number in the device
* MAX_SERVICE_NUMBER | 20 | Service number in the device
* NBR_PORT | 2 | PTP Branch number Max 8
* NBR_RETRY | 10 | Send Retry number in case of NACK or collision
******************************************************************************/

#define MAX_SERVICE_NUMBER 1
#define MAX_LOCAL_SERVICE_NUMBER 1
#define MAX_MSG_NB 5

/*******************************************************************************
17 changes: 9 additions & 8 deletions examples/projects/Arduino/gate_serialcom/node_config.h
Original file line number Diff line number Diff line change
@@ -37,18 +37,19 @@
*******************************************************************************
* Define | Default Value | Description
* :---------------------|------------------------------------------------------
* MAX_SERVICE_NUMBER | 5 | Service number in the node
* MAX_LOCAL_SERVICE_NUMBER | 5 | Service number in the node
* MAX_NODE_NUMBER. | 20 | Node number in the device
* MSG_BUFFER_SIZE | 3*SIZE_MSG_MAX (405 Bytes) | Size in byte of the Luos buffer TX and RX
* MAX_MSG_NB | 2*MAX_SERVICE_NUMBER | Message number in Luos buffer
* MAX_RTB_ENTRY | 40 | Max entries in the routing table
* MAX_MSG_NB | 2*MAX_LOCAL_SERVICE_NUMBER | Message number in Luos buffer
* MAX_NODE_NUMBER | 20 | Node number in the device
* MAX_SERVICE_NUMBER | 20 | Service number in the device
* NBR_PORT | 2 | PTP Branch number Max 8
* NBR_RETRY | 10 | Send Retry number in case of NACK or collision
******************************************************************************/

#define MAX_SERVICE_NUMBER 2
#define MSG_BUFFER_SIZE 1024
#define MAX_MSG_NB 30
#define MAX_LOCAL_SERVICE_NUMBER 2
#define MSG_BUFFER_SIZE 1024
#define MAX_MSG_NB 30

/*******************************************************************************
* LUOS HAL LIBRARY DEFINITION
@@ -93,13 +94,13 @@
*******************************************************************************
* Define | Default Value | Description
* :-------------------------|------------------------------------------------------
* MAX_RTB_ENTRY | 40 | max number entry in routing table
* MAX_NODE_NUMBER | 20 | Node number in the device
* MAX_SERVICE_NUMBER | 20 | Service number in the device
* GATE_BUFF_SIZE | 1024 | Json receive buffer size
* PIPE_TX_BUFFER_SIZE | 1024 | Receive pipe buffer size
* PIPE_RX_BUFFER_SIZE | 2048 | Transmit pipe buffer size
******************************************************************************/

#define MAX_RTB_ENTRY 40
#define GATE_BUFF_SIZE 1024
#define PIPE_TX_BUFFER_SIZE 1024
#define PIPE_RX_BUFFER_SIZE 2048
Loading