From c48b4d80cc3f0f9607a8191e63121f2373551555 Mon Sep 17 00:00:00 2001 From: matt Date: Sat, 31 Oct 2020 11:35:38 +0800 Subject: [PATCH] rec to sd card --- fmc41/hal_uart_out_wrapper.c | 53 ++++++++---------------------------- 1 file changed, 12 insertions(+), 41 deletions(-) diff --git a/fmc41/hal_uart_out_wrapper.c b/fmc41/hal_uart_out_wrapper.c index a8c87b5..c040285 100644 --- a/fmc41/hal_uart_out_wrapper.c +++ b/fmc41/hal_uart_out_wrapper.c @@ -13,7 +13,6 @@ #ifdef HAL_IMPL #include "uart_fifos.h" #include "param_pre.h" -#include "fatfs.h" #endif /* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */ #define y_width 1 @@ -23,53 +22,25 @@ * */ /* %%%-SFUNWIZ_wrapper_externs_Changes_BEGIN --- EDIT HERE TO _END */ -int is_fat_rec_init = 0; -FIL *rec_pf; +#define REC_ZONE_LEN (2000) +extern uint8_t rec_zone[2][REC_ZONE_LEN]; +extern int rec_sel; +extern int rec_head[2]; static int FAT_REC_write(uint8_t *buff, const uint16_t len) { - int rslt; - FRESULT res; - if (is_fat_rec_init == 1) + if (rec_head[rec_sel] < REC_ZONE_LEN) { - UINT bw; - res = f_write(rec_pf, buff, len, &bw); - f_sync(rec_pf); - if (res != FR_OK) - { - rslt = -1; - } - else + for (int i=0u;i= REC_ZONE_LEN) + { + break; + } } } - else if (is_fat_rec_init == 0 && ap_U.sens.gps_fixtype >= ENUM_GPS_FIXTYPE_FIX_2D) - { - res = f_mount(&SDFatFS, SDPath, 1); - if (res != FR_OK) - { - is_fat_rec_init = -1; - rslt = -1; - } - rec_pf = &SDFile; - long path_len; - char path[80]; - strncpy(path, SDPath, 3); - sprintf(&path[3], "R%d.dat", (ap_U.sens.TOW / 1000)); - res = f_open(rec_pf, path, FA_OPEN_ALWAYS | FA_WRITE); - if (res == FR_OK) - { - is_fat_rec_init = 1; - rslt = 0; - } - else - { - is_fat_rec_init = -1; - rslt = -1; - } - } - return rslt; + return 0; } /* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */