projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
need to include the Cortex toolchain
[fw/altos]
/
src
/
drivers
/
ao_lco_func.c
diff --git
a/src/drivers/ao_lco_func.c
b/src/drivers/ao_lco_func.c
index 152b5d1ba5b1d06e6c9b509a7b012597f88df036..99e58b76f872bc014e992ae622242cce1bc80701 100644
(file)
--- a/
src/drivers/ao_lco_func.c
+++ b/
src/drivers/ao_lco_func.c
@@
-28,18
+28,18
@@
ao_lco_query(uint16_t box, struct ao_pad_query *query, uint16_t *tick_offset)
{
uint8_t i;
int8_t r;
{
uint8_t i;
int8_t r;
- uint16_t time;
+ uint16_t
sent_
time;
ao_mutex_get(&ao_lco_mutex);
ao_mutex_get(&ao_lco_mutex);
- time = ao_time();
- command.tick = time;
+ command.tick = ao_time() - *tick_offset;
command.box = box;
command.cmd = AO_LAUNCH_QUERY;
command.channels = 0;
ao_radio_cmac_send(&command, sizeof (command));
command.box = box;
command.cmd = AO_LAUNCH_QUERY;
command.channels = 0;
ao_radio_cmac_send(&command, sizeof (command));
- r = ao_radio_cmac_recv(query, sizeof (*query), AO_MS_TO_TICKS(500));
+ sent_time = ao_time();
+ r = ao_radio_cmac_recv(query, sizeof (*query), AO_MS_TO_TICKS(20));
if (r == AO_RADIO_CMAC_OK)
if (r == AO_RADIO_CMAC_OK)
- *tick_offset = time - query->tick;
+ *tick_offset =
sent_
time - query->tick;
ao_mutex_put(&ao_lco_mutex);
return r;
}
ao_mutex_put(&ao_lco_mutex);
return r;
}