static int range_period_ms = 1000;
static int range_powermask = 0x1F;
-//static uint8_t range_power = 0;
+static uint8_t range_power = 0;
static int range_running = 0;
static uint64_t range_dstaddr = 0xFFFF; /* broadcast by default */
static struct callout range_event;
static void range_cb(struct callout_mgr *cm,
struct callout *clt, void *dummy)
{
- (void)cm;
- (void)clt;
- (void)dummy;
-#if 0
+ struct rc_proto_power_probe power_probe;
+ struct xbee_msg msg;
uint8_t i, mask;
- struct rc_proto_range rangepkt;
(void)clt;
(void)dummy;
}
range_power = ((range_power + i) & 0x7);
- xbeeapp_send_atcmd("PL", &range_power, sizeof(range_power), 0, NULL, NULL);
+ xbeeapp_send_atcmd("PL", &range_power, sizeof(range_power), NULL, NULL);
+
+ power_probe.type = RC_PROTO_POWER_PROBE;
+ power_probe.power_level = range_power;
- rangepkt.type = RC_PROTO_TYPE_RANGE;
- rangepkt.power_level = range_power;
+ msg.iovlen = 1;
+ msg.iov[0].buf = &power_probe;
+ msg.iov[0].len = sizeof(power_probe);
- xbeeapp_send_msg(range_dstaddr, &rangepkt, sizeof(rangepkt), 0);
+ xbeeapp_send_msg(range_dstaddr, &msg, NULL, NULL);
if (range_cur_count == 0) {
range_running = 0;
callout_stop(cm, clt);
+ return;
}
callout_reschedule(cm, clt, range_period_ms);
-#endif
+}
+
/* callback invoked when a xbee_send is done */
static int8_t send_msg_cb(int8_t retcode, void *frame, unsigned len,
void *arg)