Commit e1a249c7 authored by Guillaume Gonnet's avatar Guillaume Gonnet
Browse files

Make LoRaMAC-node faster when no reception windows.

parent 549433c4
......@@ -21,7 +21,7 @@ This project is under the MIT license
// TMP: send a ping message.
static void send_message(void)
{
bm_encode_payload(9, 5, 0);
bm_encode_payload(9, 4, 0);
puts("Sending message ...");
pvd_send(&pvd_orange_cmd, &bm_payload);
......@@ -47,8 +47,13 @@ int main(void)
// xtimer_sleep(10);
for (int i = 0; i < 3; i++) {
uint32_t start = xtimer_now_usec();
for (int i = 0; i < 5; i++) {
send_message();
//xtimer_usleep(50 * 1000); // 50 ms
}
uint32_t stop = xtimer_now_usec();
printf("Time: %ld ms\n", (stop - start) / 1000);
}
......@@ -84,6 +84,13 @@ void TimerStop(TimerEvent_t *obj);
*/
void TimerReset(TimerEvent_t *obj);
/**
* @brief Stop the timer and fire it immediatly.
*
* @param[in] obj Structure containing the timer object parameters
*/
void TimerImmediate(TimerEvent_t *obj);
/**
* @brief Set timer new timeout value
*
......
......@@ -682,6 +682,7 @@ static void OnRadioTxDone( void )
LoRaMacFlags.Bits.McpsReq = 1;
}
LoRaMacFlags.Bits.MacDone = 1;
TimerImmediate(&MacStateCheckTimer);
}
// Verify if the last uplink was a join request
......
......@@ -17,7 +17,7 @@ LGPLv2.1 license.
#include <msg.h>
#include <net/netdev.h>
#define ENABLE_DEBUG (1)
#define ENABLE_DEBUG (0)
#include <debug.h>
......
......@@ -38,6 +38,15 @@ void TimerReset(TimerEvent_t *obj)
TimerStart(obj);
}
void TimerImmediate(TimerEvent_t *obj)
{
TimerStop(obj);
msg_t *msg = &(obj->msg);
msg->type = LORARIOT_TYPE_MAC_TIMEOUT;
msg->content.ptr = obj->cb;
msg_send(msg, lorariot_pid);
}
void TimerStart(TimerEvent_t *obj)
{
obj->running = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment