Send OpenBeacon (if privacy allows)
This commit is contained in:
parent
f176bed03f
commit
69907e7d16
|
@ -0,0 +1,35 @@
|
||||||
|
#include <sysinit.h>
|
||||||
|
|
||||||
|
#include "basic/basic.h"
|
||||||
|
#include "basic/byteorder.h"
|
||||||
|
#include "basic/config.h"
|
||||||
|
|
||||||
|
#include "funk/nrf24l01p.h"
|
||||||
|
#include "funk/openbeacon.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define B_INTERVAL 100
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
|
||||||
|
void do_openbeacon(){
|
||||||
|
openbeaconSend();
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_beacon(void){
|
||||||
|
nrf_init();
|
||||||
|
openbeaconSetup();
|
||||||
|
};
|
||||||
|
|
||||||
|
void tick_beacon(void){
|
||||||
|
static int beaconctr=0;
|
||||||
|
if(GLOBAL(privacy)>0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(beaconctr--<0){
|
||||||
|
push_queue(&do_openbeacon);
|
||||||
|
beaconctr=B_INTERVAL/SYSTICKSPEED/2;
|
||||||
|
beaconctr+=getRandom()%(beaconctr*2);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue