blob: af0e8e6b62717db326515ca942cb415b45a67c23 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/*
* Copyright © 2011 Keith Packard <keithp@keithp.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#include "ao.h"
__code uint8_t ao_log_format = AO_LOG_FORMAT_TELEMETRY;
static __data uint8_t ao_log_monitor_pos;
void
ao_log_single(void)
{
ao_storage_setup();
/* This can take a while, so let the rest
* of the system finish booting before we start
*/
ao_delay(AO_SEC_TO_TICKS(2));
ao_log_running = 1;
ao_log_single_restart();
for (;;) {
while (!ao_log_running)
ao_sleep(&ao_log_running);
ao_log_monitor_pos = ao_monitor_head;
while (ao_log_running) {
/* Write samples to EEPROM */
while (ao_log_monitor_pos != ao_monitor_head) {
memcpy(&ao_log_single_write_data.telemetry,
&ao_monitor_ring[ao_log_monitor_pos],
AO_LOG_SINGLE_SIZE);
ao_log_single_write();
ao_log_monitor_pos = ao_monitor_ring_next(ao_log_monitor_pos);
}
/* Wait for more telemetry data to arrive */
ao_sleep(DATA_TO_XDATA(&ao_monitor_head));
}
}
}
void
ao_log_single_list(void)
{
if (ao_log_current_pos != 0)
printf("flight 1 start %x end %x\n",
0,
(uint16_t) ((ao_log_current_pos + 0xff) >> 8));
printf ("done\n");
}
void
ao_log_single_extra_query(void)
{
}
|