Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
flight_recorder.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Gautier Hattenberger <gautier.hattenberger@enac.fr>
3  *
4  * This file is part of paparazzi
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
26 #define PERIODIC_C_FLIGHTRECORDER
27 
29 
33 
34 #if FLIGHTRECORDER_SDLOG
36 struct chibios_sdlog flightrecorder_sdlog;
37 #ifndef FLIGHTRECORDER_DEVICE
38 #define FLIGHTRECORDER_DEVICE flightrecorder_sdlog
39 #else
40 #warning "SD log is activated, but FLIGHTRECORDER_DEVICE is alreay set (should not be defined)"
41 #endif
42 
43 #else
44 // include downlink for other devices
46 #endif
47 
48 #ifndef TELEMETRY_PROCESS_FlightRecorder
49 #error "You need to use a telemetry xml file with FlightRecorder process!"
50 #endif
51 
53 {
54 #if FLIGHTRECORDER_SDLOG
55  chibios_sdlog_init(&flightrecorder_sdlog, &flightRecorderLogFile);
56 #endif
57 }
58 
60 {
61 #if FLIGHTRECORDER_SDLOG
62  // test if sd log is ready
63  if (flightRecorderLogFile == -1) return;
64 #endif
65 
66 #if PERIODIC_TELEMETRY
67  periodic_telemetry_send_FlightRecorder(DefaultPeriodic, &pprzlog_tp.trans_tx, &(FLIGHTRECORDER_DEVICE).device);
68 #endif
69 }
70 
71 
Periodic telemetry system header (includes downlink utility and generated code).
Initialize pprzlog transport.
void flight_recorder_init()
Init function.
chibios_sdlog structure
Definition: sdlog_chibios.h:54
void flight_recorder_periodic()
Periodic function.
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66
void chibios_sdlog_init(struct chibios_sdlog *sdlog, FileDes *file)
init chibios_sdlog structure
struct pprzlog_transport pprzlog_tp
PPRZLOG transport structure.
Definition: pprzlog_tp.c:29