Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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 
pprzlog_tp.h
Initialize pprzlog transport.
chibios_sdlog_init
void chibios_sdlog_init(struct chibios_sdlog *sdlog, FileDes *file)
init chibios_sdlog structure
Definition: sdlog_chibios.c:165
flight_recorder.h
sdlog_chibios.h
telemetry.h
chibios_sdlog
chibios_sdlog structure
Definition: sdlog_chibios.h:54
flight_recorder_init
void flight_recorder_init()
Init function.
Definition: flight_recorder.c:52
pprzlog_tp
struct pprzlog_transport pprzlog_tp
PPRZLOG transport structure.
Definition: pprzlog_tp.c:29
flight_recorder_periodic
void flight_recorder_periodic()
Periodic function.
Definition: flight_recorder.c:59
DefaultPeriodic
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66