Script cleanup, WIP on mavlink logging

This commit is contained in:
Lorenz Meier 2013-07-18 14:01:42 +02:00
parent a4d0594bd7
commit 7bf2edc3bf
8 changed files with 50 additions and 24 deletions

View File

@ -23,30 +23,6 @@ else
tone_alarm 2
fi
#
# Check if auto-setup from one of the standard scripts is wanted
# SYS_AUTOSTART = 0 means no autostart (default)
#
if param compare SYS_AUTOSTART 1
then
sh /etc/init.d/rc.1_fmu_quad_x
fi
if param compare SYS_AUTOSTART 2
then
sh /etc/init.d/rc.2_fmu_io_quad_x
fi
if param compare SYS_AUTOSTART 30
then
sh /etc/init.d/rc.30_fmu_io_camflyer
fi
if param compare SYS_AUTOSTART 31
then
sh /etc/init.d/rc.31_fmu_io_phantom
fi
#
# Look for an init script on the microSD card.
#
@ -106,3 +82,42 @@ else
fi
fi
#
# Check if auto-setup from one of the standard scripts is wanted
# SYS_AUTOSTART = 0 means no autostart (default)
#
if param compare SYS_AUTOSTART 1
then
sh /etc/init.d/01_fmu_quad_x
fi
if param compare SYS_AUTOSTART 2
then
sh /etc/init.d/02_io_quad_x
fi
if param compare SYS_AUTOSTART 8
then
sh /etc/init.d/08_ardrone
fi
if param compare SYS_AUTOSTART 9
then
sh /etc/init.d/09_ardrone_flow
fi
if param compare SYS_AUTOSTART 10
then
sh /etc/init.d/10_io_f330
fi
if param compare SYS_AUTOSTART 30
then
sh /etc/init.d/30_io_camflyer
fi
if param compare SYS_AUTOSTART 31
then
sh /etc/init.d/31_io_phantom
fi

View File

@ -41,16 +41,20 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <mavlink/mavlink_log.h>
static FILE* text_recorder_fd = NULL;
void mavlink_logbuffer_init(struct mavlink_logbuffer *lb, int size)
{
lb->size = size;
lb->start = 0;
lb->count = 0;
lb->elems = (struct mavlink_logmessage *)calloc(lb->size, sizeof(struct mavlink_logmessage));
text_recorder_fd = fopen("/fs/microsd/text_recorder.txt", "w");
}
int mavlink_logbuffer_is_full(struct mavlink_logbuffer *lb)
@ -82,6 +86,13 @@ int mavlink_logbuffer_read(struct mavlink_logbuffer *lb, struct mavlink_logmessa
memcpy(elem, &(lb->elems[lb->start]), sizeof(struct mavlink_logmessage));
lb->start = (lb->start + 1) % lb->size;
--lb->count;
if (text_recorder_fd) {
fwrite(elem->text, 1, strnlen(elem->text, 50), text_recorder_fd);
fputc("\n", text_recorder_fd);
fsync(text_recorder_fd);
}
return 0;
} else {