Paparazzi UAS  v5.8.2_stable-0-g6260b7c
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 
32 
33 #if FLIGHTRECORDER_SDLOG
34 #include "sdLog.h"
35 #include "subsystems/chibios-libopencm3/chibios_sdlog.h"
36 static 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).
void flight_recorder_init()
Init function.
void flight_recorder_periodic()
Periodic function.
struct pprzlog_transport pprzlog_tp
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66
Protocol for on-board data logger with timestamp.
struct transport_tx trans_tx