1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

Merge branch 'master' into OP-378_James_INS

This commit is contained in:
James Cotton 2011-05-18 12:50:29 -05:00
commit 81b7fb6185
153 changed files with 13434 additions and 7300 deletions

5
.gitignore vendored
View File

@ -59,3 +59,8 @@ ground/uavobjgenerator/uavobjgenerator.pro.user
ground/uavobjects/uavobjects.pro.user
ground/ground.pro.user
# Ignore GNU global tags files
GPATH
GRTAGS
GSYMS
GTAGS

View File

@ -105,6 +105,11 @@ C: Gary Mortimer and the Scorpion
D: March 2011
V: http://vimeo.com/22104334
M: First Y6 OpenPilot flight
C: Sami Korhonen (Sambas)
D: May 2011
V: http://www.vimeo.com/23637586
M: First CopterControl flight on a Flybarless Heli
C: ?
D: ?

282
Makefile
View File

@ -1,9 +1,32 @@
# Set up a default goal
.DEFAULT_GOAL := help
# Set up some macros for common directories within the tree
ROOT_DIR=$(CURDIR)
TOOLS_DIR=$(ROOT_DIR)/tools
BUILD_DIR=$(ROOT_DIR)/build
DL_DIR=$(ROOT_DIR)/downloads
# Clean out undesirable variables from the environment and command-line
# to remove the chance that they will cause problems with our build
define SANITIZE_VAR
$(if $(filter-out undefined,$(origin $(1))),
$(info *NOTE* Sanitized $(2) variable '$(1)' from $(origin $(1)))
MAKEOVERRIDES = $(filter-out $(1)=%,$(MAKEOVERRIDES))
override $(1) :=
unexport $(1)
)
endef
# These specific variables can influence gcc in unexpected (and undesirable) ways
SANITIZE_GCC_VARS := TMPDIR GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH
SANITIZE_GCC_VARS += CFLAGS CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH OBJC_INCLUDE_PATH DEPENDENCIES_OUTPUT
$(foreach var, $(SANITIZE_GCC_VARS), $(eval $(call SANITIZE_VAR,$(var),disallowed)))
# These specific variables used to be valid but now they make no sense
SANITIZE_DEPRECATED_VARS := USE_BOOTLOADER
$(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),deprecated)))
# We almost need to consider autoconf/automake instead of this
# I don't know if windows supports uname :-(
QT_SPEC=win32-g++
@ -36,52 +59,66 @@ export V1 := $(AT)
else ifeq ($(V), 1)
endif
.PHONY: areyousureyoushouldberunningthis
areyousureyoushouldberunningthis:
.PHONY: help
help:
@echo
@echo " This Makefile will probably only work on Linux and Mac right now."
@echo " If you're sure you want to be using this, you may wish to try the following targets:"
@echo " This Makefile is known to work on Linux and Mac in a standard shell environment."
@echo " It also works on Windows by following the instructions in make/winx86/README.txt."
@echo
@echo " Here is a summary of the available targets:"
@echo
@echo " [Tool Installers]"
@echo " qt_sdk_install - Install the QT v4.6.2 tools"
@echo " arm_sdk_install - Install the Code Sourcery ARM gcc toolchain"
@echo " openocd_install - Install the OpenOCD JTAG daemon"
@echo " qt_sdk_install - Install the QT v4.6.2 tools"
@echo " arm_sdk_install - Install the Code Sourcery ARM gcc toolchain"
@echo " openocd_install - Install the OpenOCD JTAG daemon"
@echo
@echo " [Big Hammer]"
@echo " all - Generate UAVObjects, build openpilot firmware and gcs"
@echo " all_clean - Remove your build directory ($(BUILD_DIR))"
@echo " all - Generate UAVObjects, build openpilot firmware and gcs"
@echo " all_flight - Build all firmware, bootloaders and bootloader updaters"
@echo " all_fw - Build only firmware for all boards"
@echo " all_bl - Build only bootloaders for all boards"
@echo " all_blupd - Build only bootloader updaters for all boards"
@echo
@echo " all_clean - Remove your build directory ($(BUILD_DIR))"
@echo " all_flight_clean - Remove all firmware, bootloaders and bootloader updaters"
@echo " all_fw_clean - Remove firmware for all boards"
@echo " all_bl_clean - Remove bootlaoders for all boards"
@echo " all_blupd_clean - Remove bootloader updaters for all boards"
@echo
@echo " [Firmware]"
@echo " openpilot - Build firmware for the OpenPilot board"
@echo " openpilot_clean - Delete all build output for the OpenPilot firmware"
@echo " openpilot_program - Program the firmware onto the OpenPilot board"
@echo " ahrs - Build firmware for the AHRS board"
@echo " ahrs_clean - Delete all build output for the AHRS firmware"
@echo " ahrs_program - Program the firmware onto the AHRS board"
@echo " coptercontrol - Build firmware for the CopterControl board"
@echo " <board> - Build firmware for <board>"
@echo " supported boards are ($(FW_TARGETS))"
@echo " <board>_clean - Remove firmware for <board>"
@echo " <board>_program - Use OpenOCD + JTAG to write firmware to <board>"
@echo
@echo " NOTE: To build firmware to be chain loaded from a bootloader, use"
@echo " make openpilot USE_BOOTLOADER=YES"
@echo " Don't forget to do a clean between builds with/without bootloader"
@echo " [Bootloader]"
@echo " bl_<board> - Build bootloader for <board>"
@echo " supported boards are ($(BL_TARGETS))"
@echo " bl_<board>_clean - Remove bootloader for <board>"
@echo " bl_<board>_program - Use OpenOCD + JTAG to write bootloader to <board>"
@echo
@echo " [Bootloader Updater]"
@echo " blupd_<board> - Build bootloader updater for <board>"
@echo " supported boards are ($(BLUPD_TARGETS))"
@echo " blupd_<board>_clean - Remove bootloader updater for <board>"
@echo
@echo " [Simulation]"
@echo " sim_posix - Build OpenPilot simulation firmware for"
@echo " a POSIX compatible system (Linux, Mac OS X, ...)"
@echo " sim_posix_clean - Delete all build output for the POSIX simulation"
@echo " sim_win32 - Build OpenPilot simulation firmware for"
@echo " Windows using mingw and msys"
@echo " sim_win32_clean - Delete all build output for the win32 simulation"
@echo " sim_posix - Build OpenPilot simulation firmware for"
@echo " a POSIX compatible system (Linux, Mac OS X, ...)"
@echo " sim_posix_clean - Delete all build output for the POSIX simulation"
@echo " sim_win32 - Build OpenPilot simulation firmware for"
@echo " Windows using mingw and msys"
@echo " sim_win32_clean - Delete all build output for the win32 simulation"
@echo
@echo " [GCS]"
@echo " gcs - Build the Ground Control System application"
@echo " gcs - Build the Ground Control System (GCS) application"
@echo " gcs_clean - Remove the Ground Control System (GCS) application"
@echo
@echo " [UAVObjects]"
@echo " uavobjects - Generate source files from the UAVObject definition XML files"
@echo " uavobjects_test - parse xml-files - check for valid, duplicate ObjId's, ... "
@echo " uavobjects_flight - Generate flight source files from the UAVObject definition XML files"
@echo " uavobjects_gcs - Generate groundstation source files from the UAVObject definition XML files"
@echo " uavobjects_python - Generate python source files from the UAVObject definition XML files"
@echo " uavobjects_matlab - Generate matlab source files from the UAVObject definition XML files"
@echo " uavobjects - Generate source files from the UAVObject definition XML files"
@echo " uavobjects_test - parse xml-files - check for valid, duplicate ObjId's, ... "
@echo " uavobjects_<group> - Generate source files from a subset of the UAVObject definition XML files"
@echo " supported groups are ($(UAVOBJ_TARGETS))"
@echo
@echo " Note: All tools will be installed into $(TOOLS_DIR)"
@echo " All build output will be placed in $(BUILD_DIR)"
@ -221,14 +258,15 @@ endif
all_ground: openpilotgcs
# Convenience target for the GCS
.PHONY: gcs
.PHONY: gcs gcs_clean
gcs: openpilotgcs
gcs_clean: openpilotgcs_clean
.PHONY: openpilotgcs
openpilotgcs: uavobjects_gcs
$(V1) mkdir -p $(BUILD_DIR)/ground/$@
$(V1) ( cd $(BUILD_DIR)/ground/$@ ; \
$(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro -spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) ; \
$(V1) ( cd $(BUILD_DIR)/ground/$@ && \
$(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro -spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) && \
$(MAKE) -w ; \
)
@ -244,16 +282,22 @@ else
$(error $@ is currently only available on Windows)
endif
.PHONY: openpilotgcs_clean
openpilotgcs_clean:
$(V0) @echo " CLEAN $@"
$(V1) [ ! -d "$(BUILD_DIR)/ground/openpilotgcs" ] || $(RM) -r "$(BUILD_DIR)/ground/openpilotgcs"
.PHONY: uavobjgenerator
uavobjgenerator:
$(V1) mkdir -p $(BUILD_DIR)/ground/$@
$(V1) ( cd $(BUILD_DIR)/ground/$@ ; \
$(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro -spec $(QT_SPEC) -r CONFIG+=debug ; \
$(V1) ( cd $(BUILD_DIR)/ground/$@ && \
$(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro -spec $(QT_SPEC) -r CONFIG+=debug && \
$(MAKE) --no-print-directory -w ; \
)
UAVOBJ_TARGETS := gcs flight python matlab java
.PHONY:uavobjects
uavobjects: uavobjects_gcs uavobjects_flight uavobjects_python uavobjects_matlab uavobjects_java
uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS))
UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition
UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics
@ -262,7 +306,7 @@ $(UAVOBJ_OUT_DIR):
$(V1) mkdir -p $@
uavobjects_%: $(UAVOBJ_OUT_DIR) uavobjgenerator
$(V1) ( cd $(UAVOBJ_OUT_DIR) ; \
$(V1) ( cd $(UAVOBJ_OUT_DIR) && \
$(UAVOBJGENERATOR) -$* $(UAVOBJ_XML_DIR) $(ROOT_DIR) ; \
)
@ -270,6 +314,7 @@ uavobjects_test: $(UAVOBJ_OUT_DIR) uavobjgenerator
$(V1) $(UAVOBJGENERATOR) -v -none $(UAVOBJ_XML_DIR) $(ROOT_DIR)
uavobjects_clean:
$(V0) @echo " CLEAN $@"
$(V1) [ ! -d "$(UAVOBJ_OUT_DIR)" ] || $(RM) -r "$(UAVOBJ_OUT_DIR)"
##############################
@ -278,27 +323,40 @@ uavobjects_clean:
#
##############################
FW_TARGETS := openpilot ahrs coptercontrol pipxtreme ins
BL_TARGETS := $(addprefix bl_, $(FW_TARGETS))
FW_TARGETS := openpilot ahrs coptercontrol pipxtreme ins
BL_TARGETS := $(addprefix bl_, $(FW_TARGETS))
BLUPD_TARGETS := $(addprefix blupd_, $(FW_TARGETS))
# FIXME: The INS build doesn't have a bootloader or bootloader
# updater yet so we need to filter them out to prevent errors.
BL_TARGETS := $(filter-out bl_ins, $(BL_TARGETS))
BLUPD_TARGETS := $(filter-out blupd_ins, $(BLUPD_TARGETS))
.PHONY: all_fw all_fw_clean
all_fw: $(addsuffix _bin, $(FW_TARGETS))
all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
.PHONY: all_bw all_bw_clean
all_bl: $(addsuffix _elf, $(BL_TARGETS))
.PHONY: all_bl all_bl_clean
all_bl: $(addsuffix _bin, $(BL_TARGETS))
all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
.PHONY: all_blupd all_blupd_clean
all_blupd: $(addsuffix _bin, $(BLUPD_TARGETS))
all_blupd_clean: $(addsuffix _clean, $(BLUPD_TARGETS))
.PHONY: all_flight all_flight_clean
all_flight: all_fw all_bl
all_flight_clean: all_fw_clean all_bl_clean
all_flight: all_fw all_bl all_blupd
all_flight_clean: all_fw_clean all_bl_clean all_blupd_clean
.PHONY: openpilot
openpilot: openpilot_bin
openpilot_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/openpilot/dep
$(V1) cd $(ROOT_DIR)/flight/OpenPilot && $(MAKE) -r --no-print-directory OUTDIR="$(BUILD_DIR)/openpilot" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
$(V1) cd $(ROOT_DIR)/flight/OpenPilot && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/openpilot" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: openpilot_clean
openpilot_clean:
@ -306,23 +364,47 @@ openpilot_clean:
$(V1) $(RM) -fr $(BUILD_DIR)/openpilot
.PHONY: bl_openpilot
bl_openpilot: bl_openpilot_elf
bl_openpilot: bl_openpilot_bin
bl_openpilot_bino: bl_openpilot_bin
bl_openpilot_%:
$(V1) mkdir -p $(BUILD_DIR)/bl_openpilot/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/OpenPilot && $(MAKE) -r --no-print-directory OUTDIR="$(BUILD_DIR)/bl_openpilot" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/OpenPilot && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/bl_openpilot" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: bl_openpilot_clean
bl_openpilot_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/bl_openpilot
.PHONY: blupd_openpilot
blupd_openpilot: blupd_openpilot_bin
blupd_openpilot_%: bl_openpilot_bino
$(V1) mkdir -p $(BUILD_DIR)/blupd_openpilot/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/BootloaderUpdater && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/blupd_openpilot" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
BOARD=STM3210E_OP MODEL=HD MODEL_SUFFIX=_OP \
BLOBJ=$(BUILD_DIR)/bl_openpilot/OpenPilot_BL.bin.o $*
.PHONY: blupd_openpilot_clean
blupd_openpilot_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/blupd_openpilot
.PHONY: ahrs
ahrs: ahrs_bin
ahrs_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/ahrs/dep
$(V1) cd $(ROOT_DIR)/flight/AHRS && $(MAKE) -r --no-print-directory OUTDIR="$(BUILD_DIR)/ahrs" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
$(V1) cd $(ROOT_DIR)/flight/AHRS && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/ahrs" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: ahrs_clean
ahrs_clean:
@ -330,23 +412,47 @@ ahrs_clean:
$(V1) $(RM) -fr $(BUILD_DIR)/ahrs
.PHONY: bl_ahrs
bl_ahrs: bl_ahrs_elf
bl_ahrs: bl_ahrs_bin
bl_ahrs_bino: bl_ahrs_bin
bl_ahrs_%:
$(V1) mkdir -p $(BUILD_DIR)/bl_ahrs/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/AHRS && $(MAKE) -r --no-print-directory OUTDIR="$(BUILD_DIR)/bl_ahrs" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/AHRS && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/bl_ahrs" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: bl_ahrs_clean
bl_ahrs_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/bl_ahrs
.PHONY: blupd_ahrs
blupd_ahrs: blupd_ahrs_bin
blupd_ahrs_%: bl_ahrs_bino bl_ahrs
$(V1) mkdir -p $(BUILD_DIR)/blupd_ahrs/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/BootloaderUpdater && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/blupd_ahrs" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
BOARD=STM32103CB_AHRS MODEL=MD \
BLOBJ=$(BUILD_DIR)/bl_ahrs/AHRS_BL.bin.o $*
.PHONY: blupd_ahrs_clean
blupd_ahrs_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/blupd_ahrs
.PHONY: coptercontrol
coptercontrol: coptercontrol_bin
coptercontrol_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/coptercontrol/dep
$(V1) cd $(ROOT_DIR)/flight/CopterControl && $(MAKE) -r --no-print-directory OUTDIR="$(BUILD_DIR)/coptercontrol" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
$(V1) cd $(ROOT_DIR)/flight/CopterControl && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/coptercontrol" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: coptercontrol_clean
coptercontrol_clean:
@ -354,23 +460,47 @@ coptercontrol_clean:
$(V1) $(RM) -fr $(BUILD_DIR)/coptercontrol
.PHONY: bl_coptercontrol
bl_coptercontrol: bl_coptercontrol_elf
bl_coptercontrol: bl_coptercontrol_bin
bl_coptercontrol_bino: bl_coptercontrol_bin
bl_coptercontrol_%:
$(V1) mkdir -p $(BUILD_DIR)/bl_coptercontrol/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/CopterControl && $(MAKE) -r --no-print-directory OUTDIR="$(BUILD_DIR)/bl_coptercontrol" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/CopterControl && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/bl_coptercontrol" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: bl_coptercontrol_clean
bl_coptercontrol_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/bl_coptercontrol
.PHONY: blupd_coptercontrol
blupd_coptercontrol: blupd_coptercontrol_bin
blupd_coptercontrol_%: bl_coptercontrol_bino
$(V1) mkdir -p $(BUILD_DIR)/blupd_coptercontrol/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/BootloaderUpdater && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/blupd_coptercontrol" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
BOARD=STM32103CB_CC_Rev1 MODEL=MD MODEL_SUFFIX=_CC \
BLOBJ=$(BUILD_DIR)/bl_coptercontrol/CopterControl_BL.bin.o $*
.PHONY: blupd_coptercontrol_clean
blupd_coptercontrol_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/blupd_coptercontrol
.PHONY: pipxtreme
pipxtreme: pipxtreme_bin
pipxtreme_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/pipxtreme/dep
$(V1) cd $(ROOT_DIR)/flight/PipXtreme && $(MAKE) -r --no-print-directory OUTDIR="$(BUILD_DIR)/pipxtreme" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
$(V1) cd $(ROOT_DIR)/flight/PipXtreme && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/pipxtreme" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: pipxtreme_clean
pipxtreme_clean:
@ -378,23 +508,48 @@ pipxtreme_clean:
$(V1) $(RM) -fr $(BUILD_DIR)/pipxtreme
.PHONY: bl_pipxtreme
bl_pipxtreme: bl_pipxtreme_elf
bl_pipxtreme: bl_pipxtreme_bin
bl_pipxtreme_bino: bl_pipxtreme_bin
bl_pipxtreme_%:
$(V1) mkdir -p $(BUILD_DIR)/bl_pipxtreme/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/PipXtreme && $(MAKE) -r --no-print-directory OUTDIR="$(BUILD_DIR)/bl_pipxtreme" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/PipXtreme && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/bl_pipxtreme" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: bl_pipxtreme_clean
bl_pipxtreme_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/bl_pipxtreme
.PHONY: blupd_pipxtreme
blupd_pipxtreme: blupd_pipxtreme_bin
blupd_pipxtreme_%: bl_pipxtreme_bino
$(V1) mkdir -p $(BUILD_DIR)/blupd_pipxtreme/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/BootloaderUpdater && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/blupd_pipxtreme" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
BOARD=STM32103CB_PIPXTREME MODEL=MD MODEL_SUFFIX=_CC \
BLOBJ=$(BUILD_DIR)/bl_pipxtreme/PipXtreme_BL.bin.o $*
.PHONY: blupd_pipxtreme_clean
blupd_pipxtreme_clean:
$(V0) @echo " CLEAN $@"
$(V1) $(RM) -fr $(BUILD_DIR)/blupd_pipxtreme
.PHONY: ins
ins: ins_bin
ins_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/ins/dep
$(V1) cd $(ROOT_DIR)/flight/INS && $(MAKE) -r --no-print-directory OUTDIR="$(BUILD_DIR)/ins" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
$(V1) cd $(ROOT_DIR)/flight/INS && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/ins" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: ins_clean
ins_clean:
@ -406,7 +561,10 @@ bl_ins: bl_ins_elf
bl_ins_%:
$(V1) mkdir -p $(BUILD_DIR)/bl_ins/dep
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/INS && $(MAKE) -r --no-print-directory OUTDIR="$(BUILD_DIR)/bl_ins" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/INS && \
$(MAKE) -r --no-print-directory \
OUTDIR="$(BUILD_DIR)/bl_ins" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" $*
.PHONY: bl_ins_clean
bl_ins_clean:
@ -419,11 +577,13 @@ sim_posix: sim_posix_elf
sim_posix_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/sitl_posix
$(V1) $(MAKE) --no-print-directory -C $(ROOT_DIR)/flight/OpenPilot --file=$(ROOT_DIR)/flight/OpenPilot/Makefile.posix $*
$(V1) $(MAKE) --no-print-directory \
-C $(ROOT_DIR)/flight/OpenPilot --file=$(ROOT_DIR)/flight/OpenPilot/Makefile.posix $*
.PHONY: sim_win32
sim_win32: sim_win32_exe
sim_win32_%: uavobjects_flight
$(V1) mkdir -p $(BUILD_DIR)/sitl_win32
$(V1) $(MAKE) --no-print-directory -C $(ROOT_DIR)/flight/OpenPilot --file=$(ROOT_DIR)/flight/OpenPilot/Makefile.win32 $*
$(V1) $(MAKE) --no-print-directory \
-C $(ROOT_DIR)/flight/OpenPilot --file=$(ROOT_DIR)/flight/OpenPilot/Makefile.win32 $*

View File

@ -14,7 +14,7 @@
height="80.827866"
id="svg10068"
version="1.1"
inkscape:version="0.47 r22583"
inkscape:version="0.48.0 r9654"
sodipodi:docname="arm-status.svg"
inkscape:export-filename="H:\Documents\Hobbies\W433\My Gauges\vbat-001.png"
inkscape:export-xdpi="103.61"
@ -828,6 +828,402 @@
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 24 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
id="linearGradient5128-3">
<stop
offset="0"
style="stop-color:#e5e5e5;stop-opacity:1"
id="stop5130-1" />
<stop
offset="1"
style="stop-color:#ababab;stop-opacity:1"
id="stop5132-1" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.09614231,0,0,0.09614231,1.8468935,1.9430362)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5128-3"
id="linearGradient3260"
y2="20.895"
x2="84.63858"
y1="105.105"
x1="86.132919" />
<linearGradient
id="linearGradient3397-90">
<stop
offset="0"
style="stop-color:#aaaaaa;stop-opacity:1"
id="stop3399-8" />
<stop
offset="1"
style="stop-color:#8c8c8c;stop-opacity:1"
id="stop3401-1" />
</linearGradient>
<linearGradient
gradientTransform="translate(-17.058189,0)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3397-90"
id="linearGradient3264"
y2="16.004715"
x2="21"
y1="0"
x1="21" />
<linearGradient
gradientUnits="userSpaceOnUse"
id="linearGradient3309-6"
y2="122.8994"
x2="63.9995"
y1="3.1001"
x1="63.9995">
<stop
offset="0"
style="stop-color:#f6f6f6;stop-opacity:1"
id="stop3311-2" />
<stop
offset="1"
style="stop-color:#cccccc;stop-opacity:1"
id="stop3313-9" />
</linearGradient>
<linearGradient
gradientTransform="translate(-17.058189,0)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3309-6"
id="linearGradient3262"
y2="16.000105"
x2="25"
y1="0"
x1="25" />
<linearGradient
id="linearGradient5128-6">
<stop
offset="0"
style="stop-color:#eeeeee;stop-opacity:1"
id="stop5130-43" />
<stop
offset="1"
style="stop-color:#a2a2a2;stop-opacity:1"
id="stop5132-0" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.1562313,0,0,0.1562313,2.0012016,2.1574324)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5128-6"
id="linearGradient3241"
y2="20.895"
x2="84.63858"
y1="105.105"
x1="86.132919" />
<linearGradient
id="linearGradient3397-9">
<stop
offset="0"
style="stop-color:#aaaaaa;stop-opacity:1"
id="stop3399-7" />
<stop
offset="1"
style="stop-color:#8c8c8c;stop-opacity:1"
id="stop3401-7" />
</linearGradient>
<linearGradient
gradientTransform="translate(-24.5,0)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3397-9"
id="linearGradient3228"
y2="23.019524"
x2="40"
y1="1"
x1="40" />
<linearGradient
gradientUnits="userSpaceOnUse"
id="linearGradient3309-4"
y2="122.8994"
x2="63.9995"
y1="3.1001"
x1="63.9995">
<stop
offset="0"
style="stop-color:#f6f6f6;stop-opacity:1"
id="stop3311-8" />
<stop
offset="1"
style="stop-color:#d2d2d2;stop-opacity:1"
id="stop3313-88" />
</linearGradient>
<linearGradient
gradientTransform="translate(-24.5,0)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3309-4"
id="linearGradient3218"
y2="23.00024"
x2="34"
y1="1"
x1="34" />
<linearGradient
id="linearGradient10691-8">
<stop
offset="0"
style="stop-color:#000000;stop-opacity:1"
id="stop10693-6" />
<stop
offset="1"
style="stop-color:#000000;stop-opacity:0"
id="stop10695-0" />
</linearGradient>
<radialGradient
gradientTransform="matrix(1.660115,0,0,0.3458573,0.8727276,-3.9605294)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient10691-8"
id="radialGradient2411"
fy="73.615715"
fx="6.702713"
r="7.228416"
cy="73.615715"
cx="6.702713" />
<linearGradient
gradientTransform="matrix(0.2014014,0,0,0.2014015,3.1103045,3.311705)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5128-0"
id="linearGradient2868"
y2="20.895"
x2="84.63858"
y1="105.105"
x1="86.132919" />
<linearGradient
id="linearGradient5128-0">
<stop
offset="0"
style="stop-color:#ffffff;stop-opacity:1"
id="stop5130-4" />
<stop
offset="1"
style="stop-color:#959595;stop-opacity:1"
id="stop5132-4" />
</linearGradient>
<linearGradient
id="linearGradient3397-1">
<stop
offset="0"
style="stop-color:#aaaaaa;stop-opacity:1"
id="stop3399-0" />
<stop
offset="1"
style="stop-color:#8c8c8c;stop-opacity:1"
id="stop3401-3" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.93928017,0.34315123,-0.34315123,0.93928017,-1.7936946,-25.633934)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3397-1"
id="linearGradient3328"
y2="47.044857"
x2="25.922546"
y1="19"
x1="25.922546" />
<linearGradient
gradientUnits="userSpaceOnUse"
id="linearGradient3309-8"
y2="122.8994"
x2="63.9995"
y1="3.1001"
x1="63.9995">
<stop
offset="0"
style="stop-color:#f6f6f6;stop-opacity:1"
id="stop3311-4" />
<stop
offset="1"
style="stop-color:#d2d2d2;stop-opacity:1"
id="stop3313-8" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.93928017,0.34315123,-0.34315123,0.93928017,-1.7936946,-25.633934)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3309-8"
id="linearGradient3326"
y2="47.012184"
x2="32.036148"
y1="19"
x1="32.036148" />
<linearGradient
id="linearGradient10691">
<stop
offset="0"
style="stop-color:#000000;stop-opacity:1"
id="stop10693" />
<stop
offset="1"
style="stop-color:#000000;stop-opacity:0"
id="stop10695" />
</linearGradient>
<radialGradient
gradientTransform="matrix(2.2134617,0,0,0.4842001,1.1638028,-7.1447362)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient10691"
id="radialGradient2538"
fy="73.615715"
fx="6.702713"
r="7.228416"
cy="73.615715"
cx="6.702713" />
<linearGradient
gradientTransform="matrix(0.3244803,0,0,0.3244803,3.2332655,2.5577454)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5128"
id="linearGradient2512"
y2="20.895"
x2="84.63858"
y1="105.105"
x1="86.132919" />
<linearGradient
id="linearGradient5128">
<stop
offset="0"
style="stop-color:#e5e5e5;stop-opacity:1"
id="stop5130" />
<stop
offset="1"
style="stop-color:#ababab;stop-opacity:1"
id="stop5132" />
</linearGradient>
<linearGradient
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3309"
id="linearGradient2515"
y2="45.017357"
x2="20.758585"
y1="1"
x1="20.758585" />
<linearGradient
gradientUnits="userSpaceOnUse"
id="linearGradient3309"
y2="122.8994"
x2="63.9995"
y1="3.1001"
x1="63.9995">
<stop
offset="0"
style="stop-color:#f6f6f6;stop-opacity:1"
id="stop3311" />
<stop
offset="1"
style="stop-color:#d2d2d2;stop-opacity:1"
id="stop3313" />
</linearGradient>
<linearGradient
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3397"
id="linearGradient2517"
y2="45"
x2="37.201294"
y1="1"
x1="37.201294" />
<linearGradient
id="linearGradient3397">
<stop
offset="0"
style="stop-color:#aaaaaa;stop-opacity:1"
id="stop3399" />
<stop
offset="1"
style="stop-color:#8c8c8c;stop-opacity:1"
id="stop3401" />
</linearGradient>
<radialGradient
gradientTransform="matrix(2.1647059,0,0,0.7529402,-111.56471,36.517647)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient8838-9"
id="radialGradient2436-5"
fy="4.625"
fx="62.625"
r="10.625"
cy="4.625"
cx="62.625" />
<linearGradient
id="linearGradient8838-9">
<stop
offset="0"
style="stop-color:#000000;stop-opacity:1"
id="stop8840-7" />
<stop
offset="1"
style="stop-color:#000000;stop-opacity:0"
id="stop8842-8" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.93928017,0.34315123,-0.34315123,0.93928017,-1.7936946,-25.633934)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3309-8-1"
id="linearGradient3326-4"
y2="47.012184"
x2="32.036148"
y1="19"
x1="32.036148" />
<linearGradient
gradientUnits="userSpaceOnUse"
id="linearGradient3309-8-1"
y2="122.8994"
x2="63.9995"
y1="3.1001"
x1="63.9995">
<stop
offset="0"
style="stop-color:#f6f6f6;stop-opacity:1"
id="stop3311-4-5" />
<stop
offset="1"
style="stop-color:#d2d2d2;stop-opacity:1"
id="stop3313-8-5" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.93928017,0.34315123,-0.34315123,0.93928017,-1.7936946,-25.633934)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3397-1-9"
id="linearGradient3328-4"
y2="47.044857"
x2="25.922546"
y1="19"
x1="25.922546" />
<linearGradient
id="linearGradient3397-1-9">
<stop
offset="0"
style="stop-color:#aaaaaa;stop-opacity:1"
id="stop3399-0-8" />
<stop
offset="1"
style="stop-color:#8c8c8c;stop-opacity:1"
id="stop3401-3-3" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.2014014,0,0,0.2014015,3.1103045,3.311705)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5128-0-5"
id="linearGradient2868-8"
y2="20.895"
x2="84.63858"
y1="105.105"
x1="86.132919" />
<linearGradient
id="linearGradient5128-0-5">
<stop
offset="0"
style="stop-color:#ffffff;stop-opacity:1"
id="stop5130-4-2" />
<stop
offset="1"
style="stop-color:#959595;stop-opacity:1"
id="stop5132-4-2" />
</linearGradient>
<linearGradient
y2="20.895"
x2="84.63858"
y1="105.105"
x1="86.132919"
gradientTransform="matrix(0.2014014,0,0,0.2014015,3.1103045,3.311705)"
gradientUnits="userSpaceOnUse"
id="linearGradient3339"
xlink:href="#linearGradient5128-0-5"
inkscape:collect="always" />
</defs>
<sodipodi:namedview
id="base"
@ -836,14 +1232,14 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="44.030427"
inkscape:cy="102.26308"
inkscape:zoom="1.979899"
inkscape:cx="69.908261"
inkscape:cy="99.737699"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:current-layer="background"
showgrid="false"
inkscape:window-width="1366"
inkscape:window-height="693"
inkscape:window-height="691"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
@ -861,7 +1257,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
<dc:creator>
<cc:Agent>
<dc:title>Edouard Lafargue</dc:title>
@ -977,7 +1373,7 @@
d="m 53.950159,30.352861 c 0,13.351915 -10.823865,24.17578 -24.175779,24.17578 -13.351915,0 -24.1757796,-10.823865 -24.1757796,-24.17578 0,-13.351914 10.8238646,-24.1757789 24.1757796,-24.1757789 13.351914,0 24.175779,10.8238649 24.175779,24.1757789 z" />
</g>
<g
id="symbol-False"
id="symbol-Disarmed"
transform="translate(173.85714,-69.957837)"
inkscape:label="#layer1-6">
<path
@ -998,7 +1394,7 @@
d="M 17.049914,14.239243 33.752151,33.92599" />
</g>
<g
id="symbol-True"
id="symbol-Armed"
transform="translate(92.42857,-72.302217)"
inkscape:label="#layer1-0">
<path
@ -1015,5 +1411,26 @@
id="path1544"
d="M 32.938536,7.2012775 26.730268,18.60791 21.197213,28.668822 c -0.178482,0.181096 -0.123845,0.754094 -0.902701,0.952966 -0.538869,0.137595 -0.636352,-0.06289 -1.204172,-0.427914 l -6.950556,-5.492153 c -0.7733,-0.621665 -0.749753,-0.589365 -1.297288,-0.03737 L 8.0515824,27.18582 c -0.7518117,0.804672 -0.6353589,1.290849 0.3017539,1.891047 0,0 13.0781537,10.780055 13.0949407,10.788373 0.155564,0.085 0.0892,0.114145 0.757862,0.57814 0.428927,0.297637 0.807539,-0.647982 1.083435,-1.15286 L 39.190779,10.274963 C 39.55113,9.6155282 39.523767,9.624421 38.860008,9.2617466 L 34.11801,6.7472827 C 33.434075,6.3758505 33.430508,6.3800895 32.938536,7.2012775 z" />
</g>
<g
style="display:inline"
id="symbol-Arming"
transform="matrix(1.2857213,0,0,1.2857213,18.29593,-68.120293)"
inkscape:label="#layer1-33">
<path
style="fill:url(#linearGradient3326-4);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3328-4);stroke-width:0.77777356;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible;enable-background:accumulate"
id="rect2576"
d="m 18.636572,2.5905216 c -0.703275,-0.2569307 -1.495689,0.08705 -1.752619,0.7903248 l -0.600515,1.6437399 c -0.499176,-0.013219 -0.993955,0.00248 -1.484533,0.056512 L 14.072373,3.5181351 C 13.756758,2.8391668 12.960838,2.5483897 12.28187,2.864003 L 8.3651471,4.6602954 C 7.6861782,4.9759083 7.3954033,5.7718319 7.7110151,6.4507982 l 0.726532,1.5629636 C 8.0724464,8.359396 7.744193,8.7441155 7.4266456,9.141602 L 5.8122578,8.5518108 C 5.1089821,8.2948801 4.3165666,8.6388602 4.0596381,9.3421356 L 2.5797984,13.392781 c -0.2569313,0.703275 0.1271272,1.477063 0.8304007,1.733991 l 1.6143878,0.589791 c -0.013469,0.508577 -0.010523,1.014295 0.045789,1.513885 l -1.5629633,0.726533 c -0.6789688,0.315613 -0.9697472,1.111534 -0.654132,1.790502 l 1.8363684,3.898094 c 0.3156123,0.678968 1.1115366,0.969744 1.7905029,0.654132 l 1.5629636,-0.726532 c 0.3402133,0.357549 0.7083491,0.688501 1.0984877,1.000178 l -0.6005147,1.64374 c -0.2569313,0.703275 0.1271291,1.477064 0.8304008,1.733991 l 4.0212927,1.469116 c 0.703276,0.256931 1.466338,-0.09777 1.723267,-0.801048 l 0.600515,-1.64374 c 0.508577,0.01347 1.014295,0.01052 1.513885,-0.04579 l 0.726532,1.562963 c 0.315614,0.678968 1.111534,0.969745 1.790502,0.654132 l 3.916723,-1.796292 c 0.678969,-0.315613 0.969742,-1.111538 0.654132,-1.790503 l -0.745161,-1.603039 c 0.357549,-0.340214 0.6885,-0.708349 1.000178,-1.098488 l 1.64374,0.600515 c 0.703276,0.25693 1.466338,-0.09778 1.723267,-0.801049 l 1.47984,-4.050645 c 0.256931,-0.703275 -0.09778,-1.466339 -0.801048,-1.723268 l -1.64374,-0.600514 c 0.01322,-0.499176 -0.0025,-0.993955 -0.05651,-1.484533 l 1.60304,-0.745162 C 29.20091,13.73813 29.491686,12.942208 29.176073,12.26324 L 27.339704,8.365146 C 27.024092,7.6861784 26.228168,7.3954 25.549202,7.711014 L 23.986239,8.4375465 C 23.640605,8.0724458 23.255886,7.7441924 22.858399,7.4266449 L 23.458914,5.782905 C 23.715845,5.0796306 23.361136,4.3165668 22.657865,4.0596378 L 18.636572,2.5905216 z M 17.20103,12.71252 c 1.81469,0.662968 2.74942,2.67382 2.086452,4.48851 -0.662969,1.814689 -2.673821,2.749419 -4.48851,2.086451 -1.814691,-0.662969 -2.74942,-2.673821 -2.086452,-4.48851 0.662968,-1.81469 2.673821,-2.74942 4.48851,-2.086451 z"
inkscape:connector-curvature="0" />
<path
style="opacity:0.05;fill:#000000;fill-opacity:1;stroke:none"
id="path3315"
d="m 16.000001,7.9999996 c -4.411273,0 -7.9999985,3.5887274 -7.9999985,8.0000004 0,4.411274 3.5887255,8 7.9999985,8 C 20.411274,24 24,20.411274 24,16 24,11.588727 20.411274,7.9999996 16.000001,7.9999996 z m 0,3.6923094 c 2.377844,0 4.307693,1.929846 4.307693,4.307691 0,2.377847 -1.929849,4.307693 -4.307693,4.307693 -2.377846,0 -4.307691,-1.929846 -4.307691,-4.307693 0,-2.377845 1.929845,-4.307691 4.307691,-4.307691 z"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:url(#linearGradient3339);stroke-width:0.77777356;stroke-miterlimit:4;stroke-dasharray:none"
id="path28"
d="m 16.000001,7.6206906 c -4.620353,0 -8.3793085,3.7589574 -8.3793085,8.3793084 0,4.620352 3.7589555,8.37931 8.3793085,8.37931 4.620353,0 8.379309,-3.758958 8.379309,-8.37931 0,-4.620351 -3.758956,-8.3793084 -8.379309,-8.3793084 z"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -0,0 +1 @@
Those icons come from the Tango set and are used in the GCS.

View File

@ -0,0 +1,443 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 9.0, SVG Export Plug-In -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docbase="/home/jimmac/gfx/ximian/tango-icon-theme/scalable/mimetypes"
sodipodi:docname="application-certificate.svg"
inkscape:version="0.46"
sodipodi:version="0.32"
id="svg5105"
xml:space="preserve"
viewBox="0 0 48 48"
height="48.000000px"
width="48.000000px"
inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
id="metadata5189">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Certificate</dc:title><dc:creator><cc:Agent><dc:title>Jakub Steiner</dc:title></cc:Agent></dc:creator><dc:subject><rdf:Bag><rdf:li>certificate</rdf:li></rdf:Bag></dc:subject><cc:license
rdf:resource="http://creativecommons.org/licenses/publicdomain/" /></cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/publicdomain/"><cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" /><cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" /><cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /></cc:License></rdf:RDF>
</metadata>
<defs
id="defs5187"><inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 24 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="48 : 24 : 1"
inkscape:persp3d-origin="24 : 16 : 1"
id="perspective54" /><linearGradient
id="linearGradient6684">
<stop
id="stop6686"
offset="0.0000000"
style="stop-color:#d5dbff;stop-opacity:1.0000000;" />
<stop
id="stop6688"
offset="1"
style="stop-color:#6579ff;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient6665">
<stop
style="stop-color:#000000;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop6667" />
<stop
style="stop-color:#000000;stop-opacity:0.0000000;"
offset="1.0000000"
id="stop6669" />
</linearGradient>
<linearGradient
id="linearGradient6625">
<stop
id="stop6627"
offset="0.0000000"
style="stop-color:#1d2349;stop-opacity:1.0000000;" />
<stop
style="stop-color:#4c5279;stop-opacity:1.0000000;"
offset="0.35315102"
id="stop6637" />
<stop
style="stop-color:#b3bdff;stop-opacity:1.0000000;"
offset="0.46551725"
id="stop6633" />
<stop
id="stop6635"
offset="0.64982164"
style="stop-color:#727cbe;stop-opacity:1.0000000;" />
<stop
id="stop6629"
offset="1.0000000"
style="stop-color:#323c7e;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
id="linearGradient6617">
<stop
id="stop6619"
offset="0.0000000"
style="stop-color:#ffffff;stop-opacity:0.24742268;" />
<stop
id="stop6621"
offset="1"
style="stop-color:#ffffff;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient6604">
<stop
id="stop6606"
offset="0.0000000"
style="stop-color:#ffa196;stop-opacity:1.0000000;" />
<stop
id="stop6608"
offset="1"
style="stop-color:#ff1f06;stop-opacity:0;" />
</linearGradient>
<radialGradient
r="13.2807"
fy="20.9712"
fx="28.7891"
cy="20.9712"
cx="28.7891"
gradientUnits="userSpaceOnUse"
id="radialGradient5199"
xlink:href="#aigrd1"
inkscape:collect="always" />
<radialGradient
r="14.6944"
fy="13.5444"
fx="19.292"
cy="13.5444"
cx="19.292"
gradientUnits="userSpaceOnUse"
id="radialGradient5201"
xlink:href="#aigrd2"
inkscape:collect="always" />
<linearGradient
y2="16.7231"
x2="23.412"
y1="11.5991"
x1="18.229"
gradientUnits="userSpaceOnUse"
id="linearGradient5203"
xlink:href="#aigrd3"
inkscape:collect="always" />
<radialGradient
gradientUnits="userSpaceOnUse"
fy="20.971201"
fx="28.789101"
r="13.280700"
cy="20.971201"
cx="28.789101"
id="aigrd1">
<stop
id="stop5115"
style="stop-color:#E41E08"
offset="0" />
<stop
id="stop5117"
style="stop-color:#901505"
offset="1" />
</radialGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
fy="13.544400"
fx="19.292000"
r="14.694400"
cy="13.544400"
cx="19.292000"
id="aigrd2">
<stop
id="stop5122"
style="stop-color:#E41E08"
offset="0" />
<stop
id="stop5124"
style="stop-color:#901505"
offset="1" />
</radialGradient>
<linearGradient
y2="16.723101"
x2="23.412001"
y1="11.599100"
x1="18.229000"
gradientUnits="userSpaceOnUse"
id="aigrd3">
<stop
id="stop5137"
style="stop-color:#FFFFFF"
offset="0" />
<stop
id="stop5139"
style="stop-color:#901505"
offset="1" />
</linearGradient>
<linearGradient
gradientTransform="matrix(1.135551,0.000000,0.000000,1.135551,-3.259995,-3.266773)"
y2="16.7231"
x2="23.412"
y1="11.5991"
x1="18.229"
gradientUnits="userSpaceOnUse"
id="linearGradient5274"
xlink:href="#aigrd3"
inkscape:collect="always" />
<radialGradient
gradientTransform="matrix(1.135551,0.000000,0.000000,1.135551,-4.540325,-2.077433)"
r="14.6944"
fy="13.5444"
fx="19.292"
cy="13.5444"
cx="19.292"
gradientUnits="userSpaceOnUse"
id="radialGradient5281"
xlink:href="#aigrd2"
inkscape:collect="always" />
<radialGradient
gradientTransform="matrix(1.310386,0.000000,0.000000,1.310386,-8.642682,-4.375977)"
r="13.2807"
fy="20.9712"
fx="28.7891"
cy="20.9712"
cx="28.7891"
gradientUnits="userSpaceOnUse"
id="radialGradient5284"
xlink:href="#aigrd1"
inkscape:collect="always" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="49.895073"
x2="43.140980"
y1="5.9244628"
x1="15.338736"
gradientTransform="matrix(0.975728,0.000000,0.000000,0.931033,-0.132002,1.978392)"
id="linearGradient6610"
xlink:href="#linearGradient6604"
inkscape:collect="always" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="22.783224"
x2="29.957399"
y1="9.4436626"
x1="18.570419"
gradientTransform="matrix(1.028670,0.000000,0.000000,0.972129,-1.280330,1.189340)"
id="linearGradient6623"
xlink:href="#linearGradient6617"
inkscape:collect="always" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="35.017860"
x2="38.250904"
y1="22.886259"
x1="38.506161"
gradientTransform="matrix(0.843938,0.000000,0.000000,1.184922,-1.280330,1.689340)"
id="linearGradient6631"
xlink:href="#linearGradient6625"
inkscape:collect="always" />
<radialGradient
gradientUnits="userSpaceOnUse"
r="33.156136"
fy="19.818913"
fx="24.452202"
cy="19.818913"
cx="24.452202"
gradientTransform="matrix(1.024478,0.000000,0.000000,0.976107,0.939339,-0.530329)"
id="radialGradient6663"
xlink:href="#linearGradient6665"
inkscape:collect="always" />
<radialGradient
r="33.156136"
fy="19.818913"
fx="24.452202"
cy="19.818913"
cx="24.452202"
gradientTransform="matrix(1.024478,0.000000,0.000000,0.976107,1.646447,-0.353552)"
gradientUnits="userSpaceOnUse"
id="radialGradient6675"
xlink:href="#linearGradient6665"
inkscape:collect="always" />
<radialGradient
r="14.6944"
fy="20.479359"
fx="26.887432"
cy="20.479359"
cx="26.887432"
gradientTransform="matrix(1.135551,0.000000,0.000000,1.135551,-4.540325,-2.077433)"
gradientUnits="userSpaceOnUse"
id="radialGradient6678"
xlink:href="#aigrd2"
inkscape:collect="always" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="27.403761"
x2="36.499001"
y1="35.458244"
x1="37.502811"
gradientTransform="scale(0.843938,1.184922)"
id="linearGradient6690"
xlink:href="#linearGradient6684"
inkscape:collect="always" />
</defs>
<sodipodi:namedview
inkscape:current-layer="svg5105"
inkscape:window-y="30"
inkscape:window-x="203"
inkscape:cy="20.392013"
inkscape:cx="20.303269"
inkscape:zoom="5.6568542"
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="0.16470588"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:window-width="821"
inkscape:window-height="818"
inkscape:showpageshadow="false"
showgrid="false" />
<path
style="opacity:0.48044690;color:#000000;fill:url(#radialGradient6675);fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible"
d="M 25.389110,19.305038 C 25.389110,19.305038 19.484245,27.481005 19.484245,31.228324 C 19.484245,34.975642 26.297551,32.931650 29.022873,35.656973 C 31.748195,38.382295 22.663787,45.422711 22.663787,45.422711 L 31.748195,42.924499 L 35.381959,46.785372 C 35.381959,42.129613 40.719048,38.382295 37.993726,35.543418 C 35.154848,32.704540 27.092436,33.045205 26.638216,29.297887 C 26.183995,25.550569 25.502665,19.418593 25.502665,19.418593 L 25.389110,19.305038 z "
id="path6671" />
<path
style="opacity:0.48044690;fill:url(#radialGradient6663);fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
d="M 36.916160,9.3946518 C 38.237688,12.452028 40.559293,12.296470 40.616709,16.377167 C 40.649454,18.652929 42.449165,19.847910 42.449165,22.172684 C 42.449165,24.497457 38.434150,25.646156 37.066636,27.013668 C 35.699121,28.381184 37.174521,31.888095 33.464606,32.918627 C 29.789944,33.939367 27.994548,32.508375 25.669774,32.508375 C 23.344998,32.508375 17.781956,36.991063 15.730683,34.939790 C 13.679411,32.888519 13.635647,28.405831 11.857879,26.628063 C 9.9433579,24.713542 6.9184435,22.038663 6.9184435,18.619877 C 6.9184435,15.201092 8.8926489,13.396291 11.721128,10.217892 C 14.639403,6.9385873 14.729659,2.0128046 18.148445,2.0128046 C 21.567230,2.0128046 22.877627,2.9506145 25.787409,2.8770766 C 30.425746,2.7598534 30.994149,0.55375463 34.405481,2.2835766 C 37.413183,3.8087260 35.881638,7.0012699 36.916160,9.3946518 z "
id="path6639"
sodipodi:nodetypes="csssssssssssss" />
<path
id="path5112"
d="M 23.621340,18.067599 C 23.621340,18.067599 17.716475,26.243566 17.716475,29.990885 C 17.716475,33.738203 24.529781,31.694211 27.255103,34.419534 C 29.980425,37.144856 20.896017,44.185272 20.896017,44.185272 L 29.980425,41.687060 L 33.614189,45.547933 C 33.614189,40.892174 38.951278,37.144856 36.225956,34.305979 C 33.387078,31.467101 25.324666,31.807766 24.870446,28.060448 C 24.416225,24.313130 23.734895,18.181154 23.734895,18.181154 L 23.621340,18.067599 z "
style="stroke-opacity:1.0000000;stroke-miterlimit:6.5999999;stroke-width:1.0000000;stroke:#1f254f;fill-rule:nonzero;fill-opacity:1.0000000;fill:url(#linearGradient6631)" />
<path
sodipodi:nodetypes="cscccsss"
style="fill:none;fill-opacity:1.0000000;fill-rule:nonzero;stroke:url(#linearGradient6690);stroke-width:0.72112519;stroke-miterlimit:6.5999999;stroke-opacity:1.0000000"
d="M 20.803213,31.602421 C 25.355213,32.050805 28.232227,32.837946 28.609835,35.591528 C 28.939949,37.998767 24.377692,42.324487 24.377692,42.324487 L 30.221580,40.699741 L 33.062950,43.660691 C 33.725862,39.949751 37.427758,37.438687 35.741856,35.156087 C 33.627168,32.292939 26.775807,32.912620 26.448257,30.210335 C 26.120707,27.508049 18.114196,31.334950 20.803213,31.602421 z "
id="path6680" />
<path
sodipodi:nodetypes="csssssssssssss"
id="path5119"
d="M 34.935485,9.2468088 C 36.201806,12.176463 38.426426,12.027404 38.481444,15.937630 C 38.512821,18.118322 40.237349,19.263383 40.237349,21.491039 C 40.237349,23.718695 36.390061,24.819407 35.079675,26.129792 C 33.769288,27.440180 35.183053,30.800590 31.628119,31.788071 C 28.106966,32.766170 26.386573,31.394957 24.158916,31.394957 C 21.931258,31.394957 16.600611,35.690381 14.635030,33.724800 C 12.669450,31.759221 12.627514,27.463797 10.924012,25.760295 C 9.0894699,23.925753 6.1909207,21.362617 6.1909207,18.086651 C 6.1909207,14.810685 8.0826538,13.081280 10.792974,10.035658 C 13.589338,6.8933472 13.675824,2.1733389 16.951790,2.1733389 C 20.227756,2.1733389 21.483411,3.0719718 24.271637,3.0015059 C 28.716208,2.8891797 29.260866,0.77524063 32.529689,2.4327994 C 35.411745,3.8942357 33.944180,6.9534113 34.935485,9.2468088 z "
style="stroke-opacity:1.0000000;stroke-miterlimit:4.0000000;stroke-linejoin:round;stroke-linecap:round;stroke:#4c0901;fill-rule:nonzero;fill:url(#radialGradient5284)" />
<path
id="path5126"
d="M 34.976850,17.567599 C 34.976850,23.813130 29.866870,28.923109 23.621340,28.923109 C 17.375809,28.923109 12.265830,23.813130 12.265830,17.567599 C 12.265830,11.322069 17.375809,6.2120891 23.621340,6.2120891 C 29.866870,6.2120891 34.976850,11.322069 34.976850,17.567599 z "
style="stroke-miterlimit:4.0000000;stroke:none;fill-rule:nonzero;fill:url(#radialGradient6678)" />
<path
style="fill:none;fill-rule:nonzero;stroke:url(#linearGradient6610);stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
d="M 33.888971,10.030124 C 35.042232,12.698211 37.068232,12.562460 37.118338,16.123571 C 37.146913,18.109565 38.717470,19.152392 38.717470,21.181157 C 38.717470,23.209922 35.213679,24.212359 34.020288,25.405749 C 32.826895,26.599143 34.114436,29.659526 30.876896,30.558842 C 27.670121,31.449613 26.103329,30.200827 24.074563,30.200827 C 22.045797,30.200827 17.191084,34.112744 15.400995,32.322655 C 13.610908,30.532568 13.572716,26.620651 12.021307,25.069242 C 10.350558,23.398493 7.7107989,21.064201 7.7107989,18.080722 C 7.7107989,15.097243 9.4336334,13.522243 11.901968,10.748543 C 14.448666,7.8867861 14.527430,3.5881928 17.510909,3.5881928 C 20.494388,3.5881928 21.637935,4.4065934 24.177221,4.3424188 C 28.224968,4.2401214 28.720998,2.3149204 31.697971,3.8244879 C 34.322710,5.1554433 32.986173,7.9414875 33.888971,10.030124 z "
id="path6600"
sodipodi:nodetypes="csssssssssssss" />
<path
id="path6612"
d="M 23.663250,7.0524597 C 17.795434,7.0524597 13.016988,11.794692 13.016988,17.662510 C 13.016988,21.333503 15.000693,24.443138 17.833154,26.353336 C 25.073625,22.456374 23.786958,15.548148 33.440430,13.606789 C 31.841424,9.7576868 28.088842,7.0524597 23.663250,7.0524597 z "
style="color:#000000;fill:url(#linearGradient6623);fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible;opacity:1.0000000" />
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
width="48"
height="48"
id="svg2448">
<defs
id="defs2450">
<linearGradient
id="linearGradient8662">
<stop
id="stop8664"
style="stop-color:black;stop-opacity:1"
offset="0" />
<stop
id="stop8666"
style="stop-color:black;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="24.837126"
cy="36.421127"
r="15.644737"
fx="24.837126"
fy="36.421127"
id="radialGradient1444"
xlink:href="#linearGradient8662"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.536723,0,16.87306)" />
<linearGradient
id="linearGradient2264">
<stop
id="stop2266"
style="stop-color:#d7e866;stop-opacity:1"
offset="0" />
<stop
id="stop2268"
style="stop-color:#8cab2a;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="-84.343536"
y1="-5.3878593"
x2="-91.513138"
y2="24.558243"
id="linearGradient2628"
xlink:href="#linearGradient2264"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.017301,-0.243559,0.243559,1.017301,110.52469,-7.9553513)" />
<linearGradient
id="linearGradient3400">
<stop
id="stop3402"
style="stop-color:white;stop-opacity:1"
offset="0" />
<stop
id="stop3404"
style="stop-color:white;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="20.494444"
y1="6.0097799"
x2="20.494444"
y2="47.760197"
id="linearGradient3406"
xlink:href="#linearGradient3400"
gradientUnits="userSpaceOnUse" />
</defs>
<g
id="layer1">
<path
d="m 40.481863,36.421127 a 15.644737,8.3968938 0 1 1 -31.2894745,0 15.644737,8.3968938 0 1 1 31.2894745,0 z"
transform="matrix(1.214466,0,0,0.595458,-6.163846,20.31274)"
id="path8660"
style="opacity:0.20454544;color:black;fill:url(#radialGradient1444);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="m 33.706448,5.4818293 c -0.559734,-0.056806 -1.116221,0.217337 -1.403811,0.7436469 L 20.049307,28.645074 12.17121,22.380993 c -0.701747,-0.383453 -1.577286,-0.136769 -1.960742,0.564978 l -3.5328714,4.535744 c -0.3834475,0.701741 -0.1254891,1.577017 0.5762529,1.960469 0,0 14.3844195,11.880283 14.4021675,11.889074 0.164469,0.08987 0.336465,0.135093 0.511297,0.157184 0.571121,0.07217 1.155595,-0.196162 1.449176,-0.733433 L 40.141725,10.519399 C 40.525176,9.8176549 40.267222,8.9423801 39.565474,8.558928 L 34.26311,5.6492257 C 34.087671,5.553362 33.893026,5.5007637 33.706448,5.4818293 z"
id="path1542"
style="fill:url(#linearGradient2628);fill-opacity:1;fill-rule:nonzero;stroke:#42770c;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="M 32.938536,7.2012775 26.730268,18.60791 21.197213,28.668822 c -0.178482,0.181096 -0.123845,0.754094 -0.902701,0.952966 -0.538869,0.137595 -0.636352,-0.06289 -1.204172,-0.427914 l -6.950556,-5.492153 c -0.7733,-0.621665 -0.749753,-0.589365 -1.297288,-0.03737 L 8.0515824,27.18582 c -0.7518117,0.804672 -0.6353589,1.290849 0.3017539,1.891047 0,0 13.0781537,10.780055 13.0949407,10.788373 0.155564,0.085 0.0892,0.114145 0.757862,0.57814 0.428927,0.297637 0.807539,-0.647982 1.083435,-1.15286 L 39.190779,10.274963 C 39.55113,9.6155282 39.523767,9.624421 38.860008,9.2617466 L 34.11801,6.7472827 C 33.434075,6.3758505 33.430508,6.3800895 32.938536,7.2012775 z"
id="path1544"
style="opacity:0.4;fill:none;stroke:url(#linearGradient3406);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -0,0 +1,390 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.0"
width="48"
height="48"
id="svg2527">
<defs
id="defs2529">
<linearGradient
id="linearGradient8838">
<stop
id="stop8840"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop8842"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="62.625"
cy="4.625"
r="10.625"
fx="62.625"
fy="4.625"
id="radialGradient2436"
xlink:href="#linearGradient8838"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.1647059,0,0,0.7529402,-111.56471,36.517647)" />
<linearGradient
id="linearGradient3397">
<stop
id="stop3399"
style="stop-color:#aaaaaa;stop-opacity:1"
offset="0" />
<stop
id="stop3401"
style="stop-color:#8c8c8c;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="37.201294"
y1="1"
x2="37.201294"
y2="45"
id="linearGradient2517"
xlink:href="#linearGradient3397"
gradientUnits="userSpaceOnUse" />
<linearGradient
x1="63.9995"
y1="3.1001"
x2="63.9995"
y2="122.8994"
id="linearGradient3309"
gradientUnits="userSpaceOnUse">
<stop
id="stop3311"
style="stop-color:#f6f6f6;stop-opacity:1"
offset="0" />
<stop
id="stop3313"
style="stop-color:#d2d2d2;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="20.758585"
y1="1"
x2="20.758585"
y2="45.017357"
id="linearGradient2515"
xlink:href="#linearGradient3309"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient5128">
<stop
id="stop5130"
style="stop-color:#e5e5e5;stop-opacity:1"
offset="0" />
<stop
id="stop5132"
style="stop-color:#ababab;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="86.132919"
y1="105.105"
x2="84.63858"
y2="20.895"
id="linearGradient2512"
xlink:href="#linearGradient5128"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.3244803,0,0,0.3244803,3.2332655,2.5577454)" />
<radialGradient
cx="6.702713"
cy="73.615715"
r="7.228416"
fx="6.702713"
fy="73.615715"
id="radialGradient2538"
xlink:href="#linearGradient10691"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.2134617,0,0,0.4842001,1.1638028,-7.1447362)" />
<linearGradient
id="linearGradient10691">
<stop
id="stop10693"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop10695"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="32.036148"
y1="19"
x2="32.036148"
y2="47.012184"
id="linearGradient3326"
xlink:href="#linearGradient3309-8"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.93928017,0.34315123,-0.34315123,0.93928017,-1.7936946,-25.633934)" />
<linearGradient
x1="63.9995"
y1="3.1001"
x2="63.9995"
y2="122.8994"
id="linearGradient3309-8"
gradientUnits="userSpaceOnUse">
<stop
id="stop3311-4"
style="stop-color:#f6f6f6;stop-opacity:1"
offset="0" />
<stop
id="stop3313-8"
style="stop-color:#d2d2d2;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="25.922546"
y1="19"
x2="25.922546"
y2="47.044857"
id="linearGradient3328"
xlink:href="#linearGradient3397-1"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.93928017,0.34315123,-0.34315123,0.93928017,-1.7936946,-25.633934)" />
<linearGradient
id="linearGradient3397-1">
<stop
id="stop3399-0"
style="stop-color:#aaaaaa;stop-opacity:1"
offset="0" />
<stop
id="stop3401-3"
style="stop-color:#8c8c8c;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient5128-0">
<stop
id="stop5130-4"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop5132-4"
style="stop-color:#959595;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="86.132919"
y1="105.105"
x2="84.63858"
y2="20.895"
id="linearGradient2868"
xlink:href="#linearGradient5128-0"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.2014014,0,0,0.2014015,3.1103045,3.311705)" />
<radialGradient
cx="6.702713"
cy="73.615715"
r="7.228416"
fx="6.702713"
fy="73.615715"
id="radialGradient2411"
xlink:href="#linearGradient10691-8"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.660115,0,0,0.3458573,0.8727276,-3.9605294)" />
<linearGradient
id="linearGradient10691-8">
<stop
id="stop10693-6"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop10695-0"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="34"
y1="1"
x2="34"
y2="23.00024"
id="linearGradient3218"
xlink:href="#linearGradient3309-4"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-24.5,0)" />
<linearGradient
x1="63.9995"
y1="3.1001"
x2="63.9995"
y2="122.8994"
id="linearGradient3309-4"
gradientUnits="userSpaceOnUse">
<stop
id="stop3311-8"
style="stop-color:#f6f6f6;stop-opacity:1"
offset="0" />
<stop
id="stop3313-88"
style="stop-color:#d2d2d2;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="40"
y1="1"
x2="40"
y2="23.019524"
id="linearGradient3228"
xlink:href="#linearGradient3397-9"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-24.5,0)" />
<linearGradient
id="linearGradient3397-9">
<stop
id="stop3399-7"
style="stop-color:#aaaaaa;stop-opacity:1"
offset="0" />
<stop
id="stop3401-7"
style="stop-color:#8c8c8c;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="86.132919"
y1="105.105"
x2="84.63858"
y2="20.895"
id="linearGradient3241"
xlink:href="#linearGradient5128-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.1562313,0,0,0.1562313,2.0012016,2.1574324)" />
<linearGradient
id="linearGradient5128-6">
<stop
id="stop5130-43"
style="stop-color:#eeeeee;stop-opacity:1"
offset="0" />
<stop
id="stop5132-0"
style="stop-color:#a2a2a2;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="25"
y1="0"
x2="25"
y2="16.000105"
id="linearGradient3262"
xlink:href="#linearGradient3309-6"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-17.058189,0)" />
<linearGradient
x1="63.9995"
y1="3.1001"
x2="63.9995"
y2="122.8994"
id="linearGradient3309-6"
gradientUnits="userSpaceOnUse">
<stop
id="stop3311-2"
style="stop-color:#f6f6f6;stop-opacity:1"
offset="0" />
<stop
id="stop3313-9"
style="stop-color:#cccccc;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="21"
y1="0"
x2="21"
y2="16.004715"
id="linearGradient3264"
xlink:href="#linearGradient3397-90"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-17.058189,0)" />
<linearGradient
id="linearGradient3397-90">
<stop
id="stop3399-8"
style="stop-color:#aaaaaa;stop-opacity:1"
offset="0" />
<stop
id="stop3401-1"
style="stop-color:#8c8c8c;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="86.132919"
y1="105.105"
x2="84.63858"
y2="20.895"
id="linearGradient3260"
xlink:href="#linearGradient5128-3"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.09614231,0,0,0.09614231,1.8468935,1.9430362)" />
<linearGradient
id="linearGradient5128-3">
<stop
id="stop5130-1"
style="stop-color:#e5e5e5;stop-opacity:1"
offset="0" />
<stop
id="stop5132-1"
style="stop-color:#ababab;stop-opacity:1"
offset="1" />
</linearGradient>
</defs>
<g
transform="translate(15.999999,12)"
id="layer1">
<path
d="m 18.636572,2.5905216 c -0.703275,-0.2569307 -1.495689,0.08705 -1.752619,0.7903248 l -0.600515,1.6437399 c -0.499176,-0.013219 -0.993955,0.00248 -1.484533,0.056512 L 14.072373,3.5181351 C 13.756758,2.8391668 12.960838,2.5483897 12.28187,2.864003 L 8.3651471,4.6602954 C 7.6861782,4.9759083 7.3954033,5.7718319 7.7110151,6.4507982 l 0.726532,1.5629636 C 8.0724464,8.359396 7.744193,8.7441155 7.4266456,9.141602 L 5.8122578,8.5518108 C 5.1089821,8.2948801 4.3165666,8.6388602 4.0596381,9.3421356 L 2.5797984,13.392781 c -0.2569313,0.703275 0.1271272,1.477063 0.8304007,1.733991 l 1.6143878,0.589791 c -0.013469,0.508577 -0.010523,1.014295 0.045789,1.513885 l -1.5629633,0.726533 c -0.6789688,0.315613 -0.9697472,1.111534 -0.654132,1.790502 l 1.8363684,3.898094 c 0.3156123,0.678968 1.1115366,0.969744 1.7905029,0.654132 l 1.5629636,-0.726532 c 0.3402133,0.357549 0.7083491,0.688501 1.0984877,1.000178 l -0.6005147,1.64374 c -0.2569313,0.703275 0.1271291,1.477064 0.8304008,1.733991 l 4.0212927,1.469116 c 0.703276,0.256931 1.466338,-0.09777 1.723267,-0.801048 l 0.600515,-1.64374 c 0.508577,0.01347 1.014295,0.01052 1.513885,-0.04579 l 0.726532,1.562963 c 0.315614,0.678968 1.111534,0.969745 1.790502,0.654132 l 3.916723,-1.796292 c 0.678969,-0.315613 0.969742,-1.111538 0.654132,-1.790503 l -0.745161,-1.603039 c 0.357549,-0.340214 0.6885,-0.708349 1.000178,-1.098488 l 1.64374,0.600515 c 0.703276,0.25693 1.466338,-0.09778 1.723267,-0.801049 l 1.47984,-4.050645 c 0.256931,-0.703275 -0.09778,-1.466339 -0.801048,-1.723268 l -1.64374,-0.600514 c 0.01322,-0.499176 -0.0025,-0.993955 -0.05651,-1.484533 l 1.60304,-0.745162 C 29.20091,13.73813 29.491686,12.942208 29.176073,12.26324 L 27.339704,8.365146 C 27.024092,7.6861784 26.228168,7.3954 25.549202,7.711014 L 23.986239,8.4375465 C 23.640605,8.0724458 23.255886,7.7441924 22.858399,7.4266449 L 23.458914,5.782905 C 23.715845,5.0796306 23.361136,4.3165668 22.657865,4.0596378 L 18.636572,2.5905216 z M 17.20103,12.71252 c 1.81469,0.662968 2.74942,2.67382 2.086452,4.48851 -0.662969,1.814689 -2.673821,2.749419 -4.48851,2.086451 -1.814691,-0.662969 -2.74942,-2.673821 -2.086452,-4.48851 0.662968,-1.81469 2.673821,-2.74942 4.48851,-2.086451 z"
id="rect2576"
style="fill:url(#linearGradient3326);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3328);stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible;enable-background:accumulate" />
<path
d="m 16.000001,7.9999996 c -4.411273,0 -7.9999985,3.5887274 -7.9999985,8.0000004 0,4.411274 3.5887255,8 7.9999985,8 C 20.411274,24 24,20.411274 24,16 24,11.588727 20.411274,7.9999996 16.000001,7.9999996 z m 0,3.6923094 c 2.377844,0 4.307693,1.929846 4.307693,4.307691 0,2.377847 -1.929849,4.307693 -4.307693,4.307693 -2.377846,0 -4.307691,-1.929846 -4.307691,-4.307693 0,-2.377845 1.929845,-4.307691 4.307691,-4.307691 z"
id="path3315"
style="opacity:0.05;fill:#000000;fill-opacity:1;stroke:none" />
<path
d="m 16.000001,7.6206906 c -4.620353,0 -8.3793085,3.7589574 -8.3793085,8.3793084 0,4.620352 3.7589555,8.37931 8.3793085,8.37931 4.620353,0 8.379309,-3.758958 8.379309,-8.37931 0,-4.620351 -3.758956,-8.3793084 -8.379309,-8.3793084 z"
id="path28"
style="fill:none;stroke:url(#linearGradient2868);stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none" />
</g>
<g
transform="translate(2,-1)"
id="layer1-3">
<g
id="g2486">
<path
d="M 10.1875,1.5 C 9.799134,1.5 9.5,1.7991339 9.5,2.1875 l 0,1.6875 C 8.988333,4.0322247 8.496816,4.2537684 8.03125,4.5 L 6.84375,3.3125 c -0.274616,-0.2746162 -0.725384,-0.2746162 -1,0 L 3.3125,5.84375 c -0.274616,0.2746162 -0.274616,0.7253836 0,1 L 4.5,8.03125 C 4.253769,8.4968155 4.032225,8.9883329 3.875,9.5 l -1.6875,0 C 1.799134,9.5 1.5,9.7991344 1.5,10.1875 l 0,3.625 C 1.5,14.200866 1.799134,14.5 2.1875,14.5 l 1.6875,0 c 0.157225,0.511667 0.378769,1.003185 0.625,1.46875 l -1.1875,1.1875 c -0.274616,0.274616 -0.274616,0.725384 0,1 l 2.53125,2.53125 c 0.274616,0.274616 0.725384,0.274616 1,0 L 8.03125,19.5 C 8.496816,19.746232 8.988333,19.967775 9.5,20.125 l 0,1.6875 c 0,0.388366 0.299135,0.6875 0.6875,0.6875 l 3.625,0 c 0.388366,0 0.6875,-0.299134 0.6875,-0.6875 l 0,-1.6875 c 0.511667,-0.157225 1.003185,-0.378768 1.46875,-0.625 l 1.1875,1.1875 c 0.274616,0.274616 0.725384,0.274616 1,0 l 2.53125,-2.53125 c 0.274616,-0.274616 0.274616,-0.725384 0,-1 L 19.5,15.96875 C 19.746232,15.503185 19.967775,15.011667 20.125,14.5 l 1.6875,0 c 0.388366,0 0.6875,-0.299134 0.6875,-0.6875 l 0,-3.625 C 22.5,9.7991341 22.200866,9.5 21.8125,9.5 l -1.6875,0 C 19.967775,8.9883329 19.746232,8.4968155 19.5,8.03125 l 1.1875,-1.1875 c 0.274616,-0.2746162 0.274616,-0.7253837 0,-1 L 18.15625,3.3125 c -0.274616,-0.2746162 -0.725384,-0.2746162 -1,0 L 15.96875,4.5 C 15.503185,4.2537684 15.011667,4.0322247 14.5,3.875 l 0,-1.6875 C 14.5,1.7991341 14.200866,1.5 13.8125,1.5 l -3.625,0 z M 12,9 c 1.656,0 3,1.344 3,3 0,1.656 -1.344,3 -3,3 -1.656,0 -3,-1.344 -3,-3 0,-1.656 1.344,-3 3,-3 z"
id="rect2426"
style="fill:url(#linearGradient3218);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3228);stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible;enable-background:accumulate" />
<path
d="m 12,6 c -3.3084557,-2e-7 -5.9999999,2.6915446 -5.9999999,6 0,3.308455 2.6915442,6 5.9999999,6 3.308455,-1e-6 6,-2.691545 6,-6 0,-3.3084554 -2.691545,-6 -6,-6 z m 0,2.7692308 c 1.783385,0 3.230769,1.4473842 3.230769,3.2307692 0,1.783385 -1.447384,3.230769 -3.230769,3.230769 -1.783385,0 -3.2307692,-1.447384 -3.2307692,-3.230769 0,-1.783385 1.4473842,-3.2307692 3.2307692,-3.2307692 z"
id="path3315-9"
style="opacity:0.05;fill:#000000;fill-opacity:1;stroke:none" />
<path
d="m 11.999999,5.4999995 c -3.5840997,0 -6.4999994,2.9158997 -6.4999994,6.4999995 C 5.4999996,15.5841 8.4158993,18.5 11.999999,18.5 15.584101,18.5 18.5,15.5841 18.5,11.999999 18.5,8.4158992 15.584101,5.4999995 11.999999,5.4999995 z"
id="path28-2"
style="fill:none;stroke:url(#linearGradient3241);stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none" />
</g>
</g>
<g
transform="translate(3,29)"
id="layer1-0">
<g
id="g2479">
<path
d="M 6.9375,0.5 C 6.6890831,0.5 6.5,0.68908218 6.5,0.9375 l 0,1.25 C 5.9460971,2.3297005 5.448836,2.5593783 4.96875,2.84375 L 4.0625,1.9375 c -0.1756569,-0.1756579 -0.449342,-0.1756579 -0.625,0 l -1.5,1.5 c -0.175657,0.1756579 -0.175657,0.4493421 0,0.625 L 2.84375,4.96875 C 2.5593789,5.4488356 2.329701,5.9460968 2.1875,6.5 l -1.25,0 C 0.68908301,6.5 0.5,6.6890821 0.5,6.9375 l 0,2.125 c 1e-8,0.2484178 0.189083,0.4375 0.4375,0.4375 l 1.25,0 c 0.1422009,0.553903 0.371879,1.051164 0.65625,1.53125 L 1.9375,11.9375 c -0.175657,0.175658 -0.175657,0.449342 0,0.625 l 1.5,1.5 c 0.1756579,0.175658 0.449342,0.175658 0.625,0 L 4.96875,13.15625 C 5.4488361,13.440622 5.946097,13.6703 6.5,13.8125 l 0,1.25 c 1e-7,0.248418 0.189083,0.4375 0.4375,0.4375 l 2.125,0 C 9.3109176,15.5 9.5,15.310918 9.5,15.0625 l 0,-1.25 c 0.553903,-0.1422 1.051164,-0.371878 1.53125,-0.65625 l 0.90625,0.90625 c 0.175658,0.175658 0.449342,0.175658 0.625,0 l 1.5,-1.5 c 0.175658,-0.175658 0.175658,-0.449342 0,-0.625 L 13.15625,11.03125 C 13.440622,10.551164 13.6703,10.053903 13.8125,9.5 l 1.25,0 C 15.310918,9.5 15.5,9.3109174 15.5,9.0625 l 0,-2.125 C 15.5,6.6890822 15.310917,6.5 15.0625,6.5 l -1.25,0 C 13.6703,5.9460968 13.440622,5.4488356 13.15625,4.96875 L 14.0625,4.0625 c 0.175658,-0.1756579 0.175658,-0.449342 0,-0.625 l -1.5,-1.5 c -0.175658,-0.1756579 -0.449342,-0.1756579 -0.625,0 L 11.03125,2.84375 C 10.551164,2.5593783 10.053903,2.3297005 9.5,2.1875 l 0,-1.25 C 9.4999996,0.68908218 9.310918,0.5 9.0625,0.5 l -2.125,0 z M 8,6 c 1.104,0 2,0.896 2,2 0,1.104 -0.896,2 -2,2 C 6.896,10 6,9.104 6,8 6,6.896 6.896,6 8,6 z"
id="path2426"
style="fill:url(#linearGradient3262);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3264);stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible;enable-background:accumulate" />
<path
d="M 8,3.465116 C 5.4994229,3.465116 3.4651163,5.499423 3.4651163,8 3.4651163,10.500577 5.4994229,12.534884 8,12.534884 10.500576,12.534883 12.534884,10.500577 12.534884,8 12.534884,5.499423 10.500576,3.465116 8,3.465116 z M 8,5.55814 c 1.347907,0 2.44186,1.093953 2.44186,2.44186 0,1.347907 -1.093953,2.44186 -2.44186,2.44186 C 6.652093,10.44186 5.5581395,9.347907 5.5581395,8 5.5581395,6.652093 6.652093,5.55814 8,5.55814 z"
id="path3315-3"
style="opacity:0.05;fill:#000000;fill-opacity:1;stroke:none" />
<path
d="M 8.0000001,4 C 5.7943997,4 3.9999999,5.7944001 3.9999999,8.0000008 3.9999999,10.2056 5.7943997,12 8.0000001,12 10.2056,12 12,10.2056 12,8.0000008 12,5.7944001 10.2056,4 8.0000001,4 z"
id="path28-4"
style="fill:none;stroke:url(#linearGradient3260);stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.0"
width="48"
height="48"
id="svg3581">
<defs
id="defs3583">
<linearGradient
id="linearGradient8838">
<stop
id="stop8840"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop8842"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="62.625"
cy="4.625"
r="10.625"
fx="62.625"
fy="4.625"
id="radialGradient3534"
xlink:href="#linearGradient8838"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.1647059,0,0,0.7529402,-111.56471,36.517647)" />
<linearGradient
id="linearGradient2490-182-124">
<stop
id="stop2788"
style="stop-color:#1f4b6a;stop-opacity:1"
offset="0" />
<stop
id="stop2790"
style="stop-color:#4083c2;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="18.379412"
y1="44.980297"
x2="18.379412"
y2="3.0816143"
id="linearGradient3531"
xlink:href="#linearGradient2490-182-124"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9584364,0,0,0.9584366,0.9975246,1.9975253)" />
<linearGradient
id="linearGradient3242-187-536">
<stop
id="stop2778"
style="stop-color:#8badea;stop-opacity:1"
offset="0" />
<stop
id="stop2780"
style="stop-color:#6396cd;stop-opacity:1"
offset="0.26238" />
<stop
id="stop2782"
style="stop-color:#3b7caf;stop-opacity:1"
offset="0.66093999" />
<stop
id="stop2784"
style="stop-color:#194c70;stop-opacity:1"
offset="1" />
</linearGradient>
<radialGradient
cx="23.895569"
cy="3.9900031"
r="20.397499"
fx="23.895569"
fy="3.9900031"
id="radialGradient3529"
xlink:href="#linearGradient3242-187-536"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,2.2874593,-3.0194057,0,36.047437,-50.630156)" />
<linearGradient
id="linearGradient4873">
<stop
id="stop4875"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop4877"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="63.397362"
y1="-12.489107"
x2="63.397362"
y2="5.4675598"
id="linearGradient3526"
xlink:href="#linearGradient4873"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.1153735,0,0,2.1153253,-107.57709,32.426559)" />
</defs>
<g
id="layer1">
<path
d="M 46.999997,40 C 46.999997,44.418278 36.702545,48 23.999997,48 C 11.297449,48 0.9999968,44.418278 0.9999968,40 C 0.9999968,35.581722 11.297449,32 23.999997,32 C 36.702545,32 46.999997,35.581722 46.999997,40 L 46.999997,40 z"
id="path8836"
style="opacity:0.3;fill:url(#radialGradient3534);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999988;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
<path
d="M 24.000002,5.5018088 C 13.241573,5.5018088 4.5018088,14.24157 4.5018088,25 C 4.5018088,35.75843 13.241573,44.498195 24.000002,44.498192 C 34.758427,44.498192 43.498201,35.75843 43.498191,25 C 43.498191,14.24157 34.758427,5.5018088 24.000002,5.5018088 z"
id="path2555"
style="fill:url(#radialGradient3529);fill-opacity:1;stroke:url(#linearGradient3531);stroke-width:1.003654;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
d="M 42.500002,24.999344 C 42.500002,35.216942 34.21666,43.5 24.000235,43.5 C 13.782875,43.5 5.5000003,35.216848 5.5000003,24.999344 C 5.5000003,14.782219 13.782875,6.5000001 24.000235,6.5000001 C 34.21666,6.5000001 42.500002,14.782219 42.500002,24.999344 L 42.500002,24.999344 z"
id="path8655"
style="opacity:0.4;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3526);stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<g
transform="translate(-2.507855,0)"
id="g3538">
<path
d="M 20.507855,24.213243 C 20.766006,24.915016 21.056573,25.483856 21.675512,24.706045 C 22.442859,24.249493 25.013952,22.248288 24.756683,24.208513 C 23.93342,27.835795 22.931327,31.424931 22.165113,35.063385 C 21.363928,37.055603 23.183263,38.857649 25.082782,37.562099 C 27.101847,36.729758 28.839248,35.374018 30.614199,34.130331 C 30.372019,33.536398 30.210602,32.683218 29.541434,33.459946 C 28.662781,33.858755 26.743708,35.738993 26.387179,34.188218 C 27.125239,30.260529 28.492698,26.478234 29.366801,22.58186 C 30.171202,20.790317 28.857456,18.526637 26.890929,20.008625 C 24.534979,21.034718 22.564787,22.710882 20.507855,24.213243 z M 29.251545,11.003077 C 26.847779,10.875511 25.591007,14.750449 27.87529,15.810806 C 29.728512,16.57083 31.746339,14.670114 31.293604,12.770861 C 31.153105,11.781904 30.26521,10.96981 29.251546,11.003077 L 29.251545,11.003077 z"
id="text3482"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;opacity:0.2;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:URW Palladio L;-inkscape-font-specification:URW Palladio L Bold" />
<path
d="M 20.507855,25.213243 C 20.766006,25.915016 21.056573,26.483856 21.675512,25.706045 C 22.442859,25.249493 25.013952,23.248288 24.756683,25.208513 C 23.93342,28.835795 22.931327,32.424931 22.165113,36.063385 C 21.363928,38.055603 23.183263,39.857649 25.082782,38.562099 C 27.101847,37.729758 28.839248,36.374018 30.614199,35.130331 C 30.372019,34.536398 30.210602,33.683218 29.541434,34.459946 C 28.662781,34.858755 26.743708,36.738993 26.387179,35.188218 C 27.125239,31.260529 28.492698,27.478234 29.366801,23.58186 C 30.171202,21.790317 28.857456,19.526637 26.890929,21.008625 C 24.534979,22.034718 22.564787,23.710882 20.507855,25.213243 z M 29.251545,12.003077 C 26.847779,11.875511 25.591007,15.750449 27.87529,16.810806 C 29.728512,17.57083 31.746339,15.670114 31.293604,13.770861 C 31.153105,12.781904 30.26521,11.96981 29.251546,12.003077 L 29.251545,12.003077 z"
id="path3536"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:URW Palladio L;-inkscape-font-specification:URW Palladio L Bold" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
width="48"
height="48"
id="svg2474">
<metadata
id="metadata33">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs2476">
<linearGradient
id="linearGradient3533">
<stop
id="stop3535"
style="stop-color:#93b9dd;stop-opacity:1"
offset="0" />
<stop
id="stop3545"
style="stop-color:#6396cd;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3266">
<stop
id="stop3268"
style="stop-color:#387ab8;stop-opacity:1"
offset="0" />
<stop
id="stop3270"
style="stop-color:#387ab8;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3276">
<stop
id="stop3278"
style="stop-color:#6396cd;stop-opacity:1"
offset="0" />
<stop
id="stop3280"
style="stop-color:#83acd5;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="108.5625"
y1="102.78125"
x2="108.5625"
y2="71.78125"
id="linearGradient5497"
xlink:href="#linearGradient5491"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-95.99949,-49.00038)" />
<linearGradient
id="linearGradient5491">
<stop
id="stop5493"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop5495"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="102.5625"
y1="49.78125"
x2="103.5625"
y2="72.78125"
id="linearGradient5480"
xlink:href="#linearGradient5474"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-95.99949,-49.00038)" />
<linearGradient
id="linearGradient5474">
<stop
id="stop5476"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop5478"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="118.47968"
y1="55.060318"
x2="118.47968"
y2="91.941895"
id="linearGradient4593-5-8-1-5-2"
xlink:href="#linearGradient3533"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-100.99949,-49.00038)" />
<linearGradient
x1="34.980953"
y1="53.837799"
x2="35.996098"
y2="83.57618"
id="linearGradient4593-5-8-1-5-2-3"
xlink:href="#linearGradient3533"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-5,0)" />
<radialGradient
cx="33.875"
cy="197.29688"
r="4.84375"
fx="33.875"
fy="197.29688"
id="radialGradient5147-5"
xlink:href="#linearGradient6462-6-8-548-9-2-7"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.33870968,0,130.47051)" />
<linearGradient
id="linearGradient6462-6-8-548-9-2-7">
<stop
id="stop6464-5-9-94-5-4-4"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop6466-3-6-1-7-2-8"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient6462-6-8-548-9-5">
<stop
id="stop6464-5-9-94-5-8"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop6466-3-6-1-7-5"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="33.875"
cy="197.29688"
r="4.84375"
fx="33.875"
fy="197.29688"
id="radialGradient6081"
xlink:href="#linearGradient6462-6-8-548-9-5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.33870968,0,130.47051)" />
<linearGradient
x1="42.030777"
y1="84.719109"
x2="53.808601"
y2="73.263672"
id="linearGradient4008"
xlink:href="#linearGradient3276"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-5,0)" />
<linearGradient
x1="39.843277"
y1="83.781609"
x2="50.683601"
y2="75.138672"
id="linearGradient4018"
xlink:href="#linearGradient3266"
gradientUnits="userSpaceOnUse" />
</defs>
<path
d="m 38.71875,197.29687 a 4.84375,1.640625 0 1 1 -9.6875,0 4.84375,1.640625 0 1 1 9.6875,0 z"
transform="matrix(3.3032251,0,0,1.6761866,-89.458749,-288.73764)"
id="path6460-6-4-4-3-3"
style="opacity:0.2;color:#000000;fill:url(#radialGradient5147-5);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new" />
<path
d="M 46.405989,78.610714 A 13.125,13.125 0 0 1 33.62701,84.097034"
transform="matrix(1.0666665,0,0,1.0666665,-14.49949,-51.367037)"
id="path4010"
style="color:#000000;fill:none;stroke:url(#linearGradient4018);stroke-width:8.43750095;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new" />
<path
d="m 38.71875,197.29687 a 4.84375,1.640625 0 1 1 -9.6875,0 4.84375,1.640625 0 1 1 9.6875,0 z"
transform="matrix(4.541935,0,0,1.9809503,-131.42005,-348.86656)"
id="path6460-6-4-4-4"
style="opacity:0.1;color:#000000;fill:url(#radialGradient6081);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new" />
<path
d="M 35.542313,84.24974 A 13.125,13.125 0 1 1 47.171703,64.884866"
transform="matrix(1.0666665,0,0,1.0666665,-14.49949,-51.367037)"
id="path4788-6"
style="color:#000000;fill:none;stroke:#387ab8;stroke-width:8.43750095;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new" />
<path
d="m 38.50051,9.4996196 0,11.0000004 -11,0"
id="path4847"
style="color:#000000;fill:none;stroke:#387ab8;stroke-width:7;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new" />
<path
d="m 46.386659,78.638476 a 13.125,13.125 0 0 1 -13.412517,5.34104"
transform="matrix(1.0666665,0,0,1.0666665,-14.49949,-51.367037)"
id="path4006"
style="color:#000000;fill:none;stroke:url(#linearGradient4008);stroke-width:6.56250095;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new" />
<path
d="m 37.320778,84.13999 a 13.125,13.125 0 1 1 9.33779,-20.123155"
transform="matrix(1.0666665,0,0,1.0666665,-14.49949,-51.367037)"
id="path4788"
style="color:#000000;fill:none;stroke:url(#linearGradient4593-5-8-1-5-2-3);stroke-width:6.56250095;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new" />
<path
d="m 38.50051,9.4996196 0,11.0000004 -11,0"
id="path4847-1"
style="color:#000000;fill:none;stroke:url(#linearGradient4593-5-8-1-5-2);stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new" />
<path
d="m 29.740794,33.593555 c -3.674085,2.533277 -8.663315,2.652831 -12.552784,-0.06269 -5.010358,-3.498088 -6.216831,-10.333397 -2.718751,-15.34375 3.498091,-5.010353 10.3334,-6.216833 15.343751,-2.71875 1.16116,0.810688 2.10377,1.843969 2.875,3.03125 l -5.1875,0 c -1.056625,-0.01494 -2.028484,0.943269 -2.028484,2 0,1.056731 0.971859,2.014943 2.028484,2 l 11,0 c 1.062499,0.28125 2.062499,-0.71875 2,-2 l 0,-11.0000004 c 0.01671,-1.0680358 -0.963214,-2.0479629 -2.03125,-2.0312505 -0.06245,-0.00293 -0.125046,-0.00293 -0.1875,0 -0.982752,0.107995 -1.802514,1.0428108 -1.78125,2.0312505 l 0,4.0625004 c -0.9534,-1.127853 -2.06667,-2.152011 -3.28125,-3 l -0.09375,-0.0625 c -2.85203,-1.9610889 -6.0733,-2.9220479 -9.312501,-2.9687509 -5.46224,-0.07875 -10.90353,2.4568065 -14.2500005,7.2500009 -5.354351,7.669111 -3.450361,18.3019 4.2187505,23.65625 6.255407,4.367344 14.482569,3.905673 20.208772,-0.574695"
id="path4788-2"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:0.23999999;color:#000000;fill:none;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans" />
<path
d="m 36.50052,13.562118 c -0.9534,-1.127853 -2.06667,-2.152011 -3.28125,-3 l -0.0937,-0.0625 c -2.85203,-1.9610889 -6.0733,-2.9220479 -9.312501,-2.9687509 -5.46224,-0.07875 -10.90354,2.4568065 -14.2500105,7.2500009 -5.354351,7.669111 -3.450361,18.3019 4.2187505,23.65625"
id="path4788-2-3"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:0.3;color:#000000;fill:none;stroke:url(#linearGradient5480);stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans" />
<path
d="M 32.53183,30.81212 C 29.03374,35.822473 22.198429,37.028952 17.18808,33.53087 12.177699,30.032787 10.971229,23.197473 14.469309,18.18712 17.96742,13.176767 24.802729,11.970287 29.81308,15.46837"
id="path4788-2-3-4"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:0.3;color:#000000;fill:none;stroke:url(#linearGradient5497);stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans" />
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.0"
width="48"
height="48"
id="svg3258">
<defs
id="defs3260">
<linearGradient
id="linearGradient8838">
<stop
id="stop8840"
style="stop-color:black;stop-opacity:1"
offset="0" />
<stop
id="stop8842"
style="stop-color:black;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="62.625"
cy="4.625"
r="10.625"
fx="62.625"
fy="4.625"
id="radialGradient3254"
xlink:href="#linearGradient8838"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.1647059,0,0,0.7529402,-111.56471,36.517647)" />
<linearGradient
id="linearGradient2490">
<stop
id="stop2492"
style="stop-color:#791235;stop-opacity:1"
offset="0" />
<stop
id="stop2494"
style="stop-color:#dd3b27;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="18.379412"
y1="44.980297"
x2="18.379412"
y2="3.0816143"
id="linearGradient3251"
xlink:href="#linearGradient2490"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9584364,0,0,0.9584366,0.9975246,1.9975253)" />
<linearGradient
id="linearGradient3242">
<stop
id="stop3244"
style="stop-color:#f8b17e;stop-opacity:1"
offset="0" />
<stop
id="stop3246"
style="stop-color:#e35d4f;stop-opacity:1"
offset="0.26238" />
<stop
id="stop3248"
style="stop-color:#c6262e;stop-opacity:1"
offset="0.66093999" />
<stop
id="stop3250"
style="stop-color:#690b54;stop-opacity:1"
offset="1" />
</linearGradient>
<radialGradient
cx="23.895569"
cy="3.9900031"
r="20.397499"
fx="23.895569"
fy="3.9900031"
id="radialGradient3249"
xlink:href="#linearGradient3242"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,2.2874593,-3.0194057,0,36.047437,-50.630156)" />
<linearGradient
id="linearGradient4873">
<stop
id="stop4875"
style="stop-color:white;stop-opacity:1"
offset="0" />
<stop
id="stop4877"
style="stop-color:white;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="63.397362"
y1="-12.489107"
x2="63.397362"
y2="5.4675598"
id="linearGradient3246"
xlink:href="#linearGradient4873"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.1153735,0,0,2.1153253,-107.57709,32.426559)" />
</defs>
<g
id="layer1">
<path
d="m 46.999997,40 c 0,4.418278 -10.297452,8 -23,8 -12.702548,0 -23.0000002,-3.581722 -23.0000002,-8 0,-4.418278 10.2974522,-8 23.0000002,-8 12.702548,0 23,3.581722 23,8 l 0,0 z"
id="path8836"
style="opacity:0.3;fill:url(#radialGradient3254);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999988;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
d="M 24.000002,5.5018088 C 13.241573,5.5018088 4.5018088,14.24157 4.5018088,25 c 0,10.75843 8.7397642,19.498195 19.4981932,19.498192 10.758425,0 19.498199,-8.739762 19.498189,-19.498192 0,-10.75843 -8.739764,-19.4981912 -19.498189,-19.4981912 z"
id="path2555"
style="fill:url(#radialGradient3249);fill-opacity:1;stroke:url(#linearGradient3251);stroke-width:1.003654;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
<path
d="M 42.500002,24.999344 C 42.500002,35.216942 34.21666,43.5 24.000235,43.5 13.782875,43.5 5.5000003,35.216848 5.5000003,24.999344 c 0,-10.217125 8.2828747,-18.4993439 18.5002347,-18.4993439 10.216425,0 18.499767,8.2822189 18.499767,18.4993439 l 0,0 z"
id="path8655"
style="opacity:0.4;fill:none;stroke:url(#linearGradient3246);stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="m -33.28125,16.3125 -2.96875,2.96875 6.125,6.09375 c 0.188168,0.19054 0.188168,0.49696 0,0.6875 l -6.125,6.09375 2.96875,2.96875 6.09375,-6.09375 c 0.19054,-0.188168 0.49696,-0.188168 0.6875,0 l 6.09375,6.09375 2.96875,-2.96875 -6.09375,-6.09375 c -0.188168,-0.19054 -0.188168,-0.49696 0,-0.6875 L -17.4375,19.28125 -20.40625,16.3125 -26.5,22.40625 c -0.19054,0.188168 -0.49696,0.188168 -0.6875,0 l -6.09375,-6.09375 z"
transform="translate(50.84375,-2.1249996)"
id="path3243"
style="opacity:0.2;fill:black;fill-opacity:1;fill-rule:evenodd;stroke:none" />
<path
d="m -33.28125,16.3125 -2.96875,2.96875 6.125,6.09375 c 0.188168,0.19054 0.188168,0.49696 0,0.6875 l -6.125,6.09375 2.96875,2.96875 6.09375,-6.09375 c 0.19054,-0.188168 0.49696,-0.188168 0.6875,0 l 6.09375,6.09375 2.96875,-2.96875 -6.09375,-6.09375 c -0.188168,-0.19054 -0.188168,-0.49696 0,-0.6875 L -17.4375,19.28125 -20.40625,16.3125 -26.5,22.40625 c -0.19054,0.188168 -0.49696,0.188168 -0.6875,0 l -6.09375,-6.09375 z"
transform="translate(50.84375,-1.1249996)"
id="path3256"
style="fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -29,7 +29,6 @@ include $(TOP)/make/firmware-defs.mk
# Set developer code and compile options
# Set to YES for debugging
DEBUG ?= NO
USE_BOOTLOADER ?= YES
# Set to YES when using Code Sourcery toolchain
CODE_SOURCERY ?= YES
@ -50,11 +49,6 @@ MCU = cortex-m3
CHIP = STM32F103CBT
BOARD = STM32103CB_AHRS
MODEL = MD
ifeq ($(USE_BOOTLOADER), YES)
BOOT_MODEL = $(MODEL)_BL
else
BOOT_MODEL = $(MODEL)_NB
endif
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/ahrs
@ -229,9 +223,8 @@ CDEFS = -DSTM32F10X_$(MODEL)
CDEFS += -DUSE_STDPERIPH_DRIVER
CDEFS += -DUSE_$(BOARD)
CDEFS += -DIN_AHRS
ifeq ($(USE_BOOTLOADER), YES)
CDEFS += -DUSE_BOOTLOADER
endif
# Place project-specific -D and/or -U options for
# Assembler with preprocessor here.
#ADEFS = -DUSE_IRQ_ASM_WRAPPER
@ -303,16 +296,17 @@ LDFLAGS += $(MATH_LIB)
LDFLAGS += -lc -lgcc
# Set linker-script name depending on selected submodel name
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_$(BOARD)_$(BOOT_MODEL).ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08002000 bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08002000 bin"
# reset target
OOCD_CL+=-c "reset run"
# # terminate OOCD after programming
# terminate OOCD after programming
OOCD_CL+=-c shutdown
@ -352,19 +346,12 @@ endif
endif
# Program the device.
ifeq ($(USE_BOOTLOADER), YES)
# Program the device with OP Upload Tool".
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OP Upload Tool${quote}
../../ground/src/experimental/upload-build-desktop/debug/OPUploadTool -d 1 -p $(OUTDIR)/$(TARGET).bin
else
ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
program: $(OUTDIR)/$(TARGET).elf
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OPENOCD${quote}
$(OOCD_EXE) $(OOCD_CL)
endif
endif
# Link: create ELF output file from object files.
$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ)))
@ -393,12 +380,15 @@ $(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC))
# Compile: create assembler files from C source files. ARM only
$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
.PHONY: elf lss sym hex bin
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
.PHONY: elf lss sym hex bin bino
elf: $(OUTDIR)/$(TARGET).elf
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
bino: $(OUTDIR)/$(TARGET).bin.o
# Display sizes of sections.
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
@ -409,6 +399,16 @@ size: $(OUTDIR)/$(TARGET).elf_size
docs:
doxygen $(DOXYGENDIR)/doxygen.cfg
# Install: install binary file with prefix/suffix into install directory
install: $(OUTDIR)/$(TARGET).bin
ifneq ($(INSTALL_DIR),)
@echo $(MSG_INSTALLING) $(call toprel, $<)
$(V1) mkdir -p $(INSTALL_DIR)
$(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin
else
$(error INSTALL_DIR must be specified for $@)
endif
# Target: clean project.
clean: clean_list
@ -420,6 +420,7 @@ clean_list :
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o
$(V1) $(REMOVE) $(ALLOBJ)
$(V1) $(REMOVE) $(LSTFILES)
$(V1) $(REMOVE) $(DEPFILES)
@ -443,6 +444,5 @@ else
-include $(shell mkdir $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*)
endif
# Listing of phony targets.
.PHONY : all build clean clean_list program
.PHONY : all build clean clean_list program install

View File

@ -29,7 +29,6 @@ include $(TOP)/make/firmware-defs.mk
# Set developer code and compile options
# Set to YES for debugging
DEBUG ?= NO
override USE_BOOTLOADER = NO
# Set to YES when using Code Sourcery toolchain
CODE_SOURCERY ?= YES
@ -208,9 +207,7 @@ DEBUGF = dwarf-2
CDEFS = -DSTM32F10X_$(MODEL)
CDEFS += -DUSE_STDPERIPH_DRIVER
CDEFS += -DUSE_$(BOARD)
ifeq ($(USE_BOOTLOADER), YES)
CDEFS += -DUSE_BOOTLOADER
endif
# Place project-specific -D and/or -U options for
# Assembler with preprocessor here.
#ADEFS = -DUSE_IRQ_ASM_WRAPPER
@ -237,9 +234,10 @@ CSTANDARD = -std=gnu99
# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
ifeq ($(DEBUG),YES)
CFLAGS = -g$(DEBUGF)
CFLAGS =
endif
CFLAGS += -g$(DEBUGF)
CFLAGS += -O$(OPT)
ifeq ($(DEBUG),NO)
CFLAGS += -fdata-sections -ffunction-sections
@ -280,7 +278,7 @@ MATH_LIB = -lm
# --cref: add cross reference to map file
LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
ifeq ($(DEBUG),NO)
LDFLAGS += -Wl,-static -Wl,-s
LDFLAGS += -Wl,-static
endif
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
LDFLAGS += -lc
@ -289,13 +287,14 @@ LDFLAGS += $(MATH_LIB)
LDFLAGS += -lc -lgcc
# Set linker-script name depending on selected submodel name
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_stm32f10x_$(MODEL).ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08000000 bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08000000 bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
@ -339,7 +338,7 @@ endif
# Program the device.
ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
program: $(OUTDIR)/$(TARGET).elf
program: $(OUTDIR)/$(TARGET).bin
@echo "Programming with OPENOCD"
$(OOCD_EXE) $(OOCD_CL)
endif
@ -371,12 +370,15 @@ $(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC))
# Compile: create assembler files from C source files. ARM only
$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
.PHONY: elf lss sym hex bin
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
.PHONY: elf lss sym hex bin bino
elf: $(OUTDIR)/$(TARGET).elf
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
bino: $(OUTDIR)/$(TARGET).bin.o
# Display sizes of sections.
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
@ -387,6 +389,16 @@ size: $(OUTDIR)/$(TARGET).elf_size
docs:
doxygen $(DOXYGENDIR)/doxygen.cfg
# Install: install binary file with prefix/suffix into install directory
install: $(OUTDIR)/$(TARGET).bin
ifneq ($(INSTALL_DIR),)
@echo $(MSG_INSTALLING) $(call toprel, $<)
$(V1) mkdir -p $(INSTALL_DIR)
$(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin
else
$(error INSTALL_DIR must be specified for $@)
endif
# Target: clean project.
clean: clean_list
@ -398,6 +410,7 @@ clean_list :
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o
$(V1) $(REMOVE) $(ALLOBJ)
$(V1) $(REMOVE) $(LSTFILES)
$(V1) $(REMOVE) $(DEPFILES)
@ -423,4 +436,4 @@ else
endif
# Listing of phony targets.
.PHONY : all build clean clean_list program
.PHONY : all build clean clean_list program install

View File

@ -1,619 +1,459 @@
#####
# Project: OpenPilot
#
#
# Makefile for OpenPilot project build PiOS and the AP.
#
# The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009.
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#####
# Set developer code and compile options
# Set to YES to compile for debugging
DEBUG ?= NO
# Set to YES to use the Servo output pins for debugging via scope or logic analyser
ENABLE_DEBUG_PINS ?= NO
# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs
ENABLE_AUX_UART ?= NO
#
USE_BOOTLOADER ?= YES
# Set to the source bootloader binary
SOURCE_BL ?= NULL
# Set to YES when using Code Sourcery toolchain
CODE_SOURCERY ?= NO
# Toolchain prefix (i.e arm-elf- -> arm-elf-gcc.exe)
TCHAIN_PREFIX ?= arm-none-eabi-
# Remove command is different for Code Sourcery on Windows
ifeq ($(CODE_SOURCERY), YES)
REMOVE_CMD = cs-rm
else
REMOVE_CMD = rm
endif
FLASH_TOOL = OPENOCD
# YES enables -mthumb option to flags for source-files listed
# in SRC and CPPSRC
USE_THUMB_MODE = YES
# MCU name, submodel and board
# - MCU used for compiler-option (-mcpu)
# - MODEL used for linker-script name (-T) and passed as define
# - BOARD just passed as define (optional)
MCU = cortex-m3
CHIP = STM32F103CBT
BOARD ?= NULL
MODEL ?= NULL
ifeq ($(USE_BOOTLOADER), YES)
BOOT_MODEL = $(MODEL)_BL
else
BOOT_MODEL = $(MODEL)_NB
endif
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = ../../../build/bootloaders/BootloaderUpdater
# Target file name (without extension).
TARGET = BL_Updater
# Paths
OPSYSTEM = .
OPSYSTEMINC = $(OPSYSTEM)/inc
OPUAVTALK = ./UAVTalk
OPUAVTALKINC = $(OPUAVTALK)/inc
OPUAVOBJ = ./UAVObjects
OPUAVOBJINC = $(OPUAVOBJ)/inc
OPTESTS = ./Tests
OPMODULEDIR = ./Modules
FLIGHTLIB = ../../Libraries
FLIGHTLIBINC = ../../Libraries/inc
PIOS = ../../PiOS
PIOSINC = $(PIOS)/inc
PIOSSTM32F10X = $(PIOS)/STM32F10x
PIOSCOMMON = $(PIOS)/Common
PIOSBOARDS = $(PIOS)/Boards
APPLIBDIR = $(PIOSSTM32F10X)/Libraries
STMLIBDIR = $(APPLIBDIR)
STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver
STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver
STMSPDSRCDIR = $(STMSPDDIR)/src
STMSPDINCDIR = $(STMSPDDIR)/inc
STMUSBSRCDIR = $(STMUSBDIR)/src
STMUSBINCDIR = $(STMUSBDIR)/inc
CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3
DOSFSDIR = $(APPLIBDIR)/dosfs
MSDDIR = $(APPLIBDIR)/msd
RTOSDIR = $(APPLIBDIR)/FreeRTOS
RTOSSRCDIR = $(RTOSDIR)/Source
RTOSINCDIR = $(RTOSSRCDIR)/include
DOXYGENDIR = ../Doc/Doxygen
# List C source files here. (C dependencies are automatically generated.)
# use file-extension c for "c-only"-files
## CORE:
SRC += $(OPSYSTEM)/main.c
SRC += $(OPSYSTEM)/pios_board.c
## PIOS Hardware (STM32F10x)
SRC += $(PIOSSTM32F10X)/pios_sys.c
SRC += $(PIOSSTM32F10X)/pios_led.c
SRC += $(PIOSSTM32F10X)/pios_delay.c
SRC += $(PIOSSTM32F10X)/pios_irq.c
SRC += $(PIOSSTM32F10X)/pios_gpio.c
## CMSIS for STM32
SRC += $(CMSISDIR)/core_cm3.c
SRC += $(CMSISDIR)/system_stm32f10x.c
## Used parts of the STM-Library
SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c
SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c
SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c
SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c
SRC += $(STMSPDSRCDIR)/stm32f10x_tim.c
SRC += $(STMSPDSRCDIR)/misc.c
# List C source files here which must be compiled in ARM-Mode (no -mthumb).
# use file-extension c for "c-only"-files
## just for testing, timer.c could be compiled in thumb-mode too
SRCARM =
# List C++ source files here.
# use file-extension .cpp for C++-files (not .C)
CPPSRC =
# List C++ source files here which must be compiled in ARM-Mode.
# use file-extension .cpp for C++-files (not .C)
#CPPSRCARM = $(TARGET).cpp
CPPSRCARM =
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL).S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
EXTRAINCDIRS = $(OPSYSTEM)
EXTRAINCDIRS += $(OPSYSTEMINC)
EXTRAINCDIRS += $(OPUAVTALK)
EXTRAINCDIRS += $(OPUAVTALKINC)
EXTRAINCDIRS += $(OPUAVOBJ)
EXTRAINCDIRS += $(OPUAVOBJINC)
EXTRAINCDIRS += $(PIOS)
EXTRAINCDIRS += $(PIOSINC)
EXTRAINCDIRS += $(FLIGHTLIBINC)
EXTRAINCDIRS += $(PIOSSTM32F10X)
EXTRAINCDIRS += $(PIOSCOMMON)
EXTRAINCDIRS += $(PIOSBOARDS)
EXTRAINCDIRS += $(STMSPDINCDIR)
EXTRAINCDIRS += $(STMUSBINCDIR)
EXTRAINCDIRS += $(CMSISDIR)
EXTRAINCDIRS += $(DOSFSDIR)
EXTRAINCDIRS += $(MSDDIR)
EXTRAINCDIRS += $(RTOSINCDIR)
EXTRAINCDIRS += $(APPLIBDIR)
EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3
# List any extra directories to look for library files here.
# Also add directories where the linker should search for
# includes from linker-script to the list
# Each directory must be seperated by a space.
EXTRA_LIBDIRS =
# Extra Libraries
# Each library-name must be seperated by a space.
# i.e. to link with libxyz.a, libabc.a and libefsl.a:
# EXTRA_LIBS = xyz abc efsl
# for newlib-lpc (file: libnewlibc-lpc.a):
# EXTRA_LIBS = newlib-lpc
EXTRA_LIBS =
# Path to Linker-Scripts
LINKERSCRIPTPATH = $(PIOSSTM32F10X)
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
ifeq ($(DEBUG),YES)
OPT = 0
else
OPT = s
endif
# Output format. (can be ihex or binary or both)
# binary to create a load-image in raw-binary format i.e. for SAM-BA,
# ihex to create a load-image in Intel hex format
#LOADFORMAT = ihex
#LOADFORMAT = binary
LOADFORMAT = both
# Debugging format.
DEBUGF = dwarf-2
# Place project-specific -D (define) and/or
# -U options for C here.
CDEFS = -DSTM32F10X_$(MODEL)
CDEFS += -DUSE_STDPERIPH_DRIVER
CDEFS += -DUSE_$(BOARD)
ifeq ($(ENABLE_DEBUG_PINS), YES)
CDEFS += -DPIOS_ENABLE_DEBUG_PINS
endif
ifeq ($(ENABLE_AUX_UART), YES)
CDEFS += -DPIOS_ENABLE_AUX_UART
endif
ifeq ($(USE_BOOTLOADER), YES)
CDEFS += -DUSE_BOOTLOADER
endif
# Place project-specific -D and/or -U options for
# Assembler with preprocessor here.
#ADEFS = -DUSE_IRQ_ASM_WRAPPER
ADEFS = -D__ASSEMBLY__
# Compiler flag to set the C Standard level.
# c89 - "ANSI" C
# gnu89 - c89 plus GCC extensions
# c99 - ISO C99 standard (not yet fully implemented)
# gnu99 - c99 plus GCC extensions
CSTANDARD = -std=gnu99
#-----
# Compiler flags.
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
#
# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
ifeq ($(DEBUG),YES)
CFLAGS = -g$(DEBUGF) -DDEBUG
endif
CFLAGS += -O$(OPT)
ifeq ($(DEBUG),NO)
CFLAGS += -ffunction-sections
endif
CFLAGS += -mcpu=$(MCU) -mthumb
CFLAGS += $(CDEFS)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
CFLAGS += -mapcs-frame
CFLAGS += -fomit-frame-pointer
CFLAGS += -fpromote-loop-indices
CFLAGS += -Wall
CFLAGS += -Werror
CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<))))
# Compiler flags to generate dependency files:
CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d
# flags only for C
#CONLYFLAGS += -Wnested-externs
CONLYFLAGS += $(CSTANDARD)
# Assembler flags.
# -Wa,...: tell GCC to pass this to the assembler.
# -ahlns: create listing
ASFLAGS = -mcpu=$(MCU) -mthumb -I. -x assembler-with-cpp
ASFLAGS += $(ADEFS)
ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<))))
ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
MATH_LIB = -lm
# Linker flags.
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
ifeq ($(DEBUG),NO)
LDFLAGS += -Wl,-static -Wl,-s
endif
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
LDFLAGS += -lc
LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
LDFLAGS += $(MATH_LIB)
LDFLAGS += -lc -lgcc
# Set linker-script name depending on selected submodel name
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_$(BOARD)_$(BOOT_MODEL).ld
# Test if quotes are needed for the echo-command
result = ${shell echo "test"}
ifeq (${result}, test)
quote = '
else
quote =
endif
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
# Program
OOCD_CL+=-c "flash write_image $(OOCD_LOADFILE)"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE)"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
OOCD_CL+=-c shutdown
# Define programs and commands.
CC = $(TCHAIN_PREFIX)gcc
CPP = $(TCHAIN_PREFIX)g++
AR = $(TCHAIN_PREFIX)ar
OBJCOPY = $(TCHAIN_PREFIX)objcopy
OBJDUMP = $(TCHAIN_PREFIX)objdump
SIZE = $(TCHAIN_PREFIX)size
NM = $(TCHAIN_PREFIX)nm
REMOVE = $(REMOVE_CMD) -f
###SHELL = sh
###COPY = cp
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = ${quote}-------- begin (mode: $(RUN_MODE)) --------${quote}
MSG_END = ${quote}-------- end --------${quote}
MSG_MODINIT = ${quote}**** Generating ModInit.c${quote}
MSG_SIZE_BEFORE = ${quote}Size before:${quote}
MSG_SIZE_AFTER = ${quote}Size after build:${quote}
MSG_LOAD_FILE = ${quote}Creating load file:${quote}
MSG_EXTENDED_LISTING = ${quote}Creating Extended Listing/Disassembly:${quote}
MSG_SYMBOL_TABLE = ${quote}Creating Symbol Table:${quote}
MSG_LINKING = ${quote}**** Linking :${quote}
MSG_COMPILING = ${quote}**** Compiling C :${quote}
MSG_COMPILING_ARM = ${quote}**** Compiling C (ARM-only):${quote}
MSG_COMPILINGCPP = ${quote}Compiling C++ :${quote}
MSG_COMPILINGCPP_ARM = ${quote}Compiling C++ (ARM-only):${quote}
MSG_ASSEMBLING = ${quote}**** Assembling:${quote}
MSG_ASSEMBLING_ARM = ${quote}****Assembling (ARM-only):${quote}
MSG_CLEANING = ${quote}Cleaning project:${quote}
MSG_FORMATERROR = ${quote}Can not handle output-format${quote}
MSG_ASMFROMC = ${quote}Creating asm-File from C-Source:${quote}
MSG_ASMFROMC_ARM = ${quote}Creating asm-File from C-Source (ARM-only):${quote}
# List of all source files.
ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC)
# List of all source files without directory and file-extension.
ALLSRCBASE = $(notdir $(basename $(ALLSRC)))
# Define all object files.
ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE)))
# Define all listing files (used for make clean).
LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE)))
# Define all depedency-files (used for make clean).
DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE)))
# Default target.
#all: begin gccversion sizebefore build sizeafter finished end
all: begin gccversion build sizeafter finished end
elf: $(OUTDIR)/$(TARGET).elf
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
ifeq ($(LOADFORMAT),ihex)
build: elf hex sym
else
ifeq ($(LOADFORMAT),binary)
build: elf bin sym
else
ifeq ($(LOADFORMAT),both)
build: elf hex bin sym
else
$(error "$(MSG_FORMATERROR) $(FORMAT)")
endif
endif
endif
# Eye candy.
begin:
## @echo
@echo $(MSG_BEGIN)
ifeq ($(SOURCE_BL), NULL)
@echo ${quote}Please specify the source bootloader binary with SOURCE_BL=source_name${quote}
@exit 2
endif
ifeq ($(BOARD), NULL)
@echo ${quote}Please specify the board name with BOARD=board_name (STM3210E_OP,STM32103CB_AHRS,STM32103CB_PIPXTREME,STM32103CB_CC_Rev1)${quote}
@exit 2
endif
ifeq ($(MODEL), NULL)
@echo ${quote}Please specify the chip model with MODEL=MD/HD${quote}
@exit 2
endif
python file_to_array.py $(SOURCE_BL) bl_array.h
#UNAME := $(shell python file_to_array.py $(SOURCE_BL) bl_array.h)
###########################################################################################################
finished:
## @echo $(MSG_ERRORS_NONE)
end:
@echo $(MSG_END)
## @echo
# Display sizes of sections.
ELFSIZE = $(SIZE) -A $(OUTDIR)/$(TARGET).elf
sizebefore:
# @if [ -f $(OUTDIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
sizeafter:
# @if [ -f $(OUTDIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
@echo $(MSG_SIZE_AFTER)
$(ELFSIZE)
# Display compiler version information.
gccversion :
@$(CC) --version
# @echo $(ALLOBJ)
# Program the device.
ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
program: $(OUTDIR)/$(TARGET).elf
@echo ${quote}Programming with OPENOCD${quote}
$(OOCD_EXE) $(OOCD_CL)
endif
# Create final output file (.hex) from ELF output file.
%.hex: %.elf
## @echo
@echo $(MSG_LOAD_FILE) $@
$(OBJCOPY) -O ihex $< $@
# Create final output file (.bin) from ELF output file.
%.bin: %.elf
## @echo
@echo $(MSG_LOAD_FILE) $@
$(OBJCOPY) -O binary $< $@
# Create extended listing file/disassambly from ELF output file.
# using objdump testing: option -C
%.lss: %.elf
## @echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S -C -r $< > $@
# $(OBJDUMP) -x -S $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
## @echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(ALLOBJ)
%.elf: $(ALLOBJ)
@echo $(MSG_LINKING) $@
# use $(CC) for C-only projects or $(CPP) for C++-projects:
$(CC) $(THUMB) $(CFLAGS) $(ALLOBJ) --output $@ $(LDFLAGS)
# $(CPP) $(THUMB) $(CFLAGS) $(ALLOBJ) --output $@ $(LDFLAGS)
# Assemble: create object files from assembler source files.
define ASSEMBLE_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
## @echo
@echo $(MSG_ASSEMBLING) $$< to $$@
$(CC) -c $(THUMB) $$(ASFLAGS) $$< -o $$@
endef
$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src))))
# Assemble: create object files from assembler source files. ARM-only
define ASSEMBLE_ARM_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
## @echo
@echo $(MSG_ASSEMBLING_ARM) $$< to $$@
$(CC) -c $$(ASFLAGS) $$< -o $$@
endef
$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src))))
# Compile: create object files from C source files.
define COMPILE_C_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
## @echo
@echo $(MSG_COMPILING) $$< to $$@
$(CC) -c $(THUMB) $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
endef
$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src))))
# Compile: create object files from C source files. ARM-only
define COMPILE_C_ARM_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
## @echo
@echo $(MSG_COMPILING_ARM) $$< to $$@
$(CC) -c $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
endef
$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src))))
# Compile: create object files from C++ source files.
define COMPILE_CPP_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
## @echo
@echo $(MSG_COMPILINGCPP) $$< to $$@
$(CC) -c $(THUMB) $$(CFLAGS) $$(CPPFLAGS) $$< -o $$@
endef
$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src))))
# Compile: create object files from C++ source files. ARM-only
define COMPILE_CPP_ARM_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
## @echo
@echo $(MSG_COMPILINGCPP_ARM) $$< to $$@
$(CC) -c $$(CFLAGS) $$(CPPFLAGS) $$< -o $$@
endef
$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src))))
# Compile: create assembler files from C source files. ARM/Thumb
$(SRC:.c=.s) : %.s : %.c
@echo $(MSG_ASMFROMC) $< to $@
$(CC) $(THUMB) -S $(CFLAGS) $(CONLYFLAGS) $< -o $@
# Compile: create assembler files from C source files. ARM only
$(SRCARM:.c=.s) : %.s : %.c
@echo $(MSG_ASMFROMC_ARM) $< to $@
$(CC) -S $(CFLAGS) $(CONLYFLAGS) $< -o $@
# Generate Doxygen documents
docs:
doxygen $(DOXYGENDIR)/doxygen.cfg
# Target: clean project.
clean: begin clean_list finished end
clean_list :
## @echo
@echo $(MSG_CLEANING)
$(REMOVE) $(OUTDIR)/$(TARGET).map
$(REMOVE) $(OUTDIR)/$(TARGET).elf
$(REMOVE) $(OUTDIR)/$(TARGET).hex
$(REMOVE) $(OUTDIR)/$(TARGET).bin
$(REMOVE) $(OUTDIR)/$(TARGET).sym
$(REMOVE) $(OUTDIR)/$(TARGET).lss
$(REMOVE) $(ALLOBJ)
$(REMOVE) $(LSTFILES)
$(REMOVE) $(DEPFILES)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRCARM:.c=.s)
$(REMOVE) $(CPPSRC:.cpp=.s)
$(REMOVE) $(CPPSRCARM:.cpp=.s)
# Create output files directory
# all known MS Windows OS define the ComSpec environment variable
ifdef ComSpec
$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL)
else
$(shell mkdir -p $(OUTDIR) 2>/dev/null)
endif
# Include the dependency files.
ifdef ComSpec
-include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*)
else
-include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*)
endif
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex bin lss sym clean clean_list program
#####
# Project: OpenPilot
#
#
# Makefile for OpenPilot project build PiOS and the AP.
#
# The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009.
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#####
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
TOP := $(realpath $(WHEREAMI)/../../../)
include $(TOP)/make/firmware-defs.mk
# Set developer code and compile options
# Set to YES to compile for debugging
DEBUG ?= NO
# Set to YES to use the Servo output pins for debugging via scope or logic analyser
ENABLE_DEBUG_PINS ?= NO
# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs
ENABLE_AUX_UART ?= NO
# Set to YES when using Code Sourcery toolchain
CODE_SOURCERY ?= NO
# Toolchain prefix (i.e arm-elf- -> arm-elf-gcc.exe)
TCHAIN_PREFIX ?= arm-none-eabi-
# Remove command is different for Code Sourcery on Windows
ifeq ($(CODE_SOURCERY), YES)
REMOVE_CMD = cs-rm
else
REMOVE_CMD = rm
endif
FLASH_TOOL = OPENOCD
# MCU name, submodel and board
# - MCU used for compiler-option (-mcpu)
# - MODEL used for linker-script name (-T) and passed as define
# - BOARD just passed as define (optional)
MCU = cortex-m3
CHIP = STM32F103CBT
BOARD ?= NULL
MODEL ?= NULL
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = ../../../build/bootloaders/BootloaderUpdater
# Target file name (without extension).
TARGET = BL_Updater
# Paths
OPSYSTEM = .
OPSYSTEMINC = $(OPSYSTEM)/inc
OPUAVTALK = ./UAVTalk
OPUAVTALKINC = $(OPUAVTALK)/inc
OPUAVOBJ = ./UAVObjects
OPUAVOBJINC = $(OPUAVOBJ)/inc
OPTESTS = ./Tests
OPMODULEDIR = ./Modules
FLIGHTLIB = ../../Libraries
FLIGHTLIBINC = ../../Libraries/inc
PIOS = ../../PiOS
PIOSINC = $(PIOS)/inc
PIOSSTM32F10X = $(PIOS)/STM32F10x
PIOSCOMMON = $(PIOS)/Common
PIOSBOARDS = $(PIOS)/Boards
APPLIBDIR = $(PIOSSTM32F10X)/Libraries
STMLIBDIR = $(APPLIBDIR)
STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver
STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver
STMSPDSRCDIR = $(STMSPDDIR)/src
STMSPDINCDIR = $(STMSPDDIR)/inc
STMUSBSRCDIR = $(STMUSBDIR)/src
STMUSBINCDIR = $(STMUSBDIR)/inc
CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3
DOSFSDIR = $(APPLIBDIR)/dosfs
MSDDIR = $(APPLIBDIR)/msd
RTOSDIR = $(APPLIBDIR)/FreeRTOS
RTOSSRCDIR = $(RTOSDIR)/Source
RTOSINCDIR = $(RTOSSRCDIR)/include
DOXYGENDIR = ../Doc/Doxygen
# List C source files here. (C dependencies are automatically generated.)
# use file-extension c for "c-only"-files
## CORE:
SRC += $(OPSYSTEM)/main.c
SRC += $(OPSYSTEM)/pios_board.c
## PIOS Hardware (STM32F10x)
SRC += $(PIOSSTM32F10X)/pios_sys.c
SRC += $(PIOSSTM32F10X)/pios_led.c
SRC += $(PIOSSTM32F10X)/pios_delay.c
SRC += $(PIOSSTM32F10X)/pios_irq.c
SRC += $(PIOSSTM32F10X)/pios_gpio.c
## CMSIS for STM32
SRC += $(CMSISDIR)/core_cm3.c
SRC += $(CMSISDIR)/system_stm32f10x.c
## Used parts of the STM-Library
SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c
SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c
SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c
SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c
SRC += $(STMSPDSRCDIR)/stm32f10x_tim.c
SRC += $(STMSPDSRCDIR)/misc.c
# List C source files here which must be compiled in ARM-Mode (no -mthumb).
# use file-extension c for "c-only"-files
## just for testing, timer.c could be compiled in thumb-mode too
SRCARM =
# List C++ source files here.
# use file-extension .cpp for C++-files (not .C)
CPPSRC =
# List C++ source files here which must be compiled in ARM-Mode.
# use file-extension .cpp for C++-files (not .C)
#CPPSRCARM = $(TARGET).cpp
CPPSRCARM =
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
EXTRAINCDIRS = $(OPSYSTEM)
EXTRAINCDIRS += $(OPSYSTEMINC)
EXTRAINCDIRS += $(OPUAVTALK)
EXTRAINCDIRS += $(OPUAVTALKINC)
EXTRAINCDIRS += $(OPUAVOBJ)
EXTRAINCDIRS += $(OPUAVOBJINC)
EXTRAINCDIRS += $(PIOS)
EXTRAINCDIRS += $(PIOSINC)
EXTRAINCDIRS += $(FLIGHTLIBINC)
EXTRAINCDIRS += $(PIOSSTM32F10X)
EXTRAINCDIRS += $(PIOSCOMMON)
EXTRAINCDIRS += $(PIOSBOARDS)
EXTRAINCDIRS += $(STMSPDINCDIR)
EXTRAINCDIRS += $(STMUSBINCDIR)
EXTRAINCDIRS += $(CMSISDIR)
EXTRAINCDIRS += $(DOSFSDIR)
EXTRAINCDIRS += $(MSDDIR)
EXTRAINCDIRS += $(RTOSINCDIR)
EXTRAINCDIRS += $(APPLIBDIR)
EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3
# List any extra directories to look for library files here.
# Also add directories where the linker should search for
# includes from linker-script to the list
# Each directory must be seperated by a space.
EXTRA_LIBDIRS =
# Extra Libraries
# Each library-name must be seperated by a space.
# i.e. to link with libxyz.a, libabc.a and libefsl.a:
# EXTRA_LIBS = xyz abc efsl
# for newlib-lpc (file: libnewlibc-lpc.a):
# EXTRA_LIBS = newlib-lpc
EXTRA_LIBS =
# Path to Linker-Scripts
LINKERSCRIPTPATH = $(PIOSSTM32F10X)
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
ifeq ($(DEBUG),YES)
OPT = 0
else
OPT = s
endif
# Output format. (can be ihex or binary or both)
# binary to create a load-image in raw-binary format i.e. for SAM-BA,
# ihex to create a load-image in Intel hex format
#LOADFORMAT = ihex
#LOADFORMAT = binary
LOADFORMAT = both
# Debugging format.
DEBUGF = dwarf-2
# Place project-specific -D (define) and/or
# -U options for C here.
CDEFS = -DSTM32F10X_$(MODEL)
CDEFS += -DUSE_STDPERIPH_DRIVER
CDEFS += -DUSE_$(BOARD)
ifeq ($(ENABLE_DEBUG_PINS), YES)
CDEFS += -DPIOS_ENABLE_DEBUG_PINS
endif
ifeq ($(ENABLE_AUX_UART), YES)
CDEFS += -DPIOS_ENABLE_AUX_UART
endif
CDEFS += -DUSE_BOOTLOADER
# Place project-specific -D and/or -U options for
# Assembler with preprocessor here.
#ADEFS = -DUSE_IRQ_ASM_WRAPPER
ADEFS = -D__ASSEMBLY__
# Compiler flag to set the C Standard level.
# c89 - "ANSI" C
# gnu89 - c89 plus GCC extensions
# c99 - ISO C99 standard (not yet fully implemented)
# gnu99 - c99 plus GCC extensions
CSTANDARD = -std=gnu99
#-----
# Compiler flags.
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
#
# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
ifeq ($(DEBUG),YES)
CFLAGS = -DDEBUG
endif
CFLAGS += -g$(DEBUGF)
CFLAGS += -O$(OPT)
ifeq ($(DEBUG),NO)
CFLAGS += -ffunction-sections
endif
CFLAGS += -mcpu=$(MCU) -mthumb
CFLAGS += $(CDEFS)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
CFLAGS += -mapcs-frame
CFLAGS += -fomit-frame-pointer
CFLAGS += -fpromote-loop-indices
CFLAGS += -Wall
CFLAGS += -Werror
CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<))))
# Compiler flags to generate dependency files:
CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d
# flags only for C
#CONLYFLAGS += -Wnested-externs
CONLYFLAGS += $(CSTANDARD)
# Assembler flags.
# -Wa,...: tell GCC to pass this to the assembler.
# -ahlns: create listing
ASFLAGS = -mcpu=$(MCU) -mthumb -I. -x assembler-with-cpp
ASFLAGS += $(ADEFS)
ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<))))
ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
MATH_LIB = -lm
# Linker flags.
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
ifeq ($(DEBUG),NO)
LDFLAGS += -Wl,-static
endif
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
LDFLAGS += -lc
LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
LDFLAGS += $(MATH_LIB)
LDFLAGS += -lc -lgcc
# Set linker-script name depending on selected submodel name
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08003000 bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08003000 bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
OOCD_CL+=-c shutdown
# ---------------------------------------------------------------------------
# Define programs and commands.
REMOVE = $(REMOVE_CMD) -f
###SHELL = sh
###COPY = cp
# List of all source files.
ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC)
# List of all source files without directory and file-extension.
ALLSRCBASE = $(notdir $(basename $(ALLSRC)))
# Define all object files.
ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE)))
# Define all listing files (used for make clean).
LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE)))
# Define all depedency-files (used for make clean).
DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE)))
# Default target.
all: build
ifeq ($(LOADFORMAT),ihex)
build: elf hex sym
else
ifeq ($(LOADFORMAT),binary)
build: elf bin sym
else
ifeq ($(LOADFORMAT),both)
build: elf hex bin sym
else
$(error "$(MSG_FORMATERROR) $(FORMAT)")
endif
endif
endif
# Program the device.
ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OPENOCD${quote}
$(OOCD_EXE) $(OOCD_CL)
endif
# Link: create ELF output file from object files.
$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ) $(BLOBJ)))
# Assemble: create object files from assembler source files.
$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src))))
# Assemble: create object files from assembler source files. ARM-only
$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src))))
# Compile: create object files from C source files.
$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src))))
# Compile: create object files from C source files. ARM-only
$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src))))
# Compile: create object files from C++ source files.
$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src))))
# Compile: create object files from C++ source files. ARM-only
$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src))))
# Compile: create assembler files from C source files. ARM/Thumb
$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC))
# Compile: create assembler files from C source files. ARM only
$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
.PHONY: elf lss sym hex bin bino
elf: $(OUTDIR)/$(TARGET).elf
elf.stripped: $(OUTDIR)/$(TARGET).elf.stripped
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
bino: $(OUTDIR)/$(TARGET).bin.o
# Display sizes of sections.
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
.PHONY: size
size: $(OUTDIR)/$(TARGET).elf_size
# Generate Doxygen documents
docs:
doxygen $(DOXYGENDIR)/doxygen.cfg
# Install: install binary file with prefix/suffix into install directory
install: $(OUTDIR)/$(TARGET).bin
ifneq ($(INSTALL_DIR),)
@echo $(MSG_INSTALLING) $(call toprel, $<)
$(V1) mkdir -p $(INSTALL_DIR)
$(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin
else
$(error INSTALL_DIR must be specified for $@)
endif
# Target: clean project.
clean: begin clean_list finished end
clean_list :
@echo $(MSG_CLEANING)
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o
$(V1) $(REMOVE) $(ALLOBJ)
$(V1) $(REMOVE) $(LSTFILES)
$(V1) $(REMOVE) $(DEPFILES)
$(V1) $(REMOVE) $(SRC:.c=.s)
$(V1) $(REMOVE) $(SRCARM:.c=.s)
$(V1) $(REMOVE) $(CPPSRC:.cpp=.s)
$(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s)
# Create output files directory
# all known MS Windows OS define the ComSpec environment variable
ifdef ComSpec
$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL)
else
$(shell mkdir -p $(OUTDIR) 2>/dev/null)
endif
# Include the dependency files.
ifdef ComSpec
-include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*)
else
-include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*)
endif
# Listing of phony targets.
.PHONY : all build clean clean_list program install

View File

@ -1,105 +0,0 @@
# Convert binary file to a hex encoded array for inclusion in C projects
import os
import struct
import sys
import logging
class BinToArray:
def __init__(self):
pass
def ConvertFileToArray(self, strInFile, strOutFile, integerSize, ignoreBytes, endianNess):
""" Reads binary file at location strInFile and writes out a C array of hex values
Parameters -
strInFile - Path and filename of binary file to convert
strOutFile - Path and filename of output. Suggested extension is .c or .cpp
integerSize - Size in bytes of output array elements. Array generated is always
of type uint8, uint16, uint32. These types would need to be defined using
typedef if they don't exist, or the user can replace the type name with the
appropriate keyword valid for the compiler size conventions
ignoreBytes - Number of bytes to ignore at the beginning of binary file. Helps
strip out file headers and only encode the payload/data.
endianNess - Only used for integerSize of 2 or 4. 'l' for Little Endian, 'b' for
Big Endian
"""
# Check integerSize value
if integerSize not in (1, 2, 4):
logging.debug("Integer Size parameter must be 1, 2 or 4")
return
# endif
# Open input file
try:
fileIn = open(strInFile, 'rb')
except IOError, err:
logging.debug("Could not open input file %s" % (strInFile))
return
# end try
# Open input file
try:
fileOut = open(strOutFile, 'w')
except IOError, err:
logging.debug("Could not open output file %s" % (strOutFile))
return
# end try
# Start array definition preamble
inFileName = os.path.basename(strInFile)
strVarType = "uint%d_t" % (integerSize * 8)
fileOut.write("// Array representation of binary file %s\n\n\n" % (inFileName))
fileOut.write("static %s dataArray[] = {\n" % strVarType)
# Convert and write array into C file
fileIn.seek(ignoreBytes)
if integerSize == 1:
bufChunk = fileIn.read(20)
while bufChunk != '':
fileOut.write(" ")
for byteVal in bufChunk:
fileOut.write("0x%02x, " % ord(byteVal))
# end for
fileOut.write("\n")
bufChunk = fileIn.read(20)
# end while
else:
if endianNess == 'l' and integerSize == 2:
endianFormatter = '<H'
maxWordsPerLine = 10
elif endianNess == 'l' and integerSize == 4:
endianFormatter = '<L'
maxWordsPerLine = 6
elif endianNess == 'b' and integerSize == 2:
endianFormatter = '>H'
maxWordsPerLine = 10
elif endianNess == 'b' and integerSize == 4:
endianFormatter = '>L'
maxWordsPerLine = 6
# endif
bufChunk = fileIn.read(integerSize)
i = 0
fileOut.write(" ")
while bufChunk != '':
wordVal = struct.unpack(endianFormatter, bufChunk)
if integerSize == 2:
fileOut.write("0x%04x, " % wordVal)
else:
fileOut.write("0x%08x, " % wordVal)
# endif
i += 1
if i == maxWordsPerLine:
fileOut.write("\n ")
i = 0
# endif
bufChunk = fileIn.read(integerSize)
# end while
# end if
# Close array definition
fileOut.write("\n };\n")
fileIn.close()
fileOut.close()
if __name__ == "__main__":
print(sys.argv[0])
logging.basicConfig(level=logging.DEBUG)
converter = BinToArray()
converter.ConvertFileToArray(
sys.argv[1], sys.argv[2], 4, 0, 'l')

View File

@ -27,13 +27,25 @@
*/
/* Bootloader Includes */
#include <pios.h>
#include <bl_array.h>
#include <stdbool.h>
#define MAX_WRI_RETRYS 3
/* Prototype of PIOS_Board_Init() function */
extern void PIOS_Board_Init(void);
extern void FLASH_Download();
void error(int);
/* The ADDRESSES of the _binary_* symbols are the important
* data. This is non-intuitive for _binary_size where you
* might expect its value to hold the size but you'd be wrong.
*/
extern uint32_t _binary_start;
extern uint32_t _binary_end;
extern uint32_t _binary_size;
const uint32_t * embedded_image_start = (uint32_t *) &(_binary_start);
const uint32_t * embedded_image_end = (uint32_t *) &(_binary_end);
const uint32_t embedded_image_size = (uint32_t) &(_binary_size);
int main() {
PIOS_SYS_Init();
@ -43,63 +55,70 @@ int main() {
PIOS_LED_Off(LED1);
/// Self overwrite check
uint32_t base_adress = SCB->VTOR;
if (0x08000000 + (sizeof(dataArray)) > base_adress)
uint32_t base_address = SCB->VTOR;
if ((0x08000000 + embedded_image_size) > base_address)
error(LED1);
///
FLASH_Unlock();
/// Bootloader memory space erase
uint32_t pageAdress;
pageAdress = 0x08000000;
uint8_t fail = FALSE;
while ((pageAdress < base_adress) || (fail == TRUE)) {
uint32_t pageAddress;
pageAddress = 0x08000000;
bool fail = false;
while ((pageAddress < base_address) && (fail == false)) {
for (int retry = 0; retry < MAX_DEL_RETRYS; ++retry) {
if (FLASH_ErasePage(pageAdress) == FLASH_COMPLETE) {
fail = FALSE;
if (FLASH_ErasePage(pageAddress) == FLASH_COMPLETE) {
fail = false;
break;
} else {
fail = TRUE;
fail = true;
}
}
#ifdef STM32F10X_HD
pageAdress += 2048;
pageAddress += 2048;
#elif defined (STM32F10X_MD)
pageAdress += 1024;
pageAddress += 1024;
#endif
}
if (fail == TRUE)
if (fail == true)
error(LED1);
///
/// Bootloader programing
for (int x = 0; x < sizeof(dataArray)/sizeof(uint32_t); ++x) {
int result = 0;
for (uint32_t offset = 0; offset < embedded_image_size/sizeof(uint32_t); ++offset) {
bool result = false;
PIOS_LED_Toggle(LED1);
for (int retry = 0; retry < MAX_WRI_RETRYS; ++retry) {
if (result == 0) {
result = (FLASH_ProgramWord(0x08000000 + (x * 4), dataArray[x])
== FLASH_COMPLETE) ? 1 : 0;
for (uint8_t retry = 0; retry < MAX_WRI_RETRYS; ++retry) {
if (result == false) {
result = (FLASH_ProgramWord(0x08000000 + (offset * 4), embedded_image_start[offset])
== FLASH_COMPLETE) ? true : false;
}
}
if (result == 0)
if (result == false)
error(LED1);
}
///
for (int x=0;x<3;++x) {
for (uint8_t x = 0; x < 3; ++x) {
PIOS_LED_On(LED1);
PIOS_DELAY_WaitmS(1000);
PIOS_LED_Off(LED1);
PIOS_DELAY_WaitmS(1000);
}
}
/// Invalidate the bootloader updater so we won't run
/// the update again on the next power cycle.
FLASH_ProgramWord(base_address, 0);
FLASH_Lock();
for (;;) {
PIOS_DELAY_WaitmS(1000);
}
}
void error(int led) {
for (;;) {
PIOS_LED_On(led);

View File

@ -36,10 +36,6 @@ ENABLE_DEBUG_PINS ?= NO
# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs
ENABLE_AUX_UART ?= NO
#
override USE_BOOTLOADER = NO
# Set to YES when using Code Sourcery toolchain
CODE_SOURCERY ?= NO
@ -60,12 +56,6 @@ MCU = cortex-m3
CHIP = STM32F103CBT
BOARD = STM32103CB_CC_Rev1
MODEL = MD
ifeq ($(USE_BOOTLOADER), YES)
BOOT_MODEL = $(MODEL)_BL
else
BOOT_MODEL = $(MODEL)_NB
endif
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/bl_coptercontrol
@ -268,10 +258,6 @@ endif
ifeq ($(ENABLE_AUX_UART), YES)
CDEFS += -DPIOS_ENABLE_AUX_UART
endif
ifeq ($(USE_BOOTLOADER), YES)
CDEFS += -DUSE_BOOTLOADER
endif
# Place project-specific -D and/or -U options for
# Assembler with preprocessor here.
@ -299,9 +285,10 @@ CSTANDARD = -std=gnu99
# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
ifeq ($(DEBUG),YES)
CFLAGS = -g$(DEBUGF) -DDEBUG
CFLAGS += -DDEBUG
endif
CFLAGS += -g$(DEBUGF)
CFLAGS += -O$(OPT)
ifeq ($(DEBUG),NO)
CFLAGS += -ffunction-sections
@ -341,7 +328,7 @@ MATH_LIB = -lm
# --cref: add cross reference to map file
LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
ifeq ($(DEBUG),NO)
LDFLAGS += -Wl,-static -Wl,-s
LDFLAGS += -Wl,-static
endif
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
LDFLAGS += -lc
@ -350,13 +337,14 @@ LDFLAGS += $(MATH_LIB)
LDFLAGS += -lc -lgcc
# Set linker-script name depending on selected submodel name
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_stm32f10x_$(MODEL).ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
# Program
OOCD_CL+=-c "flash write_image $(OOCD_LOADFILE)"
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08000000 bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08000000 bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
@ -408,7 +396,7 @@ ${OUTDIR}/InitMods.c: Makefile
# Program the device.
ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
program: $(OUTDIR)/$(TARGET).elf
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OPENOCD${quote}
$(OOCD_EXE) $(OOCD_CL)
endif
@ -440,22 +428,35 @@ $(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC))
# Compile: create assembler files from C source files. ARM only
$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
# Generate Doxygen documents
docs:
doxygen $(DOXYGENDIR)/doxygen.cfg
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
.PHONY: elf lss sym hex bin
.PHONY: elf lss sym hex bin bino
elf: $(OUTDIR)/$(TARGET).elf
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
bino: $(OUTDIR)/$(TARGET).bin.o
# Display sizes of sections.
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
.PHONY: size
size: $(OUTDIR)/$(TARGET).elf_size
# Generate Doxygen documents
docs:
doxygen $(DOXYGENDIR)/doxygen.cfg
# Install: install binary file with prefix/suffix into install directory
install: $(OUTDIR)/$(TARGET).bin
ifneq ($(INSTALL_DIR),)
@echo $(MSG_INSTALLING) $(call toprel, $<)
$(V1) mkdir -p $(INSTALL_DIR)
$(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin
else
$(error INSTALL_DIR must be specified for $@)
endif
# Target: clean project.
clean: clean_list
@ -467,6 +468,7 @@ clean_list :
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o
$(V1) $(REMOVE) $(ALLOBJ)
$(V1) $(REMOVE) $(LSTFILES)
$(V1) $(REMOVE) $(DEPFILES)
@ -492,4 +494,4 @@ else
endif
# Listing of phony targets.
.PHONY : all build clean clean_list program
.PHONY : all build clean clean_list program install

View File

@ -36,10 +36,6 @@ ENABLE_DEBUG_PINS ?= NO
# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs
ENABLE_AUX_UART ?= NO
#
override USE_BOOTLOADER = NO
# Set to YES when using Code Sourcery toolchain
CODE_SOURCERY ?= NO
@ -60,12 +56,6 @@ MCU = cortex-m3
CHIP = STM32F103RET
BOARD = STM3210E_OP
MODEL = HD
ifeq ($(USE_BOOTLOADER), YES)
BOOT_MODEL = $(MODEL)_BL
else
BOOT_MODEL = $(MODEL)_NB
endif
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/bl_openpilot
@ -193,7 +183,7 @@ CPPSRCARM =
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL).S
ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)_OP.S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
@ -271,10 +261,6 @@ endif
ifeq ($(ENABLE_AUX_UART), YES)
CDEFS += -DPIOS_ENABLE_AUX_UART
endif
ifeq ($(USE_BOOTLOADER), YES)
CDEFS += -DUSE_BOOTLOADER
endif
# Place project-specific -D and/or -U options for
# Assembler with preprocessor here.
@ -302,9 +288,10 @@ CSTANDARD = -std=gnu99
# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
ifeq ($(DEBUG),YES)
CFLAGS = -g$(DEBUGF) -DDEBUG
CFLAGS = -DDEBUG
endif
CFLAGS += -g$(DEBUGF)
CFLAGS += -O$(OPT)
ifeq ($(DEBUG),NO)
CFLAGS += -ffunction-sections
@ -344,7 +331,7 @@ MATH_LIB = -lm
# --cref: add cross reference to map file
LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
ifeq ($(DEBUG),NO)
LDFLAGS += -Wl,-static -Wl,-s
LDFLAGS += -Wl,-static
endif
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
LDFLAGS += -lc
@ -353,13 +340,14 @@ LDFLAGS += $(MATH_LIB)
LDFLAGS += -lc -lgcc
# Set linker-script name depending on selected submodel name
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_stm32f10x_$(MODEL).ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08000000 bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08000000 bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
@ -411,7 +399,7 @@ ${OUTDIR}/InitMods.c: Makefile
# Program the device.
ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
program: $(OUTDIR)/$(TARGET).elf
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OPENOCD${quote}
$(OOCD_EXE) $(OOCD_CL)
endif
@ -443,12 +431,15 @@ $(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC))
# Compile: create assembler files from C source files. ARM only
$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
.PHONY: elf lss sym hex bin
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
.PHONY: elf lss sym hex bin bino
elf: $(OUTDIR)/$(TARGET).elf
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
bino: $(OUTDIR)/$(TARGET).bin.o
# Display sizes of sections.
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
@ -459,6 +450,16 @@ size: $(OUTDIR)/$(TARGET).elf_size
docs:
doxygen $(DOXYGENDIR)/doxygen.cfg
# Install: install binary file with prefix/suffix into install directory
install: $(OUTDIR)/$(TARGET).bin
ifneq ($(INSTALL_DIR),)
@echo $(MSG_INSTALLING) $(call toprel, $<)
$(V1) mkdir -p $(INSTALL_DIR)
$(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin
else
$(error INSTALL_DIR must be specified for $@)
endif
# Target: clean project.
clean: clean_list
@ -470,6 +471,7 @@ clean_list :
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o
$(V1) $(REMOVE) $(ALLOBJ)
$(V1) $(REMOVE) $(LSTFILES)
$(V1) $(REMOVE) $(DEPFILES)
@ -495,4 +497,4 @@ else
endif
# Listing of phony targets.
.PHONY : all build clean clean_list program
.PHONY : all build clean clean_list program install

View File

@ -36,10 +36,6 @@ ENABLE_DEBUG_PINS ?= NO
# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs
ENABLE_AUX_UART ?= NO
#
override USE_BOOTLOADER = NO
# Set to YES when using Code Sourcery toolchain
CODE_SOURCERY ?= NO
@ -60,12 +56,6 @@ MCU = cortex-m3
CHIP = STM32F103CBT
BOARD = STM32103CB_PIPXTREME
MODEL = MD
ifeq ($(USE_BOOTLOADER), YES)
BOOT_MODEL = $(MODEL)_BL
else
BOOT_MODEL = $(MODEL)_NB
endif
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/bl_pipxtreme
@ -267,10 +257,6 @@ endif
ifeq ($(ENABLE_AUX_UART), YES)
CDEFS += -DPIOS_ENABLE_AUX_UART
endif
ifeq ($(USE_BOOTLOADER), YES)
CDEFS += -DUSE_BOOTLOADER
endif
# Place project-specific -D and/or -U options for
# Assembler with preprocessor here.
@ -298,9 +284,10 @@ CSTANDARD = -std=gnu99
# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
ifeq ($(DEBUG),YES)
CFLAGS = -g$(DEBUGF) -DDEBUG
CFLAGS = -DDEBUG
endif
CFLAGS += -g$(DEBUGF)
CFLAGS += -O$(OPT)
ifeq ($(DEBUG),NO)
CFLAGS += -ffunction-sections
@ -340,7 +327,7 @@ MATH_LIB = -lm
# --cref: add cross reference to map file
LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
ifeq ($(DEBUG),NO)
LDFLAGS += -Wl,-static -Wl,-s
LDFLAGS += -Wl,-static
endif
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
LDFLAGS += -lc
@ -349,13 +336,14 @@ LDFLAGS += $(MATH_LIB)
LDFLAGS += -lc -lgcc
# Set linker-script name depending on selected submodel name
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_stm32f10x_$(MODEL).ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08000000 bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08000000 bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
@ -407,7 +395,7 @@ ${OUTDIR}/InitMods.c: Makefile
# Program the device.
ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
program: $(OUTDIR)/$(TARGET).elf
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OPENOCD${quote}
$(OOCD_EXE) $(OOCD_CL)
endif
@ -439,12 +427,15 @@ $(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC))
# Compile: create assembler files from C source files. ARM only
$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
.PHONY: elf lss sym hex bin
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
.PHONY: elf lss sym hex bin bino
elf: $(OUTDIR)/$(TARGET).elf
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
bino: $(OUTDIR)/$(TARGET).bin.o
# Display sizes of sections.
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
@ -455,6 +446,16 @@ size: $(OUTDIR)/$(TARGET).elf_size
docs:
doxygen $(DOXYGENDIR)/doxygen.cfg
# Install: install binary file with prefix/suffix into install directory
install: $(OUTDIR)/$(TARGET).bin
ifneq ($(INSTALL_DIR),)
@echo $(MSG_INSTALLING) $(call toprel, $<)
$(V1) mkdir -p $(INSTALL_DIR)
$(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin
else
$(error INSTALL_DIR must be specified for $@)
endif
# Target: clean project.
clean: clean_list
@ -466,6 +467,7 @@ clean_list :
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o
$(V1) $(REMOVE) $(ALLOBJ)
$(V1) $(REMOVE) $(LSTFILES)
$(V1) $(REMOVE) $(DEPFILES)
@ -491,5 +493,4 @@ else
endif
# Listing of phony targets.
.PHONY : all build clean clean_list program
.PHONY : all build clean clean_list program install

View File

@ -38,9 +38,6 @@ ENABLE_DEBUG_PINS ?= NO
# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs
ENABLE_AUX_UART ?= NO
#
USE_BOOTLOADER ?= YES
USE_SPEKTRUM ?= NO
USE_I2C ?= NO
@ -68,12 +65,6 @@ MCU = cortex-m3
CHIP = STM32F103CBT
BOARD = STM32103CB_CC_Rev1
MODEL = MD
ifeq ($(USE_BOOTLOADER), YES)
BOOT_MODEL = $(MODEL)_BL
else
BOOT_MODEL = $(MODEL)_NB
endif
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/coptercontrol
@ -160,6 +151,7 @@ ifndef TESTAPP
SRC += $(OPUAVSYNTHDIR)/objectpersistence.c
SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c
SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c
SRC += $(OPUAVSYNTHDIR)/flightstatus.c
SRC += $(OPUAVSYNTHDIR)/systemstats.c
SRC += $(OPUAVSYNTHDIR)/systemalarms.c
SRC += $(OPUAVSYNTHDIR)/systemsettings.c
@ -208,12 +200,12 @@ SRC += $(PIOSSTM32F10X)/pios_wdg.c
# PIOS USB related files (seperated to make code maintenance more easy)
SRC += $(PIOSSTM32F10X)/pios_usb_hid.c
#SRC += $(PIOSSTM32F10X)/pios_usb_hid_desc.c
SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c
SRC += $(PIOSSTM32F10X)/pios_usb_hid_prop.c
SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
## PIOS Hardware (Common)
SRC += $(PIOSCOMMON)/pios_flashfs_objlist.c
SRC += $(PIOSCOMMON)/pios_flash_w25x.c
SRC += $(PIOSCOMMON)/pios_adxl345.c
SRC += $(PIOSCOMMON)/pios_com.c
@ -389,9 +381,7 @@ endif
ifeq ($(ENABLE_AUX_UART), YES)
CDEFS += -DPIOS_ENABLE_AUX_UART
endif
ifeq ($(USE_BOOTLOADER), YES)
CDEFS += -DUSE_BOOTLOADER
endif
ifeq ($(ERASE_FLASH), YES)
CDEFS += -DERASE_FLASH
endif
@ -481,13 +471,14 @@ LDFLAGS += $(MATH_LIB)
LDFLAGS += -lc -lgcc
# Set linker-script name depending on selected submodel name
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_$(BOARD)_$(BOOT_MODEL).ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
# Program
OOCD_CL+=-c "flash write_image $(OOCD_LOADFILE)"
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08003000 bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08003000 bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
@ -548,20 +539,12 @@ ${OUTDIR}/InitMods.c: Makefile
# @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h
# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py
# Program the device.
ifeq ($(USE_BOOTLOADER), YES)
# Program the device with OP Upload Tool".
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OP Upload Tool${quote}
../../ground/src/experimental/upload-build-desktop/debug/OPUploadTool -d 0 -p $(OUTDIR)/$(TARGET).bin
else
ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
program: $(OUTDIR)/$(TARGET).elf
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OPENOCD${quote}
$(OOCD_EXE) $(OOCD_CL)
endif
endif
# Link: create ELF output file from object files.
$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ)))
@ -590,12 +573,15 @@ $(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC))
# Compile: create assembler files from C source files. ARM only
$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
.PHONY: elf lss sym hex bin
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
.PHONY: elf lss sym hex bin bino
elf: $(OUTDIR)/$(TARGET).elf
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
bino: $(OUTDIR)/$(TARGET).bin.o
# Display sizes of sections.
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
@ -606,6 +592,16 @@ size: $(OUTDIR)/$(TARGET).elf_size
docs:
doxygen $(DOXYGENDIR)/doxygen.cfg
# Install: install binary file with prefix/suffix into install directory
install: $(OUTDIR)/$(TARGET).bin
ifneq ($(INSTALL_DIR),)
@echo $(MSG_INSTALLING) $(call toprel, $<)
$(V1) mkdir -p $(INSTALL_DIR)
$(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin
else
$(error INSTALL_DIR must be specified for $@)
endif
# Target: clean project.
clean: clean_list
@ -617,6 +613,7 @@ clean_list :
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o
$(V1) $(REMOVE) $(wildcard $(OUTDIR)/*.c)
$(V1) $(REMOVE) $(wildcard $(OUTDIR)/*.h)
$(V1) $(REMOVE) $(ALLOBJ)
@ -644,5 +641,4 @@ else
endif
# Listing of phony targets.
.PHONY : all build clean clean_list program gencode
.PHONY : all build clean clean_list program gencode install

View File

@ -92,6 +92,7 @@ void OpenPilotInit()
#ifdef ERASE_FLASH
PIOS_Flash_W25X_EraseChip();
while(TRUE){};
#endif
/* Initialize modules */

View File

@ -84,18 +84,19 @@
#define AUXUART_BAUDRATE 19200
/* Alarm Thresholds */
#define HEAP_LIMIT_WARNING 450
#define HEAP_LIMIT_CRITICAL 350
#define HEAP_LIMIT_WARNING 350
#define HEAP_LIMIT_CRITICAL 250
#define CPULOAD_LIMIT_WARNING 80
#define CPULOAD_LIMIT_CRITICAL 95
/* Task stack sizes */
#define PIOS_ACTUATOR_STACK_SIZE 1020
#define PIOS_MANUAL_STACK_SIZE 644
#define PIOS_SYSTEM_STACK_SIZE 644
#define PIOS_STABILIZATION_STACK_SIZE 624
#define PIOS_MANUAL_STACK_SIZE 724
#define PIOS_SYSTEM_STACK_SIZE 504
#define PIOS_STABILIZATION_STACK_SIZE 524
#define PIOS_TELEM_STACK_SIZE 500
#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998
//#define PIOS_QUATERNION_STABILIZATION
#endif /* PIOS_CONFIG_H */

View File

@ -678,8 +678,10 @@ void PIOS_Board_Init(void) {
PIOS_DEBUG_Assert(0);
}
PIOS_Flash_W25X_Init(pios_spi_flash_accel_id);
PIOS_Flash_W25X_Init(pios_spi_flash_accel_id);
PIOS_ADXL345_Attach(pios_spi_flash_accel_id);
PIOS_FLASHFS_Init();
#if defined(PIOS_INCLUDE_SPEKTRUM)
/* SPEKTRUM init must come before comms */

View File

@ -416,6 +416,16 @@ size: $(OUTDIR)/$(TARGET).elf_size
docs:
doxygen $(DOXYGENDIR)/doxygen.cfg
# Install: install binary file with prefix/suffix into install directory
install: $(OUTDIR)/$(TARGET).bin
ifneq ($(INSTALL_DIR),)
@echo $(MSG_INSTALLING) $(call toprel, $<)
$(V1) mkdir -p $(INSTALL_DIR)
$(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin
else
$(error INSTALL_DIR must be specified for $@)
endif
# Target: clean project.
clean: clean_list
@ -450,6 +460,5 @@ else
-include $(shell mkdir $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*)
endif
# Listing of phony targets.
.PHONY : all build clean clean_list program
.PHONY : all build clean clean_list program install

View File

@ -50,8 +50,21 @@ uint32_t STOPWATCH_Init(u32 resolution, TIM_TypeDef* TIM) {
case (uint32_t)TIM4:
STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM4;
break;
case (uint32_t)TIM5:
STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM5;
break;
case (uint32_t)TIM6:
STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM6;
break;
case (uint32_t)TIM7:
STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM7;
break;
case (uint32_t)TIM8:
STOPWATCH_TIMER_RCC = RCC_APB2Periph_TIM8;
break;
default:
STOPWATCH_TIMER_RCC = RCC_APB2Periph_TIM1;
/* Unsupported timer */
while(1);
}
// enable timer clock

View File

@ -37,7 +37,7 @@
#include "systemsettings.h"
#include "actuatordesired.h"
#include "actuatorcommand.h"
#include "manualcontrolcommand.h"
#include "flightstatus.h"
#include "mixersettings.h"
#include "mixerstatus.h"
@ -135,7 +135,7 @@ static void actuatorTask(void* parameters)
MixerSettingsData mixerSettings;
ActuatorDesiredData desired;
MixerStatusData mixerStatus;
ManualControlCommandData manualControl;
FlightStatusData flightStatus;
ActuatorSettingsGet(&settings);
PIOS_Servo_SetHz(&settings.ChannelUpdateFreq[0], ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM);
@ -165,7 +165,7 @@ static void actuatorTask(void* parameters)
lastSysTime = thisSysTime;
ManualControlCommandGet(&manualControl);
FlightStatusGet(&flightStatus);
SystemSettingsGet(&sysSettings);
MixerStatusGet(&mixerStatus);
MixerSettingsGet (&mixerSettings);
@ -182,7 +182,7 @@ static void actuatorTask(void* parameters)
nMixers ++;
}
}
if(nMixers < 2) //Nothing can fly with less than two mixers.
if((nMixers < 2) && !ActuatorCommandReadOnly(dummy)) //Nothing can fly with less than two mixers.
{
setFailsafe(); // So that channels like PWM buzzer keep working
continue;
@ -190,17 +190,20 @@ static void actuatorTask(void* parameters)
AlarmsClear(SYSTEMALARMS_ALARM_ACTUATOR);
bool armed = manualControl.Armed == MANUALCONTROLCOMMAND_ARMED_TRUE;
bool armed = flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMED;
bool positiveThrottle = desired.Throttle >= 0.00;
bool spinWhileArmed = settings.MotorsSpinWhileArmed == ACTUATORSETTINGS_MOTORSSPINWHILEARMED_TRUE &&
manualControl.Armed == MANUALCONTROLCOMMAND_ARMED_TRUE;
bool spinWhileArmed = settings.MotorsSpinWhileArmed == ACTUATORSETTINGS_MOTORSSPINWHILEARMED_TRUE;
float curve1 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve1);
float curve2 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve2);
for(int ct=0; ct < MAX_MIX_ACTUATORS; ct++)
{
if(mixers[ct].type == MIXERSETTINGS_MIXER1TYPE_DISABLED)
if(mixers[ct].type == MIXERSETTINGS_MIXER1TYPE_DISABLED) {
// Set to minimum if disabled. This is not the same as saying PWM pulse = 0 us
status[ct] = -1;
command.Channel[ct] = 0;
continue;
}
status[ct] = ProcessMixer(ct, curve1, curve2, &mixerSettings, &desired, dT);
@ -401,14 +404,19 @@ static void setFailsafe()
// Reset ActuatorCommand to safe values
for (int n = 0; n < ACTUATORCOMMAND_CHANNEL_NUMELEM; ++n)
{
if(mixers[n].type == MIXERSETTINGS_MIXER1TYPE_MOTOR)
{
command.Channel[n] = settings.ChannelMin[n];
}
else
else if(mixers[n].type == MIXERSETTINGS_MIXER1TYPE_SERVO)
{
command.Channel[n] = settings.ChannelNeutral[n];
}
else
{
command.Channel[n] = 0;
}
}
// Set alarm

View File

@ -53,6 +53,7 @@
#include "attituderaw.h"
#include "attitudeactual.h"
#include "attitudesettings.h"
#include "flightstatus.h"
#include "CoordinateConversions.h"
#include "pios_flash_w25x.h"
@ -87,6 +88,7 @@ static int16_t accelbias[3];
static float q[4] = {1,0,0,0};
static float R[3][3];
static int8_t rotate = 0;
static bool zero_during_arming = false;
/**
* Initialise the module, called on startup
@ -133,15 +135,27 @@ static void AttitudeTask(void *parameters)
PIOS_FLASH_DISABLE;
PIOS_ADXL345_Init();
zero_during_arming = false;
// Main task loop
while (1) {
if(xTaskGetTickCount() < 10000) {
// For first 5 seconds use accels to get gyro bias
FlightStatusData flightStatus;
FlightStatusGet(&flightStatus);
if(xTaskGetTickCount() < 7000) {
// Force settings update to make sure rotation loaded
settingsUpdatedCb(AttitudeSettingsHandle());
// For first 7 seconds use accels to get gyro bias
accelKp = 1;
// Decrease the rate of gyro learning during init
accelKi = .5 / (1 + xTaskGetTickCount() / 5000);
yawBiasRate = 0.01 / (1 + xTaskGetTickCount() / 5000);
accelKi = 0.9;
yawBiasRate = 0.23;
init = 0;
}
else if (zero_during_arming && (flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMING)) {
accelKp = 1;
accelKi = 0.9;
yawBiasRate = 0.23;
init = 0;
} else if (init == 0) {
settingsUpdatedCb(AttitudeSettingsHandle());
init = 1;
@ -313,6 +327,8 @@ static void settingsUpdatedCb(UAVObjEvent * objEv) {
yawBiasRate = attitudeSettings.YawBiasRate;
gyroGain = attitudeSettings.GyroGain;
zero_during_arming = attitudeSettings.ZeroDuringArming == ATTITUDESETTINGS_ZERODURINGARMING_TRUE;
accelbias[0] = attitudeSettings.AccelBias[ATTITUDESETTINGS_ACCELBIAS_X];
accelbias[1] = attitudeSettings.AccelBias[ATTITUDESETTINGS_ACCELBIAS_Y];
accelbias[2] = attitudeSettings.AccelBias[ATTITUDESETTINGS_ACCELBIAS_Z];

View File

@ -30,6 +30,7 @@
#include "openpilot.h"
#include "firmwareiap.h"
#include "firmwareiapobj.h"
#include "flightstatus.h"
// Private constants
#define IAP_CMD_STEP_1 1122
@ -156,6 +157,16 @@ static void FirmwareIAPCallback(UAVObjEvent* ev)
case IAP_STATE_STEP_2:
if( data.Command == IAP_CMD_STEP_3 ) {
if( delta > iap_time_3_low_end && delta < iap_time_3_high_end ) {
FlightStatusData flightStatus;
FlightStatusGet(&flightStatus);
if(flightStatus.Armed != FLIGHTSTATUS_ARMED_DISARMED) {
// Abort any attempts if not disarmed
iap_state = IAP_STATE_READY;
break;
}
// we've met the three sequence of command numbers
// we've met the time requirements.
PIOS_IAP_SetRequest1();

View File

@ -63,7 +63,7 @@ static float GravityAccel(float latitude, float longitude, float altitude);
// Private constants
//#define FULL_COLD_RESTART // uncomment this to tell the GPS to do a FULL COLD restart
//#define DISABLE_GPS_TRESHOLD //
//#define DISABLE_GPS_THRESHOLD //
#define GPS_TIMEOUT_MS 500
#define GPS_COMMAND_RESEND_TIMEOUT_MS 2000
@ -154,7 +154,7 @@ static void gpsTask(void *parameters)
}
#endif
#ifdef DISABLE_GPS_TRESHOLD
#ifdef DISABLE_GPS_THRESHOLD
PIOS_COM_SendStringNonBlocking(gpsPort, "$PMTK397,0*23\r\n");
#endif

View File

@ -51,7 +51,7 @@
#include "positiondesired.h" // object that will be updated by the module
#include "positionactual.h"
#include "manualcontrol.h"
#include "manualcontrolcommand.h"
#include "flightstatus.h"
#include "nedaccel.h"
#include "stabilizationdesired.h"
#include "stabilizationsettings.h"
@ -114,7 +114,7 @@ static void guidanceTask(void *parameters)
{
SystemSettingsData systemSettings;
GuidanceSettingsData guidanceSettings;
ManualControlCommandData manualControl;
FlightStatusData flightStatus;
portTickType thisTime;
portTickType lastUpdateTime;
@ -182,11 +182,11 @@ static void guidanceTask(void *parameters)
NedAccelSet(&accelData);
ManualControlCommandGet(&manualControl);
FlightStatusGet(&flightStatus);
SystemSettingsGet(&systemSettings);
GuidanceSettingsGet(&guidanceSettings);
if ((PARSE_FLIGHT_MODE(manualControl.FlightMode) == FLIGHTMODE_GUIDANCE) &&
if ((PARSE_FLIGHT_MODE(flightStatus.FlightMode) == FLIGHTMODE_GUIDANCE) &&
((systemSettings.AirframeType == SYSTEMSETTINGS_AIRFRAMETYPE_VTOL) ||
(systemSettings.AirframeType == SYSTEMSETTINGS_AIRFRAMETYPE_QUADP) ||
(systemSettings.AirframeType == SYSTEMSETTINGS_AIRFRAMETYPE_QUADX) ||
@ -204,7 +204,7 @@ static void guidanceTask(void *parameters)
positionHoldLast = 1;
}
if( manualControl.FlightMode == MANUALCONTROLCOMMAND_FLIGHTMODE_POSITIONHOLD )
if( flightStatus.FlightMode == FLIGHTSTATUS_FLIGHTMODE_POSITIONHOLD )
updateVtolDesiredVelocity();
else
manualSetDesiredVelocity();

View File

@ -35,12 +35,12 @@
typedef enum {FLIGHTMODE_UNDEFINED = 0, FLIGHTMODE_MANUAL = 1, FLIGHTMODE_STABILIZED = 2, FLIGHTMODE_GUIDANCE = 3} flightmode_path;
#define PARSE_FLIGHT_MODE(x) ( \
(x == MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL) ? FLIGHTMODE_MANUAL : \
(x == MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED1) ? FLIGHTMODE_STABILIZED : \
(x == MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED2) ? FLIGHTMODE_STABILIZED : \
(x == MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED3) ? FLIGHTMODE_STABILIZED : \
(x == MANUALCONTROLCOMMAND_FLIGHTMODE_VELOCITYCONTROL) ? FLIGHTMODE_GUIDANCE : \
(x == MANUALCONTROLCOMMAND_FLIGHTMODE_POSITIONHOLD) ? FLIGHTMODE_GUIDANCE : FLIGHTMODE_UNDEFINED \
(x == FLIGHTSTATUS_FLIGHTMODE_MANUAL) ? FLIGHTMODE_MANUAL : \
(x == FLIGHTSTATUS_FLIGHTMODE_STABILIZED1) ? FLIGHTMODE_STABILIZED : \
(x == FLIGHTSTATUS_FLIGHTMODE_STABILIZED2) ? FLIGHTMODE_STABILIZED : \
(x == FLIGHTSTATUS_FLIGHTMODE_STABILIZED3) ? FLIGHTMODE_STABILIZED : \
(x == FLIGHTSTATUS_FLIGHTMODE_VELOCITYCONTROL) ? FLIGHTMODE_GUIDANCE : \
(x == FLIGHTSTATUS_FLIGHTMODE_POSITIONHOLD) ? FLIGHTMODE_GUIDANCE : FLIGHTMODE_UNDEFINED \
)
int32_t ManualControlInitialize();

View File

@ -41,6 +41,7 @@
#include "actuatordesired.h"
#include "stabilizationdesired.h"
#include "flighttelemetrystats.h"
#include "flightstatus.h"
// Private constants
#if defined(PIOS_MANUAL_STACK_SIZE)
@ -54,6 +55,7 @@
#define THROTTLE_FAILSAFE -0.1
#define FLIGHT_MODE_LIMIT 1.0/3.0
#define ARMED_TIME_MS 1000
#define ARMED_THRESHOLD 0.50
//safe band to allow a bit of calibration error or trim offset (in microseconds)
#define CONNECTION_OFFSET 150
@ -70,13 +72,16 @@ typedef enum
// Private variables
static xTaskHandle taskHandle;
static ArmState_t armState;
static portTickType lastSysTime;
// Private functions
static void updateActuatorDesired(ManualControlCommandData * cmd);
static void updateStabilizationDesired(ManualControlCommandData * cmd, ManualControlSettingsData * settings);
static void processFlightMode(ManualControlSettingsData * settings, float flightMode);
static void processArm(ManualControlCommandData * cmd, ManualControlSettingsData * settings);
static void manualControlTask(void *parameters);
static float scaleChannel(int16_t value, int16_t max, int16_t min, int16_t neutral, int16_t deadband_percent);
static float scaleChannel(int16_t value, int16_t max, int16_t min, int16_t neutral);
static uint32_t timeDifferenceMs(portTickType start_time, portTickType end_time);
static bool okToArm(void);
static bool validInputRange(int16_t min, int16_t max, uint16_t value);
@ -125,12 +130,12 @@ static bool validInputRange(int16_t min, int16_t max, uint16_t value);
#define assumptions_flightmode ( \
( (int)MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_MANUAL == (int) MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL) && \
( (int)MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_STABILIZED1 == (int) MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED1) && \
( (int)MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_STABILIZED2 == (int) MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED2) && \
( (int)MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_STABILIZED3 == (int) MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED3) && \
( (int)MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_VELOCITYCONTROL == (int) MANUALCONTROLCOMMAND_FLIGHTMODE_VELOCITYCONTROL) && \
( (int)MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_POSITIONHOLD == (int) MANUALCONTROLCOMMAND_FLIGHTMODE_POSITIONHOLD) \
( (int)MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_MANUAL == (int) FLIGHTSTATUS_FLIGHTMODE_MANUAL) && \
( (int)MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_STABILIZED1 == (int) FLIGHTSTATUS_FLIGHTMODE_STABILIZED1) && \
( (int)MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_STABILIZED2 == (int) FLIGHTSTATUS_FLIGHTMODE_STABILIZED2) && \
( (int)MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_STABILIZED3 == (int) FLIGHTSTATUS_FLIGHTMODE_STABILIZED3) && \
( (int)MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_VELOCITYCONTROL == (int) FLIGHTSTATUS_FLIGHTMODE_VELOCITYCONTROL) && \
( (int)MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_POSITIONHOLD == (int) FLIGHTSTATUS_FLIGHTMODE_POSITIONHOLD) \
)
#define assumptions (assumptions1 && assumptions3 && assumptions5 && assumptions7 && assumptions8 && assumptions_flightmode)
@ -159,18 +164,16 @@ static void manualControlTask(void *parameters)
{
ManualControlSettingsData settings;
ManualControlCommandData cmd;
portTickType lastSysTime;
FlightStatusData flightStatus;
float flightMode = 0;
uint8_t disconnected_count = 0;
uint8_t connected_count = 0;
enum { CONNECTED, DISCONNECTED } connection_state = DISCONNECTED;
// Make sure unarmed on power up
ManualControlCommandGet(&cmd);
cmd.Armed = MANUALCONTROLCOMMAND_ARMED_FALSE;
ManualControlCommandSet(&cmd);
FlightStatusGet(&flightStatus);
flightStatus.Armed = FLIGHTSTATUS_ARMED_DISARMED;
armState = ARM_STATE_DISARMED;
// Main task loop
@ -211,7 +214,7 @@ static void manualControlTask(void *parameters)
#elif defined(PIOS_INCLUDE_SPEKTRUM)
cmd.Channel[n] = PIOS_SPEKTRUM_Get(n);
#endif
scaledChannel[n] = scaleChannel(cmd.Channel[n], settings.ChannelMax[n], settings.ChannelMin[n], settings.ChannelNeutral[n], 0);
scaledChannel[n] = scaleChannel(cmd.Channel[n], settings.ChannelMax[n], settings.ChannelMin[n], settings.ChannelNeutral[n]);
}
// Check settings, if error raise alarm
@ -227,38 +230,23 @@ static void manualControlTask(void *parameters)
}
// decide if we have valid manual input or not
bool valid_input_detected = TRUE;
if (!validInputRange(settings.ChannelMin[settings.Throttle], settings.ChannelMax[settings.Throttle], cmd.Channel[settings.Throttle]))
valid_input_detected = FALSE;
if (!validInputRange(settings.ChannelMin[settings.Roll], settings.ChannelMax[settings.Roll], cmd.Channel[settings.Roll]))
valid_input_detected = FALSE;
if (!validInputRange(settings.ChannelMin[settings.Yaw], settings.ChannelMax[settings.Yaw], cmd.Channel[settings.Yaw]))
valid_input_detected = FALSE;
if (!validInputRange(settings.ChannelMin[settings.Pitch], settings.ChannelMax[settings.Pitch], cmd.Channel[settings.Pitch]))
valid_input_detected = FALSE;
bool valid_input_detected = validInputRange(settings.ChannelMin[settings.Throttle], settings.ChannelMax[settings.Throttle], cmd.Channel[settings.Throttle]) &&
validInputRange(settings.ChannelMin[settings.Roll], settings.ChannelMax[settings.Roll], cmd.Channel[settings.Roll]) &&
validInputRange(settings.ChannelMin[settings.Yaw], settings.ChannelMax[settings.Yaw], cmd.Channel[settings.Yaw]) &&
validInputRange(settings.ChannelMin[settings.Pitch], settings.ChannelMax[settings.Pitch], cmd.Channel[settings.Pitch]);
// Implement hysteresis loop on connection status
if (valid_input_detected)
{
if (++connected_count > 10)
{
connection_state = CONNECTED;
connected_count = 0;
disconnected_count = 0;
}
}
else
{
if (++disconnected_count > 10)
{
connection_state = DISCONNECTED;
connected_count = 0;
disconnected_count = 0;
}
if (valid_input_detected && (++connected_count > 10)) {
cmd.Connected = MANUALCONTROLCOMMAND_CONNECTED_TRUE;
connected_count = 0;
disconnected_count = 0;
} else if (!valid_input_detected && (++disconnected_count > 10)) {
cmd.Connected = MANUALCONTROLCOMMAND_CONNECTED_FALSE;
connected_count = 0;
disconnected_count = 0;
}
if (connection_state == DISCONNECTED) {
cmd.Connected = MANUALCONTROLCOMMAND_CONNECTED_FALSE;
if (cmd.Connected == MANUALCONTROLCOMMAND_CONNECTED_FALSE) {
cmd.Throttle = -1; // Shut down engine with no control
cmd.Roll = 0;
cmd.Yaw = 0;
@ -269,161 +257,22 @@ static void manualControlTask(void *parameters)
AlarmsSet(SYSTEMALARMS_ALARM_MANUALCONTROL, SYSTEMALARMS_ALARM_WARNING);
ManualControlCommandSet(&cmd);
} else {
cmd.Connected = MANUALCONTROLCOMMAND_CONNECTED_TRUE;
AlarmsClear(SYSTEMALARMS_ALARM_MANUALCONTROL);
// Scale channels to -1 -> +1 range
cmd.Roll = scaledChannel[settings.Roll];
cmd.Pitch = scaledChannel[settings.Pitch];
cmd.Yaw = scaledChannel[settings.Yaw];
cmd.Throttle = scaledChannel[settings.Throttle];
flightMode = scaledChannel[settings.FlightMode];
cmd.Roll = scaledChannel[settings.Roll];
cmd.Pitch = scaledChannel[settings.Pitch];
cmd.Yaw = scaledChannel[settings.Yaw];
cmd.Throttle = scaledChannel[settings.Throttle];
flightMode = scaledChannel[settings.FlightMode];
if (settings.Accessory1 != MANUALCONTROLSETTINGS_ACCESSORY1_NONE)
cmd.Accessory1 = scaledChannel[settings.Accessory1];
else
cmd.Accessory1 = 0;
// Set accessory channels
cmd.Accessory1 = (settings.Accessory1 != MANUALCONTROLSETTINGS_ACCESSORY1_NONE) ? scaledChannel[settings.Accessory1] : 0;
cmd.Accessory2 = (settings.Accessory1 != MANUALCONTROLSETTINGS_ACCESSORY2_NONE) ? scaledChannel[settings.Accessory2] : 0;
cmd.Accessory3 = (settings.Accessory1 != MANUALCONTROLSETTINGS_ACCESSORY3_NONE) ? scaledChannel[settings.Accessory3] : 0;
if (settings.Accessory2 != MANUALCONTROLSETTINGS_ACCESSORY2_NONE)
cmd.Accessory2 = scaledChannel[settings.Accessory2];
else
cmd.Accessory2 = 0;
if (settings.Accessory3 != MANUALCONTROLSETTINGS_ACCESSORY3_NONE)
cmd.Accessory3 = scaledChannel[settings.Accessory3];
else
cmd.Accessory3 = 0;
// Note here the code is ass
if (flightMode < -FLIGHT_MODE_LIMIT)
cmd.FlightMode = settings.FlightModePosition[0];
else if (flightMode > FLIGHT_MODE_LIMIT)
cmd.FlightMode = settings.FlightModePosition[2];
else
cmd.FlightMode = settings.FlightModePosition[1];
//
// Arming and Disarming mechanism
//
if (settings.Arming == MANUALCONTROLSETTINGS_ARMING_ALWAYSDISARMED) {
// In this configuration we always disarm
cmd.Armed = MANUALCONTROLCOMMAND_ARMED_FALSE;
} else {
// In all other cases, we will not change the arm state when disconnected
if (connection_state == CONNECTED)
{
if (settings.Arming == MANUALCONTROLSETTINGS_ARMING_ALWAYSARMED) {
// In this configuration, we go into armed state as soon as the throttle is low, never disarm
if (cmd.Throttle < 0) {
cmd.Armed = MANUALCONTROLCOMMAND_ARMED_TRUE;
}
} else {
// When the configuration is not "Always armed" and no "Always disarmed",
// the state will not be changed when the throttle is not low
if (cmd.Throttle < 0) {
static portTickType armedDisarmStart;
float armingInputLevel = 0;
// Calc channel see assumptions7
switch ( (settings.Arming-MANUALCONTROLSETTINGS_ARMING_ROLLLEFT)/2 ) {
case ARMING_CHANNEL_ROLL: armingInputLevel = cmd.Roll; break;
case ARMING_CHANNEL_PITCH: armingInputLevel = cmd.Pitch; break;
case ARMING_CHANNEL_YAW: armingInputLevel = cmd.Yaw; break;
}
bool manualArm = false;
bool manualDisarm = false;
if (connection_state == CONNECTED) {
// Should use RC input only if RX is connected
if (armingInputLevel <= -0.50)
manualArm = true;
else if (armingInputLevel >= +0.50)
manualDisarm = true;
}
// Swap arm-disarming see assumptions8
if ((settings.Arming-MANUALCONTROLSETTINGS_ARMING_ROLLLEFT)%2) {
bool temp = manualArm;
manualArm = manualDisarm;
manualDisarm = temp;
}
switch(armState) {
case ARM_STATE_DISARMED:
cmd.Armed = MANUALCONTROLCOMMAND_ARMED_FALSE;
if (manualArm)
{
if (okToArm()) // only allow arming if it's OK too
{
armedDisarmStart = lastSysTime;
armState = ARM_STATE_ARMING_MANUAL;
}
}
break;
case ARM_STATE_ARMING_MANUAL:
if (manualArm) {
if (timeDifferenceMs(armedDisarmStart, lastSysTime) > ARMED_TIME_MS)
armState = ARM_STATE_ARMED;
}
else
armState = ARM_STATE_DISARMED;
break;
case ARM_STATE_ARMED:
// When we get here, the throttle is low,
// we go immediately to disarming due to timeout, also when the disarming mechanism is not enabled
armedDisarmStart = lastSysTime;
armState = ARM_STATE_DISARMING_TIMEOUT;
cmd.Armed = MANUALCONTROLCOMMAND_ARMED_TRUE;
break;
case ARM_STATE_DISARMING_TIMEOUT:
// We get here when armed while throttle low, even when the arming timeout is not enabled
if (settings.ArmedTimeout != 0)
if (timeDifferenceMs(armedDisarmStart, lastSysTime) > settings.ArmedTimeout)
armState = ARM_STATE_DISARMED;
// Switch to disarming due to manual control when needed
if (manualDisarm) {
armedDisarmStart = lastSysTime;
armState = ARM_STATE_DISARMING_MANUAL;
}
break;
case ARM_STATE_DISARMING_MANUAL:
if (manualDisarm) {
if (timeDifferenceMs(armedDisarmStart, lastSysTime) > ARMED_TIME_MS)
armState = ARM_STATE_DISARMED;
}
else
armState = ARM_STATE_ARMED;
break;
} // End Switch
} else {
// The throttle is not low, in case we where arming or disarming, abort
switch(armState) {
case ARM_STATE_DISARMING_MANUAL:
case ARM_STATE_DISARMING_TIMEOUT:
armState = ARM_STATE_ARMED;
break;
case ARM_STATE_ARMING_MANUAL:
armState = ARM_STATE_DISARMED;
break;
default:
// Nothing needs to be done in the other states
break;
}
}
}
}
}
//
// End of arming/disarming
//
processFlightMode(&settings, flightMode);
processArm(&cmd, &settings);
// Update cmd object
ManualControlCommandSet(&cmd);
@ -435,8 +284,10 @@ static void manualControlTask(void *parameters)
}
FlightStatusGet(&flightStatus);
// Depending on the mode update the Stabilization or Actuator objects
switch(PARSE_FLIGHT_MODE(cmd.FlightMode)) {
switch(PARSE_FLIGHT_MODE(flightStatus.FlightMode)) {
case FLIGHTMODE_UNDEFINED:
// This reflects a bug in the code architecture!
AlarmsSet(SYSTEMALARMS_ALARM_MANUALCONTROL, SYSTEMALARMS_ALARM_CRITICAL);
@ -450,7 +301,7 @@ static void manualControlTask(void *parameters)
case FLIGHTMODE_GUIDANCE:
// TODO: Implement
break;
}
}
}
}
@ -474,14 +325,16 @@ static void updateStabilizationDesired(ManualControlCommandData * cmd, ManualCon
StabilizationSettingsGet(&stabSettings);
uint8_t * stab_settings;
switch(cmd->FlightMode) {
case MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED1:
FlightStatusData flightStatus;
FlightStatusGet(&flightStatus);
switch(flightStatus.FlightMode) {
case FLIGHTSTATUS_FLIGHTMODE_STABILIZED1:
stab_settings = settings->Stabilization1Settings;
break;
case MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED2:
case FLIGHTSTATUS_FLIGHTMODE_STABILIZED2:
stab_settings = settings->Stabilization2Settings;
break;
case MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED3:
case FLIGHTSTATUS_FLIGHTMODE_STABILIZED3:
stab_settings = settings->Stabilization3Settings;
break;
default:
@ -517,7 +370,7 @@ static void updateStabilizationDesired(ManualControlCommandData * cmd, ManualCon
/**
* Convert channel from servo pulse duration (microseconds) to scaled -1/+1 range.
*/
static float scaleChannel(int16_t value, int16_t max, int16_t min, int16_t neutral, int16_t deadband_percent)
static float scaleChannel(int16_t value, int16_t max, int16_t min, int16_t neutral)
{
float valueScaled;
@ -537,20 +390,6 @@ static float scaleChannel(int16_t value, int16_t max, int16_t min, int16_t neutr
valueScaled = 0;
}
// Neutral RC stick position dead band
if (deadband_percent > 0)
{
if (deadband_percent > 50) deadband_percent = 50; // limit deadband to a maximum of 50%
float deadband = (float)deadband_percent / 100;
if (fabs(valueScaled) <= deadband)
valueScaled = 0; // deadband the value
else
if (valueScaled < 0)
valueScaled = (valueScaled + deadband) / (1.0 - deadband); // value scales 0.0 to -1.0 after deadband
else
valueScaled = (valueScaled - deadband) / (1.0 - deadband); // value scales 0.0 to +1.0 after deadband
}
// Bound
if (valueScaled > 1.0) valueScaled = 1.0;
else
@ -591,6 +430,161 @@ static bool okToArm(void)
return true;
}
/**
* @brief Update the flightStatus object only if value changed. Reduces callbacks
* @param[in] val The new value
*/
static void setArmedIfChanged(uint8_t val) {
FlightStatusData flightStatus;
FlightStatusGet(&flightStatus);
if(flightStatus.Armed != val) {
flightStatus.Armed = val;
FlightStatusSet(&flightStatus);
}
}
/**
* @brief Process the inputs and determine whether to arm or not
* @param[out] cmd The structure to set the armed in
* @param[in] settings Settings indicating the necessary position
*/
static void processArm(ManualControlCommandData * cmd, ManualControlSettingsData * settings)
{
bool lowThrottle = cmd->Throttle <= 0;
if (settings->Arming == MANUALCONTROLSETTINGS_ARMING_ALWAYSDISARMED) {
// In this configuration we always disarm
setArmedIfChanged(FLIGHTSTATUS_ARMED_DISARMED);
} else {
// Not really needed since this function not called when disconnected
if (cmd->Connected == MANUALCONTROLCOMMAND_CONNECTED_FALSE)
return;
// The throttle is not low, in case we where arming or disarming, abort
if (!lowThrottle) {
switch(armState) {
case ARM_STATE_DISARMING_MANUAL:
case ARM_STATE_DISARMING_TIMEOUT:
armState = ARM_STATE_ARMED;
break;
case ARM_STATE_ARMING_MANUAL:
armState = ARM_STATE_DISARMED;
break;
default:
// Nothing needs to be done in the other states
break;
}
return;
}
// The rest of these cases throttle is low
if (settings->Arming == MANUALCONTROLSETTINGS_ARMING_ALWAYSARMED) {
// In this configuration, we go into armed state as soon as the throttle is low, never disarm
setArmedIfChanged(FLIGHTSTATUS_ARMED_ARMED);
return;
}
// When the configuration is not "Always armed" and no "Always disarmed",
// the state will not be changed when the throttle is not low
static portTickType armedDisarmStart;
float armingInputLevel = 0;
// Calc channel see assumptions7
int8_t sign = ((settings->Arming-MANUALCONTROLSETTINGS_ARMING_ROLLLEFT)%2) ? -1 : 1;
switch ( (settings->Arming-MANUALCONTROLSETTINGS_ARMING_ROLLLEFT)/2 ) {
case ARMING_CHANNEL_ROLL: armingInputLevel = sign * cmd->Roll; break;
case ARMING_CHANNEL_PITCH: armingInputLevel = sign * cmd->Pitch; break;
case ARMING_CHANNEL_YAW: armingInputLevel = sign * cmd->Yaw; break;
}
bool manualArm = false;
bool manualDisarm = false;
if (armingInputLevel <= -ARMED_THRESHOLD)
manualArm = true;
else if (armingInputLevel >= +ARMED_THRESHOLD)
manualDisarm = true;
switch(armState) {
case ARM_STATE_DISARMED:
setArmedIfChanged(FLIGHTSTATUS_ARMED_DISARMED);
// only allow arming if it's OK too
if (manualArm && okToArm()) {
armedDisarmStart = lastSysTime;
armState = ARM_STATE_ARMING_MANUAL;
}
break;
case ARM_STATE_ARMING_MANUAL:
setArmedIfChanged(FLIGHTSTATUS_ARMED_ARMING);
if (manualArm && (timeDifferenceMs(armedDisarmStart, lastSysTime) > ARMED_TIME_MS))
armState = ARM_STATE_ARMED;
else if (!manualArm)
armState = ARM_STATE_DISARMED;
break;
case ARM_STATE_ARMED:
// When we get here, the throttle is low,
// we go immediately to disarming due to timeout, also when the disarming mechanism is not enabled
armedDisarmStart = lastSysTime;
armState = ARM_STATE_DISARMING_TIMEOUT;
setArmedIfChanged(FLIGHTSTATUS_ARMED_ARMED);
break;
case ARM_STATE_DISARMING_TIMEOUT:
// We get here when armed while throttle low, even when the arming timeout is not enabled
if ((settings->ArmedTimeout != 0) && (timeDifferenceMs(armedDisarmStart, lastSysTime) > settings->ArmedTimeout))
armState = ARM_STATE_DISARMED;
// Switch to disarming due to manual control when needed
if (manualDisarm) {
armedDisarmStart = lastSysTime;
armState = ARM_STATE_DISARMING_MANUAL;
}
break;
case ARM_STATE_DISARMING_MANUAL:
if (manualDisarm &&(timeDifferenceMs(armedDisarmStart, lastSysTime) > ARMED_TIME_MS))
armState = ARM_STATE_DISARMED;
else if (!manualDisarm)
armState = ARM_STATE_ARMED;
break;
} // End Switch
}
}
/**
* @brief Determine which of three positions the flight mode switch is in and set flight mode accordingly
* @param[out] cmd Pointer to the command structure to set the flight mode in
* @param[in] settings The settings which indicate which position is which mode
* @param[in] flightMode the value of the switch position
*/
static void processFlightMode(ManualControlSettingsData * settings, float flightMode)
{
FlightStatusData flightStatus;
FlightStatusGet(&flightStatus);
uint8_t newMode;
// Note here the code is ass
if (flightMode < -FLIGHT_MODE_LIMIT)
newMode = settings->FlightModePosition[0];
else if (flightMode > FLIGHT_MODE_LIMIT)
newMode = settings->FlightModePosition[2];
else
newMode = settings->FlightModePosition[1];
if(flightStatus.FlightMode != newMode) {
flightStatus.FlightMode = newMode;
FlightStatusSet(&flightStatus);
}
}
/**
* @brief Determine if the manual input value is within acceptable limits
* @returns return TRUE if so, otherwise return FALSE
@ -606,16 +600,6 @@ bool validInputRange(int16_t min, int16_t max, uint16_t value)
return (value >= min - CONNECTION_OFFSET && value <= max + CONNECTION_OFFSET);
}
//
//static void armingMechanism(uint8_t* armingState, const ManualControlSettingsData* settings, const ManualControlCommandData* cmd)
//{
// if (settings->Arming == MANUALCONTROLSETTINGS_ARMING_ALWAYSDISARMED) {
// *armingState = MANUALCONTROLCOMMAND_ARMED_FALSE;
// return;
// }
//
//
//}
/**
* @}
* @}

View File

@ -39,9 +39,10 @@
#include "stabilizationdesired.h"
#include "attitudeactual.h"
#include "attituderaw.h"
#include "manualcontrolcommand.h"
#include "flightstatus.h"
#include "systemsettings.h"
#include "ahrssettings.h"
#include "manualcontrol.h" // Just to get a macro
#include "CoordinateConversions.h"
// Private constants
@ -125,7 +126,7 @@ static void stabilizationTask(void* parameters)
AttitudeActualData attitudeActual;
AttitudeRawData attitudeRaw;
SystemSettingsData systemSettings;
ManualControlCommandData manualControl;
FlightStatusData flightStatus;
SettingsUpdatedCb((UAVObjEvent *) NULL);
@ -148,13 +149,13 @@ static void stabilizationTask(void* parameters)
dT = (thisSysTime - lastSysTime) / portTICK_RATE_MS / 1000.0f;
lastSysTime = thisSysTime;
ManualControlCommandGet(&manualControl);
FlightStatusGet(&flightStatus);
StabilizationDesiredGet(&stabDesired);
AttitudeActualGet(&attitudeActual);
AttitudeRawGet(&attitudeRaw);
RateDesiredGet(&rateDesired);
SystemSettingsGet(&systemSettings);
#if defined(PIOS_QUATERNION_STABILIZATION)
// Quaternion calculation of error in each axis. Uses more memory.
float rpy_desired[3];
@ -261,11 +262,8 @@ static void stabilizationTask(void* parameters)
// Save dT
actuatorDesired.UpdateTime = dT * 1000;
if(manualControl.FlightMode == MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL)
{
if(PARSE_FLIGHT_MODE(flightStatus.FlightMode) == FLIGHTMODE_MANUAL)
shouldUpdate = 0;
}
if(shouldUpdate)
{
@ -275,14 +273,15 @@ static void stabilizationTask(void* parameters)
ActuatorDesiredSet(&actuatorDesired);
}
if(manualControl.Armed == MANUALCONTROLCOMMAND_ARMED_FALSE ||
if(flightStatus.Armed != FLIGHTSTATUS_ARMED_ARMED ||
!shouldUpdate || (stabDesired.Throttle < 0))
{
ZeroPids();
}
// Clear alarms
AlarmsClear(SYSTEMALARMS_ALARM_STABILIZATION);
AlarmsClear(SYSTEMALARMS_ALARM_STABILIZATION);
}
}

View File

@ -41,7 +41,7 @@
#include "openpilot.h"
#include "systemmod.h"
#include "objectpersistence.h"
#include "manualcontrolcommand.h"
#include "flightstatus.h"
#include "systemstats.h"
#include "i2cstats.h"
#include "watchdogstatus.h"
@ -52,12 +52,15 @@
// Private constants
#define SYSTEM_UPDATE_PERIOD_MS 1000
#define LED_BLINK_RATE_HZ 5
#ifndef IDLE_COUNTS_PER_SEC_AT_NO_LOAD
#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 995998 // calibrated by running tests/test_cpuload.c
// must be updated if the FreeRTOS or compiler
// optimisation options are changed.
#endif
#if defined(PIOS_MANUAL_STACK_SIZE)
#define STACK_SIZE_BYTES PIOS_MANUAL_STACK_SIZE
#if defined(PIOS_SYSTEM_STACK_SIZE)
#define STACK_SIZE_BYTES PIOS_SYSTEM_STACK_SIZE
#else
#define STACK_SIZE_BYTES 924
#endif
@ -139,11 +142,11 @@ static void systemTask(void *parameters)
}
#endif
ManualControlCommandData manualControlCommandData;
ManualControlCommandGet(&manualControlCommandData);
FlightStatusData flightStatus;
FlightStatusGet(&flightStatus);
// Wait until next period
if(manualControlCommandData.Armed == MANUALCONTROLCOMMAND_ARMED_TRUE) {
if(flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMED) {
vTaskDelayUntil(&lastSysTime, SYSTEM_UPDATE_PERIOD_MS / portTICK_RATE_MS / (LED_BLINK_RATE_HZ * 2) );
} else {
vTaskDelayUntil(&lastSysTime, SYSTEM_UPDATE_PERIOD_MS / portTICK_RATE_MS);

View File

@ -36,9 +36,6 @@ ENABLE_DEBUG_PINS ?= NO
# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs
ENABLE_AUX_UART ?= NO
#
USE_BOOTLOADER ?= YES
USE_SPEKTRUM ?= NO
@ -55,14 +52,13 @@ endif
FLASH_TOOL = OPENOCD
# List of modules to include
MODULES = Actuator Telemetry GPS ManualControl Altitude AHRSComms Stabilization Guidance FirmwareIAP FlightPlan
MODULES = Actuator Telemetry GPS ManualControl Altitude AHRSComms Stabilization Guidance FirmwareIAP
PYMODULES = FlightPlan
#MODULES = Telemetry Example
#MODULES = Telemetry MK/MKSerial
#MODULES = Telemetry
#MODULES += Osd/OsdEtStd
# MCU name, submodel and board
# - MCU used for compiler-option (-mcpu)
# - MODEL used for linker-script name (-T) and passed as define
@ -71,12 +67,6 @@ MCU = cortex-m3
CHIP = STM32F103RET
BOARD = STM3210E_OP
MODEL = HD
ifeq ($(USE_BOOTLOADER), YES)
BOOT_MODEL = $(MODEL)_BL
else
BOOT_MODEL = $(MODEL)_NB
endif
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/openpilot
@ -133,17 +123,19 @@ UAVOBJSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight
# List C source files here. (C dependencies are automatically generated.)
# use file-extension c for "c-only"-files
MODNAMES = $(notdir ${MODULES})
MODNAMES = $(notdir ${MODULES} ${PYMODULES})
ifndef TESTAPP
## PyMite files
## PyMite files and modules
SRC += $(OUTDIR)/pmlib_img.c
SRC += $(OUTDIR)/pmlib_nat.c
SRC += $(OUTDIR)/pmlibusr_img.c
SRC += $(OUTDIR)/pmlibusr_nat.c
SRC += $(wildcard ${PYMITEVM}/*.c)
SRC += $(wildcard ${PYMITEPLAT}/*.c)
PYSRC += $(wildcard ${PYMITEVM}/*.c)
PYSRC += $(wildcard ${PYMITEPLAT}/*.c)
PYSRC += ${foreach MOD, ${PYMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}}
SRC += $(PYSRC)
## MODULES
SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}}
@ -326,7 +318,7 @@ EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3
EXTRAINCDIRS += $(AHRSBOOTLOADERINC)
EXTRAINCDIRS += $(PYMITEINC)
EXTRAINCDIRS += ${foreach MOD, ${MODULES}, $(OPMODULEDIR)/${MOD}/inc} ${OPMODULEDIR}/System/inc
EXTRAINCDIRS += ${foreach MOD, ${MODULES} ${PYMODULES}, $(OPMODULEDIR)/${MOD}/inc} ${OPMODULEDIR}/System/inc
# List any extra directories to look for library files here.
@ -377,9 +369,7 @@ endif
ifeq ($(ENABLE_AUX_UART), YES)
CDEFS += -DPIOS_ENABLE_AUX_UART
endif
ifeq ($(USE_BOOTLOADER), YES)
CDEFS += -DUSE_BOOTLOADER
endif
ifeq ($(USE_SPEKTRUM), YES)
CDEFS += -DUSE_SPEKTRUM
@ -458,13 +448,14 @@ LDFLAGS += $(MATH_LIB)
LDFLAGS += -lc -lgcc
# Set linker-script name depending on selected submodel name
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_$(BOARD)_$(BOOT_MODEL).ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
# Program
OOCD_CL+=-c "flash write_image $(OOCD_LOADFILE)"
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08005000 bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08005000 bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
@ -491,7 +482,7 @@ LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE)))
DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE)))
# Default target.
all: gencode gccversion build
all: gccversion build
ifeq ($(LOADFORMAT),ihex)
build: elf hex lss sym
@ -510,6 +501,8 @@ endif
# Generate intermediate code
gencode: ${OUTDIR}/InitMods.c ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h
$(PYSRC): gencode
# Generate code for module initialization
${OUTDIR}/InitMods.c: Makefile
@echo $(MSG_MODINIT) $(call toprel, $@)
@ -527,19 +520,12 @@ ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/p
@$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py
# Program the device.
ifeq ($(USE_BOOTLOADER), YES)
# Program the device with OP Upload Tool".
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OP Upload Tool${quote}
../../ground/src/experimental/upload-build-desktop/debug/OPUploadTool -d 0 -p $(OUTDIR)/$(TARGET).bin
else
ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
program: $(OUTDIR)/$(TARGET).elf
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OPENOCD${quote}
$(OOCD_EXE) $(OOCD_CL)
endif
endif
# Link: create ELF output file from object files.
$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ)))
@ -568,12 +554,15 @@ $(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC))
# Compile: create assembler files from C source files. ARM only
$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
.PHONY: elf lss sym hex bin
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
.PHONY: elf lss sym hex bin bino
elf: $(OUTDIR)/$(TARGET).elf
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
bino: $(OUTDIR)/$(TARGET).bin.o
# Display sizes of sections.
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
@ -584,6 +573,16 @@ size: $(OUTDIR)/$(TARGET).elf_size
docs:
doxygen $(DOXYGENDIR)/doxygen.cfg
# Install: install binary file with prefix/suffix into install directory
install: $(OUTDIR)/$(TARGET).bin
ifneq ($(INSTALL_DIR),)
@echo $(MSG_INSTALLING) $(call toprel, $<)
$(V1) mkdir -p $(INSTALL_DIR)
$(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin
else
$(error INSTALL_DIR must be specified for $@)
endif
# Target: clean project.
clean: clean_list
@ -595,6 +594,7 @@ clean_list :
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o
$(V1) $(REMOVE) $(wildcard $(OUTDIR)/*.c)
$(V1) $(REMOVE) $(wildcard $(OUTDIR)/*.h)
$(V1) $(REMOVE) $(ALLOBJ)
@ -622,5 +622,4 @@ else
endif
# Listing of phony targets.
.PHONY : all build clean clean_list program gencode
.PHONY : all build clean clean_list program gencode install

View File

@ -67,6 +67,7 @@ UAVOBJSRCFILENAMES += telemetrysettings
UAVOBJSRCFILENAMES += velocityactual
UAVOBJSRCFILENAMES += velocitydesired
UAVOBJSRCFILENAMES += watchdogstatus
UAVOBJSRCFILENAMES += flightstatus
UAVOBJSRC = $(foreach UAVOBJSRCFILE,$(UAVOBJSRCFILENAMES),$(UAVOBJSYNTHDIR)/$(UAVOBJSRCFILE).c )
UAVOBJDEFINE = $(foreach UAVOBJSRCFILE,$(UAVOBJSRCFILENAMES),-DUAVOBJ_INIT_$(UAVOBJSRCFILE) )

View File

@ -11,6 +11,8 @@
#include "STM32103CB_CC_Rev1.h"
#elif USE_STM3210E_INS
#include "STM3210E_INS.h"
#else
#error Board definition has not been provided.
#endif
#endif /* PIOS_BOARD_H_ */

View File

@ -222,6 +222,14 @@ int8_t PIOS_Flash_W25X_WriteData(uint32_t addr, uint8_t * data, uint16_t len)
return 0;
}
/**
* @brief Read data from a location in flash memory
* @param[in] addr Address in flash to write to
* @param[in] data Pointer to data to write from flash
* @param[in] len Length of data to write (max 256 bytes)
* @return Zero if success or error code
* @retval -1 Unable to claim SPI bus
*/
int8_t PIOS_Flash_W25X_ReadData(uint32_t addr, uint8_t * data, uint16_t len)
{
if(PIOS_Flash_W25X_ClaimBus() == -1)

View File

@ -0,0 +1,294 @@
/**
******************************************************************************
*
* @addtogroup PIOS PIOS Core hardware abstraction layer
* @{
* @addtogroup PIOS_FLASHFS_OBJLIST Object list based flash filesystem (low ram)
* @{
*
* @file pios_flashfs_objlist.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief A file system for storing UAVObject in flash chip
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "openpilot.h"
#include "uavobjectmanager.h"
// Private functions
static int32_t PIOS_FLASHFS_CleabObjectTableHeader();
static int32_t PIOS_FLASHFS_GetObjAddress(uint32_t objId, uint16_t instId);
static int32_t PIOS_FLASHFS_GetNewAddress(uint32_t objId, uint16_t instId);
// Private variables
static int32_t numObjects = -1;
// Private structures
// Header for objects in the file system table
struct objectHeader {
uint32_t objMagic;
uint32_t objId;
uint32_t instId;
uint32_t address;
} __attribute__((packed));;
struct fileHeader {
uint32_t id;
uint16_t instId;
uint16_t size;
} __attribute__((packed));
#define OBJECT_TABLE_MAGIC 0x85FB3C33
#define OBJ_MAGIC 0x3015AE71
#define OBJECT_TABLE_START 0x00000010
#define OBJECT_TABLE_END 0x00001000
#define SECTOR_SIZE 0x00001000
/**
* @brief Initialize the flash object setting FS
* @return 0 if success, -1 if failure
*/
int32_t PIOS_FLASHFS_Init()
{
// Check for valid object table or create one
uint32_t object_table_magic;
if (PIOS_Flash_W25X_ReadData(0, (uint8_t *)&object_table_magic, sizeof(object_table_magic)) != 0)
return -1;
if(object_table_magic != OBJECT_TABLE_MAGIC) {
if(PIOS_FLASHFS_CleabObjectTableHeader() < 0)
return -1;
}
int32_t addr = OBJECT_TABLE_START;
struct objectHeader header;
numObjects = 0;
// Loop through header area while objects detect to count how many saved
while(addr < OBJECT_TABLE_END) {
// Read the instance data
if (PIOS_Flash_W25X_ReadData(addr, (uint8_t *)&header, sizeof(header)) != 0)
return -1;
// Counting number of valid headers
if(header.objMagic != OBJ_MAGIC)
break;
numObjects++;
addr += sizeof(header);
}
return 0;
}
/**
* @brief Erase the headers for all objects in the flash chip
* @return 0 if successful, -1 if not
*/
static int32_t PIOS_FLASHFS_CleabObjectTableHeader()
{
if(PIOS_Flash_W25X_EraseSector(OBJECT_TABLE_START) != 0)
return -1;
uint32_t object_table_magic = OBJECT_TABLE_MAGIC;
if (PIOS_Flash_W25X_WriteData(0, (uint8_t *)&object_table_magic, sizeof(object_table_magic)) != 0)
return -1;
return 0;
}
/**
* @brief Get the address of an object
* @param obj UAVObjHandle for that object
* @parma instId Instance id for that object
* @return address if successful, -1 if not found
*/
static int32_t PIOS_FLASHFS_GetObjAddress(uint32_t objId, uint16_t instId)
{
int32_t addr = OBJECT_TABLE_START;
struct objectHeader header;
// Loop through header area while objects detect to count how many saved
while(addr < OBJECT_TABLE_END) {
// Read the instance data
if (PIOS_Flash_W25X_ReadData(addr, (uint8_t *) &header, sizeof(header)) != 0)
return -1;
if(header.objMagic != OBJ_MAGIC)
break; // stop searching once hit first non-object header
else if (header.objId == objId && header.instId == instId)
break;
addr += sizeof(header);
}
if (header.objId == objId && header.instId == instId)
return header.address;
return -1;
}
/**
* @brief Returns an address for a new object and creates entry into object table
* @param[in] obj Object handle for object to be saved
* @param[in] instId The instance id of object to be saved
* @return 0 if success or error code
* @retval -1 Object not found
* @retval -2 No room in object table
* @retval -3 Unable to write entry into object table
* @retval -4 FS not initialized
*/
int32_t PIOS_FLASHFS_GetNewAddress(uint32_t objId, uint16_t instId)
{
struct objectHeader header;
if(numObjects < 0)
return -4;
// Don't worry about max size of flash chip here, other code will catch that
header.objMagic = OBJ_MAGIC;
header.objId = objId;
header.instId = instId;
header.address = OBJECT_TABLE_END + SECTOR_SIZE * numObjects;
int32_t addr = OBJECT_TABLE_START + sizeof(header) * numObjects;
// No room for this header in object table
if((addr + sizeof(header)) > OBJECT_TABLE_END)
return -2;
if(PIOS_Flash_W25X_WriteData(addr, (uint8_t *) &header, sizeof(header)) != 0)
return -3;
// This numObejcts value must stay consistent or there will be a break in the table
// and later the table will have bad values in it
numObjects++;
return header.address;
}
/**
* @brief Saves one object instance per sector
* @param[in] obj UAVObjHandle the object to save
* @param[in] instId The instance of the object to save
* @return 0 if success or -1 if failure
* @note This uses one sector on the flash chip per object so that no buffering in ram
* must be done when erasing the sector before a save
*/
int32_t PIOS_FLASHFS_ObjSave(UAVObjHandle obj, uint16_t instId, uint8_t * data)
{
uint32_t objId = UAVObjGetID(obj);
int32_t addr = PIOS_FLASHFS_GetObjAddress(objId, instId);
// Object currently not saved
if(addr < 0)
addr = PIOS_FLASHFS_GetNewAddress(objId, instId);
// Could not allocate a sector
if(addr < 0)
return -1;
struct fileHeader header = {
.id = objId,
.instId = instId,
.size = UAVObjGetNumBytes(obj)
};
if(PIOS_Flash_W25X_EraseSector(addr) != 0)
return -2;
// Save header
// This information IS redundant with the object table id. Oh well. Better safe than sorry.
if(PIOS_Flash_W25X_WriteData(addr, (uint8_t *) &header, sizeof(header)) != 0)
return -3;
// Save data
if(PIOS_Flash_W25X_WriteData(addr + sizeof(header), data, UAVObjGetNumBytes(obj)) != 0)
return -4;
return 0;
}
/**
* @brief Load one object instance per sector
* @param[in] obj UAVObjHandle the object to save
* @param[in] instId The instance of the object to save
* @return 0 if success or error code
* @retval -1 if object not in file table
* @retval -2 if unable to retrieve object header
* @retval -3 if loaded data instId or objId don't match
* @retval -4 if unable to retrieve instance data
* @note This uses one sector on the flash chip per object so that no buffering in ram
* must be done when erasing the sector before a save
*/
int32_t PIOS_FLASHFS_ObjLoad(UAVObjHandle obj, uint16_t instId, uint8_t * data)
{
uint32_t objId = UAVObjGetID(obj);
int32_t addr = PIOS_FLASHFS_GetObjAddress(objId, instId);
// Object currently not saved
if(addr < 0)
return -1;
struct fileHeader header;
// Load header
// This information IS redundant with the object table id. Oh well. Better safe than sorry.
if(PIOS_Flash_W25X_ReadData(addr, (uint8_t *) &header, sizeof(header)) != 0)
return -2;
if((header.id != objId) || (header.instId != instId))
return -3;
// Read the instance data
if (PIOS_Flash_W25X_ReadData(addr + sizeof(header), data, UAVObjGetNumBytes(obj)) != 0)
return -4;
return 0;
}
/**
* @brief Delete object from flash
* @param[in] obj UAVObjHandle the object to save
* @param[in] instId The instance of the object to save
* @return 0 if success or error code
* @retval -1 if object not in file table
* @retval -2 Erase failed
* @note To avoid buffering the file table (1k ram!) the entry in the file table
* remains but destination sector is erased. This will make the load fail as the
* file header won't match the object. At next save it goes back there.
*/
int32_t PIOS_FLASHFS_ObjDelete(UAVObjHandle obj, uint16_t instId)
{
uint32_t objId = UAVObjGetID(obj);
int32_t addr = PIOS_FLASHFS_GetObjAddress(objId, instId);
// Object currently not saved
if(addr < 0)
return -1;
if(PIOS_Flash_W25X_EraseSector(addr) != 0)
return -2;
return 0;
}

View File

@ -1,9 +1,3 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x08002000, LENGTH = 116K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00005000
}
_estack = 0x20004FF0;
/* Section Definitions */
@ -15,17 +9,17 @@ SECTIONS
*(.text .text.* .gnu.linkonce.t.*)
*(.glue_7t) *(.glue_7)
*(.rodata .rodata* .gnu.linkonce.r.*)
} > FLASH
} > BL_FLASH
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > FLASH
} > BL_FLASH
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > FLASH
} > BL_FLASH
. = ALIGN(4);
_etext = .;
@ -51,4 +45,4 @@ SECTIONS
. = ALIGN(4);
_end = . ;
}
}

View File

@ -0,0 +1,6 @@
MEMORY
{
BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 8K
FLASH (rx) : ORIGIN = 0x08000000 + 8K, LENGTH = 128K - 8K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}

View File

@ -1,9 +1,3 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x08003000, LENGTH = 116K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00005000
}
_estack = 0x20004FF0;
/* Section Definitions */
@ -51,4 +45,4 @@ SECTIONS
. = ALIGN(4);
_end = . ;
}
}

View File

@ -0,0 +1,97 @@
/* Stub out these functions since we don't use them anyway */
PROVIDE ( vPortSVCHandler = 0 ) ;
PROVIDE ( xPortPendSVHandler = 0 ) ;
PROVIDE ( xPortSysTickHandler = 0 ) ;
_estack = 0x20004FF0;
/* Section Definitions */
SECTIONS
{
.text :
{
KEEP(*(.isr_vector .isr_vector.*))
*(.text .text.* .gnu.linkonce.t.*)
*(.glue_7t) *(.glue_7)
*(.rodata .rodata* .gnu.linkonce.r.*)
} > BL_FLASH
/* init sections */
.initcalluavobj.init :
{
. = ALIGN(4);
__uavobj_initcall_start = .;
KEEP(*(.initcalluavobj.init))
. = ALIGN(4);
__uavobj_initcall_end = .;
} > BL_FLASH
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > BL_FLASH
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > BL_FLASH
. = ALIGN(4);
_etext = .;
_sidata = .;
.data : AT (_etext)
{
_sdata = .;
*(.data .data.*)
. = ALIGN(4);
_edata = . ;
} > SRAM
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
_sbss = . ;
*(.bss .bss.*)
*(COMMON)
. = ALIGN(4);
_ebss = . ;
} > SRAM
. = ALIGN(4);
_end = . ;
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
}

View File

@ -1,64 +0,0 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x08003000, LENGTH = 116K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00005000
}
_estack = 0x20004FF0;
/* Section Definitions */
SECTIONS
{
.text :
{
KEEP(*(.isr_vector .isr_vector.*))
*(.text .text.* .gnu.linkonce.t.*)
*(.glue_7t) *(.glue_7)
*(.rodata .rodata* .gnu.linkonce.r.*)
} > FLASH
/* init sections */
.initcalluavobj.init :
{
. = ALIGN(4);
__uavobj_initcall_start = .;
KEEP(*(.initcalluavobj.init))
. = ALIGN(4);
__uavobj_initcall_end = .;
} >FLASH
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > FLASH
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > FLASH
. = ALIGN(4);
_etext = .;
_sidata = .;
.data : AT (_etext)
{
_sdata = .;
*(.data .data.*)
. = ALIGN(4);
_edata = . ;
} > SRAM
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
_sbss = . ;
*(.bss .bss.*)
*(COMMON)
. = ALIGN(4);
_ebss = . ;
} > SRAM
. = ALIGN(4);
_end = . ;
}

View File

@ -1,64 +0,0 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x00020000
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00005000
}
_estack = 0x20004FF0;
/* Section Definitions */
SECTIONS
{
.text :
{
KEEP(*(.isr_vector .isr_vector.*))
*(.text .text.* .gnu.linkonce.t.*)
*(.glue_7t) *(.glue_7)
*(.rodata .rodata* .gnu.linkonce.r.*)
} > FLASH
/* init sections */
.initcalluavobj.init :
{
. = ALIGN(4);
__uavobj_initcall_start = .;
KEEP(*(.initcalluavobj.init))
. = ALIGN(4);
__uavobj_initcall_end = .;
} >FLASH
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > FLASH
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > FLASH
. = ALIGN(4);
_etext = .;
_sidata = .;
.data : AT (_etext)
{
_sdata = .;
*(.data .data.*)
. = ALIGN(4);
_edata = . ;
} > SRAM
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
_sbss = . ;
*(.bss .bss.*)
*(COMMON)
. = ALIGN(4);
_ebss = . ;
} > SRAM
. = ALIGN(4);
_end = . ;
}

View File

@ -0,0 +1,6 @@
MEMORY
{
BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 12K
FLASH (rx) : ORIGIN = 0x08000000 + 12K, LENGTH = 128K - 12K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}

View File

@ -0,0 +1,97 @@
/* Stub out these functions since we don't use them anyway */
PROVIDE ( vPortSVCHandler = 0 ) ;
PROVIDE ( xPortPendSVHandler = 0 ) ;
PROVIDE ( xPortSysTickHandler = 0 ) ;
_estack = 0x20004FF0;
/* Section Definitions */
SECTIONS
{
.text :
{
KEEP(*(.isr_vector .isr_vector.*))
*(.text .text.* .gnu.linkonce.t.*)
*(.glue_7t) *(.glue_7)
*(.rodata .rodata* .gnu.linkonce.r.*)
} > FLASH
/* init sections */
.initcalluavobj.init :
{
. = ALIGN(4);
__uavobj_initcall_start = .;
KEEP(*(.initcalluavobj.init))
. = ALIGN(4);
__uavobj_initcall_end = .;
} >FLASH
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > FLASH
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > FLASH
. = ALIGN(4);
_etext = .;
_sidata = .;
.data : AT (_etext)
{
_sdata = .;
*(.data .data.*)
. = ALIGN(4);
_edata = . ;
} > SRAM
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
_sbss = . ;
*(.bss .bss.*)
*(COMMON)
. = ALIGN(4);
_ebss = . ;
} > SRAM
. = ALIGN(4);
_end = . ;
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
}

View File

@ -1,8 +1,7 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x00020000
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00005000
}
/* Stub out these functions since we don't use them anyway */
PROVIDE ( vPortSVCHandler = 0 ) ;
PROVIDE ( xPortPendSVHandler = 0 ) ;
PROVIDE ( xPortSysTickHandler = 0 ) ;
_estack = 0x20004FF0;
@ -15,17 +14,17 @@ SECTIONS
*(.text .text.* .gnu.linkonce.t.*)
*(.glue_7t) *(.glue_7)
*(.rodata .rodata* .gnu.linkonce.r.*)
} > FLASH
} > BL_FLASH
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > FLASH
} > BL_FLASH
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > FLASH
} > BL_FLASH
. = ALIGN(4);
_etext = .;
@ -51,4 +50,4 @@ SECTIONS
. = ALIGN(4);
_end = . ;
}
}

View File

@ -0,0 +1,6 @@
MEMORY
{
BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 12K
FLASH (rx) : ORIGIN = 0x08000000 + 12K, LENGTH = 128K - 12K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}

View File

@ -1,8 +1,7 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x00020000
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00005000
}
/* Stub out these functions since we don't use them anyway */
PROVIDE ( vPortSVCHandler = 0 ) ;
PROVIDE ( xPortPendSVHandler = 0 ) ;
PROVIDE ( xPortSysTickHandler = 0 ) ;
_estack = 0x20004FF0;
@ -51,4 +50,4 @@ SECTIONS
. = ALIGN(4);
_end = . ;
}
}

View File

@ -1,41 +1,3 @@
/**
******************************************************************************
*
* @file link_stm32f10x_HD_NB.ld
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2009.
* @brief PiOS linker for the OpenPilot board
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Memory Spaces Definitions */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
}
/* This is the size of the stack for early init and for all FreeRTOS IRQs */
_irq_stack_size = 0x400;
@ -59,10 +21,10 @@ PROVIDE ( HardFault_Handler = 0 ) ;
PROVIDE ( MemManage_Handler = 0 ) ;
PROVIDE ( BusFault_Handler = 0 ) ;
PROVIDE ( UsageFault_Handler = 0 ) ;
PROVIDE ( SVC_Handler = 0 ) ;
PROVIDE ( vPortSVCHandler = 0 ) ;
PROVIDE ( DebugMon_Handler = 0 ) ;
PROVIDE ( PendSV_Handler = 0 ) ;
PROVIDE ( SysTick_Handler = 0 ) ;
PROVIDE ( xPortPendSVHandler = 0 ) ;
PROVIDE ( xPortSysTickHandler = 0 ) ;
PROVIDE ( WWDG_IRQHandler = 0 ) ;
PROVIDE ( PVD_IRQHandler = 0 ) ;
@ -207,7 +169,7 @@ SECTIONS
{
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
} > BL_FLASH
/* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */
.flashtext :
@ -215,7 +177,7 @@ SECTIONS
. = ALIGN(4);
*(.flashtext) /* Startup code */
. = ALIGN(4);
} >FLASH
} > BL_FLASH
/* init sections */
@ -226,7 +188,7 @@ SECTIONS
KEEP(*(.initcalluavobj.init))
. = ALIGN(4);
__uavobj_initcall_end = .;
} >FLASH
} > BL_FLASH
/* the program code is stored in the .text section, which goes to Flash */
.text :
@ -244,7 +206,7 @@ SECTIONS
_etext = .;
/* This is used by the startup in order to initialize the .data secion */
_sidata = _etext;
} >FLASH
} > BL_FLASH
/*

View File

@ -0,0 +1,11 @@
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 20K
FLASH (rx) : ORIGIN = 0x08000000 + 20K, LENGTH = 512K - 20K
FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
}

View File

@ -1,41 +1,3 @@
/**
******************************************************************************
*
* @file link_stm32f10x_HD_BL.ld
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2009.
* @brief PiOS linker for the OpenPilot board
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Memory Spaces Definitions */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x08005000, LENGTH = 492K
FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
}
/* This is the size of the stack for early init and for all FreeRTOS IRQs */
_irq_stack_size = 0x400;
@ -59,10 +21,10 @@ PROVIDE ( HardFault_Handler = 0 ) ;
PROVIDE ( MemManage_Handler = 0 ) ;
PROVIDE ( BusFault_Handler = 0 ) ;
PROVIDE ( UsageFault_Handler = 0 ) ;
PROVIDE ( SVC_Handler = 0 ) ;
PROVIDE ( vPortSVCHandler = 0 ) ;
PROVIDE ( DebugMon_Handler = 0 ) ;
PROVIDE ( PendSV_Handler = 0 ) ;
PROVIDE ( SysTick_Handler = 0 ) ;
PROVIDE ( xPortPendSVHandler = 0 ) ;
PROVIDE ( xPortSysTickHandler = 0 ) ;
PROVIDE ( WWDG_IRQHandler = 0 ) ;
PROVIDE ( PVD_IRQHandler = 0 ) ;

View File

@ -51,4 +51,38 @@ SECTIONS
. = ALIGN(4);
_end = . ;
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
}

View File

@ -0,0 +1,37 @@
/**
******************************************************************************
*
* @addtogroup PIOS PIOS Core hardware abstraction layer
* @{
* @addtogroup PIOS_FLASHFS_OBJLIST Object list based flash filesystem (low ram)
* @{
*
* @file pios_flashfs_objlist.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief A file system for storing UAVObject in flash chip
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "openpilot.h"
#include "uavobjectmanager.h"
int32_t PIOS_FLASHFS_Init();
int32_t PIOS_FLASHFS_ObjSave(UAVObjHandle obj, uint16_t instId, uint8_t * data);
int32_t PIOS_FLASHFS_ObjLoad(UAVObjHandle obj, uint16_t instId, uint8_t * data);
int32_t PIOS_FLASHFS_ObjDelete(UAVObjHandle obj, uint16_t instId);

View File

@ -31,7 +31,6 @@
#define PIOS_LED_H
/* Type Definitions */
#if (PIOS_LED_NUM == 1)
typedef enum { LED1 = 0 } LedTypeDef;
#elif (PIOS_LED_NUM == 2)
@ -40,6 +39,8 @@ typedef enum { LED1 = 0, LED2 = 1 } LedTypeDef;
typedef enum { LED1 = 0, LED2 = 1, LED3 = 2 } LedTypeDef;
#elif (PIOS_LED_NUM == 4)
typedef enum { LED1 = 0, LED2 = 1, LED3 = 2, LED4 = 3 } LedTypeDef;
#else
#error PIOS_LED_NUM not defined
#endif
/* Public Functions */

View File

@ -1,135 +1,136 @@
/**
******************************************************************************
*
* @file pios.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Main PiOS header.
* - Central header for the project.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIOS_H
#define PIOS_H
/* PIOS Feature Selection */
#include "pios_config.h"
#if defined(PIOS_INCLUDE_FREERTOS)
/* FreeRTOS Includes */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#endif
/* C Lib Includes */
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
/* STM32 Std Perf Lib */
#include <stm32f10x.h>
#include <stm32f10x_conf.h>
#if defined(PIOS_INCLUDE_SDCARD)
/* Dosfs Includes */
#include <dosfs.h>
/* Mass Storage Device Includes */
#include <msd.h>
#endif
/* Generic initcall infrastructure */
#include "pios_initcall.h"
/* PIOS Board Specific Device Configuration */
#include "pios_board.h"
/* PIOS Hardware Includes (STM32F10x) */
#include <pios_sys.h>
#include <pios_delay.h>
#include <pios_led.h>
#include <pios_sdcard.h>
#include <pios_usart.h>
#include <pios_irq.h>
#include <pios_adc.h>
#include <pios_servo.h>
#include <pios_i2c.h>
#include <pios_spi.h>
#include <pios_ppm.h>
#include <pios_pwm.h>
#include <pios_spektrum.h>
#include <pios_usb_hid.h>
#include <pios_debug.h>
#include <pios_gpio.h>
#if defined(PIOS_INCLUDE_EXTI)
#include <pios_exti.h>
#endif
#include <pios_wdg.h>
/* PIOS Hardware Includes (Common) */
#include <pios_sdcard.h>
#include <pios_com.h>
#if defined(PIOS_INCLUDE_BMP085)
#include <pios_bmp085.h>
#endif
#if defined(PIOS_INCLUDE_HCSR04)
#include <pios_hcsr04.h>
#endif
#if defined(PIOS_INCLUDE_HMC5843)
#include <pios_hmc5843.h>
#endif
#if defined(PIOS_INCLUDE_HMC5883)
#include <pios_hmc5883.h>
#endif
#if defined(PIOS_INCLUDE_I2C_ESC)
#include <pios_i2c_esc.h>
#endif
#if defined(PIOS_INCLUDE_IMU3000)
#include <pios_imu3000.h>
#endif
#include <pios_iap.h>
#if defined(PIOS_INCLUDE_ADXL345)
#include <pios_adxl345.h>
#endif
#if defined(PIOS_INCLUDE_BMA180)
#include <pios_bma180.h>
#endif
#if defined(PIOS_INCLUDE_FLASH)
#include <pios_flash_w25x.h>
#endif
#if defined(PIOS_INCLUDE_BL_HELPER)
#include <pios_bl_helper.h>
#endif
#if defined(PIOS_INCLUDE_USB)
/* USB Libs */
#include <usb_lib.h>
#endif
#define NELEMENTS(x) (sizeof(x) / sizeof(*(x)))
#endif /* PIOS_H */
/**
******************************************************************************
*
* @file pios.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Main PiOS header.
* - Central header for the project.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIOS_H
#define PIOS_H
/* PIOS Feature Selection */
#include "pios_config.h"
#if defined(PIOS_INCLUDE_FREERTOS)
/* FreeRTOS Includes */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#endif
/* C Lib Includes */
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
/* STM32 Std Perf Lib */
#include <stm32f10x.h>
#include <stm32f10x_conf.h>
#if defined(PIOS_INCLUDE_SDCARD)
/* Dosfs Includes */
#include <dosfs.h>
/* Mass Storage Device Includes */
#include <msd.h>
#endif
/* Generic initcall infrastructure */
#include "pios_initcall.h"
/* PIOS Board Specific Device Configuration */
#include "pios_board.h"
/* PIOS Hardware Includes (STM32F10x) */
#include <pios_sys.h>
#include <pios_delay.h>
#include <pios_led.h>
#include <pios_sdcard.h>
#include <pios_usart.h>
#include <pios_irq.h>
#include <pios_adc.h>
#include <pios_servo.h>
#include <pios_i2c.h>
#include <pios_spi.h>
#include <pios_ppm.h>
#include <pios_pwm.h>
#include <pios_spektrum.h>
#include <pios_usb_hid.h>
#include <pios_debug.h>
#include <pios_gpio.h>
#if defined(PIOS_INCLUDE_EXTI)
#include <pios_exti.h>
#endif
#include <pios_wdg.h>
/* PIOS Hardware Includes (Common) */
#include <pios_sdcard.h>
#include <pios_com.h>
#if defined(PIOS_INCLUDE_BMP085)
#include <pios_bmp085.h>
#endif
#if defined(PIOS_INCLUDE_HCSR04)
#include <pios_hcsr04.h>
#endif
#if defined(PIOS_INCLUDE_HMC5843)
#include <pios_hmc5843.h>
#endif
#if defined(PIOS_INCLUDE_HMC5883)
#include <pios_hmc5883.h>
#endif
#if defined(PIOS_INCLUDE_I2C_ESC)
#include <pios_i2c_esc.h>
#endif
#if defined(PIOS_INCLUDE_IMU3000)
#include <pios_imu3000.h>
#endif
#include <pios_iap.h>
#if defined(PIOS_INCLUDE_ADXL345)
#include <pios_adxl345.h>
#endif
#if defined(PIOS_INCLUDE_BMA180)
#include <pios_bma180.h>
#endif
#if defined(PIOS_INCLUDE_FLASH)
#include <pios_flash_w25x.h>
#include <pios_flashfs_objlist.h>
#endif
#if defined(PIOS_INCLUDE_BL_HELPER)
#include <pios_bl_helper.h>
#endif
#if defined(PIOS_INCLUDE_USB)
/* USB Libs */
#include <usb_lib.h>
#endif
#define NELEMENTS(x) (sizeof(x) / sizeof(*(x)))
#endif /* PIOS_H */

View File

@ -29,9 +29,6 @@ include $(TOP)/make/firmware-defs.mk
# Debugging (YES/NO) ?
DEBUG ?= NO
# Is this code a bootloader (YES/NO) ?
USE_BOOTLOADER ?= NO
# Use Code Sourcery toolchain (YES/NO) ?
CODE_SOURCERY ?= YES
@ -56,11 +53,6 @@ BOARD = STM32103CB_PIPXTREME
#CHIP = STM32F103C8T
#BOARD = STM32103C8_PIPXTREME
MODEL = MD
ifeq ($(USE_BOOTLOADER), YES)
BOOT_MODEL = $(MODEL)_BL
else
BOOT_MODEL = $(MODEL)_NB
endif
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(TOP)/build/pipxtreme
@ -265,9 +257,7 @@ DEBUGF = dwarf-2
CDEFS = -DSTM32F10X_$(MODEL)
CDEFS += -DUSE_STDPERIPH_DRIVER
CDEFS += -DUSE_$(BOARD)
ifeq ($(USE_BOOTLOADER), YES)
CDEFS += -DUSE_BOOTLOADER
endif
# Place project-specific -D and/or -U options for
# Assembler with preprocessor here.
@ -347,13 +337,14 @@ LDFLAGS += $(MATH_LIB)
LDFLAGS += -lc -lgcc
# Set linker-script name depending on selected submodel name
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_$(BOARD)_$(BOOT_MODEL).ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld
LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin
# Program
OOCD_CL+=-c "flash write_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08003000 bin"
# Verify
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE)"
OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08003000 bin"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
@ -395,19 +386,12 @@ endif
endif
# Program the device.
ifeq ($(USE_BOOTLOADER), YES)
# Program the device with OP Upload Tool".
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OP Upload Tool${quote}
../../ground/src/experimental/upload-build-desktop/debug/OPUploadTool -d 1 -p $(OUTDIR)/$(TARGET).bin
else
ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
program: $(OUTDIR)/$(TARGET).elf
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OPENOCD${quote}
$(OOCD_EXE) $(OOCD_CL)
endif
endif
# Link: create ELF output file from object files.
$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ)))
@ -436,12 +420,15 @@ $(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC))
# Compile: create assembler files from C source files. ARM only
$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM))
.PHONY: elf lss sym hex bin
$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
.PHONY: elf lss sym hex bin bino
elf: $(OUTDIR)/$(TARGET).elf
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
bino: $(OUTDIR)/$(TARGET).bin.o
# Display sizes of sections.
$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf))
@ -452,6 +439,16 @@ size: $(OUTDIR)/$(TARGET).elf_size
docs:
doxygen $(DOXYGENDIR)/doxygen.cfg
# Install: install binary file with prefix/suffix into install directory
install: $(OUTDIR)/$(TARGET).bin
ifneq ($(INSTALL_DIR),)
@echo $(MSG_INSTALLING) $(call toprel, $<)
$(V1) mkdir -p $(INSTALL_DIR)
$(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin
else
$(error INSTALL_DIR must be specified for $@)
endif
# Target: clean project.
clean: clean_list
@ -463,6 +460,7 @@ clean_list :
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss
$(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o
$(V1) $(REMOVE) $(ALLOBJ)
$(V1) $(REMOVE) $(LSTFILES)
$(V1) $(REMOVE) $(DEPFILES)
@ -488,4 +486,4 @@ else
endif
# Listing of phony targets.
.PHONY : all build clean clean_list program
.PHONY : all build clean clean_list program install

View File

@ -9,6 +9,7 @@
/* Begin PBXFileReference section */
65003B31121249CA00C183DD /* pios_wdg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_wdg.c; sourceTree = "<group>"; };
6502584212CA4D2600583CDF /* insgps13state.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = insgps13state.c; path = ../../AHRS/insgps13state.c; sourceTree = SOURCE_ROOT; };
65078B09136FCEE600536549 /* flightstatus.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = flightstatus.xml; sourceTree = "<group>"; };
6509C7E912CA57DC002E5DC2 /* insgps16state.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = insgps16state.c; path = ../../AHRS/insgps16state.c; sourceTree = SOURCE_ROOT; };
650D8E2112DFE16400D05CC9 /* actuator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = actuator.c; sourceTree = "<group>"; };
650D8E2312DFE16400D05CC9 /* actuator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = actuator.h; sourceTree = "<group>"; };
@ -3124,6 +3125,54 @@
65FBE14412E7C98100176B5A /* pios_servo_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_servo_priv.h; sourceTree = "<group>"; };
65FC66AA123F30F100B04F74 /* ahrs_timer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ahrs_timer.c; path = ../../AHRS/ahrs_timer.c; sourceTree = SOURCE_ROOT; };
65FC66AB123F312A00B04F74 /* ahrs_timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_timer.h; sourceTree = "<group>"; };
65FF4BB513791C3300146BE4 /* ahrs_slave_test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_slave_test.c; sourceTree = "<group>"; };
65FF4BB613791C3300146BE4 /* ahrs_spi_program.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_spi_program.c; sourceTree = "<group>"; };
65FF4BB713791C3300146BE4 /* ahrs_spi_program_master.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_spi_program_master.c; sourceTree = "<group>"; };
65FF4BB813791C3300146BE4 /* ahrs_spi_program_slave.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_spi_program_slave.c; sourceTree = "<group>"; };
65FF4BB913791C3300146BE4 /* bl_fsm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bl_fsm.c; sourceTree = "<group>"; };
65FF4BBB13791C3300146BE4 /* ahrs_bl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_bl.h; sourceTree = "<group>"; };
65FF4BBC13791C3300146BE4 /* ahrs_spi_program.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_spi_program.h; sourceTree = "<group>"; };
65FF4BBD13791C3300146BE4 /* ahrs_spi_program_master.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_spi_program_master.h; sourceTree = "<group>"; };
65FF4BBE13791C3300146BE4 /* ahrs_spi_program_slave.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_spi_program_slave.h; sourceTree = "<group>"; };
65FF4BBF13791C3300146BE4 /* bl_fsm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bl_fsm.h; sourceTree = "<group>"; };
65FF4BC013791C3300146BE4 /* pios_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_config.h; sourceTree = "<group>"; };
65FF4BC113791C3300146BE4 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
65FF4BC213791C3300146BE4 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
65FF4BC313791C3300146BE4 /* pios_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_board.c; sourceTree = "<group>"; };
65FF4BC613791C3300146BE4 /* pios_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_config.h; sourceTree = "<group>"; };
65FF4BC713791C3300146BE4 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
65FF4BC813791C3300146BE4 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
65FF4BC913791C3300146BE4 /* pios_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_board.c; sourceTree = "<group>"; };
65FF4BCA13791C3300146BE4 /* test.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = test.bin; sourceTree = "<group>"; };
65FF4BCD13791C3300146BE4 /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = "<group>"; };
65FF4BCE13791C3300146BE4 /* op_dfu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = op_dfu.h; sourceTree = "<group>"; };
65FF4BCF13791C3300146BE4 /* pios_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_config.h; sourceTree = "<group>"; };
65FF4BD013791C3300146BE4 /* pios_usb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_usb.h; sourceTree = "<group>"; };
65FF4BD113791C3300146BE4 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
65FF4BD213791C3300146BE4 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
65FF4BD313791C3300146BE4 /* op_dfu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = op_dfu.c; sourceTree = "<group>"; };
65FF4BD413791C3300146BE4 /* pios_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_board.c; sourceTree = "<group>"; };
65FF4BD713791C3300146BE4 /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = "<group>"; };
65FF4BD813791C3300146BE4 /* op_dfu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = op_dfu.h; sourceTree = "<group>"; };
65FF4BD913791C3300146BE4 /* pios_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_config.h; sourceTree = "<group>"; };
65FF4BDA13791C3300146BE4 /* pios_usb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_usb.h; sourceTree = "<group>"; };
65FF4BDB13791C3300146BE4 /* ssp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ssp.h; sourceTree = "<group>"; };
65FF4BDC13791C3300146BE4 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
65FF4BDD13791C3300146BE4 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
65FF4BDE13791C3300146BE4 /* op_dfu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = op_dfu.c; sourceTree = "<group>"; };
65FF4BDF13791C3300146BE4 /* pios_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_board.c; sourceTree = "<group>"; };
65FF4BE013791C3300146BE4 /* ssp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssp.c; sourceTree = "<group>"; };
65FF4BE113791C3300146BE4 /* ssp_timer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssp_timer.c; sourceTree = "<group>"; };
65FF4BE413791C3300146BE4 /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = "<group>"; };
65FF4BE513791C3300146BE4 /* op_dfu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = op_dfu.h; sourceTree = "<group>"; };
65FF4BE613791C3300146BE4 /* pios_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_config.h; sourceTree = "<group>"; };
65FF4BE713791C3300146BE4 /* pios_usb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_usb.h; sourceTree = "<group>"; };
65FF4BE813791C3300146BE4 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
65FF4BE913791C3300146BE4 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
65FF4BEA13791C3300146BE4 /* op_dfu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = op_dfu.c; sourceTree = "<group>"; };
65FF4BEB13791C3300146BE4 /* pios_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_board.c; sourceTree = "<group>"; };
65FF4D5E137EDEC100146BE4 /* pios_flashfs_objlist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_flashfs_objlist.c; sourceTree = "<group>"; };
65FF4D61137EFA4F00146BE4 /* pios_flashfs_objlist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_flashfs_objlist.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
@ -3504,6 +3553,7 @@
657CEEB5121DBC49007A1FBE /* flight */ = {
isa = PBXGroup;
children = (
65FF4BB313791C3300146BE4 /* Bootloaders */,
65F93B9012EE09280047DB36 /* PipXtreme */,
65B7E6AC120DF1CD000C1123 /* AHRS */,
65E6DF7012E02E8E00058553 /* CopterControl */,
@ -7383,6 +7433,7 @@
65C35E5E12EFB2F3004811C2 /* flightplansettings.xml */,
65C35E5F12EFB2F3004811C2 /* flightplanstatus.xml */,
65C35E6012EFB2F3004811C2 /* flighttelemetrystats.xml */,
65078B09136FCEE600536549 /* flightstatus.xml */,
65C35E6112EFB2F3004811C2 /* gcstelemetrystats.xml */,
65C35E6212EFB2F3004811C2 /* gpsposition.xml */,
65C35E6312EFB2F3004811C2 /* gpssatellites.xml */,
@ -7608,6 +7659,7 @@
65E8F03711EFF25C00BBF654 /* printf-stdarg.c */,
6528CCB412E406B800CF5144 /* pios_adxl345.c */,
6512D60712ED4CB8008175E5 /* pios_flash_w25x.c */,
65FF4D5E137EDEC100146BE4 /* pios_flashfs_objlist.c */,
);
name = Common;
path = ../../PiOS/Common;
@ -7632,6 +7684,7 @@
65E8F03E11EFF25C00BBF654 /* pios_debug.h */,
65E8F03F11EFF25C00BBF654 /* pios_delay.h */,
65E8F04011EFF25C00BBF654 /* pios_exti.h */,
65FF4D61137EFA4F00146BE4 /* pios_flashfs_objlist.h */,
65E8F04111EFF25C00BBF654 /* pios_gpio.h */,
65E8F04211EFF25C00BBF654 /* pios_hmc5843.h */,
65E8F04311EFF25C00BBF654 /* pios_i2c.h */,
@ -8236,6 +8289,140 @@
path = inc;
sourceTree = "<group>";
};
65FF4BB313791C3300146BE4 /* Bootloaders */ = {
isa = PBXGroup;
children = (
65FF4BB413791C3300146BE4 /* AHRS */,
65FF4BC413791C3300146BE4 /* BootloaderUpdater */,
65FF4BCB13791C3300146BE4 /* CopterControl */,
65FF4BD513791C3300146BE4 /* OpenPilot */,
65FF4BE213791C3300146BE4 /* PipXtreme */,
);
name = Bootloaders;
path = ../../Bootloaders;
sourceTree = SOURCE_ROOT;
};
65FF4BB413791C3300146BE4 /* AHRS */ = {
isa = PBXGroup;
children = (
65FF4BB513791C3300146BE4 /* ahrs_slave_test.c */,
65FF4BB613791C3300146BE4 /* ahrs_spi_program.c */,
65FF4BB713791C3300146BE4 /* ahrs_spi_program_master.c */,
65FF4BB813791C3300146BE4 /* ahrs_spi_program_slave.c */,
65FF4BB913791C3300146BE4 /* bl_fsm.c */,
65FF4BBA13791C3300146BE4 /* inc */,
65FF4BC113791C3300146BE4 /* main.c */,
65FF4BC213791C3300146BE4 /* Makefile */,
65FF4BC313791C3300146BE4 /* pios_board.c */,
);
path = AHRS;
sourceTree = "<group>";
};
65FF4BBA13791C3300146BE4 /* inc */ = {
isa = PBXGroup;
children = (
65FF4BBB13791C3300146BE4 /* ahrs_bl.h */,
65FF4BBC13791C3300146BE4 /* ahrs_spi_program.h */,
65FF4BBD13791C3300146BE4 /* ahrs_spi_program_master.h */,
65FF4BBE13791C3300146BE4 /* ahrs_spi_program_slave.h */,
65FF4BBF13791C3300146BE4 /* bl_fsm.h */,
65FF4BC013791C3300146BE4 /* pios_config.h */,
);
path = inc;
sourceTree = "<group>";
};
65FF4BC413791C3300146BE4 /* BootloaderUpdater */ = {
isa = PBXGroup;
children = (
65FF4BC513791C3300146BE4 /* inc */,
65FF4BC713791C3300146BE4 /* main.c */,
65FF4BC813791C3300146BE4 /* Makefile */,
65FF4BC913791C3300146BE4 /* pios_board.c */,
65FF4BCA13791C3300146BE4 /* test.bin */,
);
path = BootloaderUpdater;
sourceTree = "<group>";
};
65FF4BC513791C3300146BE4 /* inc */ = {
isa = PBXGroup;
children = (
65FF4BC613791C3300146BE4 /* pios_config.h */,
);
path = inc;
sourceTree = "<group>";
};
65FF4BCB13791C3300146BE4 /* CopterControl */ = {
isa = PBXGroup;
children = (
65FF4BCC13791C3300146BE4 /* inc */,
65FF4BD113791C3300146BE4 /* main.c */,
65FF4BD213791C3300146BE4 /* Makefile */,
65FF4BD313791C3300146BE4 /* op_dfu.c */,
65FF4BD413791C3300146BE4 /* pios_board.c */,
);
path = CopterControl;
sourceTree = "<group>";
};
65FF4BCC13791C3300146BE4 /* inc */ = {
isa = PBXGroup;
children = (
65FF4BCD13791C3300146BE4 /* common.h */,
65FF4BCE13791C3300146BE4 /* op_dfu.h */,
65FF4BCF13791C3300146BE4 /* pios_config.h */,
65FF4BD013791C3300146BE4 /* pios_usb.h */,
);
path = inc;
sourceTree = "<group>";
};
65FF4BD513791C3300146BE4 /* OpenPilot */ = {
isa = PBXGroup;
children = (
65FF4BD613791C3300146BE4 /* inc */,
65FF4BDC13791C3300146BE4 /* main.c */,
65FF4BDD13791C3300146BE4 /* Makefile */,
65FF4BDE13791C3300146BE4 /* op_dfu.c */,
65FF4BDF13791C3300146BE4 /* pios_board.c */,
65FF4BE013791C3300146BE4 /* ssp.c */,
65FF4BE113791C3300146BE4 /* ssp_timer.c */,
);
path = OpenPilot;
sourceTree = "<group>";
};
65FF4BD613791C3300146BE4 /* inc */ = {
isa = PBXGroup;
children = (
65FF4BD713791C3300146BE4 /* common.h */,
65FF4BD813791C3300146BE4 /* op_dfu.h */,
65FF4BD913791C3300146BE4 /* pios_config.h */,
65FF4BDA13791C3300146BE4 /* pios_usb.h */,
65FF4BDB13791C3300146BE4 /* ssp.h */,
);
path = inc;
sourceTree = "<group>";
};
65FF4BE213791C3300146BE4 /* PipXtreme */ = {
isa = PBXGroup;
children = (
65FF4BE313791C3300146BE4 /* inc */,
65FF4BE813791C3300146BE4 /* main.c */,
65FF4BE913791C3300146BE4 /* Makefile */,
65FF4BEA13791C3300146BE4 /* op_dfu.c */,
65FF4BEB13791C3300146BE4 /* pios_board.c */,
);
path = PipXtreme;
sourceTree = "<group>";
};
65FF4BE313791C3300146BE4 /* inc */ = {
isa = PBXGroup;
children = (
65FF4BE413791C3300146BE4 /* common.h */,
65FF4BE513791C3300146BE4 /* op_dfu.h */,
65FF4BE613791C3300146BE4 /* pios_config.h */,
65FF4BE713791C3300146BE4 /* pios_usb.h */,
);
path = inc;
sourceTree = "<group>";
};
C6A0FF2B0290797F04C91782 /* Documentation */ = {
isa = PBXGroup;
children = (

View File

@ -0,0 +1,38 @@
define connect
target remote localhost:3333
monitor cortex_m3 vector_catch all
file ./build/bl_coptercontrol/CopterControl_BL.elf
end
#monitor reset halt
define hook-step
monitor cortex_m3 maskisr on
end
define hookpost-step
monitor cortex_m3 maskisr off
end
define hook-stepi
monitor cortex_m3 maskisr on
end
define hookpost-stepi
monitor cortex_m3 maskisr off
end
define hook-next
monitor cortex_m3 maskisr on
end
define hookpost-next
monitor cortex_m3 maskisr off
end
define hook-finish
monitor cortex_m3 maskisr on
end
define hookpost-finish
monitor cortex_m3 maskisr off
end

99
flight/Project/versionblob.py Executable file
View File

@ -0,0 +1,99 @@
#!/usr/bin/env python
# Generate a version blob for
# the OpenPilot firmware.
#
# By E. Lafargue (c) 2011 E. Lafargue & the OpenPilot team
# Licence: GPLv3
#
###
# Usage:
# versionblob.py --append --firmware=<Firmware file name> --boardid=<Board code>
#
# append: if present, then append blob to firmware file directly, otherwise create "blob.bin"
# firmware: the filename of the firmware binary
# boardid: as a string, the board code, for example "0401" for CC board version 1.
# should match the codes in firmware description files.
#
# We have 100 bytes for the whole description.
#
# Only the first 40 are visible on the FirmwareIAP uavobject, the remaining
# 60 are ok to use for packaging and will be saved in the flash
#
# Structure is:
# 4 bytes: header: "OpFw"
# 4 bytes: GIT commit tag (short version of SHA1)
# 4 bytes: Unix timestamp of compile time
# 2 bytes: target platform. Should follow same rule as BOARD_TYPE and BOARD_REVISION in board define files.
# 26 bytes: commit tag if it is there, otherwise branch name. Zero-padded
# ---- 40 bytes limit ---
# 20 bytes: SHA1 sum of the firmware.
# 40 bytes: free for now.
import binascii
import os
from time import time
import argparse
# Do the argument parsing:
parser = argparse.ArgumentParser(description='Generate firmware desciption blob')
parser.add_argument('--append', action='store_true')
parser.add_argument('--firmware', help='name of firmware binary file' , required=True)
parser.add_argument('--boardid', help='ID of board model, for example 0401 for CopterControl', required=True)
args = parser.parse_args()
print args
if args.append == True:
print 'Appending description blob directly to ' + args.firmware
filename = args.firmware
file = open(filename,"ab")
else:
filename = 'blob.bin'
file = open(filename,"wb")
# Write the magic value:
file.write("OpFw")
# Get the short commit tag of the current git repository.
# Strip it to 8 characters for a 4 byte (int32) value.
# We have no full guarantee of unicity, but it is good enough
# with the rest of the information in the structure.
hs= os.popen('git rev-parse --short=8 HEAD').read().strip()
print "Version: " + hs
hb=binascii.a2b_hex(hs)
file.write(hb)
# Then the Unix time into a 32 bit integer:
print "Date: " + hex(int(time())).lstrip('0x')
hb = binascii.a2b_hex(hex(int(time())).lstrip('0x'))
file.write(hb)
# Then write board type and board revision
hb = binascii.a2b_hex(args.boardid)
file.write(hb)
# Last: a user-friendly description if it exists in GIT, otherwise
# just "unreleased"
hs = os.popen('git describe --exact-match').read()
if len(hs) == 0 :
print "Unreleased: get branch name instead"
hs = os.popen('git branch --contains HEAD').read()
file.write(hs[0:26])
file.write("\0"*(26-len(hs)))
## Now we are at the 40 bytes mark.
## Add the 20 byte SHA1 hash of the firmware:
import hashlib
sha1 = hashlib.sha1()
with open('build/coptercontrol/CopterControl.bin','rb') as f:
for chunk in iter(lambda: f.read(8192), ''):
sha1.update(chunk)
file.write(sha1.digest())
# Pad will null bytes:
file.write('\0'*40)
file.close()

View File

@ -1,1607 +1,1498 @@
/**
******************************************************************************
* @addtogroup UAVObjects OpenPilot UAVObjects
* @{
* @addtogroup UAV Object Manager
* @brief The core UAV Objects functions, most of which are wrappered by
* autogenerated defines
* @{
*
*
* @file uavobjectmanager.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Object manager library. This library holds a collection of all objects.
* It can be used by all modules/libraries to find an object reference.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "openpilot.h"
// Constants
// Private types
/**
* List of event queues and the eventmask associated with the queue.
*/
struct ObjectEventListStruct {
xQueueHandle queue;
UAVObjEventCallback cb;
int32_t eventMask;
struct ObjectEventListStruct* next;
};
typedef struct ObjectEventListStruct ObjectEventList;
/**
* List of object instances, holds the actual data structure and instance ID
*/
struct ObjectInstListStruct {
void* data;
uint16_t instId;
struct ObjectInstListStruct* next;
};
typedef struct ObjectInstListStruct ObjectInstList;
/**
* List of objects registered in the object manager
*/
struct ObjectListStruct {
uint32_t id; /** The object ID */
const char* name; /** The object name */
int8_t isMetaobject; /** Set to 1 if this is a metaobject */
int8_t isSingleInstance; /** Set to 1 if this object has a single instance */
int8_t isSettings; /** Set to 1 if this object is a settings object */
uint16_t numBytes; /** Number of data bytes contained in the object (for a single instance) */
uint16_t numInstances; /** Number of instances */
struct ObjectListStruct* linkedObj; /** Linked object, for regular objects this is the metaobject and for metaobjects it is the parent object */
ObjectInstList instances; /** List of object instances, instance 0 always exists */
ObjectEventList* events; /** Event queues registered on the object */
struct ObjectListStruct* next; /** Needed by linked list library (utlist.h) */
};
typedef struct ObjectListStruct ObjectList;
// Private functions
static int32_t sendEvent(ObjectList* obj, uint16_t instId, UAVObjEventType event);
static ObjectInstList* createInstance(ObjectList* obj, uint16_t instId);
static ObjectInstList* getInstance(ObjectList* obj, uint16_t instId);
static int32_t connectObj(UAVObjHandle obj, xQueueHandle queue, UAVObjEventCallback cb, int32_t eventMask);
static int32_t disconnectObj(UAVObjHandle obj, xQueueHandle queue, UAVObjEventCallback cb);
#if defined(PIOS_INCLUDE_SDCARD)
static void objectFilename(ObjectList* obj, uint8_t* filename);
static void customSPrintf(uint8_t* buffer, uint8_t* format, ...);
#endif
// Private variables
static ObjectList* objList;
static xSemaphoreHandle mutex;
static UAVObjMetadata defMetadata;
static UAVObjStats stats;
/**
* Initialize the object manager
* \return 0 Success
* \return -1 Failure
*/
int32_t UAVObjInitialize()
{
// Initialize variables
objList = NULL;
memset(&stats, 0, sizeof(UAVObjStats));
// Create mutex
mutex = xSemaphoreCreateRecursiveMutex();
if (mutex == NULL)
return -1;
// Initialize default metadata structure (metadata of metaobjects)
defMetadata.access = ACCESS_READWRITE;
defMetadata.gcsAccess = ACCESS_READWRITE;
defMetadata.telemetryAcked = 1;
defMetadata.telemetryUpdateMode = UPDATEMODE_ONCHANGE;
defMetadata.telemetryUpdatePeriod = 0;
defMetadata.gcsTelemetryAcked = 1;
defMetadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE;
defMetadata.gcsTelemetryUpdatePeriod = 0;
defMetadata.loggingUpdateMode = UPDATEMODE_ONCHANGE;
defMetadata.loggingUpdatePeriod = 0;
// Done
return 0;
}
/**
* Get the statistics counters
* @param[out] statsOut The statistics counters will be copied there
*/
void UAVObjGetStats(UAVObjStats* statsOut)
{
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
memcpy(statsOut, &stats, sizeof(UAVObjStats));
xSemaphoreGiveRecursive(mutex);
}
/**
* Clear the statistics counters
*/
void UAVObjClearStats()
{
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
memset(&stats, 0, sizeof(UAVObjStats));
xSemaphoreGiveRecursive(mutex);
}
/**
* Register and new object in the object manager.
* \param[in] id Unique object ID
* \param[in] name Object name
* \param[in] nameName Metaobject name
* \param[in] isMetaobject Is this a metaobject (1:true, 0:false)
* \param[in] isSingleInstance Is this a single instance or multi-instance object
* \param[in] isSettings Is this a settings object
* \param[in] numBytes Number of bytes of object data (for one instance)
* \param[in] initCb Default field and metadata initialization function
* \return Object handle, or NULL if failure.
* \return
*/
UAVObjHandle UAVObjRegister(uint32_t id, const char* name, const char* metaName, int32_t isMetaobject,
int32_t isSingleInstance, int32_t isSettings, uint32_t numBytes, UAVObjInitializeCallback initCb)
{
ObjectList* objEntry;
ObjectInstList* instEntry;
ObjectList* metaObj;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Check that the object is not already registered
LL_FOREACH(objList, objEntry)
{
if (objEntry->id == id)
{
// Already registered, ignore
xSemaphoreGiveRecursive(mutex);
return NULL;
}
}
// Create and append entry
objEntry = (ObjectList*)pvPortMalloc(sizeof(ObjectList));
if (objEntry == NULL)
{
xSemaphoreGiveRecursive(mutex);
return NULL;
}
objEntry->id = id;
objEntry->name = name;
objEntry->isMetaobject = (int8_t)isMetaobject;
objEntry->isSingleInstance = (int8_t)isSingleInstance;
objEntry->isSettings = (int8_t)isSettings;
objEntry->numBytes = numBytes;
objEntry->events = NULL;
objEntry->numInstances = 0;
objEntry->instances.data = NULL;
objEntry->instances.instId = 0xFFFF;
objEntry->instances.next = NULL;
objEntry->linkedObj = NULL; // will be set later
LL_APPEND(objList, objEntry);
// Create instance zero
instEntry = createInstance(objEntry, 0);
if ( instEntry == NULL )
{
xSemaphoreGiveRecursive(mutex);
return NULL;
}
// Create metaobject and update linkedObj
if (isMetaobject)
{
objEntry->linkedObj = NULL; // will be set later
}
else
{
// Create metaobject
metaObj = (ObjectList*)UAVObjRegister(id+1, metaName, NULL, 1, 1, 0, sizeof(UAVObjMetadata), NULL);
// Link two objects
objEntry->linkedObj = metaObj;
metaObj->linkedObj = objEntry;
}
// Initialize object fields and metadata to default values
if ( initCb != NULL )
{
initCb((UAVObjHandle)objEntry, 0);
}
// Attempt to load object's metadata from the SD card (not done directly on the metaobject, but through the object)
if ( !objEntry->isMetaobject )
{
UAVObjLoad( (UAVObjHandle)objEntry->linkedObj, 0 );
}
// If this is a settings object, attempt to load from SD card
if ( objEntry->isSettings )
{
UAVObjLoad( (UAVObjHandle)objEntry, 0 );
}
// Release lock
xSemaphoreGiveRecursive(mutex);
return (UAVObjHandle)objEntry;
}
/**
* Retrieve an object from the list given its id
* \param[in] The object ID
* \return The object or NULL if not found.
*/
UAVObjHandle UAVObjGetByID(uint32_t id)
{
ObjectList* objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Look for object
LL_FOREACH(objList, objEntry)
{
if (objEntry->id == id)
{
// Release lock
xSemaphoreGiveRecursive(mutex);
// Done, object found
return (UAVObjHandle)objEntry;
}
}
// Object not found, release lock and return error
xSemaphoreGiveRecursive(mutex);
return NULL;
}
/**
* Retrieve an object from the list given its name
* \param[in] name The name of the object
* \return The object or NULL if not found.
*/
UAVObjHandle UAVObjGetByName(char* name)
{
ObjectList* objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Look for object
LL_FOREACH(objList, objEntry)
{
if (objEntry->name != NULL && strcmp(objEntry->name, name) == 0)
{
// Release lock
xSemaphoreGiveRecursive(mutex);
// Done, object found
return (UAVObjHandle)objEntry;
}
}
// Object not found, release lock and return error
xSemaphoreGiveRecursive(mutex);
return NULL;
}
/**
* Get the object's ID
* \param[in] obj The object handle
* \return The object ID
*/
uint32_t UAVObjGetID(UAVObjHandle obj)
{
return ((ObjectList*)obj)->id;
}
/**
* Get the object's name
* \param[in] obj The object handle
* \return The object's name
*/
const char* UAVObjGetName(UAVObjHandle obj)
{
return ((ObjectList*)obj)->name;
}
/**
* Get the number of bytes of the object's data (for one instance)
* \param[in] obj The object handle
* \return The number of bytes
*/
uint32_t UAVObjGetNumBytes(UAVObjHandle obj)
{
return ((ObjectList*)obj)->numBytes;
}
/**
* Get the object this object is linked to. For regular objects, the linked object
* is the metaobject. For metaobjects the linked object is the parent object.
* This function is normally only needed by the telemetry module.
* \param[in] obj The object handle
* \return The object linked object handle
*/
UAVObjHandle UAVObjGetLinkedObj(UAVObjHandle obj)
{
return (UAVObjHandle)(((ObjectList*)obj)->linkedObj);
}
/**
* Get the number of instances contained in the object.
* \param[in] obj The object handle
* \return The number of instances
*/
uint16_t UAVObjGetNumInstances(UAVObjHandle obj)
{
uint32_t numInstances;
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
numInstances = ((ObjectList*)obj)->numInstances;
xSemaphoreGiveRecursive(mutex);
return numInstances;
}
/**
* Create a new instance in the object.
* \param[in] obj The object handle
* \return The instance ID or 0 if an error
*/
uint16_t UAVObjCreateInstance(UAVObjHandle obj, UAVObjInitializeCallback initCb)
{
ObjectList* objEntry;
ObjectInstList* instEntry;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Create new instance
objEntry = (ObjectList*)obj;
instEntry = createInstance(objEntry, objEntry->numInstances);
if ( instEntry == NULL )
{
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Initialize instance data
if ( initCb != NULL )
{
initCb(obj, instEntry->instId);
}
// Unlock
xSemaphoreGiveRecursive(mutex);
return instEntry->instId;
}
/**
* Does this object contains a single instance or multiple instances?
* \param[in] obj The object handle
* \return True (1) if this is a single instance object
*/
int32_t UAVObjIsSingleInstance(UAVObjHandle obj)
{
return ((ObjectList*)obj)->isSingleInstance;
}
/**
* Is this a metaobject?
* \param[in] obj The object handle
* \return True (1) if this is metaobject
*/
int32_t UAVObjIsMetaobject(UAVObjHandle obj)
{
return ((ObjectList*)obj)->isMetaobject;
}
/**
* Is this a settings object?
* \param[in] obj The object handle
* \return True (1) if this is a settings object
*/
int32_t UAVObjIsSettings(UAVObjHandle obj)
{
return ((ObjectList*)obj)->isSettings;
}
/**
* Unpack an object from a byte array
* \param[in] obj The object handle
* \param[in] instId The instance ID
* \param[in] dataIn The byte array
* \return 0 if success or -1 if failure
*/
int32_t UAVObjUnpack(UAVObjHandle obj, uint16_t instId, const uint8_t* dataIn)
{
ObjectList* objEntry;
ObjectInstList* instEntry;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast handle to object
objEntry = (ObjectList*)obj;
// Get the instance
instEntry = getInstance(objEntry, instId);
// If the instance does not exist create it and any other instances before it
if ( instEntry == NULL )
{
instEntry = createInstance(objEntry, instId);
if ( instEntry == NULL )
{
// Error, unlock and return
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
// Set the data
memcpy(instEntry->data, dataIn, objEntry->numBytes);
// Fire event
sendEvent(objEntry, instId, EV_UNPACKED);
// Unlock
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Pack an object to a byte array
* \param[in] obj The object handle
* \param[in] instId The instance ID
* \param[out] dataOut The byte array
* \return 0 if success or -1 if failure
*/
int32_t UAVObjPack(UAVObjHandle obj, uint16_t instId, uint8_t* dataOut)
{
ObjectList* objEntry;
ObjectInstList* instEntry;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast handle to object
objEntry = (ObjectList*)obj;
// Get the instance
instEntry = getInstance(objEntry, instId);
if ( instEntry == NULL )
{
// Error, unlock and return
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Pack data
memcpy(dataOut, instEntry->data, objEntry->numBytes);
// Unlock
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Save the data of the specified object instance to the file system (SD card).
* The object will be appended and the file will not be closed.
* The object data can be restored using the UAVObjLoad function.
* @param[in] obj The object handle.
* @param[in] instId The instance ID
* @param[in] file File to append to
* @return 0 if success or -1 if failure
*/
int32_t UAVObjSaveToFile(UAVObjHandle obj, uint16_t instId, FILEINFO* file)
{
#if defined(PIOS_INCLUDE_SDCARD)
uint32_t bytesWritten;
ObjectList* objEntry;
ObjectInstList* instEntry;
// Check for file system availability
if ( PIOS_SDCARD_IsMounted() == 0 )
{
return -1;
}
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast to object
objEntry = (ObjectList*)obj;
// Get the instance information
instEntry = getInstance(objEntry, instId);
if ( instEntry == NULL )
{
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Write the object ID
PIOS_FWRITE(file,&objEntry->id,sizeof(objEntry->id),&bytesWritten);
// Write the instance ID
if (!objEntry->isSingleInstance)
{
PIOS_FWRITE(file,&instEntry->instId,sizeof(instEntry->instId),&bytesWritten);
}
// Write the data and check that the write was successful
PIOS_FWRITE(file,instEntry->data,objEntry->numBytes,&bytesWritten);
if ( bytesWritten != objEntry->numBytes )
{
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Done
xSemaphoreGiveRecursive(mutex);
#endif /* PIOS_INCLUDE_SDCARD */
return 0;
}
struct fileHeader {
uint32_t id;
uint16_t instId;
uint16_t size;
} __attribute__((packed));
#define FLASH_MASK 0x001ff000 /* Select a sector */
/**
* Save the data of the specified object to the file system (SD card).
* If the object contains multiple instances, all of them will be saved.
* A new file with the name of the object will be created.
* The object data can be restored using the UAVObjLoad function.
* @param[in] obj The object handle.
* @param[in] instId The instance ID
* @param[in] file File to append to
* @return 0 if success or -1 if failure
*/
int32_t UAVObjSave(UAVObjHandle obj, uint16_t instId)
{
#if defined(PIOS_INCLUDE_FLASH_SECTOR_SETTINGS)
ObjectList* objEntry = (ObjectList*)obj;
if(objEntry == NULL)
return -1;
ObjectInstList* instEntry = getInstance(objEntry, instId);
if(instEntry == NULL)
return -1;
if(instEntry->data == NULL)
return -1;
struct fileHeader header = {
.id = objEntry->id,
.instId = instId,
.size = objEntry->numBytes
};
uint32_t addr = (objEntry->id & FLASH_MASK);
PIOS_Flash_W25X_EraseSector(addr);
PIOS_Flash_W25X_WriteData(addr, (uint8_t *) &header, sizeof(header));
PIOS_Flash_W25X_WriteData(addr + sizeof(header), instEntry->data,objEntry->numBytes);
#endif
#if defined(PIOS_INCLUDE_SDCARD)
FILEINFO file;
ObjectList* objEntry;
uint8_t filename[14];
// Check for file system availability
if ( PIOS_SDCARD_IsMounted() == 0 )
{
return -1;
}
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast to object
objEntry = (ObjectList*)obj;
// Get filename
objectFilename(objEntry, filename);
// Open file
if ( PIOS_FOPEN_WRITE(filename,file) )
{
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Append object
if ( UAVObjSaveToFile(obj, instId, &file) == -1 )
{
PIOS_FCLOSE(file);
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Done, close file and unlock
PIOS_FCLOSE(file);
xSemaphoreGiveRecursive(mutex);
#endif /* PIOS_INCLUDE_SDCARD */
return 0;
}
/**
* Load an object from the file system (SD card).
* @param[in] file File to read from
* @return The handle of the object loaded or NULL if a failure
*/
UAVObjHandle UAVObjLoadFromFile(FILEINFO* file)
{
#if defined(PIOS_INCLUDE_SDCARD)
uint32_t bytesRead;
ObjectList* objEntry;
ObjectInstList* instEntry;
uint32_t objId;
uint16_t instId;
UAVObjHandle obj;
// Check for file system availability
if ( PIOS_SDCARD_IsMounted() == 0 )
{
return NULL;
}
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Read the object ID
if ( PIOS_FREAD(file,&objId,sizeof(objId),&bytesRead) )
{
xSemaphoreGiveRecursive(mutex);
return NULL;
}
// Get the object
obj = UAVObjGetByID(objId);
if ( obj == 0 )
{
xSemaphoreGiveRecursive(mutex);
return NULL;
}
objEntry = (ObjectList*)obj;
// Get the instance ID
instId = 0;
if ( !objEntry->isSingleInstance )
{
if ( PIOS_FREAD(file,&instId,sizeof(instId),&bytesRead) )
{
xSemaphoreGiveRecursive(mutex);
return NULL;
}
}
// Get the instance information
instEntry = getInstance(objEntry, instId);
// If the instance does not exist create it and any other instances before it
if ( instEntry == NULL )
{
instEntry = createInstance(objEntry, instId);
if ( instEntry == NULL )
{
// Error, unlock and return
xSemaphoreGiveRecursive(mutex);
return NULL;
}
}
// Read the instance data
if ( PIOS_FREAD(file,instEntry->data,objEntry->numBytes,&bytesRead) )
{
xSemaphoreGiveRecursive(mutex);
return NULL;
}
// Fire event
sendEvent(objEntry, instId, EV_UNPACKED);
// Unlock
xSemaphoreGiveRecursive(mutex);
return obj;
#else /* PIOS_INCLUDE_SDCARD */
return NULL;
#endif
}
/**
* Load an object from the file system (SD card).
* A file with the name of the object will be opened.
* The object data can be saved using the UAVObjSave function.
* @param[in] obj The object handle.
* @param[in] instId The object instance
* @return 0 if success or -1 if failure
*/
int32_t UAVObjLoad(UAVObjHandle obj, uint16_t instId)
{
#if defined(PIOS_INCLUDE_FLASH_SECTOR_SETTINGS)
ObjectList* objEntry = (ObjectList*)obj;
if(objEntry == NULL)
return -1;
ObjectInstList* instEntry = getInstance(objEntry, instId);
if(instEntry == NULL)
return -1;
if(instEntry->data == NULL)
return -1;
struct fileHeader header;
uint32_t addr = (objEntry->id & FLASH_MASK);
PIOS_Flash_W25X_ReadData(addr, (uint8_t *) &header, sizeof(header));
if(header.id != objEntry->id)
return -1;
// Read the instance data
if (PIOS_Flash_W25X_ReadData(addr + sizeof(header) ,instEntry->data, objEntry->numBytes) != 0)
return -1;
// Fire event
sendEvent(objEntry, instId, EV_UNPACKED);
#endif
#if defined(PIOS_INCLUDE_SDCARD)
FILEINFO file;
ObjectList* objEntry;
UAVObjHandle loadedObj;
ObjectList* loadedObjEntry;
uint8_t filename[14];
// Check for file system availability
if ( PIOS_SDCARD_IsMounted() == 0 )
{
return -1;
}
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast to object
objEntry = (ObjectList*)obj;
// Get filename
objectFilename(objEntry, filename);
// Open file
if ( PIOS_FOPEN_READ(filename,file) )
{
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Load object
loadedObj = UAVObjLoadFromFile(&file);
if (loadedObj == 0)
{
PIOS_FCLOSE(file);
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Check that the IDs match
loadedObjEntry = (ObjectList*)loadedObj;
if ( loadedObjEntry->id != objEntry->id )
{
PIOS_FCLOSE(file);
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Done, close file and unlock
PIOS_FCLOSE(file);
xSemaphoreGiveRecursive(mutex);
#endif /* PIOS_INCLUDE_SDCARD */
return 0;
}
/**
* Delete an object from the file system (SD card).
* @param[in] obj The object handle.
* @param[in] instId The object instance
* @return 0 if success or -1 if failure
*/
int32_t UAVObjDelete(UAVObjHandle obj, uint16_t instId)
{
#if defined(PIOS_INCLUDE_FLASH_SECTOR_SETTINGS)
ObjectList* objEntry = (ObjectList*)obj;
if(objEntry == NULL)
return -1;
uint32_t addr = (objEntry->id & FLASH_MASK);
PIOS_Flash_W25X_EraseSector(addr);
#endif
#if defined(PIOS_INCLUDE_SDCARD)
ObjectList* objEntry;
uint8_t filename[14];
// Check for file system availability
if ( PIOS_SDCARD_IsMounted() == 0 )
{
return -1;
}
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast to object
objEntry = (ObjectList*)obj;
// Get filename
objectFilename(objEntry, filename);
// Delete file
PIOS_FUNLINK(filename);
// Done
xSemaphoreGiveRecursive(mutex);
#endif /* PIOS_INCLUDE_SDCARD */
return 0;
}
/**
* Save all settings objects to the SD card.
* @return 0 if success or -1 if failure
*/
int32_t UAVObjSaveSettings()
{
ObjectList* objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Save all settings objects
LL_FOREACH(objList, objEntry)
{
// Check if this is a settings object
if ( objEntry->isSettings )
{
// Save object
if ( UAVObjSave( (UAVObjHandle)objEntry, 0 ) == -1 )
{
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
}
// Done
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Load all settings objects from the SD card.
* @return 0 if success or -1 if failure
*/
int32_t UAVObjLoadSettings()
{
ObjectList* objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Load all settings objects
LL_FOREACH(objList, objEntry)
{
// Check if this is a settings object
if ( objEntry->isSettings )
{
// Load object
if ( UAVObjLoad( (UAVObjHandle)objEntry, 0 ) == -1 )
{
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
}
// Done
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Delete all settings objects from the SD card.
* @return 0 if success or -1 if failure
*/
int32_t UAVObjDeleteSettings()
{
ObjectList* objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Save all settings objects
LL_FOREACH(objList, objEntry)
{
// Check if this is a settings object
if ( objEntry->isSettings )
{
// Save object
if ( UAVObjDelete( (UAVObjHandle)objEntry, 0 ) == -1 )
{
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
}
// Done
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Save all metaobjects to the SD card.
* @return 0 if success or -1 if failure
*/
int32_t UAVObjSaveMetaobjects()
{
ObjectList* objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Save all settings objects
LL_FOREACH(objList, objEntry)
{
// Check if this is a settings object
if ( objEntry->isMetaobject )
{
// Save object
if ( UAVObjSave( (UAVObjHandle)objEntry, 0 ) == -1 )
{
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
}
// Done
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Load all metaobjects from the SD card.
* @return 0 if success or -1 if failure
*/
int32_t UAVObjLoadMetaobjects()
{
ObjectList* objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Load all settings objects
LL_FOREACH(objList, objEntry)
{
// Check if this is a settings object
if ( objEntry->isMetaobject )
{
// Load object
if ( UAVObjLoad( (UAVObjHandle)objEntry, 0 ) == -1 )
{
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
}
// Done
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Delete all metaobjects from the SD card.
* @return 0 if success or -1 if failure
*/
int32_t UAVObjDeleteMetaobjects()
{
ObjectList* objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Load all settings objects
LL_FOREACH(objList, objEntry)
{
// Check if this is a settings object
if ( objEntry->isMetaobject )
{
// Load object
if ( UAVObjDelete( (UAVObjHandle)objEntry, 0 ) == -1 )
{
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
}
// Done
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Set the object data
* \param[in] obj The object handle
* \param[in] dataIn The object's data structure
* \return 0 if success or -1 if failure
*/
int32_t UAVObjSetData(UAVObjHandle obj, const void* dataIn)
{
return UAVObjSetInstanceData(obj, 0, dataIn);
}
/**
* Get the object data
* \param[in] obj The object handle
* \param[out] dataOut The object's data structure
* \return 0 if success or -1 if failure
*/
int32_t UAVObjGetData(UAVObjHandle obj, void* dataOut)
{
return UAVObjGetInstanceData(obj, 0, dataOut);
}
/**
* Set the data of a specific object instance
* \param[in] obj The object handle
* \param[in] instId The object instance ID
* \param[in] dataIn The object's data structure
* \return 0 if success or -1 if failure
*/
int32_t UAVObjSetInstanceData(UAVObjHandle obj, uint16_t instId, const void* dataIn)
{
ObjectList* objEntry;
ObjectInstList* instEntry;
UAVObjMetadata* mdata;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast to object info
objEntry = (ObjectList*)obj;
// Check access level
if ( !objEntry->isMetaobject )
{
mdata = (UAVObjMetadata*)(objEntry->linkedObj->instances.data);
if ( mdata->access == ACCESS_READONLY )
{
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
// Get instance information
instEntry = getInstance(objEntry, instId);
if ( instEntry == NULL )
{
// Error, unlock and return
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Set data
memcpy(instEntry->data, dataIn, objEntry->numBytes);
// Fire event
sendEvent(objEntry, instId, EV_UPDATED);
// Unlock
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Get the data of a specific object instance
* \param[in] obj The object handle
* \param[in] instId The object instance ID
* \param[out] dataOut The object's data structure
* \return 0 if success or -1 if failure
*/
int32_t UAVObjGetInstanceData(UAVObjHandle obj, uint16_t instId, void* dataOut)
{
ObjectList* objEntry;
ObjectInstList* instEntry;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast to object info
objEntry = (ObjectList*)obj;
// Get instance information
instEntry = getInstance(objEntry, instId);
if ( instEntry == NULL )
{
// Error, unlock and return
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Set data
memcpy(dataOut, instEntry->data, objEntry->numBytes);
// Unlock
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Set the object metadata
* \param[in] obj The object handle
* \param[in] dataIn The object's metadata structure
* \return 0 if success or -1 if failure
*/
int32_t UAVObjSetMetadata(UAVObjHandle obj, const UAVObjMetadata* dataIn)
{
ObjectList* objEntry;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Set metadata (metadata of metaobjects can not be modified)
objEntry = (ObjectList*)obj;
if (!objEntry->isMetaobject)
{
UAVObjSetData((UAVObjHandle)objEntry->linkedObj, dataIn);
}
else
{
return -1;
}
// Unlock
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Get the object metadata
* \param[in] obj The object handle
* \param[out] dataOut The object's metadata structure
* \return 0 if success or -1 if failure
*/
int32_t UAVObjGetMetadata(UAVObjHandle obj, UAVObjMetadata* dataOut)
{
ObjectList* objEntry;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Get metadata
objEntry = (ObjectList*)obj;
if (objEntry->isMetaobject)
{
memcpy(dataOut, &defMetadata, sizeof(UAVObjMetadata));
}
else
{
UAVObjGetData((UAVObjHandle)objEntry->linkedObj, dataOut);
}
// Unlock
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Check if an object is read only
* \param[in] obj The object handle
* \return
* \arg 0 if not read only
* \arg 1 if read only
* \arg -1 if unable to get meta data
*/
int8_t UAVObjReadOnly(UAVObjHandle obj)
{
ObjectList* objEntry;
UAVObjMetadata* mdata;
// Cast to object info
objEntry = (ObjectList*)obj;
// Check access level
if ( !objEntry->isMetaobject )
{
mdata = (UAVObjMetadata*)(objEntry->linkedObj->instances.data);
return mdata->access == ACCESS_READONLY;
}
return -1;
}
/**
* Connect an event queue to the object, if the queue is already connected then the event mask is only updated.
* All events matching the event mask will be pushed to the event queue.
* \param[in] obj The object handle
* \param[in] queue The event queue
* \param[in] eventMask The event mask, if EV_MASK_ALL then all events are enabled (e.g. EV_UPDATED | EV_UPDATED_MANUAL)
* \return 0 if success or -1 if failure
*/
int32_t UAVObjConnectQueue(UAVObjHandle obj, xQueueHandle queue, int32_t eventMask)
{
int32_t res;
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
res = connectObj(obj, queue, 0, eventMask);
xSemaphoreGiveRecursive(mutex);
return res;
}
/**
* Disconnect an event queue from the object.
* \param[in] obj The object handle
* \param[in] queue The event queue
* \return 0 if success or -1 if failure
*/
int32_t UAVObjDisconnectQueue(UAVObjHandle obj, xQueueHandle queue)
{
int32_t res;
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
res = disconnectObj(obj, queue, 0);
xSemaphoreGiveRecursive(mutex);
return res;
}
/**
* Connect an event callback to the object, if the callback is already connected then the event mask is only updated.
* The supplied callback will be invoked on all events matching the event mask.
* \param[in] obj The object handle
* \param[in] cb The event callback
* \param[in] eventMask The event mask, if EV_MASK_ALL then all events are enabled (e.g. EV_UPDATED | EV_UPDATED_MANUAL)
* \return 0 if success or -1 if failure
*/
int32_t UAVObjConnectCallback(UAVObjHandle obj, UAVObjEventCallback cb, int32_t eventMask)
{
int32_t res;
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
res = connectObj(obj, 0, cb, eventMask);
xSemaphoreGiveRecursive(mutex);
return res;
}
/**
* Disconnect an event callback from the object.
* \param[in] obj The object handle
* \param[in] cb The event callback
* \return 0 if success or -1 if failure
*/
int32_t UAVObjDisconnectCallback(UAVObjHandle obj, UAVObjEventCallback cb)
{
int32_t res;
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
res = disconnectObj(obj, 0, cb);
xSemaphoreGiveRecursive(mutex);
return res;
}
/**
* Request an update of the object's data from the GCS. The call will not wait for the response, a EV_UPDATED event
* will be generated as soon as the object is updated.
* \param[in] obj The object handle
*/
void UAVObjRequestUpdate(UAVObjHandle obj)
{
UAVObjRequestInstanceUpdate(obj, UAVOBJ_ALL_INSTANCES);
}
/**
* Request an update of the object's data from the GCS. The call will not wait for the response, a EV_UPDATED event
* will be generated as soon as the object is updated.
* \param[in] obj The object handle
* \param[in] instId Object instance ID to update
*/
void UAVObjRequestInstanceUpdate(UAVObjHandle obj, uint16_t instId)
{
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
sendEvent((ObjectList*)obj, instId, EV_UPDATE_REQ);
xSemaphoreGiveRecursive(mutex);
}
/**
* Send the object's data to the GCS (triggers a EV_UPDATED_MANUAL event on this object).
* \param[in] obj The object handle
*/
void UAVObjUpdated(UAVObjHandle obj)
{
UAVObjInstanceUpdated(obj, UAVOBJ_ALL_INSTANCES);
}
/**
* Send the object's data to the GCS (triggers a EV_UPDATED_MANUAL event on this object).
* \param[in] obj The object handle
* \param[in] instId The object instance ID
*/
void UAVObjInstanceUpdated(UAVObjHandle obj, uint16_t instId)
{
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
sendEvent((ObjectList*)obj, instId, EV_UPDATED_MANUAL);
xSemaphoreGiveRecursive(mutex);
}
/**
* Iterate through all objects in the list.
* \param iterator This function will be called once for each object,
* the object will be passed as a parameter
*/
void UAVObjIterate(void (*iterator)(UAVObjHandle obj))
{
ObjectList* objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Iterate through the list and invoke iterator for each object
LL_FOREACH(objList, objEntry)
{
(*iterator)((UAVObjHandle)objEntry);
}
// Release lock
xSemaphoreGiveRecursive(mutex);
}
/**
* Send an event to all event queues registered on the object.
*/
static int32_t sendEvent(ObjectList* obj, uint16_t instId, UAVObjEventType event)
{
ObjectEventList* eventEntry;
UAVObjEvent msg;
// Setup event
msg.obj = (UAVObjHandle)obj;
msg.event = event;
msg.instId = instId;
// Go through each object and push the event message in the queue (if event is activated for the queue)
LL_FOREACH(obj->events, eventEntry)
{
if ( eventEntry->eventMask == 0 || (eventEntry->eventMask & event) != 0 )
{
// Send to queue if a valid queue is registered
if (eventEntry->queue != 0)
{
if ( xQueueSend(eventEntry->queue, &msg, 0) != pdTRUE ) // will not block
{
++stats.eventErrors;
}
}
// Invoke callback (from event task) if a valid one is registered
if (eventEntry->cb != 0)
{
if ( EventCallbackDispatch(&msg, eventEntry->cb) != pdTRUE ) // invoke callback from the event task, will not block
{
++stats.eventErrors;
}
}
}
}
// Done
return 0;
}
/**
* Create a new object instance, return the instance info or NULL if failure.
*/
static ObjectInstList* createInstance(ObjectList* obj, uint16_t instId)
{
ObjectInstList* instEntry;
int32_t n;
// For single instance objects, only instance zero is allowed
if (obj->isSingleInstance && instId != 0)
{
return NULL;
}
// Make sure that the instance ID is within limits
if (instId >= UAVOBJ_MAX_INSTANCES)
{
return NULL;
}
// Check if the instance already exists
if ( getInstance(obj, instId) != NULL )
{
return NULL;
}
// Create any missing instances (all instance IDs must be sequential)
for (n = obj->numInstances; n < instId; ++n)
{
if ( createInstance(obj, n) == NULL )
{
return NULL;
}
}
if(instId == 0) /* Instance 0 ObjectInstList allocated with ObjectList element */
{
instEntry = &obj->instances;
instEntry->data = pvPortMalloc(obj->numBytes);
if (instEntry->data == NULL) return NULL;
memset(instEntry->data, 0, obj->numBytes);
instEntry->instId = instId;
} else
{
// Create the actual instance
instEntry = (ObjectInstList*)pvPortMalloc(sizeof(ObjectInstList));
if (instEntry == NULL) return NULL;
instEntry->data = pvPortMalloc(obj->numBytes);
if (instEntry->data == NULL) return NULL;
memset(instEntry->data, 0, obj->numBytes);
instEntry->instId = instId;
LL_APPEND(obj->instances.next, instEntry);
}
++obj->numInstances;
// Fire event
UAVObjInstanceUpdated((UAVObjHandle)obj, instId);
// Done
return instEntry;
}
/**
* Get the instance information or NULL if the instance does not exist
*/
static ObjectInstList* getInstance(ObjectList* obj, uint16_t instId)
{
ObjectInstList* instEntry;
// Look for specified instance ID
LL_FOREACH(&(obj->instances), instEntry)
{
if (instEntry->instId == instId)
{
return instEntry;
}
}
// If this point is reached then instance id was not found
return NULL;
}
/**
* Connect an event queue to the object, if the queue is already connected then the event mask is only updated.
* \param[in] obj The object handle
* \param[in] queue The event queue
* \param[in] cb The event callback
* \param[in] eventMask The event mask, if EV_MASK_ALL then all events are enabled (e.g. EV_UPDATED | EV_UPDATED_MANUAL)
* \return 0 if success or -1 if failure
*/
static int32_t connectObj(UAVObjHandle obj, xQueueHandle queue, UAVObjEventCallback cb, int32_t eventMask)
{
ObjectEventList* eventEntry;
ObjectList* objEntry;
// Check that the queue is not already connected, if it is simply update event mask
objEntry = (ObjectList*)obj;
LL_FOREACH(objEntry->events, eventEntry)
{
if ( eventEntry->queue == queue && eventEntry->cb == cb )
{
// Already connected, update event mask and return
eventEntry->eventMask = eventMask;
return 0;
}
}
// Add queue to list
eventEntry = (ObjectEventList*)pvPortMalloc(sizeof(ObjectEventList));
if (eventEntry == NULL)
{
return -1;
}
eventEntry->queue = queue;
eventEntry->cb = cb;
eventEntry->eventMask = eventMask;
LL_APPEND(objEntry->events, eventEntry);
// Done
return 0;
}
/**
* Disconnect an event queue from the object
* \param[in] obj The object handle
* \param[in] queue The event queue
* \param[in] cb The event callback
* \return 0 if success or -1 if failure
*/
static int32_t disconnectObj(UAVObjHandle obj, xQueueHandle queue, UAVObjEventCallback cb)
{
ObjectEventList* eventEntry;
ObjectList* objEntry;
// Find queue and remove it
objEntry = (ObjectList*)obj;
LL_FOREACH(objEntry->events, eventEntry)
{
if ( ( eventEntry->queue == queue && eventEntry->cb == cb ) )
{
LL_DELETE(objEntry->events, eventEntry);
vPortFree(eventEntry);
return 0;
}
}
// If this point is reached the queue was not found
return -1;
}
#if defined(PIOS_INCLUDE_SDCARD)
/**
* Wrapper for the sprintf function
*/
static void customSPrintf(uint8_t* buffer, uint8_t* format, ...)
{
va_list args;
va_start(args, format);
vsprintf((char *)buffer, (char *)format, args);
}
/**
* Get an 8 character (plus extension) filename for the object.
*/
static void objectFilename(ObjectList* obj, uint8_t* filename)
{
customSPrintf(filename, (uint8_t*)"%X.obj", obj->id);
}
#endif /* PIOS_INCLUDE_SDCARD */
/**
******************************************************************************
* @addtogroup UAVObjects OpenPilot UAVObjects
* @{
* @addtogroup UAV Object Manager
* @brief The core UAV Objects functions, most of which are wrappered by
* autogenerated defines
* @{
*
*
* @file uavobjectmanager.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Object manager library. This library holds a collection of all objects.
* It can be used by all modules/libraries to find an object reference.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "openpilot.h"
// Constants
// Private types
/**
* List of event queues and the eventmask associated with the queue.
*/
struct ObjectEventListStruct {
xQueueHandle queue;
UAVObjEventCallback cb;
int32_t eventMask;
struct ObjectEventListStruct *next;
};
typedef struct ObjectEventListStruct ObjectEventList;
/**
* List of object instances, holds the actual data structure and instance ID
*/
struct ObjectInstListStruct {
void *data;
uint16_t instId;
struct ObjectInstListStruct *next;
};
typedef struct ObjectInstListStruct ObjectInstList;
/**
* List of objects registered in the object manager
*/
struct ObjectListStruct {
uint32_t id;
/** The object ID */
const char *name;
/** The object name */
int8_t isMetaobject;
/** Set to 1 if this is a metaobject */
int8_t isSingleInstance;
/** Set to 1 if this object has a single instance */
int8_t isSettings;
/** Set to 1 if this object is a settings object */
uint16_t numBytes;
/** Number of data bytes contained in the object (for a single instance) */
uint16_t numInstances;
/** Number of instances */
struct ObjectListStruct *linkedObj;
/** Linked object, for regular objects this is the metaobject and for metaobjects it is the parent object */
ObjectInstList instances;
/** List of object instances, instance 0 always exists */
ObjectEventList *events;
/** Event queues registered on the object */
struct ObjectListStruct *next;
/** Needed by linked list library (utlist.h) */
};
typedef struct ObjectListStruct ObjectList;
// Private functions
static int32_t sendEvent(ObjectList * obj, uint16_t instId,
UAVObjEventType event);
static ObjectInstList *createInstance(ObjectList * obj, uint16_t instId);
static ObjectInstList *getInstance(ObjectList * obj, uint16_t instId);
static int32_t connectObj(UAVObjHandle obj, xQueueHandle queue,
UAVObjEventCallback cb, int32_t eventMask);
static int32_t disconnectObj(UAVObjHandle obj, xQueueHandle queue,
UAVObjEventCallback cb);
#if defined(PIOS_INCLUDE_SDCARD)
static void objectFilename(ObjectList * obj, uint8_t * filename);
static void customSPrintf(uint8_t * buffer, uint8_t * format, ...);
#endif
// Private variables
static ObjectList *objList;
static xSemaphoreHandle mutex;
static UAVObjMetadata defMetadata;
static UAVObjStats stats;
/**
* Initialize the object manager
* \return 0 Success
* \return -1 Failure
*/
int32_t UAVObjInitialize()
{
// Initialize variables
objList = NULL;
memset(&stats, 0, sizeof(UAVObjStats));
// Create mutex
mutex = xSemaphoreCreateRecursiveMutex();
if (mutex == NULL)
return -1;
// Initialize default metadata structure (metadata of metaobjects)
defMetadata.access = ACCESS_READWRITE;
defMetadata.gcsAccess = ACCESS_READWRITE;
defMetadata.telemetryAcked = 1;
defMetadata.telemetryUpdateMode = UPDATEMODE_ONCHANGE;
defMetadata.telemetryUpdatePeriod = 0;
defMetadata.gcsTelemetryAcked = 1;
defMetadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE;
defMetadata.gcsTelemetryUpdatePeriod = 0;
defMetadata.loggingUpdateMode = UPDATEMODE_ONCHANGE;
defMetadata.loggingUpdatePeriod = 0;
// Done
return 0;
}
/**
* Get the statistics counters
* @param[out] statsOut The statistics counters will be copied there
*/
void UAVObjGetStats(UAVObjStats * statsOut)
{
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
memcpy(statsOut, &stats, sizeof(UAVObjStats));
xSemaphoreGiveRecursive(mutex);
}
/**
* Clear the statistics counters
*/
void UAVObjClearStats()
{
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
memset(&stats, 0, sizeof(UAVObjStats));
xSemaphoreGiveRecursive(mutex);
}
/**
* Register and new object in the object manager.
* \param[in] id Unique object ID
* \param[in] name Object name
* \param[in] nameName Metaobject name
* \param[in] isMetaobject Is this a metaobject (1:true, 0:false)
* \param[in] isSingleInstance Is this a single instance or multi-instance object
* \param[in] isSettings Is this a settings object
* \param[in] numBytes Number of bytes of object data (for one instance)
* \param[in] initCb Default field and metadata initialization function
* \return Object handle, or NULL if failure.
* \return
*/
UAVObjHandle UAVObjRegister(uint32_t id, const char *name,
const char *metaName, int32_t isMetaobject,
int32_t isSingleInstance, int32_t isSettings,
uint32_t numBytes,
UAVObjInitializeCallback initCb)
{
ObjectList *objEntry;
ObjectInstList *instEntry;
ObjectList *metaObj;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Check that the object is not already registered
LL_FOREACH(objList, objEntry) {
if (objEntry->id == id) {
// Already registered, ignore
xSemaphoreGiveRecursive(mutex);
return NULL;
}
}
// Create and append entry
objEntry = (ObjectList *) pvPortMalloc(sizeof(ObjectList));
if (objEntry == NULL) {
xSemaphoreGiveRecursive(mutex);
return NULL;
}
objEntry->id = id;
objEntry->name = name;
objEntry->isMetaobject = (int8_t) isMetaobject;
objEntry->isSingleInstance = (int8_t) isSingleInstance;
objEntry->isSettings = (int8_t) isSettings;
objEntry->numBytes = numBytes;
objEntry->events = NULL;
objEntry->numInstances = 0;
objEntry->instances.data = NULL;
objEntry->instances.instId = 0xFFFF;
objEntry->instances.next = NULL;
objEntry->linkedObj = NULL; // will be set later
LL_APPEND(objList, objEntry);
// Create instance zero
instEntry = createInstance(objEntry, 0);
if (instEntry == NULL) {
xSemaphoreGiveRecursive(mutex);
return NULL;
}
// Create metaobject and update linkedObj
if (isMetaobject) {
objEntry->linkedObj = NULL; // will be set later
} else {
// Create metaobject
metaObj =
(ObjectList *) UAVObjRegister(id + 1, metaName,
NULL, 1, 1, 0,
sizeof
(UAVObjMetadata),
NULL);
// Link two objects
objEntry->linkedObj = metaObj;
metaObj->linkedObj = objEntry;
}
// Initialize object fields and metadata to default values
if (initCb != NULL) {
initCb((UAVObjHandle) objEntry, 0);
}
// Attempt to load object's metadata from the SD card (not done directly on the metaobject, but through the object)
if (!objEntry->isMetaobject) {
UAVObjLoad((UAVObjHandle) objEntry->linkedObj, 0);
}
// If this is a settings object, attempt to load from SD card
if (objEntry->isSettings) {
UAVObjLoad((UAVObjHandle) objEntry, 0);
}
// Release lock
xSemaphoreGiveRecursive(mutex);
return (UAVObjHandle) objEntry;
}
/**
* Retrieve an object from the list given its id
* \param[in] The object ID
* \return The object or NULL if not found.
*/
UAVObjHandle UAVObjGetByID(uint32_t id)
{
ObjectList *objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Look for object
LL_FOREACH(objList, objEntry) {
if (objEntry->id == id) {
// Release lock
xSemaphoreGiveRecursive(mutex);
// Done, object found
return (UAVObjHandle) objEntry;
}
}
// Object not found, release lock and return error
xSemaphoreGiveRecursive(mutex);
return NULL;
}
/**
* Retrieve an object from the list given its name
* \param[in] name The name of the object
* \return The object or NULL if not found.
*/
UAVObjHandle UAVObjGetByName(char *name)
{
ObjectList *objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Look for object
LL_FOREACH(objList, objEntry) {
if (objEntry->name != NULL
&& strcmp(objEntry->name, name) == 0) {
// Release lock
xSemaphoreGiveRecursive(mutex);
// Done, object found
return (UAVObjHandle) objEntry;
}
}
// Object not found, release lock and return error
xSemaphoreGiveRecursive(mutex);
return NULL;
}
/**
* Get the object's ID
* \param[in] obj The object handle
* \return The object ID
*/
uint32_t UAVObjGetID(UAVObjHandle obj)
{
return ((ObjectList *) obj)->id;
}
/**
* Get the object's name
* \param[in] obj The object handle
* \return The object's name
*/
const char *UAVObjGetName(UAVObjHandle obj)
{
return ((ObjectList *) obj)->name;
}
/**
* Get the number of bytes of the object's data (for one instance)
* \param[in] obj The object handle
* \return The number of bytes
*/
uint32_t UAVObjGetNumBytes(UAVObjHandle obj)
{
return ((ObjectList *) obj)->numBytes;
}
/**
* Get the object this object is linked to. For regular objects, the linked object
* is the metaobject. For metaobjects the linked object is the parent object.
* This function is normally only needed by the telemetry module.
* \param[in] obj The object handle
* \return The object linked object handle
*/
UAVObjHandle UAVObjGetLinkedObj(UAVObjHandle obj)
{
return (UAVObjHandle) (((ObjectList *) obj)->linkedObj);
}
/**
* Get the number of instances contained in the object.
* \param[in] obj The object handle
* \return The number of instances
*/
uint16_t UAVObjGetNumInstances(UAVObjHandle obj)
{
uint32_t numInstances;
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
numInstances = ((ObjectList *) obj)->numInstances;
xSemaphoreGiveRecursive(mutex);
return numInstances;
}
/**
* Create a new instance in the object.
* \param[in] obj The object handle
* \return The instance ID or 0 if an error
*/
uint16_t UAVObjCreateInstance(UAVObjHandle obj,
UAVObjInitializeCallback initCb)
{
ObjectList *objEntry;
ObjectInstList *instEntry;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Create new instance
objEntry = (ObjectList *) obj;
instEntry = createInstance(objEntry, objEntry->numInstances);
if (instEntry == NULL) {
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Initialize instance data
if (initCb != NULL) {
initCb(obj, instEntry->instId);
}
// Unlock
xSemaphoreGiveRecursive(mutex);
return instEntry->instId;
}
/**
* Does this object contains a single instance or multiple instances?
* \param[in] obj The object handle
* \return True (1) if this is a single instance object
*/
int32_t UAVObjIsSingleInstance(UAVObjHandle obj)
{
return ((ObjectList *) obj)->isSingleInstance;
}
/**
* Is this a metaobject?
* \param[in] obj The object handle
* \return True (1) if this is metaobject
*/
int32_t UAVObjIsMetaobject(UAVObjHandle obj)
{
return ((ObjectList *) obj)->isMetaobject;
}
/**
* Is this a settings object?
* \param[in] obj The object handle
* \return True (1) if this is a settings object
*/
int32_t UAVObjIsSettings(UAVObjHandle obj)
{
return ((ObjectList *) obj)->isSettings;
}
/**
* Unpack an object from a byte array
* \param[in] obj The object handle
* \param[in] instId The instance ID
* \param[in] dataIn The byte array
* \return 0 if success or -1 if failure
*/
int32_t UAVObjUnpack(UAVObjHandle obj, uint16_t instId,
const uint8_t * dataIn)
{
ObjectList *objEntry;
ObjectInstList *instEntry;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast handle to object
objEntry = (ObjectList *) obj;
// Get the instance
instEntry = getInstance(objEntry, instId);
// If the instance does not exist create it and any other instances before it
if (instEntry == NULL) {
instEntry = createInstance(objEntry, instId);
if (instEntry == NULL) {
// Error, unlock and return
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
// Set the data
memcpy(instEntry->data, dataIn, objEntry->numBytes);
// Fire event
sendEvent(objEntry, instId, EV_UNPACKED);
// Unlock
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Pack an object to a byte array
* \param[in] obj The object handle
* \param[in] instId The instance ID
* \param[out] dataOut The byte array
* \return 0 if success or -1 if failure
*/
int32_t UAVObjPack(UAVObjHandle obj, uint16_t instId, uint8_t * dataOut)
{
ObjectList *objEntry;
ObjectInstList *instEntry;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast handle to object
objEntry = (ObjectList *) obj;
// Get the instance
instEntry = getInstance(objEntry, instId);
if (instEntry == NULL) {
// Error, unlock and return
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Pack data
memcpy(dataOut, instEntry->data, objEntry->numBytes);
// Unlock
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Save the data of the specified object instance to the file system (SD card).
* The object will be appended and the file will not be closed.
* The object data can be restored using the UAVObjLoad function.
* @param[in] obj The object handle.
* @param[in] instId The instance ID
* @param[in] file File to append to
* @return 0 if success or -1 if failure
*/
int32_t UAVObjSaveToFile(UAVObjHandle obj, uint16_t instId,
FILEINFO * file)
{
#if defined(PIOS_INCLUDE_SDCARD)
uint32_t bytesWritten;
ObjectList *objEntry;
ObjectInstList *instEntry;
// Check for file system availability
if (PIOS_SDCARD_IsMounted() == 0) {
return -1;
}
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast to object
objEntry = (ObjectList *) obj;
// Get the instance information
instEntry = getInstance(objEntry, instId);
if (instEntry == NULL) {
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Write the object ID
PIOS_FWRITE(file, &objEntry->id, sizeof(objEntry->id),
&bytesWritten);
// Write the instance ID
if (!objEntry->isSingleInstance) {
PIOS_FWRITE(file, &instEntry->instId,
sizeof(instEntry->instId), &bytesWritten);
}
// Write the data and check that the write was successful
PIOS_FWRITE(file, instEntry->data, objEntry->numBytes,
&bytesWritten);
if (bytesWritten != objEntry->numBytes) {
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Done
xSemaphoreGiveRecursive(mutex);
#endif /* PIOS_INCLUDE_SDCARD */
return 0;
}
/**
* Save the data of the specified object to the file system (SD card).
* If the object contains multiple instances, all of them will be saved.
* A new file with the name of the object will be created.
* The object data can be restored using the UAVObjLoad function.
* @param[in] obj The object handle.
* @param[in] instId The instance ID
* @param[in] file File to append to
* @return 0 if success or -1 if failure
*/
int32_t UAVObjSave(UAVObjHandle obj, uint16_t instId)
{
#if defined(PIOS_INCLUDE_FLASH_SECTOR_SETTINGS)
ObjectList *objEntry = (ObjectList *) obj;
if (objEntry == NULL)
return -1;
ObjectInstList *instEntry = getInstance(objEntry, instId);
if (instEntry == NULL)
return -1;
if (instEntry->data == NULL)
return -1;
if (PIOS_FLASHFS_ObjSave(obj, instId, instEntry->data) != 0)
return -1;
#endif
#if defined(PIOS_INCLUDE_SDCARD)
FILEINFO file;
ObjectList *objEntry;
uint8_t filename[14];
// Check for file system availability
if (PIOS_SDCARD_IsMounted() == 0) {
return -1;
}
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast to object
objEntry = (ObjectList *) obj;
// Get filename
objectFilename(objEntry, filename);
// Open file
if (PIOS_FOPEN_WRITE(filename, file)) {
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Append object
if (UAVObjSaveToFile(obj, instId, &file) == -1) {
PIOS_FCLOSE(file);
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Done, close file and unlock
PIOS_FCLOSE(file);
xSemaphoreGiveRecursive(mutex);
#endif /* PIOS_INCLUDE_SDCARD */
return 0;
}
/**
* Load an object from the file system (SD card).
* @param[in] file File to read from
* @return The handle of the object loaded or NULL if a failure
*/
UAVObjHandle UAVObjLoadFromFile(FILEINFO * file)
{
#if defined(PIOS_INCLUDE_SDCARD)
uint32_t bytesRead;
ObjectList *objEntry;
ObjectInstList *instEntry;
uint32_t objId;
uint16_t instId;
UAVObjHandle obj;
// Check for file system availability
if (PIOS_SDCARD_IsMounted() == 0) {
return NULL;
}
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Read the object ID
if (PIOS_FREAD(file, &objId, sizeof(objId), &bytesRead)) {
xSemaphoreGiveRecursive(mutex);
return NULL;
}
// Get the object
obj = UAVObjGetByID(objId);
if (obj == 0) {
xSemaphoreGiveRecursive(mutex);
return NULL;
}
objEntry = (ObjectList *) obj;
// Get the instance ID
instId = 0;
if (!objEntry->isSingleInstance) {
if (PIOS_FREAD
(file, &instId, sizeof(instId), &bytesRead)) {
xSemaphoreGiveRecursive(mutex);
return NULL;
}
}
// Get the instance information
instEntry = getInstance(objEntry, instId);
// If the instance does not exist create it and any other instances before it
if (instEntry == NULL) {
instEntry = createInstance(objEntry, instId);
if (instEntry == NULL) {
// Error, unlock and return
xSemaphoreGiveRecursive(mutex);
return NULL;
}
}
// Read the instance data
if (PIOS_FREAD
(file, instEntry->data, objEntry->numBytes, &bytesRead)) {
xSemaphoreGiveRecursive(mutex);
return NULL;
}
// Fire event
sendEvent(objEntry, instId, EV_UNPACKED);
// Unlock
xSemaphoreGiveRecursive(mutex);
return obj;
#else /* PIOS_INCLUDE_SDCARD */
return NULL;
#endif
}
/**
* Load an object from the file system (SD card).
* A file with the name of the object will be opened.
* The object data can be saved using the UAVObjSave function.
* @param[in] obj The object handle.
* @param[in] instId The object instance
* @return 0 if success or -1 if failure
*/
int32_t UAVObjLoad(UAVObjHandle obj, uint16_t instId)
{
#if defined(PIOS_INCLUDE_FLASH_SECTOR_SETTINGS)
ObjectList *objEntry = (ObjectList *) obj;
if (objEntry == NULL)
return -1;
ObjectInstList *instEntry = getInstance(objEntry, instId);
if (instEntry == NULL)
return -1;
if (instEntry->data == NULL)
return -1;
// Fire event on success
if (PIOS_FLASHFS_ObjLoad(obj, instId, instEntry->data) == 0)
sendEvent(objEntry, instId, EV_UNPACKED);
else
return -1;
#endif
#if defined(PIOS_INCLUDE_SDCARD)
FILEINFO file;
ObjectList *objEntry;
UAVObjHandle loadedObj;
ObjectList *loadedObjEntry;
uint8_t filename[14];
// Check for file system availability
if (PIOS_SDCARD_IsMounted() == 0) {
return -1;
}
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast to object
objEntry = (ObjectList *) obj;
// Get filename
objectFilename(objEntry, filename);
// Open file
if (PIOS_FOPEN_READ(filename, file)) {
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Load object
loadedObj = UAVObjLoadFromFile(&file);
if (loadedObj == 0) {
PIOS_FCLOSE(file);
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Check that the IDs match
loadedObjEntry = (ObjectList *) loadedObj;
if (loadedObjEntry->id != objEntry->id) {
PIOS_FCLOSE(file);
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Done, close file and unlock
PIOS_FCLOSE(file);
xSemaphoreGiveRecursive(mutex);
#endif /* PIOS_INCLUDE_SDCARD */
return 0;
}
/**
* Delete an object from the file system (SD card).
* @param[in] obj The object handle.
* @param[in] instId The object instance
* @return 0 if success or -1 if failure
*/
int32_t UAVObjDelete(UAVObjHandle obj, uint16_t instId)
{
#if defined(PIOS_INCLUDE_FLASH_SECTOR_SETTINGS)
PIOS_FLASHFS_ObjDelete(obj, instId);
#endif
#if defined(PIOS_INCLUDE_SDCARD)
ObjectList *objEntry;
uint8_t filename[14];
// Check for file system availability
if (PIOS_SDCARD_IsMounted() == 0) {
return -1;
}
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast to object
objEntry = (ObjectList *) obj;
// Get filename
objectFilename(objEntry, filename);
// Delete file
PIOS_FUNLINK(filename);
// Done
xSemaphoreGiveRecursive(mutex);
#endif /* PIOS_INCLUDE_SDCARD */
return 0;
}
/**
* Save all settings objects to the SD card.
* @return 0 if success or -1 if failure
*/
int32_t UAVObjSaveSettings()
{
ObjectList *objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Save all settings objects
LL_FOREACH(objList, objEntry) {
// Check if this is a settings object
if (objEntry->isSettings) {
// Save object
if (UAVObjSave((UAVObjHandle) objEntry, 0) ==
-1) {
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
}
// Done
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Load all settings objects from the SD card.
* @return 0 if success or -1 if failure
*/
int32_t UAVObjLoadSettings()
{
ObjectList *objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Load all settings objects
LL_FOREACH(objList, objEntry) {
// Check if this is a settings object
if (objEntry->isSettings) {
// Load object
if (UAVObjLoad((UAVObjHandle) objEntry, 0) ==
-1) {
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
}
// Done
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Delete all settings objects from the SD card.
* @return 0 if success or -1 if failure
*/
int32_t UAVObjDeleteSettings()
{
ObjectList *objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Save all settings objects
LL_FOREACH(objList, objEntry) {
// Check if this is a settings object
if (objEntry->isSettings) {
// Save object
if (UAVObjDelete((UAVObjHandle) objEntry, 0)
== -1) {
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
}
// Done
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Save all metaobjects to the SD card.
* @return 0 if success or -1 if failure
*/
int32_t UAVObjSaveMetaobjects()
{
ObjectList *objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Save all settings objects
LL_FOREACH(objList, objEntry) {
// Check if this is a settings object
if (objEntry->isMetaobject) {
// Save object
if (UAVObjSave((UAVObjHandle) objEntry, 0) ==
-1) {
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
}
// Done
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Load all metaobjects from the SD card.
* @return 0 if success or -1 if failure
*/
int32_t UAVObjLoadMetaobjects()
{
ObjectList *objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Load all settings objects
LL_FOREACH(objList, objEntry) {
// Check if this is a settings object
if (objEntry->isMetaobject) {
// Load object
if (UAVObjLoad((UAVObjHandle) objEntry, 0) ==
-1) {
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
}
// Done
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Delete all metaobjects from the SD card.
* @return 0 if success or -1 if failure
*/
int32_t UAVObjDeleteMetaobjects()
{
ObjectList *objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Load all settings objects
LL_FOREACH(objList, objEntry) {
// Check if this is a settings object
if (objEntry->isMetaobject) {
// Load object
if (UAVObjDelete((UAVObjHandle) objEntry, 0)
== -1) {
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
}
// Done
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Set the object data
* \param[in] obj The object handle
* \param[in] dataIn The object's data structure
* \return 0 if success or -1 if failure
*/
int32_t UAVObjSetData(UAVObjHandle obj, const void *dataIn)
{
return UAVObjSetInstanceData(obj, 0, dataIn);
}
/**
* Get the object data
* \param[in] obj The object handle
* \param[out] dataOut The object's data structure
* \return 0 if success or -1 if failure
*/
int32_t UAVObjGetData(UAVObjHandle obj, void *dataOut)
{
return UAVObjGetInstanceData(obj, 0, dataOut);
}
/**
* Set the data of a specific object instance
* \param[in] obj The object handle
* \param[in] instId The object instance ID
* \param[in] dataIn The object's data structure
* \return 0 if success or -1 if failure
*/
int32_t UAVObjSetInstanceData(UAVObjHandle obj, uint16_t instId,
const void *dataIn)
{
ObjectList *objEntry;
ObjectInstList *instEntry;
UAVObjMetadata *mdata;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast to object info
objEntry = (ObjectList *) obj;
// Check access level
if (!objEntry->isMetaobject) {
mdata =
(UAVObjMetadata *) (objEntry->linkedObj->instances.
data);
if (mdata->access == ACCESS_READONLY) {
xSemaphoreGiveRecursive(mutex);
return -1;
}
}
// Get instance information
instEntry = getInstance(objEntry, instId);
if (instEntry == NULL) {
// Error, unlock and return
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Set data
memcpy(instEntry->data, dataIn, objEntry->numBytes);
// Fire event
sendEvent(objEntry, instId, EV_UPDATED);
// Unlock
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Get the data of a specific object instance
* \param[in] obj The object handle
* \param[in] instId The object instance ID
* \param[out] dataOut The object's data structure
* \return 0 if success or -1 if failure
*/
int32_t UAVObjGetInstanceData(UAVObjHandle obj, uint16_t instId,
void *dataOut)
{
ObjectList *objEntry;
ObjectInstList *instEntry;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Cast to object info
objEntry = (ObjectList *) obj;
// Get instance information
instEntry = getInstance(objEntry, instId);
if (instEntry == NULL) {
// Error, unlock and return
xSemaphoreGiveRecursive(mutex);
return -1;
}
// Set data
memcpy(dataOut, instEntry->data, objEntry->numBytes);
// Unlock
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Set the object metadata
* \param[in] obj The object handle
* \param[in] dataIn The object's metadata structure
* \return 0 if success or -1 if failure
*/
int32_t UAVObjSetMetadata(UAVObjHandle obj, const UAVObjMetadata * dataIn)
{
ObjectList *objEntry;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Set metadata (metadata of metaobjects can not be modified)
objEntry = (ObjectList *) obj;
if (!objEntry->isMetaobject) {
UAVObjSetData((UAVObjHandle) objEntry->linkedObj,
dataIn);
} else {
return -1;
}
// Unlock
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Get the object metadata
* \param[in] obj The object handle
* \param[out] dataOut The object's metadata structure
* \return 0 if success or -1 if failure
*/
int32_t UAVObjGetMetadata(UAVObjHandle obj, UAVObjMetadata * dataOut)
{
ObjectList *objEntry;
// Lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Get metadata
objEntry = (ObjectList *) obj;
if (objEntry->isMetaobject) {
memcpy(dataOut, &defMetadata, sizeof(UAVObjMetadata));
} else {
UAVObjGetData((UAVObjHandle) objEntry->linkedObj,
dataOut);
}
// Unlock
xSemaphoreGiveRecursive(mutex);
return 0;
}
/**
* Check if an object is read only
* \param[in] obj The object handle
* \return
* \arg 0 if not read only
* \arg 1 if read only
* \arg -1 if unable to get meta data
*/
int8_t UAVObjReadOnly(UAVObjHandle obj)
{
ObjectList *objEntry;
UAVObjMetadata *mdata;
// Cast to object info
objEntry = (ObjectList *) obj;
// Check access level
if (!objEntry->isMetaobject) {
mdata =
(UAVObjMetadata *) (objEntry->linkedObj->instances.
data);
return mdata->access == ACCESS_READONLY;
}
return -1;
}
/**
* Connect an event queue to the object, if the queue is already connected then the event mask is only updated.
* All events matching the event mask will be pushed to the event queue.
* \param[in] obj The object handle
* \param[in] queue The event queue
* \param[in] eventMask The event mask, if EV_MASK_ALL then all events are enabled (e.g. EV_UPDATED | EV_UPDATED_MANUAL)
* \return 0 if success or -1 if failure
*/
int32_t UAVObjConnectQueue(UAVObjHandle obj, xQueueHandle queue,
int32_t eventMask)
{
int32_t res;
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
res = connectObj(obj, queue, 0, eventMask);
xSemaphoreGiveRecursive(mutex);
return res;
}
/**
* Disconnect an event queue from the object.
* \param[in] obj The object handle
* \param[in] queue The event queue
* \return 0 if success or -1 if failure
*/
int32_t UAVObjDisconnectQueue(UAVObjHandle obj, xQueueHandle queue)
{
int32_t res;
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
res = disconnectObj(obj, queue, 0);
xSemaphoreGiveRecursive(mutex);
return res;
}
/**
* Connect an event callback to the object, if the callback is already connected then the event mask is only updated.
* The supplied callback will be invoked on all events matching the event mask.
* \param[in] obj The object handle
* \param[in] cb The event callback
* \param[in] eventMask The event mask, if EV_MASK_ALL then all events are enabled (e.g. EV_UPDATED | EV_UPDATED_MANUAL)
* \return 0 if success or -1 if failure
*/
int32_t UAVObjConnectCallback(UAVObjHandle obj, UAVObjEventCallback cb,
int32_t eventMask)
{
int32_t res;
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
res = connectObj(obj, 0, cb, eventMask);
xSemaphoreGiveRecursive(mutex);
return res;
}
/**
* Disconnect an event callback from the object.
* \param[in] obj The object handle
* \param[in] cb The event callback
* \return 0 if success or -1 if failure
*/
int32_t UAVObjDisconnectCallback(UAVObjHandle obj, UAVObjEventCallback cb)
{
int32_t res;
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
res = disconnectObj(obj, 0, cb);
xSemaphoreGiveRecursive(mutex);
return res;
}
/**
* Request an update of the object's data from the GCS. The call will not wait for the response, a EV_UPDATED event
* will be generated as soon as the object is updated.
* \param[in] obj The object handle
*/
void UAVObjRequestUpdate(UAVObjHandle obj)
{
UAVObjRequestInstanceUpdate(obj, UAVOBJ_ALL_INSTANCES);
}
/**
* Request an update of the object's data from the GCS. The call will not wait for the response, a EV_UPDATED event
* will be generated as soon as the object is updated.
* \param[in] obj The object handle
* \param[in] instId Object instance ID to update
*/
void UAVObjRequestInstanceUpdate(UAVObjHandle obj, uint16_t instId)
{
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
sendEvent((ObjectList *) obj, instId, EV_UPDATE_REQ);
xSemaphoreGiveRecursive(mutex);
}
/**
* Send the object's data to the GCS (triggers a EV_UPDATED_MANUAL event on this object).
* \param[in] obj The object handle
*/
void UAVObjUpdated(UAVObjHandle obj)
{
UAVObjInstanceUpdated(obj, UAVOBJ_ALL_INSTANCES);
}
/**
* Send the object's data to the GCS (triggers a EV_UPDATED_MANUAL event on this object).
* \param[in] obj The object handle
* \param[in] instId The object instance ID
*/
void UAVObjInstanceUpdated(UAVObjHandle obj, uint16_t instId)
{
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
sendEvent((ObjectList *) obj, instId, EV_UPDATED_MANUAL);
xSemaphoreGiveRecursive(mutex);
}
/**
* Iterate through all objects in the list.
* \param iterator This function will be called once for each object,
* the object will be passed as a parameter
*/
void UAVObjIterate(void (*iterator) (UAVObjHandle obj))
{
ObjectList *objEntry;
// Get lock
xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
// Iterate through the list and invoke iterator for each object
LL_FOREACH(objList, objEntry) {
(*iterator) ((UAVObjHandle) objEntry);
}
// Release lock
xSemaphoreGiveRecursive(mutex);
}
/**
* Send an event to all event queues registered on the object.
*/
static int32_t sendEvent(ObjectList * obj, uint16_t instId,
UAVObjEventType event)
{
ObjectEventList *eventEntry;
UAVObjEvent msg;
// Setup event
msg.obj = (UAVObjHandle) obj;
msg.event = event;
msg.instId = instId;
// Go through each object and push the event message in the queue (if event is activated for the queue)
LL_FOREACH(obj->events, eventEntry) {
if (eventEntry->eventMask == 0
|| (eventEntry->eventMask & event) != 0) {
// Send to queue if a valid queue is registered
if (eventEntry->queue != 0) {
if (xQueueSend(eventEntry->queue, &msg, 0) != pdTRUE) // will not block
{
++stats.eventErrors;
}
}
// Invoke callback (from event task) if a valid one is registered
if (eventEntry->cb != 0) {
if (EventCallbackDispatch(&msg, eventEntry->cb) != pdTRUE) // invoke callback from the event task, will not block
{
++stats.eventErrors;
}
}
}
}
// Done
return 0;
}
/**
* Create a new object instance, return the instance info or NULL if failure.
*/
static ObjectInstList *createInstance(ObjectList * obj, uint16_t instId)
{
ObjectInstList *instEntry;
int32_t n;
// For single instance objects, only instance zero is allowed
if (obj->isSingleInstance && instId != 0) {
return NULL;
}
// Make sure that the instance ID is within limits
if (instId >= UAVOBJ_MAX_INSTANCES) {
return NULL;
}
// Check if the instance already exists
if (getInstance(obj, instId) != NULL) {
return NULL;
}
// Create any missing instances (all instance IDs must be sequential)
for (n = obj->numInstances; n < instId; ++n) {
if (createInstance(obj, n) == NULL) {
return NULL;
}
}
if (instId == 0) { /* Instance 0 ObjectInstList allocated with ObjectList element */
instEntry = &obj->instances;
instEntry->data = pvPortMalloc(obj->numBytes);
if (instEntry->data == NULL)
return NULL;
memset(instEntry->data, 0, obj->numBytes);
instEntry->instId = instId;
} else {
// Create the actual instance
instEntry =
(ObjectInstList *)
pvPortMalloc(sizeof(ObjectInstList));
if (instEntry == NULL)
return NULL;
instEntry->data = pvPortMalloc(obj->numBytes);
if (instEntry->data == NULL)
return NULL;
memset(instEntry->data, 0, obj->numBytes);
instEntry->instId = instId;
LL_APPEND(obj->instances.next, instEntry);
}
++obj->numInstances;
// Fire event
UAVObjInstanceUpdated((UAVObjHandle) obj, instId);
// Done
return instEntry;
}
/**
* Get the instance information or NULL if the instance does not exist
*/
static ObjectInstList *getInstance(ObjectList * obj, uint16_t instId)
{
ObjectInstList *instEntry;
// Look for specified instance ID
LL_FOREACH(&(obj->instances), instEntry) {
if (instEntry->instId == instId) {
return instEntry;
}
}
// If this point is reached then instance id was not found
return NULL;
}
/**
* Connect an event queue to the object, if the queue is already connected then the event mask is only updated.
* \param[in] obj The object handle
* \param[in] queue The event queue
* \param[in] cb The event callback
* \param[in] eventMask The event mask, if EV_MASK_ALL then all events are enabled (e.g. EV_UPDATED | EV_UPDATED_MANUAL)
* \return 0 if success or -1 if failure
*/
static int32_t connectObj(UAVObjHandle obj, xQueueHandle queue,
UAVObjEventCallback cb, int32_t eventMask)
{
ObjectEventList *eventEntry;
ObjectList *objEntry;
// Check that the queue is not already connected, if it is simply update event mask
objEntry = (ObjectList *) obj;
LL_FOREACH(objEntry->events, eventEntry) {
if (eventEntry->queue == queue && eventEntry->cb == cb) {
// Already connected, update event mask and return
eventEntry->eventMask = eventMask;
return 0;
}
}
// Add queue to list
eventEntry =
(ObjectEventList *) pvPortMalloc(sizeof(ObjectEventList));
if (eventEntry == NULL) {
return -1;
}
eventEntry->queue = queue;
eventEntry->cb = cb;
eventEntry->eventMask = eventMask;
LL_APPEND(objEntry->events, eventEntry);
// Done
return 0;
}
/**
* Disconnect an event queue from the object
* \param[in] obj The object handle
* \param[in] queue The event queue
* \param[in] cb The event callback
* \return 0 if success or -1 if failure
*/
static int32_t disconnectObj(UAVObjHandle obj, xQueueHandle queue,
UAVObjEventCallback cb)
{
ObjectEventList *eventEntry;
ObjectList *objEntry;
// Find queue and remove it
objEntry = (ObjectList *) obj;
LL_FOREACH(objEntry->events, eventEntry) {
if ((eventEntry->queue == queue
&& eventEntry->cb == cb)) {
LL_DELETE(objEntry->events, eventEntry);
vPortFree(eventEntry);
return 0;
}
}
// If this point is reached the queue was not found
return -1;
}
#if defined(PIOS_INCLUDE_SDCARD)
/**
* Wrapper for the sprintf function
*/
static void customSPrintf(uint8_t * buffer, uint8_t * format, ...)
{
va_list args;
va_start(args, format);
vsprintf((char *)buffer, (char *)format, args);
}
/**
* Get an 8 character (plus extension) filename for the object.
*/
static void objectFilename(ObjectList * obj, uint8_t * filename)
{
customSPrintf(filename, (uint8_t *) "%X.obj", obj->id);
}
#endif /* PIOS_INCLUDE_SDCARD */

View File

@ -16,4 +16,4 @@ for %%D in (%0) do set NSI=%%~dD%%~pD\openpilotgcs.nsi
rem Build installer
echo Generating Windows installer...
"%NSISC%" /V2 %NSI%
"%NSISC%" /V3 %NSI%

View File

@ -31,7 +31,7 @@
;--------------------------------
; Paths
; Tree root locations (relative to this script location)
!define NSIS_DATA_TREE "."
!define GCS_BUILD_TREE "..\..\..\..\build\ground\openpilotgcs"
@ -39,7 +39,7 @@
; Default installation folder
InstallDir "$LOCALAPPDATA\OpenPilot"
; Get installation folder from registry if available
InstallDirRegKey HKCU "Software\OpenPilot" "Install Location"
@ -83,7 +83,7 @@
; Compression level
SetCompressor /solid lzma
;--------------------------------
; Branding
@ -97,7 +97,7 @@
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSIS_DATA_TREE}\resources\welcome.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP_NOSTRETCH
;--------------------------------
; Language selection dialog settings
@ -105,6 +105,12 @@
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\OpenPilot"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
!define MUI_LANGDLL_ALWAYSSHOW
;--------------------------------
; Settings for MUI_PAGE_FINISH
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION "RunApplication"
;--------------------------------
; Pages
@ -115,27 +121,25 @@
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
; !define MUI_FINISHPAGE_RUN "$INSTDIR\bin\openpilotgcs.exe"
;--------------------------------
; Supported languages, license files and translations
!include "${NSIS_DATA_TREE}\translations\languages.nsh"
;--------------------------------
; Reserve files
; If you are using solid compression, files that are required before
; the actual installation should be stored first in the data block,
; because this will make your installer start faster.
!insertmacro MUI_RESERVEFILE_LANGDLL
;--------------------------------
@ -191,7 +195,7 @@ SectionEnd
Section ; create uninstall info
; Write the installation path into the registry
WriteRegStr HKCU "Software\OpenPilot" "Install Location" $INSTDIR
; Write the uninstall keys for Windows
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenPilot" "DisplayName" "OpenPilot GCS"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenPilot" "UninstallString" '"$INSTDIR\Uninstall.exe"'
@ -213,7 +217,7 @@ SectionEnd
!insertmacro MUI_DESCRIPTION_TEXT ${InSecLocalization} $(DESC_InSecLocalization)
!insertmacro MUI_DESCRIPTION_TEXT ${InSecShortcuts} $(DESC_InSecShortcuts)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
; Installer functions
@ -248,12 +252,18 @@ SectionEnd
Section "un.Maps cache" UnSecCache
; Remove maps cache
RMDir /r /rebootok "$PROFILE\OpenPilot"
RMDir /r /rebootok "$APPDATA\OpenPilot\mapscache"
SectionEnd
Section /o "un.Configuration" UnSecConfig
; Remove configuration
RMDir /r /rebootok "$APPDATA\OpenPilot"
Delete /rebootok "$APPDATA\OpenPilot\OpenPilotGCS.db"
Delete /rebootok "$APPDATA\OpenPilot\OpenPilotGCS.ini"
SectionEnd
Section "-un.Profile" UnSecProfile
; Remove OpenPilot user profile subdirectory if empty
RMDir "$APPDATA\OpenPilot"
SectionEnd
;--------------------------------
@ -264,12 +274,21 @@ SectionEnd
!insertmacro MUI_DESCRIPTION_TEXT ${UnSecCache} $(DESC_UnSecCache)
!insertmacro MUI_DESCRIPTION_TEXT ${UnSecConfig} $(DESC_UnSecConfig)
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END
;--------------------------------
; Uninstaller functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd
;--------------------------------
; Function to run the application from installer
Function RunApplication
Exec '"$INSTDIR\bin\openpilotgcs.exe"'
FunctionEnd

View File

@ -14,7 +14,7 @@
height="80.827866"
id="svg10068"
version="1.1"
inkscape:version="0.47 r22583"
inkscape:version="0.48.0 r9654"
sodipodi:docname="arm-status.svg"
inkscape:export-filename="H:\Documents\Hobbies\W433\My Gauges\vbat-001.png"
inkscape:export-xdpi="103.61"
@ -828,6 +828,402 @@
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 24 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
id="linearGradient5128-3">
<stop
offset="0"
style="stop-color:#e5e5e5;stop-opacity:1"
id="stop5130-1" />
<stop
offset="1"
style="stop-color:#ababab;stop-opacity:1"
id="stop5132-1" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.09614231,0,0,0.09614231,1.8468935,1.9430362)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5128-3"
id="linearGradient3260"
y2="20.895"
x2="84.63858"
y1="105.105"
x1="86.132919" />
<linearGradient
id="linearGradient3397-90">
<stop
offset="0"
style="stop-color:#aaaaaa;stop-opacity:1"
id="stop3399-8" />
<stop
offset="1"
style="stop-color:#8c8c8c;stop-opacity:1"
id="stop3401-1" />
</linearGradient>
<linearGradient
gradientTransform="translate(-17.058189,0)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3397-90"
id="linearGradient3264"
y2="16.004715"
x2="21"
y1="0"
x1="21" />
<linearGradient
gradientUnits="userSpaceOnUse"
id="linearGradient3309-6"
y2="122.8994"
x2="63.9995"
y1="3.1001"
x1="63.9995">
<stop
offset="0"
style="stop-color:#f6f6f6;stop-opacity:1"
id="stop3311-2" />
<stop
offset="1"
style="stop-color:#cccccc;stop-opacity:1"
id="stop3313-9" />
</linearGradient>
<linearGradient
gradientTransform="translate(-17.058189,0)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3309-6"
id="linearGradient3262"
y2="16.000105"
x2="25"
y1="0"
x1="25" />
<linearGradient
id="linearGradient5128-6">
<stop
offset="0"
style="stop-color:#eeeeee;stop-opacity:1"
id="stop5130-43" />
<stop
offset="1"
style="stop-color:#a2a2a2;stop-opacity:1"
id="stop5132-0" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.1562313,0,0,0.1562313,2.0012016,2.1574324)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5128-6"
id="linearGradient3241"
y2="20.895"
x2="84.63858"
y1="105.105"
x1="86.132919" />
<linearGradient
id="linearGradient3397-9">
<stop
offset="0"
style="stop-color:#aaaaaa;stop-opacity:1"
id="stop3399-7" />
<stop
offset="1"
style="stop-color:#8c8c8c;stop-opacity:1"
id="stop3401-7" />
</linearGradient>
<linearGradient
gradientTransform="translate(-24.5,0)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3397-9"
id="linearGradient3228"
y2="23.019524"
x2="40"
y1="1"
x1="40" />
<linearGradient
gradientUnits="userSpaceOnUse"
id="linearGradient3309-4"
y2="122.8994"
x2="63.9995"
y1="3.1001"
x1="63.9995">
<stop
offset="0"
style="stop-color:#f6f6f6;stop-opacity:1"
id="stop3311-8" />
<stop
offset="1"
style="stop-color:#d2d2d2;stop-opacity:1"
id="stop3313-88" />
</linearGradient>
<linearGradient
gradientTransform="translate(-24.5,0)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3309-4"
id="linearGradient3218"
y2="23.00024"
x2="34"
y1="1"
x1="34" />
<linearGradient
id="linearGradient10691-8">
<stop
offset="0"
style="stop-color:#000000;stop-opacity:1"
id="stop10693-6" />
<stop
offset="1"
style="stop-color:#000000;stop-opacity:0"
id="stop10695-0" />
</linearGradient>
<radialGradient
gradientTransform="matrix(1.660115,0,0,0.3458573,0.8727276,-3.9605294)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient10691-8"
id="radialGradient2411"
fy="73.615715"
fx="6.702713"
r="7.228416"
cy="73.615715"
cx="6.702713" />
<linearGradient
gradientTransform="matrix(0.2014014,0,0,0.2014015,3.1103045,3.311705)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5128-0"
id="linearGradient2868"
y2="20.895"
x2="84.63858"
y1="105.105"
x1="86.132919" />
<linearGradient
id="linearGradient5128-0">
<stop
offset="0"
style="stop-color:#ffffff;stop-opacity:1"
id="stop5130-4" />
<stop
offset="1"
style="stop-color:#959595;stop-opacity:1"
id="stop5132-4" />
</linearGradient>
<linearGradient
id="linearGradient3397-1">
<stop
offset="0"
style="stop-color:#aaaaaa;stop-opacity:1"
id="stop3399-0" />
<stop
offset="1"
style="stop-color:#8c8c8c;stop-opacity:1"
id="stop3401-3" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.93928017,0.34315123,-0.34315123,0.93928017,-1.7936946,-25.633934)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3397-1"
id="linearGradient3328"
y2="47.044857"
x2="25.922546"
y1="19"
x1="25.922546" />
<linearGradient
gradientUnits="userSpaceOnUse"
id="linearGradient3309-8"
y2="122.8994"
x2="63.9995"
y1="3.1001"
x1="63.9995">
<stop
offset="0"
style="stop-color:#f6f6f6;stop-opacity:1"
id="stop3311-4" />
<stop
offset="1"
style="stop-color:#d2d2d2;stop-opacity:1"
id="stop3313-8" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.93928017,0.34315123,-0.34315123,0.93928017,-1.7936946,-25.633934)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3309-8"
id="linearGradient3326"
y2="47.012184"
x2="32.036148"
y1="19"
x1="32.036148" />
<linearGradient
id="linearGradient10691">
<stop
offset="0"
style="stop-color:#000000;stop-opacity:1"
id="stop10693" />
<stop
offset="1"
style="stop-color:#000000;stop-opacity:0"
id="stop10695" />
</linearGradient>
<radialGradient
gradientTransform="matrix(2.2134617,0,0,0.4842001,1.1638028,-7.1447362)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient10691"
id="radialGradient2538"
fy="73.615715"
fx="6.702713"
r="7.228416"
cy="73.615715"
cx="6.702713" />
<linearGradient
gradientTransform="matrix(0.3244803,0,0,0.3244803,3.2332655,2.5577454)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5128"
id="linearGradient2512"
y2="20.895"
x2="84.63858"
y1="105.105"
x1="86.132919" />
<linearGradient
id="linearGradient5128">
<stop
offset="0"
style="stop-color:#e5e5e5;stop-opacity:1"
id="stop5130" />
<stop
offset="1"
style="stop-color:#ababab;stop-opacity:1"
id="stop5132" />
</linearGradient>
<linearGradient
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3309"
id="linearGradient2515"
y2="45.017357"
x2="20.758585"
y1="1"
x1="20.758585" />
<linearGradient
gradientUnits="userSpaceOnUse"
id="linearGradient3309"
y2="122.8994"
x2="63.9995"
y1="3.1001"
x1="63.9995">
<stop
offset="0"
style="stop-color:#f6f6f6;stop-opacity:1"
id="stop3311" />
<stop
offset="1"
style="stop-color:#d2d2d2;stop-opacity:1"
id="stop3313" />
</linearGradient>
<linearGradient
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3397"
id="linearGradient2517"
y2="45"
x2="37.201294"
y1="1"
x1="37.201294" />
<linearGradient
id="linearGradient3397">
<stop
offset="0"
style="stop-color:#aaaaaa;stop-opacity:1"
id="stop3399" />
<stop
offset="1"
style="stop-color:#8c8c8c;stop-opacity:1"
id="stop3401" />
</linearGradient>
<radialGradient
gradientTransform="matrix(2.1647059,0,0,0.7529402,-111.56471,36.517647)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient8838-9"
id="radialGradient2436-5"
fy="4.625"
fx="62.625"
r="10.625"
cy="4.625"
cx="62.625" />
<linearGradient
id="linearGradient8838-9">
<stop
offset="0"
style="stop-color:#000000;stop-opacity:1"
id="stop8840-7" />
<stop
offset="1"
style="stop-color:#000000;stop-opacity:0"
id="stop8842-8" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.93928017,0.34315123,-0.34315123,0.93928017,-1.7936946,-25.633934)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3309-8-1"
id="linearGradient3326-4"
y2="47.012184"
x2="32.036148"
y1="19"
x1="32.036148" />
<linearGradient
gradientUnits="userSpaceOnUse"
id="linearGradient3309-8-1"
y2="122.8994"
x2="63.9995"
y1="3.1001"
x1="63.9995">
<stop
offset="0"
style="stop-color:#f6f6f6;stop-opacity:1"
id="stop3311-4-5" />
<stop
offset="1"
style="stop-color:#d2d2d2;stop-opacity:1"
id="stop3313-8-5" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.93928017,0.34315123,-0.34315123,0.93928017,-1.7936946,-25.633934)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3397-1-9"
id="linearGradient3328-4"
y2="47.044857"
x2="25.922546"
y1="19"
x1="25.922546" />
<linearGradient
id="linearGradient3397-1-9">
<stop
offset="0"
style="stop-color:#aaaaaa;stop-opacity:1"
id="stop3399-0-8" />
<stop
offset="1"
style="stop-color:#8c8c8c;stop-opacity:1"
id="stop3401-3-3" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.2014014,0,0,0.2014015,3.1103045,3.311705)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5128-0-5"
id="linearGradient2868-8"
y2="20.895"
x2="84.63858"
y1="105.105"
x1="86.132919" />
<linearGradient
id="linearGradient5128-0-5">
<stop
offset="0"
style="stop-color:#ffffff;stop-opacity:1"
id="stop5130-4-2" />
<stop
offset="1"
style="stop-color:#959595;stop-opacity:1"
id="stop5132-4-2" />
</linearGradient>
<linearGradient
y2="20.895"
x2="84.63858"
y1="105.105"
x1="86.132919"
gradientTransform="matrix(0.2014014,0,0,0.2014015,3.1103045,3.311705)"
gradientUnits="userSpaceOnUse"
id="linearGradient3339"
xlink:href="#linearGradient5128-0-5"
inkscape:collect="always" />
</defs>
<sodipodi:namedview
id="base"
@ -836,14 +1232,14 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="44.030427"
inkscape:cy="102.26308"
inkscape:zoom="1.979899"
inkscape:cx="69.908261"
inkscape:cy="99.737699"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:current-layer="background"
showgrid="false"
inkscape:window-width="1366"
inkscape:window-height="693"
inkscape:window-height="691"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
@ -861,7 +1257,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
<dc:creator>
<cc:Agent>
<dc:title>Edouard Lafargue</dc:title>
@ -977,7 +1373,7 @@
d="m 53.950159,30.352861 c 0,13.351915 -10.823865,24.17578 -24.175779,24.17578 -13.351915,0 -24.1757796,-10.823865 -24.1757796,-24.17578 0,-13.351914 10.8238646,-24.1757789 24.1757796,-24.1757789 13.351914,0 24.175779,10.8238649 24.175779,24.1757789 z" />
</g>
<g
id="symbol-False"
id="symbol-Disarmed"
transform="translate(173.85714,-69.957837)"
inkscape:label="#layer1-6">
<path
@ -998,7 +1394,7 @@
d="M 17.049914,14.239243 33.752151,33.92599" />
</g>
<g
id="symbol-True"
id="symbol-Armed"
transform="translate(92.42857,-72.302217)"
inkscape:label="#layer1-0">
<path
@ -1015,5 +1411,26 @@
id="path1544"
d="M 32.938536,7.2012775 26.730268,18.60791 21.197213,28.668822 c -0.178482,0.181096 -0.123845,0.754094 -0.902701,0.952966 -0.538869,0.137595 -0.636352,-0.06289 -1.204172,-0.427914 l -6.950556,-5.492153 c -0.7733,-0.621665 -0.749753,-0.589365 -1.297288,-0.03737 L 8.0515824,27.18582 c -0.7518117,0.804672 -0.6353589,1.290849 0.3017539,1.891047 0,0 13.0781537,10.780055 13.0949407,10.788373 0.155564,0.085 0.0892,0.114145 0.757862,0.57814 0.428927,0.297637 0.807539,-0.647982 1.083435,-1.15286 L 39.190779,10.274963 C 39.55113,9.6155282 39.523767,9.624421 38.860008,9.2617466 L 34.11801,6.7472827 C 33.434075,6.3758505 33.430508,6.3800895 32.938536,7.2012775 z" />
</g>
<g
style="display:inline"
id="symbol-Arming"
transform="matrix(1.2857213,0,0,1.2857213,18.29593,-68.120293)"
inkscape:label="#layer1-33">
<path
style="fill:url(#linearGradient3326-4);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3328-4);stroke-width:0.77777356;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible;enable-background:accumulate"
id="rect2576"
d="m 18.636572,2.5905216 c -0.703275,-0.2569307 -1.495689,0.08705 -1.752619,0.7903248 l -0.600515,1.6437399 c -0.499176,-0.013219 -0.993955,0.00248 -1.484533,0.056512 L 14.072373,3.5181351 C 13.756758,2.8391668 12.960838,2.5483897 12.28187,2.864003 L 8.3651471,4.6602954 C 7.6861782,4.9759083 7.3954033,5.7718319 7.7110151,6.4507982 l 0.726532,1.5629636 C 8.0724464,8.359396 7.744193,8.7441155 7.4266456,9.141602 L 5.8122578,8.5518108 C 5.1089821,8.2948801 4.3165666,8.6388602 4.0596381,9.3421356 L 2.5797984,13.392781 c -0.2569313,0.703275 0.1271272,1.477063 0.8304007,1.733991 l 1.6143878,0.589791 c -0.013469,0.508577 -0.010523,1.014295 0.045789,1.513885 l -1.5629633,0.726533 c -0.6789688,0.315613 -0.9697472,1.111534 -0.654132,1.790502 l 1.8363684,3.898094 c 0.3156123,0.678968 1.1115366,0.969744 1.7905029,0.654132 l 1.5629636,-0.726532 c 0.3402133,0.357549 0.7083491,0.688501 1.0984877,1.000178 l -0.6005147,1.64374 c -0.2569313,0.703275 0.1271291,1.477064 0.8304008,1.733991 l 4.0212927,1.469116 c 0.703276,0.256931 1.466338,-0.09777 1.723267,-0.801048 l 0.600515,-1.64374 c 0.508577,0.01347 1.014295,0.01052 1.513885,-0.04579 l 0.726532,1.562963 c 0.315614,0.678968 1.111534,0.969745 1.790502,0.654132 l 3.916723,-1.796292 c 0.678969,-0.315613 0.969742,-1.111538 0.654132,-1.790503 l -0.745161,-1.603039 c 0.357549,-0.340214 0.6885,-0.708349 1.000178,-1.098488 l 1.64374,0.600515 c 0.703276,0.25693 1.466338,-0.09778 1.723267,-0.801049 l 1.47984,-4.050645 c 0.256931,-0.703275 -0.09778,-1.466339 -0.801048,-1.723268 l -1.64374,-0.600514 c 0.01322,-0.499176 -0.0025,-0.993955 -0.05651,-1.484533 l 1.60304,-0.745162 C 29.20091,13.73813 29.491686,12.942208 29.176073,12.26324 L 27.339704,8.365146 C 27.024092,7.6861784 26.228168,7.3954 25.549202,7.711014 L 23.986239,8.4375465 C 23.640605,8.0724458 23.255886,7.7441924 22.858399,7.4266449 L 23.458914,5.782905 C 23.715845,5.0796306 23.361136,4.3165668 22.657865,4.0596378 L 18.636572,2.5905216 z M 17.20103,12.71252 c 1.81469,0.662968 2.74942,2.67382 2.086452,4.48851 -0.662969,1.814689 -2.673821,2.749419 -4.48851,2.086451 -1.814691,-0.662969 -2.74942,-2.673821 -2.086452,-4.48851 0.662968,-1.81469 2.673821,-2.74942 4.48851,-2.086451 z"
inkscape:connector-curvature="0" />
<path
style="opacity:0.05;fill:#000000;fill-opacity:1;stroke:none"
id="path3315"
d="m 16.000001,7.9999996 c -4.411273,0 -7.9999985,3.5887274 -7.9999985,8.0000004 0,4.411274 3.5887255,8 7.9999985,8 C 20.411274,24 24,20.411274 24,16 24,11.588727 20.411274,7.9999996 16.000001,7.9999996 z m 0,3.6923094 c 2.377844,0 4.307693,1.929846 4.307693,4.307691 0,2.377847 -1.929849,4.307693 -4.307693,4.307693 -2.377846,0 -4.307691,-1.929846 -4.307691,-4.307693 0,-2.377845 1.929845,-4.307691 4.307691,-4.307691 z"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:url(#linearGradient3339);stroke-width:0.77777356;stroke-miterlimit:4;stroke-dasharray:none"
id="path28"
d="m 16.000001,7.6206906 c -4.620353,0 -8.3793085,3.7589574 -8.3793085,8.3793084 0,4.620352 3.7589555,8.37931 8.3793085,8.37931 4.620353,0 8.379309,-3.758958 8.379309,-8.37931 0,-4.620351 -3.758956,-8.3793084 -8.379309,-8.3793084 z"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -0,0 +1 @@
<html>Here you will find help for Angle Limit fields</html>

View File

@ -0,0 +1 @@
<html>Here you will find help for tunning Attitude Stabilization</html>

View File

@ -0,0 +1 @@
<html>Add explanation of what Get Current, Apply, and Save each do</html>

View File

@ -0,0 +1 @@
<html>Here you will find help for tunning Attitude Stabilization</html>

View File

@ -0,0 +1 @@
<html>Here you will find help for what the Update in Real Time checkmark does</html>

View File

@ -21,6 +21,7 @@ alert
altitude
amps
aquired
armed
autonomous flight
battery
camera
@ -32,8 +33,10 @@ complete
connected
connection
control
coptercontrol
critical
disabled
disarmed
disconnected
feet
figure eight
@ -58,11 +61,13 @@ lost
low altitude
low battery
low gps quality
magic
manual flight
maxium
meters
minimum
mode
moved
MPH
navigation
OpenPilot
@ -122,8 +127,4 @@ hundread
thousand
Upto: OpenPilot
critical
battery
point

View File

@ -6,10 +6,10 @@ SUBDIRS = \
qtconcurrent \
aggregation \
extensionsystem \
utils \
opmapcontrol \
qwt \
qextserialport \
utils \
glc_lib\
sdlgamepad \
libqxt

View File

@ -1,3 +1,4 @@
TEMPLATE = subdirs
SUBDIRS = src \

View File

@ -1,4 +1,5 @@
DESTDIR = ../build
QT += network
QT += sql
CONFIG += staticlib
@ -6,3 +7,4 @@ TEMPLATE = lib
UI_DIR = uics
MOC_DIR = mocs
OBJECTS_DIR = objs
INCLUDEPATH +=../../../../libs/

View File

@ -25,6 +25,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "cache.h"
#include "utils/pathutils.h"
#include <QSettings>
namespace core {
@ -53,11 +54,7 @@ namespace core {
{
if(cache.isNull()|cache.isEmpty())
{
QSettings set(QSettings::IniFormat, QSettings::UserScope,QLatin1String("OpenPilot"), QLatin1String("OpenPilotGCS"));
QDir dir(set.fileName());
QFileInfo f(dir.absolutePath());
f.dir().absolutePath();
cache=f.dir().absolutePath()+QDir::separator()+"mapscache"+QDir::separator();
cache= Utils::PathUtils().GetStoragePath()+"mapscache"+QDir::separator();
setCacheLocation(cache);
}
}

View File

@ -15,11 +15,15 @@ SOURCES += mapgraphicitem.cpp \
mapripform.cpp \
mapripper.cpp \
traillineitem.cpp
LIBS += -L../build \
-lcore \
-linternals \
-lcore
# order of linking matters
include(../../../utils/utils.pri)
POST_TARGETDEPS += ../build/libcore.a
POST_TARGETDEPS += ../build/libinternals.a

View File

@ -96,12 +96,16 @@ QString PathUtils::InsertDataPath(QString path)
QString PathUtils::GetStoragePath()
{
// This routine works with "/" as the standard:
// Figure out root: Up one from 'bin'
const QString homeDirPath = QDir::home().canonicalPath();
// Work out where the settings are stored on the machine
QSettings set(QSettings::IniFormat, QSettings::UserScope,QLatin1String("OpenPilot"), QLatin1String("OpenPilotGCS"));
QFileInfo f(set.fileName());
QDir dir(f.absoluteDir());
const QString homeDirPath = dir.canonicalPath();
QString storagePath = homeDirPath;
storagePath += QLatin1Char('/');
storagePath += QLatin1String("OpenPilot");
storagePath += QLatin1Char('/');
// storagePath += QLatin1String("OpenPilot");
// storagePath += QLatin1Char('/');
return storagePath;
}
@ -118,7 +122,6 @@ QString PathUtils::RemoveStoragePath(QString path)
return QString("%%STOREPATH%%") + goodPath.right(i);
} else
return goodPath;
}
/**

View File

@ -33,6 +33,7 @@
#include "../extensionsystem/pluginmanager.h"
#include <QDir>
#include <QApplication>
#include <QSettings>
namespace Utils {

View File

@ -1 +1 @@
LIBS *= -l$$qtLibraryTarget(Utils)
LIBS += -l$$qtLibraryTarget(Utils)

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>720</width>
<height>501</height>
<height>509</height>
</rect>
</property>
<property name="windowTitle">
@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab_2">
<attribute name="title">
@ -41,17 +41,57 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>#1: Multi-Point Calibration</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="multiPointHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>#1: Multi-Point Calibration</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGraphicsView" name="sixPointsHelp">
@ -111,17 +151,57 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>#2: Sensor noise calibration</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QPushButton" name="sensorNoiseHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>#2: Sensor noise calibration</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGraphicsView" name="ahrsBargraph">
@ -197,17 +277,51 @@ Hint: run this with engines at cruising speed.</string>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>#3: Accelerometer Bias calibration</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QPushButton" name="accelBiasHelp">
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>#3: Accelerometer Bias calibration</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
@ -253,17 +367,51 @@ Hint: run this with engines at cruising speed.</string>
<item>
<layout class="QVBoxLayout" name="gyroDriftLayout">
<item>
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>#4 Gyro temperature drift calibration</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QPushButton" name="gyroDriftHelp">
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>#4 Gyro temperature drift calibration</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
@ -432,8 +580,37 @@ p, li { white-space: pre-wrap; }
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QHBoxLayout" name="ahrsSettingsLayout">
<item>
<widget class="QPushButton" name="insAlgorithmHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>INS Algorithm:</string>
</property>
@ -461,8 +638,37 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="homeLocationHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Home Location:</string>
</property>
@ -550,6 +756,29 @@ new home location unless it is in indoor mode.</string>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="commandHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ahrsSettingsRequest">
<property name="toolTip">
@ -590,7 +819,9 @@ specific calibration button on top of the screen.</string>
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="configgadget.qrc"/>
</resources>
<connections/>
<buttongroups>
<buttongroup name="buttonGroup"/>

View File

@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tabWidgetPage1">
<attribute name="title">
@ -29,8 +29,37 @@
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="acftTypeHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Aircraft type:</string>
</property>
@ -73,7 +102,7 @@
<item>
<widget class="QStackedWidget" name="airframesWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="fixedWing">
<property name="enabled">
@ -87,6 +116,23 @@
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="airplaneTypeHelp">
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
@ -95,6 +141,12 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Airplane type:</string>
</property>
@ -119,11 +171,51 @@
</layout>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Channel Assignment</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_23">
<item>
<widget class="QPushButton" name="channelAssignmentHelp">
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Channel Assignment</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_15">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
@ -359,8 +451,31 @@
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="QPushButton" name="throttleCurveHelp">
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_13">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Throttle Curve</string>
</property>
@ -471,8 +586,37 @@
<layout class="QVBoxLayout" name="verticalLayout_24">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="multiFrameTypeHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_15">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Frame type:</string>
</property>
@ -505,17 +649,57 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_20">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Mix Level</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_25">
<item>
<widget class="QPushButton" name="mixLevelHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Mix Level</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_19">
@ -701,8 +885,37 @@ Typical value is 50% for + or X configuration on quads.</string>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="throttleCurveHelp_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_24">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Throttle Curve</string>
</property>
@ -772,18 +985,64 @@ Typical value is 50% for + or X configuration on quads.</string>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,3">
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,0,3">
<property name="spacing">
<number>10</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QLabel" name="label_23">
<property name="text">
<string>Tricopter Yaw</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_26">
<item>
<widget class="QPushButton" name="tricopterYawHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_23">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Tricopter Yaw</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_18">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_2">
@ -826,6 +1085,46 @@ Typical value is 50% for + or X configuration on quads.</string>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_26">
<item>
<widget class="QPushButton" name="motorOutputChanHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
@ -1089,6 +1388,8 @@ p, li { white-space: pre-wrap; }
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
@ -1175,6 +1476,8 @@ p, li { white-space: pre-wrap; }
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
@ -1833,6 +2136,23 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="commandHelp">
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="getAircraftCurrent">
<property name="toolTip">
@ -1875,17 +2195,57 @@ p, li { white-space: pre-wrap; }
<item>
<layout class="QVBoxLayout" name="verticalLayout_11" stretch="0,1,0,0,0,0">
<item>
<widget class="QLabel" name="label_19">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Feed Forward</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_24">
<item>
<widget class="QPushButton" name="feedForwardHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_19">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Feed Forward</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_16">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QFormLayout" name="formLayout_7">
@ -2170,6 +2530,29 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="commandHelp_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ffGetCurrent">
<property name="toolTip">
@ -2224,7 +2607,9 @@ p, li { white-space: pre-wrap; }
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="configgadget.qrc"/>
</resources>
<connections>
<connection>
<sender>feedForwardSlider</sender>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>307</height>
<width>331</width>
<height>324</height>
</rect>
</property>
<property name="windowTitle">
@ -15,231 +15,337 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>110</height>
</size>
</property>
<property name="title">
<string>Attitude Rotation</string>
</property>
<widget class="QSpinBox" name="rollBias">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>81</width>
<height>25</height>
</rect>
</property>
<property name="minimum">
<number>-180</number>
</property>
<property name="maximum">
<number>180</number>
</property>
</widget>
<widget class="QSpinBox" name="pitchBias">
<property name="geometry">
<rect>
<x>120</x>
<y>70</y>
<width>81</width>
<height>25</height>
</rect>
</property>
<property name="minimum">
<number>-90</number>
</property>
<property name="maximum">
<number>90</number>
</property>
</widget>
<widget class="QSpinBox" name="yawBias">
<property name="geometry">
<rect>
<x>220</x>
<y>70</y>
<width>81</width>
<height>25</height>
</rect>
</property>
<property name="minimum">
<number>-180</number>
</property>
<property name="maximum">
<number>180</number>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>91</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Roll</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>120</x>
<y>50</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Pitch</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>220</x>
<y>50</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Yaw</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>341</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Select the amount to rotate the attitude</string>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>140</height>
</size>
</property>
<property name="title">
<string>Attitude Calibration</string>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>20</y>
<width>371</width>
<height>111</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<number>3</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label">
<widget class="QPushButton" name="attitudeRotationHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Place aircraft flat before computing</string>
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Attitude Rotation</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string> Select the amount to rotate the attitude</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="status">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Click &quot;Zero Accel Bias&quot; to start</string>
<string>Roll</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<widget class="QSpinBox" name="rollBias">
<property name="minimum">
<number>-180</number>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="maximum">
<number>180</number>
</property>
</spacer>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QPushButton" name="zeroBias">
<property name="toolTip">
<string>Launch horizontal calibration.</string>
</property>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Zero Accel Bias</string>
<string>Pitch</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="zeroBiasProgress">
<property name="value">
<number>0</number>
<widget class="QSpinBox" name="pitchBias">
<property name="minimum">
<number>-90</number>
</property>
<property name="maximum">
<number>90</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Yaw</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="yawBias">
<property name="minimum">
<number>-180</number>
</property>
<property name="maximum">
<number>180</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPushButton" name="attitudeCalibHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Attitude Calibration</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Place aircraft flat before computing</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="status">
<property name="text">
<string>Click &quot;Zero Accel Bias&quot; to start</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>4</number>
</property>
<item>
<widget class="QPushButton" name="zeroBias">
<property name="toolTip">
<string>Launch horizontal calibration.</string>
</property>
<property name="text">
<string>Zero Accel Bias</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="zeroBiasProgress">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="zeroOnArmHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="zeroGyroBiasOnArming">
<property name="toolTip">
<string>If enabled, a fast recalibration of gyro zero point will be done
whenever the frame is armed. Do not move the airframe while
arming it in that case!</string>
</property>
<property name="text">
<string>Zero gyro bias upon airframe arming</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
@ -256,6 +362,29 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="commandHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="configgadget.qrc">
<normaloff>:/configgadget/images/help2.png</normaloff>:/configgadget/images/help2.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="getCurrentButton">
<property name="text">
@ -297,6 +426,8 @@
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="configgadget.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -37,6 +37,7 @@
#include <QThread>
#include <iostream>
#include <Eigen/align-function.h>
#include <QSignalMapper>
#include "assertions.h"
#include "calibration.h"
@ -227,6 +228,24 @@ ConfigAHRSWidget::ConfigAHRSWidget(QWidget *parent) : ConfigTaskWidget(parent)
connect(m_ahrs->startDriftCalib, SIGNAL(clicked()),this, SLOT(launchGyroDriftCalibration()));
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(ahrsSettingsRequest()));
// Connect all the help buttons to signal mapper that passes button name to SLOT function
QSignalMapper* signalMapper = new QSignalMapper(this);
connect( m_ahrs->multiPointHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_ahrs->multiPointHelp, m_ahrs->multiPointHelp->objectName());
connect( m_ahrs->sensorNoiseHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_ahrs->sensorNoiseHelp, m_ahrs->sensorNoiseHelp->objectName());
connect( m_ahrs->accelBiasHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_ahrs->accelBiasHelp, m_ahrs->accelBiasHelp->objectName());
connect( m_ahrs->gyroDriftHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_ahrs->gyroDriftHelp, m_ahrs->gyroDriftHelp->objectName());
connect( m_ahrs->commandHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_ahrs->commandHelp, QString("commandHelp"));
connect( m_ahrs->insAlgorithmHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_ahrs->insAlgorithmHelp, m_ahrs->insAlgorithmHelp->objectName());
connect( m_ahrs->homeLocationHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_ahrs->homeLocationHelp, m_ahrs->homeLocationHelp->objectName());
connect(signalMapper, SIGNAL(mapped(const QString &)), parent, SLOT(showHelp(const QString &)));
}

View File

@ -34,6 +34,7 @@
#include <QtGui/QVBoxLayout>
#include <QtGui/QPushButton>
#include <math.h>
#include <QSignalMapper>
/**
Helper delegate for the custom mixer editor table.
@ -192,6 +193,32 @@ ConfigAirframeWidget::ConfigAirframeWidget(QWidget *parent) : ConfigTaskWidget(p
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestAircraftUpdate()));
// Connect all the help buttons to signal mapper that passes button name to SLOT function
QSignalMapper* signalMapper = new QSignalMapper(this);
connect( m_aircraft->acftTypeHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_aircraft->acftTypeHelp, m_aircraft->acftTypeHelp->objectName());
connect( m_aircraft->airplaneTypeHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_aircraft->airplaneTypeHelp, m_aircraft->airplaneTypeHelp->objectName());
connect( m_aircraft->channelAssignmentHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_aircraft->channelAssignmentHelp, m_aircraft->channelAssignmentHelp->objectName());
connect( m_aircraft->commandHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_aircraft->commandHelp, QString("commandHelp"));
connect( m_aircraft->throttleCurveHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_aircraft->throttleCurveHelp, QString("throttleCurveHelp"));
connect( m_aircraft->multiFrameTypeHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_aircraft->multiFrameTypeHelp, m_aircraft->multiFrameTypeHelp->objectName());
connect( m_aircraft->throttleCurveHelp_2, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_aircraft->throttleCurveHelp_2, QString("throttleCurveHelp"));
connect( m_aircraft->tricopterYawHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_aircraft->tricopterYawHelp, m_aircraft->tricopterYawHelp->objectName());
connect( m_aircraft->motorOutputChanHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_aircraft->motorOutputChanHelp, m_aircraft->motorOutputChanHelp->objectName());
connect( m_aircraft->feedForwardHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_aircraft->feedForwardHelp, m_aircraft->feedForwardHelp->objectName());
connect( m_aircraft->commandHelp_2, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_aircraft->commandHelp_2, QString("commandHelp"));
connect(signalMapper, SIGNAL(mapped(const QString &)), parent, SLOT(showHelp(const QString &)));
}
ConfigAirframeWidget::~ConfigAirframeWidget()

View File

@ -30,6 +30,7 @@
#include <QMutexLocker>
#include <QMessageBox>
#include <QDebug>
#include <QSignalMapper>
ConfigCCAttitudeWidget::ConfigCCAttitudeWidget(QWidget *parent) :
ConfigTaskWidget(parent),
@ -44,6 +45,19 @@ ConfigCCAttitudeWidget::ConfigCCAttitudeWidget(QWidget *parent) :
// Make it smart:
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(getCurrentAttitudeSettings()));
getCurrentAttitudeSettings(); // The 1st time this panel is instanciated, the autopilot is already connected.
// Connect all the help buttons to signal mapper that passes button name to SLOT function
QSignalMapper* signalMapper = new QSignalMapper(this);
connect( ui->attitudeRotationHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(ui->attitudeRotationHelp, ui->attitudeRotationHelp->objectName());
connect( ui->attitudeCalibHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(ui->attitudeCalibHelp, ui->attitudeCalibHelp->objectName());
connect( ui->zeroOnArmHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(ui->zeroOnArmHelp, ui->zeroOnArmHelp->objectName());
connect( ui->commandHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(ui->commandHelp, QString("commandHelp"));
connect(signalMapper, SIGNAL(mapped(const QString &)), parent, SLOT(showHelp(const QString &)));
}
ConfigCCAttitudeWidget::~ConfigCCAttitudeWidget()
@ -53,7 +67,6 @@ ConfigCCAttitudeWidget::~ConfigCCAttitudeWidget()
void ConfigCCAttitudeWidget::attitudeRawUpdated(UAVObject * obj) {
QMutexLocker locker(&startStop);
UAVDataObject * attitudeRaw = dynamic_cast<UAVDataObject*>(obj);
ui->zeroBiasProgress->setValue((float) updates / NUM_ACCEL_UPDATES * 100);
@ -63,7 +76,9 @@ void ConfigCCAttitudeWidget::attitudeRawUpdated(UAVObject * obj) {
x_accum.append(field->getDouble(0));
y_accum.append(field->getDouble(1));
z_accum.append(field->getDouble(2));
} else {
qDebug("update %d: %f, %f, %f\n",updates,field->getDouble(0),field->getDouble(1),field->getDouble(2));
} else if ( updates == NUM_ACCEL_UPDATES ) {
updates++;
timer.stop();
disconnect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(attitudeRawUpdated(UAVObject*)));
disconnect(&timer,SIGNAL(timeout()),this,SLOT(timeout()));
@ -79,15 +94,19 @@ void ConfigCCAttitudeWidget::attitudeRawUpdated(UAVObject * obj) {
field->setDouble(field->getDouble(0) + x_bias,0);
field->setDouble(field->getDouble(1) + y_bias,1);
field->setDouble(field->getDouble(2) + z_bias,2);
qDebug("New X bias: %f\n", field->getDouble(0)+x_bias);
qDebug("New Y bias: %f\n", field->getDouble(1)+y_bias);
qDebug("New Z bias: %f\n", field->getDouble(2)+z_bias);
settings->updated();
ui->status->setText("Calibration done.");
} else {
// Possible to get here if weird threading stuff happens. Just ignore updates.
qDebug("Unexpected accel update received.");
}
}
void ConfigCCAttitudeWidget::timeout() {
QMutexLocker locker(&startStop);
UAVObjectManager * objMngr = getObjectManager();
UAVDataObject * obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AttitudeRaw")));
disconnect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(attitudeRawUpdated(UAVObject*)));
disconnect(&timer,SIGNAL(timeout()),this,SLOT(timeout()));
@ -108,6 +127,11 @@ void ConfigCCAttitudeWidget::applyAttitudeSettings() {
field->setValue(ui->pitchBias->value(),1);
field->setValue(ui->yawBias->value(),2);
field = settings->getField("ZeroDuringArming");
// Handling of boolean values is done through enums on
// uavobjects...
field->setValue((ui->zeroGyroBiasOnArming->isChecked()) ? "TRUE": "FALSE");
settings->updated();
}
@ -118,6 +142,12 @@ void ConfigCCAttitudeWidget::getCurrentAttitudeSettings() {
ui->rollBias->setValue(field->getDouble(0));
ui->pitchBias->setValue(field->getDouble(1));
ui->yawBias->setValue(field->getDouble(2));
field = settings->getField("ZeroDuringArming");
// Handling of boolean values is done through enums on
// uavobjects...
bool enabled = (field->getValue().toString() == "FALSE") ? false : true;
ui->zeroGyroBiasOnArming->setChecked(enabled);
}
void ConfigCCAttitudeWidget::startAccelCalibration() {
@ -135,7 +165,7 @@ void ConfigCCAttitudeWidget::startAccelCalibration() {
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(attitudeRawUpdated(UAVObject*)));
// Set up timeout timer
timer.start(2000);
timer.start(10000);
connect(&timer,SIGNAL(timeout()),this,SLOT(timeout()));
// Speed up updates

View File

@ -64,7 +64,7 @@ private:
QList<double> x_accum, y_accum, z_accum;
static const int NUM_ACCEL_UPDATES = 10;
static const int NUM_ACCEL_UPDATES = 60;
static const float ACCEL_SCALE = 0.004f * 9.81f;
};

View File

@ -1,17 +1,18 @@
<RCC>
<qresource prefix="/configgadget">
<file>images/XBee.svg</file>
<file>images/Airframe.png</file>
<file>images/Servo.png</file>
<file>images/ahrs-calib.svg</file>
<file>images/AHRS-v1.3.png</file>
<file>images/paper-plane.svg</file>
<file>images/curve-bg.svg</file>
<file>images/quad-shapes.svg</file>
<file>images/ccpm_setup.svg</file>
<file>images/PipXtreme.png</file>
<file>images/gyroscope.svg</file>
<file>images/Transmitter.png</file>
<file>images/help.png</file>
</qresource>
</RCC>
<RCC>
<qresource prefix="/configgadget">
<file>images/help2.png</file>
<file>images/XBee.svg</file>
<file>images/Airframe.png</file>
<file>images/Servo.png</file>
<file>images/ahrs-calib.svg</file>
<file>images/AHRS-v1.3.png</file>
<file>images/paper-plane.svg</file>
<file>images/curve-bg.svg</file>
<file>images/quad-shapes.svg</file>
<file>images/ccpm_setup.svg</file>
<file>images/PipXtreme.png</file>
<file>images/gyroscope.svg</file>
<file>images/Transmitter.png</file>
<file>images/help.png</file>
</qresource>
</RCC>

View File

@ -95,6 +95,7 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
if (telMngr->isConnected())
onAutopilotConnect();
help = 0;
}
ConfigGadgetWidget::~ConfigGadgetWidget()
@ -139,3 +140,43 @@ void ConfigGadgetWidget::onAutopilotConnect() {
emit autopilotConnected();
}
void ConfigGadgetWidget::showHelp(const QString &helpName)
{
// Close any previous help windows still open
if(help != 0) {
help->close();
}
// Make help windows with given filename and resize to config gadget width
help = new QTextBrowser(this);
help->setSource(QUrl::fromLocalFile( QString(Utils::PathUtils().InsertDataPath("%%DATAPATH%%help/")) +
helpName + QString(".html") ));
QSize size = help->sizeHint();
size.setWidth(this->width());
help->resize(size);
// Now catch closing events, show the window and give it focus
help->installEventFilter(this);
help->show();
help->setFocus();
}
bool ConfigGadgetWidget::eventFilter(QObject *obj, QEvent *event)
{
// If help is open and we get a close event, close the help window
// Close events currently are any key press and the mouse leaving the help window
//printf("event type: %d\n",event->type());
if(help != 0) {
if (event->type() == QEvent::Leave || event->type() == QEvent::KeyPress) {
help->close();
help=0;
return true;
}
}
// standard event processing
return QObject::eventFilter(obj, event);
}

View File

@ -34,6 +34,9 @@
#include "objectpersistence.h"
#include <QtGui/QWidget>
#include <QList>
//#include <QtWebKit/QWebView>
#include <QTextBrowser>
#include "utils/pathutils.h"
#include "fancytabwidget.h"
@ -41,6 +44,7 @@
class ConfigGadgetWidget: public QWidget
{
Q_OBJECT
QTextBrowser* help;
public:
ConfigGadgetWidget(QWidget *parent = 0);
@ -48,6 +52,10 @@ public:
public slots:
void onAutopilotConnect();
void showHelp(const QString &helpName);
private slots:
bool eventFilter(QObject *obj, QEvent *event);
signals:
void autopilotConnected();

View File

@ -35,6 +35,7 @@
#include <QtGui/QTextEdit>
#include <QtGui/QVBoxLayout>
#include <QtGui/QPushButton>
#include <QSignalMapper>
ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
{
@ -199,6 +200,30 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
connect(tm, SIGNAL(disconnected()), this, SLOT(onTelemetryDisconnect()));
}
}
// Connect all the help buttons to signal mapper that passes button name to SLOT function
QSignalMapper* signalMapper = new QSignalMapper(this);
connect( m_config->receiverTypeHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->receiverTypeHelp, m_config->receiverTypeHelp->objectName());
connect( m_config->runCalibrationHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->runCalibrationHelp, m_config->runCalibrationHelp->objectName());
connect( m_config->commandHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->commandHelp, QString("commandHelp"));
connect( m_config->flightModeSwPosHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->flightModeSwPosHelp, m_config->flightModeSwPosHelp->objectName());
connect( m_config->stabilizationModePerAxis, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->stabilizationModePerAxis, m_config->stabilizationModePerAxis->objectName());
connect( m_config->commandHelp_2, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->commandHelp_2, QString("commandHelp"));
connect( m_config->armPositionHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->armPositionHelp, m_config->armPositionHelp->objectName());
connect( m_config->armingTimeoutHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->armingTimeoutHelp, m_config->armingTimeoutHelp->objectName());
connect( m_config->commandHelp_3, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->commandHelp_2, QString("commandHelp"));
connect(signalMapper, SIGNAL(mapped(const QString &)), parent, SLOT(showHelp(const QString &)));
}
ConfigInputWidget::~ConfigInputWidget()

View File

@ -36,6 +36,7 @@
#include <QtGui/QVBoxLayout>
#include <QtGui/QPushButton>
#include <QMessageBox>
#include <QSignalMapper>
ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent)
{
@ -94,29 +95,18 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
<< m_config->ch6Rev
<< m_config->ch7Rev;
links << m_config->ch0Link
<< m_config->ch1Link
<< m_config->ch2Link
<< m_config->ch3Link
<< m_config->ch4Link
<< m_config->ch5Link
<< m_config->ch6Link
<< m_config->ch7Link;
links << m_config->ch0Link
<< m_config->ch1Link
<< m_config->ch2Link
<< m_config->ch3Link
<< m_config->ch4Link
<< m_config->ch5Link
<< m_config->ch6Link
<< m_config->ch7Link;
UAVDataObject * obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
QList<UAVObjectField*> fieldList = obj->getFields();
foreach (UAVObjectField* field, fieldList) {
if (field->getUnits().contains("channel")) {
m_config->ch0Output->addItem(field->getName());
m_config->ch1Output->addItem(field->getName());
m_config->ch2Output->addItem(field->getName());
m_config->ch3Output->addItem(field->getName());
m_config->ch4Output->addItem(field->getName());
m_config->ch5Output->addItem(field->getName());
m_config->ch6Output->addItem(field->getName());
m_config->ch7Output->addItem(field->getName());
}
}
// Register for ActuatorSettings changes:
UAVDataObject * obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(requestRCOutputUpdate()));
for (int i = 0; i < 8; i++) {
@ -138,6 +128,9 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
connect(m_config->saveRCOutputToSD, SIGNAL(clicked()), this, SLOT(saveRCOutputObject()));
connect(m_config->saveRCOutputToRAM, SIGNAL(clicked()), this, SLOT(sendRCOutputUpdate()));
// Actually, this is not really needed since we are subscribing to the object updates already
// TODO: remove those buttons on all config gadget panels.
connect(m_config->getRCOutputCurrent, SIGNAL(clicked()), this, SLOT(requestRCOutputUpdate()));
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestRCOutputUpdate()));
@ -160,6 +153,21 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
connect(tm, SIGNAL(disconnected()), this, SLOT(onTelemetryDisconnect()));
}
}
// Connect all the help buttons to signal mapper that passes button name to SLOT function
QSignalMapper* signalMapper = new QSignalMapper(this);
connect( m_config->channelRateHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->channelRateHelp, m_config->channelRateHelp->objectName());
connect( m_config->channelValuesHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->channelValuesHelp, m_config->channelValuesHelp->objectName());
connect( m_config->spinningArmedlHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->spinningArmedlHelp, m_config->spinningArmedlHelp->objectName());
connect( m_config->testOutputsHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->testOutputsHelp, m_config->testOutputsHelp->objectName());
connect( m_config->commandHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_config->commandHelp, QString("commandHelp"));
connect(signalMapper, SIGNAL(mapped(const QString &)), parent, SLOT(showHelp(const QString &)));
}
ConfigOutputWidget::~ConfigOutputWidget()
@ -265,17 +273,34 @@ void ConfigOutputWidget::runChannelTests(bool state)
mdata.gcsTelemetryAcked = false;
mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
mdata.gcsTelemetryUpdatePeriod = 100;
// Prevent stupid users from touching the minimum & maximum ranges while
// moving the sliders. Thanks Ivan for the tip :)
foreach (QSpinBox* box, outMin) {
box->setEnabled(false);
}
foreach (QSpinBox* box, outMax) {
box->setEnabled(false);
}
}
else
{
mdata = accInitialData; // Restore metadata
foreach (QSpinBox* box, outMin) {
box->setEnabled(true);
}
foreach (QSpinBox* box, outMax) {
box->setEnabled(true);
}
}
obj->setMetadata(mdata);
}
/**
* Set the dropdown option for a channel output assignement
* Set the label for a channel output assignement
*/
void ConfigOutputWidget::assignOutputChannel(UAVDataObject *obj, QString str)
{
@ -283,28 +308,28 @@ void ConfigOutputWidget::assignOutputChannel(UAVDataObject *obj, QString str)
QStringList options = field->getOptions();
switch (options.indexOf(field->getValue().toString())) {
case 0:
m_config->ch0Output->setCurrentIndex(m_config->ch0Output->findText(str));
m_config->ch0Output->setText(str);
break;
case 1:
m_config->ch1Output->setCurrentIndex(m_config->ch1Output->findText(str));
m_config->ch1Output->setText(str);
break;
case 2:
m_config->ch2Output->setCurrentIndex(m_config->ch2Output->findText(str));
m_config->ch2Output->setText(str);
break;
case 3:
m_config->ch3Output->setCurrentIndex(m_config->ch3Output->findText(str));
m_config->ch3Output->setText(str);
break;
case 4:
m_config->ch4Output->setCurrentIndex(m_config->ch4Output->findText(str));
m_config->ch4Output->setText(str);
break;
case 5:
m_config->ch5Output->setCurrentIndex(m_config->ch5Output->findText(str));
m_config->ch5Output->setText(str);
break;
case 6:
m_config->ch6Output->setCurrentIndex(m_config->ch6Output->findText(str));
m_config->ch6Output->setText(str);
break;
case 7:
m_config->ch7Output->setCurrentIndex(m_config->ch7Output->findText(str));
m_config->ch7Output->setText(str);
break;
}
}
@ -388,19 +413,18 @@ void ConfigOutputWidget::requestRCOutputUpdate()
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
// Reset all channel assignements:
m_config->ch0Output->setCurrentIndex(0);
m_config->ch1Output->setCurrentIndex(0);
m_config->ch2Output->setCurrentIndex(0);
m_config->ch3Output->setCurrentIndex(0);
m_config->ch4Output->setCurrentIndex(0);
m_config->ch5Output->setCurrentIndex(0);
m_config->ch6Output->setCurrentIndex(0);
m_config->ch7Output->setCurrentIndex(0);
m_config->ch0Output->setText("-");
m_config->ch1Output->setText("-");
m_config->ch2Output->setText("-");
m_config->ch3Output->setText("-");
m_config->ch4Output->setText("-");
m_config->ch5Output->setText("-");
m_config->ch6Output->setText("-");
m_config->ch7Output->setText("-");
// Get the channel assignements:
UAVDataObject * obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
Q_ASSERT(obj);
obj->requestUpdate();
QList<UAVObjectField*> fieldList = obj->getFields();
foreach (UAVObjectField* field, fieldList) {
if (field->getUnits().contains("channel")) {
@ -508,57 +532,9 @@ void ConfigOutputWidget::sendRCOutputUpdate()
field->setValue(m_config->outputRate3->value(),2);
field->setValue(m_config->outputRate4->value(),3);
// Set Actuator assignement for each channel:
// Rule: if two channels have the same setting (which is wrong!) the higher channel
// will get the setting.
// First, reset all channel assignements:
QList<UAVObjectField*> fieldList = obj->getFields();
foreach (UAVObjectField* field, fieldList) {
// NOTE: we assume that all options in ActuatorSettings are a channel assignement
// except for the options called "ChannelXXX"
if (field->getUnits().contains("channel")) {
field->setValue(field->getOptions().last());
}
}
if (m_config->ch0Output->currentIndex() != 0) {
field = obj->getField(m_config->ch0Output->currentText());
field->setValue(field->getOptions().at(0)); // -> This way we don't depend on channel naming convention
}
if (m_config->ch1Output->currentIndex() != 0) {
field = obj->getField(m_config->ch1Output->currentText());
field->setValue(field->getOptions().at(1)); // -> This way we don't depend on channel naming convention
}
if (m_config->ch2Output->currentIndex() != 0) {
field = obj->getField(m_config->ch2Output->currentText());
field->setValue(field->getOptions().at(2)); // -> This way we don't depend on channel naming convention
}
if (m_config->ch3Output->currentIndex() != 0) {
field = obj->getField(m_config->ch3Output->currentText());
field->setValue(field->getOptions().at(3)); // -> This way we don't depend on channel naming convention
}
if (m_config->ch4Output->currentIndex() != 0) {
field = obj->getField(m_config->ch4Output->currentText());
field->setValue(field->getOptions().at(4)); // -> This way we don't depend on channel naming convention
}
if (m_config->ch5Output->currentIndex() != 0) {
field = obj->getField(m_config->ch5Output->currentText());
field->setValue(field->getOptions().at(5)); // -> This way we don't depend on channel naming convention
}
if (m_config->ch6Output->currentIndex() != 0) {
field = obj->getField(m_config->ch6Output->currentText());
field->setValue(field->getOptions().at(6)); // -> This way we don't depend on channel naming convention
}
if (m_config->ch7Output->currentIndex() != 0) {
field = obj->getField(m_config->ch7Output->currentText());
field->setValue(field->getOptions().at(7)); // -> This way we don't depend on channel naming convention
}
// ... and send to the OP Board
obj->updated();
}

View File

@ -32,7 +32,7 @@
#include <QtGui/QTextEdit>
#include <QtGui/QVBoxLayout>
#include <QtGui/QPushButton>
#include <QSignalMapper>
ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTaskWidget(parent)
@ -43,7 +43,7 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
m_stabilization->setupUi(this);
// Now connect the widget to the ManualControlCommand / Channel UAVObject
UAVObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("StabilizationSettings")));
//UAVObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("StabilizationSettings")));
requestStabilizationUpdate();
connect(m_stabilization->saveStabilizationToSD, SIGNAL(clicked()), this, SLOT(saveStabilizationUpdate()));
@ -74,6 +74,20 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
connect(m_stabilization->pitchKi, SIGNAL(valueChanged(double)), this, SLOT(updatePitchKI(double)));
connect(m_stabilization->pitchILimit, SIGNAL(valueChanged(double)), this, SLOT(updatePitchILimit(double)));
// Connect all the help buttons to signal mapper that passes button name to SLOT function
QSignalMapper* signalMapper = new QSignalMapper(this);
connect( m_stabilization->rateStabiHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_stabilization->rateStabiHelp, m_stabilization->rateStabiHelp->objectName());
connect( m_stabilization->attitudeStabiHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_stabilization->attitudeStabiHelp, m_stabilization->attitudeStabiHelp->objectName());
connect( m_stabilization->angleLimitsHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_stabilization->angleLimitsHelp, m_stabilization->angleLimitsHelp->objectName());
connect( m_stabilization->updateRealTimeHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_stabilization->updateRealTimeHelp, m_stabilization->updateRealTimeHelp->objectName());
connect( m_stabilization->commandHelp, SIGNAL(clicked()), signalMapper, SLOT(map()) );
signalMapper->setMapping(m_stabilization->commandHelp, m_stabilization->commandHelp->objectName());
connect(signalMapper, SIGNAL(mapped(const QString &)), parent, SLOT(showHelp(const QString &)));
}
ConfigStabilizationWidget::~ConfigStabilizationWidget()
@ -275,3 +289,4 @@ void ConfigStabilizationWidget::realtimeUpdateToggle(bool state)
else
updateTimer.stop();
}

View File

@ -50,7 +50,6 @@ private:
StabilizationSettings* stabSettings;
QTimer updateTimer;
private slots:
void requestStabilizationUpdate();
void sendStabilizationUpdate();
@ -72,8 +71,6 @@ private slots:
void updatePitchKP(double);
void updatePitchKI(double);
void updatePitchILimit(double);
};
#endif // ConfigStabilizationWidget_H

Some files were not shown because too many files have changed in this diff Show More