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

Relay forwarding task is executed 2 seconds after the transmission, instead of 50 milliseconds #16

Closed
adriansmares opened this issue Sep 15, 2023 · 2 comments

Comments

@adriansmares
Copy link

adriansmares commented Sep 15, 2023

When LBM is compiled with relay RX support, the 'relaying' task (which re-transmits the uplink message from the end device) is executed 2 seconds after the transmission end, instead of 50 milliseconds after the transmission end:

void lorawan_relay_rx_fwd_uplink( uint8_t stack_id, const uint8_t* data, uint8_t data_len, uint32_t time_tx,
bool is_join )
{
IS_VALID_STACK_ID( stack_id );
IS_SERVICE_INITIALIZED( );
// SMTC_MODEM_HAL_TRACE_PRINTF( "Relay RX service add fwd ul task %d\n", smtc_modem_hal_get_time_in_ms( ) );
smodem_task task_relay = {
.id = relay_rx_obj.task_id,
.stack_id = stack_id,
.priority = TASK_HIGH_PRIORITY,
.time_to_execute_s = smtc_modem_hal_get_time_in_s( ) + 2,
};
SMTC_MODEM_HAL_PANIC_ON_FAILURE( modem_supervisor_add_task( &task_relay ) == TASK_VALID );
memcpy( relay_rx_obj.buffer, data, data_len );
relay_rx_obj.buffer_len = data_len;
relay_rx_obj.time_to_tx = time_tx;
relay_rx_obj.service_state = ( is_join == true ) ? SERVICE_FWD_FWD_JOIN : SERVICE_FWD_FWD_UL;
relay_stop( true );
}

The enqueuing itself is done correctly - it uses the receive timestamp + 50 milliseconds:

lorawan_relay_rx_fwd_uplink(
RELAY_STACK_ID, buffer, info->buffer_length + RELAY_FWD_UPLINK_BYTE_ORDER_UPLINK_PAYLOAD,
info->rx_uplink_timestamp_ms + RELAY_FWD_DELAY, ( wor->wor_type == WOR_MSG_TYPE_JOIN_REQUEST ? true : false ) );

I guess this change from the specification is done in order to avoid the relay interfering with the RX1 and RX2 of the original transmission, and to be honest it sort of makes sense (although it assumes RX1=1), but I think that either the delay in the regional parameters should be updated or this delay should be somehow controllable - it makes deduplication on the Network Server significantly harder if we want to keep all downlink paths, and the 2 seconds seem arbitrary.

@lbm-team
Copy link
Contributor

Hello @adriansmares ,

This 2s delay was introduce for some tests and should have not made it to the release.
This would be fixed in the next release.

In the meantime, you could remove the "+2" in the task_relay variable.

@lbm-team
Copy link
Contributor

Hello,

This issue was solved in the release v4.4.0-feature-relay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants