int gps_loop(void)
{
- struct fat_file_struct *fd = NULL;
uint32_t ms;
uint8_t flags, prio;
int16_t len;
char buf[128];
struct gps_pos pos;
- fd = get_log_file();
-
while (1) {
IRQ_LOCK(flags);
(double)gps_pos.sea_altitude/100.);
- if (fd != NULL) {
+ if (sd_log_enabled()) {
- if (fat_write_file(fd, (unsigned char *)buf, len) != len) {
+ if (sd_log_write(buf, len) != len) {
printf_P(PSTR("error writing to file\n"));
return -1;
}