git.droids-corp.org
/
protos
/
xbee-avr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e39c5d5
)
fix range_cb command
author
Olivier Matz
<zer0@droids-corp.org>
Sat, 8 Mar 2014 20:16:26 +0000
(21:16 +0100)
committer
Olivier Matz
<zer0@droids-corp.org>
Sun, 9 Mar 2014 21:13:09 +0000
(22:13 +0100)
commands.c
patch
|
blob
|
history
diff --git
a/commands.c
b/commands.c
index
2c663c1
..
b64dfb1
100644
(file)
--- a/
commands.c
+++ b/
commands.c
@@
-67,7
+67,7
@@
struct monitor_reg *monitor_current;
static int range_period_ms = 1000;
static int range_powermask = 0x1F;
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 int range_running = 0;
static uint64_t range_dstaddr = 0xFFFF; /* broadcast by default */
static struct callout range_event;
@@
-92,12
+92,9
@@
static void monitor_cb(struct callout_mgr *cm,
static void range_cb(struct callout_mgr *cm,
struct callout *clt, void *dummy)
{
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;
uint8_t i, mask;
- struct rc_proto_range rangepkt;
(void)clt;
(void)dummy;
(void)clt;
(void)dummy;
@@
-112,20
+109,26
@@
static void range_cb(struct callout_mgr *cm,
}
range_power = ((range_power + i) & 0x7);
}
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);
if (range_cur_count == 0) {
range_running = 0;
callout_stop(cm, clt);
+ return;
}
callout_reschedule(cm, clt, range_period_ms);
}
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)
/* callback invoked when a xbee_send is done */
static int8_t send_msg_cb(int8_t retcode, void *frame, unsigned len,
void *arg)