mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 06:54:49 +08:00
sdlog
This commit is contained in:
@@ -36,6 +36,16 @@
|
||||
#include "subsystems/abi.h"
|
||||
#include "led.h"
|
||||
|
||||
// sd-log
|
||||
#if APOGEE_BARO_SDLOG
|
||||
#include "sdLog.h"
|
||||
#include "subsystems/chibios-libopencm3/chibios_sdlog.h"
|
||||
#include "subsystems/gps.h"
|
||||
bool_t log_apogee_baro_started;
|
||||
int count_sd_writes;
|
||||
#endif
|
||||
|
||||
|
||||
/** Normal frequency with the default settings
|
||||
*
|
||||
* the baro read function should be called at 5 Hz
|
||||
@@ -72,6 +82,12 @@ void baro_init(void)
|
||||
LED_OFF(BARO_LED);
|
||||
#endif
|
||||
startup_cnt = BARO_STARTUP_COUNTER;
|
||||
|
||||
#if APOGEE_BARO_SDLOG
|
||||
log_apogee_baro_started = FALSE;
|
||||
count_sd_writes=0;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void baro_periodic(void)
|
||||
@@ -105,6 +121,26 @@ void apogee_baro_event(void)
|
||||
float temp = apogee_baro.temperature / 16.0f;
|
||||
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
||||
apogee_baro.data_available = FALSE;
|
||||
|
||||
#if APOGEE_BARO_SDLOG
|
||||
if (pprzLogFile != -1) {
|
||||
if (!log_apogee_baro_started) {
|
||||
sdLogWriteLog(pprzLogFile, "APOGEE_BARO: Pres(Pa) GPS_fix TOW(ms) Week Lat(1e7deg) Lon(1e7deg) HMSL(mm) gpseed(cm/s) course(1e7deg) climb(cm/s)\n");
|
||||
log_apogee_baro_started = TRUE;
|
||||
}
|
||||
if (count_sd_writes == 0) {
|
||||
sdLogWriteLog(pprzLogFile, "apogee_baro: %9.4f %9.4f %d %d %d %d %d %d %d %d %d\n",
|
||||
pressure,temp,
|
||||
gps.fix, gps.tow, gps.week,
|
||||
gps.lla_pos.lat, gps.lla_pos.lon, gps.hmsl,
|
||||
gps.gspeed, gps.course, -gps.ned_vel.z);
|
||||
}
|
||||
count_sd_writes++;
|
||||
if (count_sd_writes > 8) {count_sd_writes=0;}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ void humid_sht_periodic(void)
|
||||
#if SHT_SDLOG
|
||||
if (pprzLogFile != -1) {
|
||||
if (!log_sht_started) {
|
||||
sdLogWriteLog(pprzLogFile, "SHT75: Humid(pct) Temp(degC) H(usec) GPS_fix TOW(ms) Week Lat(1e7rad) Lon(1e7rad) HMSL(mm) gpseed(cm/s) course(1e7rad) climb(cm/s)\n");
|
||||
sdLogWriteLog(pprzLogFile, "SHT75: Humid(pct) Temp(degC) GPS_fix TOW(ms) Week Lat(1e7deg) Lon(1e7deg) HMSL(mm) gspeed(cm/s) course(1e7deg) climb(cm/s)\n");
|
||||
log_sht_started = TRUE;
|
||||
}
|
||||
sdLogWriteLog(pprzLogFile, "sht75: %9.4f %9.4f %d %d %d %d %d %d %d %d %d\n",
|
||||
|
||||
@@ -90,7 +90,7 @@ void temod_event(void)
|
||||
#if TEMP_TEMOD_SDLOG
|
||||
if (pprzLogFile != -1) {
|
||||
if (!log_temod_started) {
|
||||
sdLogWriteLog(pprzLogFile, "TEMOD: Temp(degC) H(usec) GPS_fix TOW(ms) Week Lat(1e7rad) Lon(1e7rad) HMSL(mm) gpseed(cm/s) course(1e7rad) climb(cm/s)\n");
|
||||
sdLogWriteLog(pprzLogFile, "TEMOD: Temp(degC) GPS_fix TOW(ms) Week Lat(1e7deg) Lon(1e7deg) HMSL(mm) gspeed(cm/s) course(1e7deg) climb(cm/s)\n");
|
||||
log_temod_started = TRUE;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -83,12 +83,14 @@ PRINT_CONFIG_VAR(AIRSPEED_ETS_I2C_DEV)
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(AIRSPEED_ETS_START_DELAY)
|
||||
|
||||
#ifndef SITL
|
||||
#if AIRSPEED_ETS_SDLOG
|
||||
#include "sdLog.h"
|
||||
#include "subsystems/chibios-libopencm3/chibios_sdlog.h"
|
||||
#include "subsystems/gps.h"
|
||||
bool_t log_airspeed_ets_started;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// Global variables
|
||||
@@ -131,9 +133,11 @@ void airspeed_ets_init(void)
|
||||
airspeed_ets_delay_done = FALSE;
|
||||
SysTimeTimerStart(airspeed_ets_delay_time);
|
||||
|
||||
#ifndef SITL
|
||||
#if AIRSPEED_ETS_SDLOG
|
||||
log_airspeed_ets_started = FALSE;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void airspeed_ets_read_periodic(void)
|
||||
@@ -234,9 +238,10 @@ void airspeed_ets_read_event(void)
|
||||
|
||||
|
||||
#if AIRSPEED_ETS_SDLOG
|
||||
#ifndef SITL
|
||||
if (pprzLogFile != -1) {
|
||||
if (!log_airspeed_ets_started) {
|
||||
sdLogWriteLog(pprzLogFile, "AIRSPEED_ETS: raw offset airspeed(m/s) GPS_fix TOW(ms) Week Lat(1e7rad) Lon(1e7rad) HMSL(mm) gpseed(cm/s) course(1e7rad) climb(cm/s)\n");
|
||||
sdLogWriteLog(pprzLogFile, "AIRSPEED_ETS: raw offset airspeed(m/s) GPS_fix TOW(ms) Week Lat(1e7deg) Lon(1e7deg) HMSL(mm) gpseed(cm/s) course(1e7rad) climb(cm/s)\n");
|
||||
log_airspeed_ets_started = TRUE;
|
||||
}
|
||||
sdLogWriteLog(pprzLogFile, "airspeed_ets: %d %d %8.4f %d %d %d %d %d %d %d %d %d\n",
|
||||
@@ -246,6 +251,7 @@ void airspeed_ets_read_event(void)
|
||||
gps.gspeed, gps.course, -gps.ned_vel.z);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user