git.droids-corp.org
/
protos
/
xbee-avr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix xbee_user after rework (e39c5d5)
[protos/xbee-avr.git]
/
commands.c
diff --git
a/commands.c
b/commands.c
index
2c663c1
..
68c0c6b
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)
@@
-172,9
+175,9
@@
static int8_t dump_xbee_atresp_cb(int8_t retcode, void *frame, unsigned len,
memcpy(atcmd_str, &recvframe->cmd, 2);
atcmd_str[2] = '\0';
memcpy(atcmd_str, &recvframe->cmd, 2);
atcmd_str[2] = '\0';
+ atresp_to_str(buf, sizeof(buf), frame, len);
len -= sizeof(*recvframe);
len -= sizeof(*recvframe);
- atresp_to_str(buf, sizeof(buf), frame);
- NOTICE(E_USER_XBEE, "status ok, len=%d, %s", len, buf);
+ printf_P(PSTR("status ok, len=%d, %s\n"), len, buf);
return XBEE_USER_RETCODE_OK;
}
return XBEE_USER_RETCODE_OK;
}
@@
-664,7
+667,7
@@
static void cmd_send_hello_parsed(void *parsed_result, void *use_neigh)
if (diff < res->period)
continue;
if (diff < res->period)
continue;
- rc_proto_send_hello(addr, res->data, strlen(res->data));
+ rc_proto_send_hello(addr, res->data, strlen(res->data)
, -1
);
next += res->period;
res->count--;
}
next += res->period;
res->count--;
}