radio_sstrength returns last received packet instead of current value
radio_current_sstrength returns current value
This commit is contained in:
parent
d62e75ac3f
commit
41adb8caf3
2 changed files with 16 additions and 3 deletions
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cooja-radio.c,v 1.1 2007/05/18 13:48:16 fros4943 Exp $
|
||||
* $Id: cooja-radio.c,v 1.2 2007/05/18 15:20:21 fros4943 Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
@ -54,6 +54,7 @@ int simOutSize;
|
|||
|
||||
char simRadioHWOn = 1;
|
||||
int simSignalStrength = -200;
|
||||
int simLastSignalStrength = -200;
|
||||
char simPower = 100;
|
||||
int simRadioChannel = 1;
|
||||
int inSendFunction = 0;
|
||||
|
@ -98,6 +99,12 @@ radio_set_channel(int channel)
|
|||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
radio_sstrength(void)
|
||||
{
|
||||
return simLastSignalStrength;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
radio_current_sstrength(void)
|
||||
{
|
||||
return simSignalStrength;
|
||||
}
|
||||
|
@ -121,6 +128,7 @@ doInterfaceActionsBeforeTick(void)
|
|||
|
||||
// Don't fall asleep while receiving (in main file)
|
||||
if (simReceiving) {
|
||||
simLastSignalStrength = simSignalStrength;
|
||||
simDontFallAsleep = 1;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: cooja-radio.h,v 1.1 2007/05/18 13:48:30 fros4943 Exp $
|
||||
* $Id: cooja-radio.h,v 1.2 2007/05/18 15:20:20 fros4943 Exp $
|
||||
*/
|
||||
|
||||
#ifndef __COOJA_RADIO_H__
|
||||
|
@ -102,10 +102,15 @@ u16_t
|
|||
radio_read(u8_t *buf, u16_t bufsize);
|
||||
|
||||
/**
|
||||
* This function returns the recevied signal strength of the last
|
||||
* This function returns the signal strength of the last
|
||||
* received packet. This function typically is called when a packet
|
||||
* has been received.
|
||||
*/
|
||||
int radio_sstrength(void);
|
||||
|
||||
/**
|
||||
* This function measures and returns the signal strength.
|
||||
*/
|
||||
int radio_current_sstrength(void);
|
||||
|
||||
#endif /* __COOJA_RADIO_H__ */
|
||||
|
|
Loading…
Reference in a new issue