Added both things. On my machine, I get about 10x increase in speed:
200000000 cycles in 7607 ms => 26291573 cycles/sec --- with wfi
200000000 cycles in 74895 ms => 2670405 cycles/sec --- without wfi
Get a new version from GitHub, and updated example attached. Format of the new path loss command:
Additional Path Loss
This command defines additional path loss between two nodes, a node and a noise source, or a sniffer and a node.
This command can be used to simulate obstacles (like walls and buildings), or non-uniform environments. It can also be used to artificially force certain routing configurations. Introduced path loss is symmetrical in both directions for configurations where both sides are nodes.
Additional path loss is defined by the loss parameter. The negative values represent additional signal amplification.
Format:
loss <receiver> <transmitter> <loss>
receiver -- name of the receiver device (can be a node or a sniffer)
transmitter -- name of the transmitter device (can be a node or a noise source)
loss -- additional path loss between the devices (dBm)
Example:
noise R_0 R_1 10.0
And as far as WFI goes, as you will see, I added this code to the main loop:
if (!NWK_Busy())
asm("wfi");
This makes sure that as long as stack has nothing to do, device sleeps, while waiting on interrupts. There are two sources of interrupts at the moment - the radio, and the timer. Timer interrupts every 10 ms to maintain software timers, and radio interrupts when frames are received and sent.
This makes sure that stack is not blocked when it is busy processing the frames.
But this does not really take into account application needs. In this case application is very simple, and it is not a problem, but more complex application may want to indicate that they are also busy doing useful things at the moment, ad node should not sleep.
To indicate that application is busy, it must call NWK_Lock(), and when it is done it must call NWK_Unlock(). NWK_Lock() and NWK_Unlock() must come in symmetrical pairs, since one simply increments a counter, and another one decrements. Once counter is 0 - the stack is ready for sleep.