Skip to content

Commit

Permalink
Improve IRQ disabled time to secure Robus RX on small targets
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-rabault committed Sep 28, 2023
1 parent ca84cd5 commit 0714d27
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions engine/IO/src/luos_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,8 @@ _CRITICAL static void Phy_alloc(luos_phy_t *phy_ptr)
phy_ptr->rx_keep = false;
return;
}
Phy_SetIrqState(true);
Phy_SetIrqState(false);

// We need to store the received data.
// Update the informations allowing reception to continue and directly copy the data into the allocated buffer
Expand Down
11 changes: 8 additions & 3 deletions engine/IO/src/msg_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,17 @@ void MsgAlloc_Init(memory_stats_t *memory_stats)
******************************************************************************/
void MsgAlloc_Loop(void)
{
static volatile uint8_t *last_data_ptr = NULL;
// Compute buffer occupation rate
uint8_t stat = 0;
stat = (uint8_t)(((MSG_BUFFER_SIZE - MsgAlloc_BufferAvailableSpaceComputation()) * 100) / (MSG_BUFFER_SIZE));
if (stat > mem_stat->buffer_occupation_ratio)
if (data_ptr != last_data_ptr)
{
mem_stat->buffer_occupation_ratio = stat;
last_data_ptr = data_ptr;
stat = (uint8_t)(((MSG_BUFFER_SIZE - MsgAlloc_BufferAvailableSpaceComputation()) * 100) / (MSG_BUFFER_SIZE));
if (stat > mem_stat->buffer_occupation_ratio)
{
mem_stat->buffer_occupation_ratio = stat;
}
}
}

Expand Down

0 comments on commit 0714d27

Please sign in to comment.