Browse Source

Script cleanup, WIP on mavlink logging

sbg
Lorenz Meier 12 years ago
parent
commit
7bf2edc3bf
  1. 0
      ROMFS/px4fmu_common/init.d/01_fmu_quad_x
  2. 0
      ROMFS/px4fmu_common/init.d/02_io_quad_x
  3. 0
      ROMFS/px4fmu_common/init.d/08_ardrone
  4. 0
      ROMFS/px4fmu_common/init.d/09_ardrone_flow
  5. 0
      ROMFS/px4fmu_common/init.d/30_io_camflyer
  6. 0
      ROMFS/px4fmu_common/init.d/31_io_phantom
  7. 63
      ROMFS/px4fmu_common/init.d/rcS
  8. 11
      src/modules/mavlink/mavlink_log.c

0
ROMFS/px4fmu_common/init.d/rc.1_fmu_quad_x → ROMFS/px4fmu_common/init.d/01_fmu_quad_x

0
ROMFS/px4fmu_common/init.d/rc.2_fmu_io_quad_x → ROMFS/px4fmu_common/init.d/02_io_quad_x

0
ROMFS/px4fmu_common/init.d/rc.fmu_ardrone → ROMFS/px4fmu_common/init.d/08_ardrone

0
ROMFS/px4fmu_common/init.d/rc.fmu_ardrone_flow → ROMFS/px4fmu_common/init.d/09_ardrone_flow

0
ROMFS/px4fmu_common/init.d/rc.30_fmu_io_camflyer → ROMFS/px4fmu_common/init.d/30_io_camflyer

0
ROMFS/px4fmu_common/init.d/rc.31_fmu_io_phantom → ROMFS/px4fmu_common/init.d/31_io_phantom

63
ROMFS/px4fmu_common/init.d/rcS

@ -23,30 +23,6 @@ else @@ -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 @@ -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

11
src/modules/mavlink/mavlink_log.c

@ -41,16 +41,20 @@ @@ -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 @@ -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 {

Loading…
Cancel
Save