diff --git a/Makefile b/Makefile index 3c0cb974f..f0e7e9720 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # # Top level Makefile for the OpenPilot project build system. # Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org +# Use 'make help' for instructions. # # 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 @@ -93,39 +94,11 @@ endif # the tools.mk to ensure that we download/install the right tools. UNAME := $(shell uname) ARCH := $(shell uname -m) -# Here and everywhere if not Linux or OSX then assume Windows +# Here and everywhere if not Linux or Mac then assume Windows ifeq ($(filter Linux Darwin, $(UNAME)), ) UNAME := Windows endif -# Set up misc host tools -export ECHO := echo -export MKDIR := mkdir -export CP := cp -export RM := rm -export LN := ln -export CAT := cat -export SED := sed -export TAR := tar -export ANT := ant -export JAVAC := javac -export JAR := jar -export GIT := git -export CURL := curl -export PYTHON := python -export INSTALL := install - -# Command to extract version info data from the repository and source tree -export VERSION_INFO := $(PYTHON) "$(ROOT_DIR)/make/scripts/version-info.py" --path="$(ROOT_DIR)" - -# Test if quotes are needed for the echo-command -ifeq (${shell $(ECHO) "test"}, test) - export QUOTE := ' -# This line is just to clear out the single quote above ' -else - export QUOTE := -endif - # Include tools installers include $(ROOT_DIR)/make/tools.mk @@ -136,7 +109,7 @@ ifeq ($(UNAME), Linux) else ifeq ($(UNAME), Darwin) QT_SPEC = macx-g++ UAVOBJGENERATOR = "$(BUILD_DIR)/uavobjgenerator/uavobjgenerator" -else +else ifeq ($(UNAME), Windows) QT_SPEC = win32-g++ UAVOBJGENERATOR = "$(BUILD_DIR)/uavobjgenerator/$(UAVOGEN_BUILD_CONF)/uavobjgenerator.exe" endif @@ -294,6 +267,7 @@ $(1): fw_$(1)_opfw fw_$(1): fw_$(1)_opfw fw_$(1)_%: uavobjects_flight + $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE) $(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep $(V1) cd $(ROOT_DIR)/flight/targets/$(2) && \ $$(MAKE) -r --no-print-directory \ @@ -321,6 +295,7 @@ bl_$(1): bl_$(1)_bin bl_$(1)_bino: bl_$(1)_bin bl_$(1)_%: + $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE) $(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep $(V1) cd $(ROOT_DIR)/flight/targets/Bootloaders/$(2) && \ $$(MAKE) -r --no-print-directory \ @@ -846,8 +821,10 @@ help: @$(ECHO) " Here is a summary of the available targets:" @$(ECHO) @$(ECHO) " [Tool Installers]" - @$(ECHO) " qt_sdk_install - Install the QT development tools" @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain" + @$(ECHO) " qt_sdk_install - Install the QT development tools" + @$(ECHO) " mingw_install - Install the MinGW toolchain (Windows only)" + @$(ECHO) " python_install - Install the Python interpreter (Windows only)" @$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon" @$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards" @$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards" diff --git a/artwork/3D Model/boards/OPGPS/OPGPS.3DS b/artwork/3D Model/boards/OPGPS/OPGPS.3DS new file mode 100644 index 000000000..c6bbed975 Binary files /dev/null and b/artwork/3D Model/boards/OPGPS/OPGPS.3DS differ diff --git a/artwork/3D Model/boards/OPGPS/OPGPS.jpg b/artwork/3D Model/boards/OPGPS/OPGPS.jpg new file mode 100644 index 000000000..319696a04 Binary files /dev/null and b/artwork/3D Model/boards/OPGPS/OPGPS.jpg differ diff --git a/artwork/3D Model/boards/OPGPS/TEXTURE.PNG b/artwork/3D Model/boards/OPGPS/TEXTURE.PNG new file mode 100644 index 000000000..23f8c3b14 Binary files /dev/null and b/artwork/3D Model/boards/OPGPS/TEXTURE.PNG differ diff --git a/artwork/3D Model/boards/OPLink/OPLink.3DS b/artwork/3D Model/boards/OPLink/OPLink.3DS new file mode 100644 index 000000000..cfe56f1c4 Binary files /dev/null and b/artwork/3D Model/boards/OPLink/OPLink.3DS differ diff --git a/artwork/3D Model/boards/OPLink/OPLink.jpg b/artwork/3D Model/boards/OPLink/OPLink.jpg new file mode 100644 index 000000000..e5b1aac6d Binary files /dev/null and b/artwork/3D Model/boards/OPLink/OPLink.jpg differ diff --git a/artwork/3D Model/boards/OPLink/TEXTURE.PNG b/artwork/3D Model/boards/OPLink/TEXTURE.PNG new file mode 100644 index 000000000..ee659614d Binary files /dev/null and b/artwork/3D Model/boards/OPLink/TEXTURE.PNG differ diff --git a/artwork/3D Model/boards/Revolution/Revolution.3DS b/artwork/3D Model/boards/Revolution/Revolution.3DS new file mode 100644 index 000000000..58cfe8d6d Binary files /dev/null and b/artwork/3D Model/boards/Revolution/Revolution.3DS differ diff --git a/artwork/3D Model/boards/Revolution/Revolution.jpg b/artwork/3D Model/boards/Revolution/Revolution.jpg new file mode 100644 index 000000000..8d55053b0 Binary files /dev/null and b/artwork/3D Model/boards/Revolution/Revolution.jpg differ diff --git a/artwork/3D Model/boards/Revolution/TEXTURE.PNG b/artwork/3D Model/boards/Revolution/TEXTURE.PNG new file mode 100644 index 000000000..cfc4d7f6a Binary files /dev/null and b/artwork/3D Model/boards/Revolution/TEXTURE.PNG differ diff --git a/artwork/3D Model/multi/joes_cnc/CC.PNG b/artwork/3D Model/multi/joes_cnc/CC.PNG deleted file mode 100644 index 467f34a97..000000000 Binary files a/artwork/3D Model/multi/joes_cnc/CC.PNG and /dev/null differ diff --git a/artwork/3D Model/multi/joes_cnc/J14-QT_+.3DS b/artwork/3D Model/multi/joes_cnc/J14-QT_+.3DS index 1879b07c6..9d0d2de8c 100644 Binary files a/artwork/3D Model/multi/joes_cnc/J14-QT_+.3DS and b/artwork/3D Model/multi/joes_cnc/J14-QT_+.3DS differ diff --git a/artwork/3D Model/multi/joes_cnc/J14-QT_X.3DS b/artwork/3D Model/multi/joes_cnc/J14-QT_X.3DS index f26dacb45..a29de2543 100644 Binary files a/artwork/3D Model/multi/joes_cnc/J14-QT_X.3DS and b/artwork/3D Model/multi/joes_cnc/J14-QT_X.3DS differ diff --git a/artwork/3D Model/multi/joes_cnc/J14-Q_+.3DS b/artwork/3D Model/multi/joes_cnc/J14-Q_+.3DS index 21fbccf01..d4bb3dfbf 100644 Binary files a/artwork/3D Model/multi/joes_cnc/J14-Q_+.3DS and b/artwork/3D Model/multi/joes_cnc/J14-Q_+.3DS differ diff --git a/artwork/3D Model/multi/joes_cnc/J14-Q_X.3DS b/artwork/3D Model/multi/joes_cnc/J14-Q_X.3DS index 529e60fac..cb0f3e995 100644 Binary files a/artwork/3D Model/multi/joes_cnc/J14-Q_X.3DS and b/artwork/3D Model/multi/joes_cnc/J14-Q_X.3DS differ diff --git a/artwork/3D Model/multi/joes_cnc/TEXTURE.JPG b/artwork/3D Model/multi/joes_cnc/TEXTURE.JPG new file mode 100644 index 000000000..9e5500340 Binary files /dev/null and b/artwork/3D Model/multi/joes_cnc/TEXTURE.JPG differ diff --git a/artwork/3D Model/multi/joes_cnc/TEXTURE.PNG b/artwork/3D Model/multi/joes_cnc/TEXTURE.PNG deleted file mode 100644 index 5d26bb120..000000000 Binary files a/artwork/3D Model/multi/joes_cnc/TEXTURE.PNG and /dev/null differ diff --git a/artwork/PFD/pfd.svg b/artwork/PFD/pfd.svg index 6313bf1df..abdc4f8c5 100755 --- a/artwork/PFD/pfd.svg +++ b/artwork/PFD/pfd.svg @@ -14,12 +14,12 @@ height="707.56323" id="svg2" version="1.1" - inkscape:version="0.48.1 " - sodipodi:docname="pfd.svg" + inkscape:version="0.48.3.1 r9886" + sodipodi:docname="pfd-11.svg" style="display:inline" - inkscape:export-filename="H:\Documents\Hobbies\OpenPilot\SVN\artwork\PFD-2.png" - inkscape:export-xdpi="269.53" - inkscape:export-ydpi="269.53"> + inkscape:export-filename="C:\Users\Nuno\Desktop\OpenPilot\PFD\PFD-4.png" + inkscape:export-xdpi="71.993568" + inkscape:export-ydpi="71.993568"> + + + + + + + + @@ -1696,7 +1728,7 @@ + transform="matrix(4.6362185,0,0,1.9084264,-1475.4746,-363.49767)" + id="world-bg" + inkscape:label="#g4280"> + id="ground" + style="fill:url(#linearGradient5597);fill-opacity:1;stroke:none" + inkscape:label="#rect3724" /> + rx="2.7755576e-017" + inkscape:label="#rect2942" /> - 10 - 10 - - - - - 20 - 20 - - - - - -10 - -10 - - - - - - - - - - - - - - - - - - - -20 - -20 - - + style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:label="#path3808" /> + + + 10 + + + 10 + + + 20 + + + 20 + + + -10 + + + -10 + + + -20 + + + -20 + + + + + + + + + + + + + + + transform="translate(230.4171,-2.5493479)" + sodipodi:insensitive="true"> @@ -2102,8 +2051,8 @@ @@ -2278,13 +2227,370 @@ x1="460.75775" style="fill:none;stroke:#ffffff;stroke-width:2.61937094;display:inline" /> + SPD + + ALT + m/s + m + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + 1 + 2 + 1 + + + + ft/s + VSI + + + + + - diff --git a/flight/targets/PipXtreme/System/alarms.c b/flight/Libraries/alarms.c old mode 100755 new mode 100644 similarity index 59% rename from flight/targets/PipXtreme/System/alarms.c rename to flight/Libraries/alarms.c index a55cbd158..78238a3bf --- a/flight/targets/PipXtreme/System/alarms.c +++ b/flight/Libraries/alarms.c @@ -28,7 +28,7 @@ */ #include "openpilot.h" -#include "alarms.h" +#include "inc/alarms.h" // Private constants @@ -46,12 +46,12 @@ static int32_t hasSeverity(SystemAlarmsAlarmOptions severity); int32_t AlarmsInitialize(void) { SystemAlarmsInitialize(); - - lock = xSemaphoreCreateRecursiveMutex(); - //do not change the default states of the alarms, let the init code generated by the uavobjectgenerator handle that - //AlarmsClearAll(); - //AlarmsDefaultAll(); - return 0; + + lock = xSemaphoreCreateRecursiveMutex(); + //do not change the default states of the alarms, let the init code generated by the uavobjectgenerator handle that + //AlarmsClearAll(); + //AlarmsDefaultAll(); + return 0; } /** @@ -62,23 +62,21 @@ int32_t AlarmsInitialize(void) */ int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity) { - SystemAlarmsData alarms; + SystemAlarmsData alarms; - // Check that this is a valid alarm - if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) - { - return -1; - } + // Check that this is a valid alarm + if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) { + return -1; + } - // Lock + // Lock xSemaphoreTakeRecursive(lock, portMAX_DELAY); // Read alarm and update its severity only if it was changed SystemAlarmsGet(&alarms); - if ( alarms.Alarm[alarm] != severity ) - { - alarms.Alarm[alarm] = severity; - SystemAlarmsSet(&alarms); + if (alarms.Alarm[alarm] != severity) { + alarms.Alarm[alarm] = severity; + SystemAlarmsSet(&alarms); } // Release lock @@ -87,6 +85,43 @@ int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity } +/** + * Set an Extended Alarm + * @param alarm The system alarm to be modified + * @param severity The alarm severity + * @param status The Extended alarm status field + * @param subStatus The Extended alarm substatus field + * @return 0 if success, -1 if an error + */ +int32_t ExtendedAlarmsSet(SystemAlarmsAlarmElem alarm, + SystemAlarmsAlarmOptions severity, + SystemAlarmsExtendedAlarmStatusOptions status, + uint8_t subStatus) +{ + SystemAlarmsData alarms; + + // Check that this is a valid alarm + if (alarm >= SYSTEMALARMS_EXTENDEDALARMSTATUS_NUMELEM) { + return -1; + } + + // Lock + xSemaphoreTakeRecursive(lock, portMAX_DELAY); + + // Read alarm and update its severity only if it was changed + SystemAlarmsGet(&alarms); + if (alarms.Alarm[alarm] != severity) { + alarms.ExtendedAlarmStatus[alarm] = status; + alarms.ExtendedAlarmSubStatus[alarm] = subStatus; + alarms.Alarm[alarm] = severity; + SystemAlarmsSet(&alarms); + } + + // Release lock + xSemaphoreGiveRecursive(lock); + return 0; +} + /** * Get an alarm * @param alarm The system alarm to be read @@ -94,13 +129,12 @@ int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity */ SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm) { - SystemAlarmsData alarms; + SystemAlarmsData alarms; - // Check that this is a valid alarm - if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) - { - return 0; - } + // Check that this is a valid alarm + if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) { + return 0; + } // Read alarm SystemAlarmsGet(&alarms); @@ -114,7 +148,7 @@ SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm) */ int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm) { - return AlarmsSet(alarm, SYSTEMALARMS_ALARM_DEFAULT); + return AlarmsSet(alarm, SYSTEMALARMS_ALARM_DEFAULT); } /** @@ -122,10 +156,8 @@ int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm) */ void AlarmsDefaultAll() { - uint32_t n; - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - AlarmsDefault(n); + for (uint32_t n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) { + AlarmsDefault(n); } } @@ -136,7 +168,11 @@ void AlarmsDefaultAll() */ int32_t AlarmsClear(SystemAlarmsAlarmElem alarm) { - return AlarmsSet(alarm, SYSTEMALARMS_ALARM_OK); + if (alarm < SYSTEMALARMS_EXTENDEDALARMSTATUS_NUMELEM) { + return ExtendedAlarmsSet(alarm, SYSTEMALARMS_ALARM_OK, SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE, 0); + } else { + return AlarmsSet(alarm, SYSTEMALARMS_ALARM_OK); + } } /** @@ -144,10 +180,8 @@ int32_t AlarmsClear(SystemAlarmsAlarmElem alarm) */ void AlarmsClearAll() { - uint32_t n; - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - AlarmsClear(n); + for (uint32_t n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) { + AlarmsClear(n); } } @@ -157,7 +191,7 @@ void AlarmsClearAll() */ int32_t AlarmsHasWarnings() { - return hasSeverity(SYSTEMALARMS_ALARM_WARNING); + return hasSeverity(SYSTEMALARMS_ALARM_WARNING); } /** @@ -166,8 +200,9 @@ int32_t AlarmsHasWarnings() */ int32_t AlarmsHasErrors() { - return hasSeverity(SYSTEMALARMS_ALARM_ERROR); -}; + return hasSeverity(SYSTEMALARMS_ALARM_ERROR); +} + /** * Check if there are any alarms with critical or higher severity @@ -175,8 +210,9 @@ int32_t AlarmsHasErrors() */ int32_t AlarmsHasCritical() { - return hasSeverity(SYSTEMALARMS_ALARM_CRITICAL); -}; + return hasSeverity(SYSTEMALARMS_ALARM_CRITICAL); +} + /** * Check if there are any alarms with the given or higher severity @@ -184,31 +220,28 @@ int32_t AlarmsHasCritical() */ static int32_t hasSeverity(SystemAlarmsAlarmOptions severity) { - SystemAlarmsData alarms; - uint32_t n; + SystemAlarmsData alarms; - // Lock + // Lock xSemaphoreTakeRecursive(lock, portMAX_DELAY); // Read alarms SystemAlarmsGet(&alarms); // Go through alarms and check if any are of the given severity or higher - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - if ( alarms.Alarm[n] >= severity) - { - xSemaphoreGiveRecursive(lock); - return 1; - } + for (uint32_t n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) { + if (alarms.Alarm[n] >= severity) { + xSemaphoreGiveRecursive(lock); + return 1; + } } // If this point is reached then no alarms found xSemaphoreGiveRecursive(lock); return 0; } + /** * @} * @} */ - diff --git a/flight/targets/OSD/System/inc/alarms.h b/flight/Libraries/inc/alarms.h similarity index 91% rename from flight/targets/OSD/System/inc/alarms.h rename to flight/Libraries/inc/alarms.h index 0f0faeb8f..e91a3be55 100644 --- a/flight/targets/OSD/System/inc/alarms.h +++ b/flight/Libraries/inc/alarms.h @@ -33,6 +33,10 @@ int32_t AlarmsInitialize(void); int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity); +int32_t ExtendedAlarmsSet(SystemAlarmsAlarmElem alarm, + SystemAlarmsAlarmOptions severity, + SystemAlarmsExtendedAlarmStatusOptions status, + uint8_t subStatus); SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm); int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm); void AlarmsDefaultAll(); diff --git a/flight/Libraries/inc/sanitycheck.h b/flight/Libraries/inc/sanitycheck.h index 2f201da22..214b50cfc 100644 --- a/flight/Libraries/inc/sanitycheck.h +++ b/flight/Libraries/inc/sanitycheck.h @@ -26,9 +26,22 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #ifndef SANITYCHECK_H #define SANITYCHECK_H +#define SANITYCHECK_STATUS_ERROR_NONE SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE +#define SANITYCHECK_STATUS_ERROR_FLIGHTMODE SYSTEMALARMS_EXTENDEDALARMSTATUS_FLIGHTMODE + +#define BOOTFAULT_STATUS_ERROR_NONE SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE +#define BOOTFAULT_STATUS_ERROR_REQUIRE_REBOOT SYSTEMALARMS_EXTENDEDALARMSTATUS_REBOOTREQUIRED + +#if (SYSTEMALARMS_EXTENDEDALARMSTATUS_NUMELEM != SYSTEMALARMS_EXTENDEDALARMSUBSTATUS_NUMELEM) || \ + (SYSTEMALARMS_EXTENDEDALARMSUBSTATUS_NUMELEM > SYSTEMALARMS_ALARM_NUMELEM) +#error Incongruent SystemAlarms. Please revise the UAVO definition in systemalarms.xml +#endif + extern int32_t configuration_check(); -#endif /* SANITYCHECK_H */ \ No newline at end of file +#endif /* SANITYCHECK_H */ diff --git a/flight/Libraries/sanitycheck.c b/flight/Libraries/sanitycheck.c index ab5cab3bf..75c1fd6b2 100644 --- a/flight/Libraries/sanitycheck.c +++ b/flight/Libraries/sanitycheck.c @@ -26,13 +26,16 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "openpilot.h" -#include "taskmonitor.h" +#include #include -#include "sanitycheck.h" -#include "manualcontrolsettings.h" -#include "systemalarms.h" -#include "systemsettings.h" + +// Private includes +#include "inc/taskmonitor.h" +#include "inc/sanitycheck.h" + +// UAVOs +#include +#include /**************************** * Current checks: @@ -49,98 +52,101 @@ static int32_t check_stabilization_settings(int index, bool multirotor); */ int32_t configuration_check() { - int32_t status = SYSTEMALARMS_ALARM_OK; + int32_t severity = SYSTEMALARMS_ALARM_OK; + SystemAlarmsExtendedAlarmStatusOptions alarmstatus = SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE; + uint8_t alarmsubstatus = 0; + // Get board type + const struct pios_board_info * bdinfo = &pios_board_info_blob; + bool coptercontrol = bdinfo->board_type == 0x04; - // Get board type - const struct pios_board_info * bdinfo = &pios_board_info_blob; - bool coptercontrol = bdinfo->board_type == 0x04; + // Classify airframe type + bool multirotor = true; + uint8_t airframe_type; + SystemSettingsAirframeTypeGet(&airframe_type); + switch(airframe_type) { + case SYSTEMSETTINGS_AIRFRAMETYPE_QUADX: + case SYSTEMSETTINGS_AIRFRAMETYPE_QUADP: + case SYSTEMSETTINGS_AIRFRAMETYPE_HEXA: + case SYSTEMSETTINGS_AIRFRAMETYPE_OCTO: + case SYSTEMSETTINGS_AIRFRAMETYPE_HEXAX: + case SYSTEMSETTINGS_AIRFRAMETYPE_OCTOV: + case SYSTEMSETTINGS_AIRFRAMETYPE_OCTOCOAXP: + case SYSTEMSETTINGS_AIRFRAMETYPE_HEXACOAX: + case SYSTEMSETTINGS_AIRFRAMETYPE_TRI: + multirotor = true; + break; + default: + multirotor = false; + } - // Classify airframe type - bool multirotor = true; - uint8_t airframe_type; - SystemSettingsAirframeTypeGet(&airframe_type); - switch(airframe_type) { - case SYSTEMSETTINGS_AIRFRAMETYPE_QUADX: - case SYSTEMSETTINGS_AIRFRAMETYPE_QUADP: - case SYSTEMSETTINGS_AIRFRAMETYPE_HEXA: - case SYSTEMSETTINGS_AIRFRAMETYPE_OCTO: - case SYSTEMSETTINGS_AIRFRAMETYPE_HEXAX: - case SYSTEMSETTINGS_AIRFRAMETYPE_OCTOV: - case SYSTEMSETTINGS_AIRFRAMETYPE_OCTOCOAXP: - case SYSTEMSETTINGS_AIRFRAMETYPE_HEXACOAX: - case SYSTEMSETTINGS_AIRFRAMETYPE_TRI: - multirotor = true; - break; - default: - multirotor = false; - } + // For each available flight mode position sanity check the available + // modes + uint8_t num_modes; + uint8_t modes[MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_NUMELEM]; + ManualControlSettingsFlightModeNumberGet(&num_modes); + ManualControlSettingsFlightModePositionGet(modes); - // For each available flight mode position sanity check the available - // modes - uint8_t num_modes; - uint8_t modes[MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_NUMELEM]; - ManualControlSettingsFlightModeNumberGet(&num_modes); - ManualControlSettingsFlightModePositionGet(modes); + for(uint32_t i = 0; i < num_modes; i++) { + switch(modes[i]) { + case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_MANUAL: + if (multirotor) { + severity = SYSTEMALARMS_ALARM_ERROR; + } + break; + case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_STABILIZED1: + severity = (severity == SYSTEMALARMS_ALARM_OK) ? check_stabilization_settings(1, multirotor) : severity; + break; + case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_STABILIZED2: + severity = (severity == SYSTEMALARMS_ALARM_OK) ? check_stabilization_settings(2, multirotor) : severity; + break; + case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_STABILIZED3: + severity = (severity == SYSTEMALARMS_ALARM_OK) ? check_stabilization_settings(3, multirotor) : severity; + break; + case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_AUTOTUNE: + if (!TaskMonitorQueryRunning(TASKINFO_RUNNING_AUTOTUNE)) { + severity = SYSTEMALARMS_ALARM_ERROR; + } + break; + case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_ALTITUDEHOLD: + if (coptercontrol) { + severity = SYSTEMALARMS_ALARM_ERROR; + } else if (!TaskMonitorQueryRunning(TASKINFO_RUNNING_ALTITUDEHOLD)) { // Revo supports altitude hold + severity = SYSTEMALARMS_ALARM_ERROR; + } + break; + case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_VELOCITYCONTROL: + if (coptercontrol) { + severity = SYSTEMALARMS_ALARM_ERROR; + } else if (!TaskMonitorQueryRunning(TASKINFO_RUNNING_PATHFOLLOWER)) { // Revo supports altitude hold + severity = SYSTEMALARMS_ALARM_ERROR; + } + break; + case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_POSITIONHOLD: + if (coptercontrol){ + severity = SYSTEMALARMS_ALARM_ERROR; + } else if (!TaskMonitorQueryRunning(TASKINFO_RUNNING_PATHFOLLOWER)) { // Revo supports altitude hold + severity = SYSTEMALARMS_ALARM_ERROR; + } + break; + default: + // Uncovered modes are automatically an error + severity = SYSTEMALARMS_ALARM_ERROR; + } + // mark the first encountered erroneous setting in status and substatus + if ((severity != SYSTEMALARMS_ALARM_OK) && (alarmstatus == SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE)) { + alarmstatus = SYSTEMALARMS_EXTENDEDALARMSTATUS_FLIGHTMODE; + alarmsubstatus = i; + } - for(uint32_t i = 0; i < num_modes; i++) { - switch(modes[i]) { - case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_MANUAL: - if (multirotor) - status = SYSTEMALARMS_ALARM_ERROR; - break; - case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_STABILIZED1: - status = (status == SYSTEMALARMS_ALARM_OK) ? check_stabilization_settings(1, multirotor) : status; - break; - case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_STABILIZED2: - status = (status == SYSTEMALARMS_ALARM_OK) ? check_stabilization_settings(2, multirotor) : status; - break; - case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_STABILIZED3: - status = (status == SYSTEMALARMS_ALARM_OK) ? check_stabilization_settings(3, multirotor) : status; - break; - case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_AUTOTUNE: - if (!TaskMonitorQueryRunning(TASKINFO_RUNNING_AUTOTUNE)) - status = SYSTEMALARMS_ALARM_ERROR; - break; - case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_ALTITUDEHOLD: - if (coptercontrol) - status = SYSTEMALARMS_ALARM_ERROR; - else { - // Revo supports altitude hold - if (!TaskMonitorQueryRunning(TASKINFO_RUNNING_ALTITUDEHOLD)) - status = SYSTEMALARMS_ALARM_ERROR; - } - break; - case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_VELOCITYCONTROL: - if (coptercontrol) - status = SYSTEMALARMS_ALARM_ERROR; - else { - // Revo supports altitude hold - if (!TaskMonitorQueryRunning(TASKINFO_RUNNING_PATHFOLLOWER)) - status = SYSTEMALARMS_ALARM_ERROR; - } - break; - case MANUALCONTROLSETTINGS_FLIGHTMODEPOSITION_POSITIONHOLD: - if (coptercontrol) - status = SYSTEMALARMS_ALARM_ERROR; - else { - // Revo supports altitude hold - if (!TaskMonitorQueryRunning(TASKINFO_RUNNING_PATHFOLLOWER)) - status = SYSTEMALARMS_ALARM_ERROR; - } - break; - default: - // Uncovered modes are automatically an error - status = SYSTEMALARMS_ALARM_ERROR; - } - } + } - // TODO: Check on a multirotor no axis supports "None" - if(status != SYSTEMALARMS_ALARM_OK) - AlarmsSet(SYSTEMALARMS_ALARM_SYSTEMCONFIGURATION, status); - else - AlarmsClear(SYSTEMALARMS_ALARM_SYSTEMCONFIGURATION); + // TODO: Check on a multirotor no axis supports "None" + if(severity != SYSTEMALARMS_ALARM_OK) + ExtendedAlarmsSet(SYSTEMALARMS_ALARM_SYSTEMCONFIGURATION, severity, alarmstatus, alarmsubstatus); + else + AlarmsClear(SYSTEMALARMS_ALARM_SYSTEMCONFIGURATION); - return 0; + return 0; } /** @@ -151,39 +157,39 @@ int32_t configuration_check() */ static int32_t check_stabilization_settings(int index, bool multirotor) { - // Make sure the modes have identical sizes - if (MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NUMELEM != MANUALCONTROLSETTINGS_STABILIZATION2SETTINGS_NUMELEM || - MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NUMELEM != MANUALCONTROLSETTINGS_STABILIZATION3SETTINGS_NUMELEM) - return SYSTEMALARMS_ALARM_ERROR; + // Make sure the modes have identical sizes + if (MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NUMELEM != MANUALCONTROLSETTINGS_STABILIZATION2SETTINGS_NUMELEM || + MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NUMELEM != MANUALCONTROLSETTINGS_STABILIZATION3SETTINGS_NUMELEM) + return SYSTEMALARMS_ALARM_ERROR; - uint8_t modes[MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NUMELEM]; + uint8_t modes[MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NUMELEM]; - // Get the different axis modes for this switch position - switch(index) { - case 1: - ManualControlSettingsStabilization1SettingsGet(modes); - break; - case 2: - ManualControlSettingsStabilization2SettingsGet(modes); - break; - case 3: - ManualControlSettingsStabilization3SettingsGet(modes); - break; - default: - return SYSTEMALARMS_ALARM_ERROR; - } + // Get the different axis modes for this switch position + switch(index) { + case 1: + ManualControlSettingsStabilization1SettingsGet(modes); + break; + case 2: + ManualControlSettingsStabilization2SettingsGet(modes); + break; + case 3: + ManualControlSettingsStabilization3SettingsGet(modes); + break; + default: + return SYSTEMALARMS_ALARM_ERROR; + } - // For multirotors verify that nothing is set to "none" - if (multirotor) { - for(uint32_t i = 0; i < NELEMENTS(modes); i++) { - if (modes[i] == MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NONE) - return SYSTEMALARMS_ALARM_ERROR; - } - } + // For multirotors verify that nothing is set to "none" + if (multirotor) { + for(uint32_t i = 0; i < NELEMENTS(modes); i++) { + if (modes[i] == MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NONE) + return SYSTEMALARMS_ALARM_ERROR; + } + } - // Warning: This assumes that certain conditions in the XML file are met. That - // MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NONE has the same numeric value for each channel - // and is the same for STABILIZATIONDESIRED_STABILIZATIONMODE_NONE + // Warning: This assumes that certain conditions in the XML file are met. That + // MANUALCONTROLSETTINGS_STABILIZATION1SETTINGS_NONE has the same numeric value for each channel + // and is the same for STABILIZATIONDESIRED_STABILIZATIONMODE_NONE - return SYSTEMALARMS_ALARM_OK; + return SYSTEMALARMS_ALARM_OK; } diff --git a/flight/Modules/Attitude/attitude.c b/flight/Modules/Attitude/attitude.c index b65811069..6bc72e8c9 100644 --- a/flight/Modules/Attitude/attitude.c +++ b/flight/Modules/Attitude/attitude.c @@ -218,14 +218,14 @@ static void AttitudeTask(void *parameters) // For first 7 seconds use accels to get gyro bias accelKp = 1; accelKi = 0.9; - yawBiasRate = 0.23; + yawBiasRate = 0.01; accel_filter_enabled = false; init = 0; } else if (zero_during_arming && (flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMING)) { accelKp = 1; accelKi = 0.9; - yawBiasRate = 0.23; + yawBiasRate = 0.01; accel_filter_enabled = false; init = 0; } else if (init == 0) { diff --git a/flight/Modules/ManualControl/manualcontrol.c b/flight/Modules/ManualControl/manualcontrol.c index 4a4481566..de3ca578a 100644 --- a/flight/Modules/ManualControl/manualcontrol.c +++ b/flight/Modules/ManualControl/manualcontrol.c @@ -697,11 +697,8 @@ static void updateStabilizationDesired(ManualControlCommandData * cmd, ManualCon static void updatePathDesired(ManualControlCommandData * cmd, bool changed,bool home) { static portTickType lastSysTime; - portTickType thisSysTime; - float dT; - - thisSysTime = xTaskGetTickCount(); - dT = (thisSysTime - lastSysTime) / portTICK_RATE_MS / 1000.0f; + portTickType thisSysTime = xTaskGetTickCount(); + /* float dT = (thisSysTime - lastSysTime) / portTICK_RATE_MS / 1000.0f; */ lastSysTime = thisSysTime; if (home && changed) { @@ -738,16 +735,15 @@ static void updatePathDesired(ManualControlCommandData * cmd, bool changed,bool pathDesired.EndingVelocity=0; pathDesired.Mode = PATHDESIRED_MODE_FLYENDPOINT; PathDesiredSet(&pathDesired); + /* Disable this section, until such time as proper discussion can be had about how to implement it for all types of crafts. } else { - -/*Disable this section, until such time as proper discussion can be had about how to implement it for all types of crafts. PathDesiredData pathDesired; PathDesiredGet(&pathDesired); pathDesired.End[PATHDESIRED_END_NORTH] += dT * -cmd->Pitch; pathDesired.End[PATHDESIRED_END_EAST] += dT * cmd->Roll; pathDesired.Mode = PATHDESIRED_MODE_FLYENDPOINT; PathDesiredSet(&pathDesired); -*/ + */ } } diff --git a/flight/Modules/System/systemmod.c b/flight/Modules/System/systemmod.c index 8d6e88508..b3f5f6db8 100644 --- a/flight/Modules/System/systemmod.c +++ b/flight/Modules/System/systemmod.c @@ -38,17 +38,25 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "openpilot.h" -#include "systemmod.h" -#include "objectpersistence.h" -#include "flightstatus.h" -#include "systemstats.h" -#include "systemsettings.h" -#include "i2cstats.h" -#include "taskinfo.h" -#include "watchdogstatus.h" -#include "taskmonitor.h" -#include "hwsettings.h" +#include + +// private includes +#include "inc/systemmod.h" + +// UAVOs +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Flight Libraries +#include + //#define DEBUG_THIS_FILE @@ -64,8 +72,8 @@ #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. + // must be updated if the FreeRTOS or compiler + // optimisation options are changed. #endif #if defined(PIOS_SYSTEM_STACK_SIZE) @@ -85,6 +93,7 @@ static xTaskHandle systemTaskHandle; static xQueueHandle objectPersistenceQueue; static bool stackOverflow; static bool mallocFailed; +static HwSettingsData bootHwSettings; // Private functions static void objectUpdatedCb(UAVObjEvent * ev); @@ -171,6 +180,8 @@ static void systemTask(void *parameters) // Listen for SettingPersistance object updates, connect a callback function ObjectPersistenceConnectQueue(objectPersistenceQueue); + // Load a copy of HwSetting active at boot time + HwSettingsGet(&bootHwSettings); // Whenever the configuration changes, make sure it is safe to fly HwSettingsConnectCallback(hwSettingsUpdatedCb); @@ -303,9 +314,10 @@ static void objectUpdatedCb(UAVObjEvent * ev) retval = UAVObjDeleteMetaobjects(); } } else if (objper.Operation == OBJECTPERSISTENCE_OPERATION_FULLERASE) { - retval = -1; #if defined(PIOS_INCLUDE_FLASH_SECTOR_SETTINGS) retval = PIOS_FLASHFS_Format(0); +#else + retval = -1; #endif } switch(retval) { @@ -328,7 +340,12 @@ static void objectUpdatedCb(UAVObjEvent * ev) */ static void hwSettingsUpdatedCb(UAVObjEvent * ev) { - AlarmsSet(SYSTEMALARMS_ALARM_BOOTFAULT,SYSTEMALARMS_ALARM_ERROR); + HwSettingsData currentHwSettings; + HwSettingsGet(¤tHwSettings); + // check whether the Hw Configuration has changed from the one used at boot time + if (memcmp(&bootHwSettings, ¤tHwSettings, sizeof(HwSettingsData)) != 0) { + ExtendedAlarmsSet(SYSTEMALARMS_ALARM_BOOTFAULT, SYSTEMALARMS_ALARM_ERROR, SYSTEMALARMS_EXTENDEDALARMSTATUS_REBOOTREQUIRED, 0); + } } /** diff --git a/flight/PiOS/Common/Libraries/CMSIS2/library.mk b/flight/PiOS/Common/Libraries/CMSIS2/library.mk index fd9410ad0..e7d8e8572 100644 --- a/flight/PiOS/Common/Libraries/CMSIS2/library.mk +++ b/flight/PiOS/Common/Libraries/CMSIS2/library.mk @@ -11,7 +11,7 @@ ifeq ($(USE_DSP_LIB), YES) CMSIS_DSPLIB := $(CMSIS2_DIR)DSP_Lib/Source # Compile all files into output directory - DSPLIB_SRC := $(wildcard $(CMSIS_DSPLIB)/*/*.c) + DSPLIB_SRC := $(sort $(wildcard $(CMSIS_DSPLIB)/*/*.c)) DSPLIB_SRCBASE := $(notdir $(basename $(DSPLIB_SRC))) $(foreach src, $(DSPLIB_SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) diff --git a/flight/PiOS/Common/Libraries/FreeRTOS/library.mk b/flight/PiOS/Common/Libraries/FreeRTOS/library.mk index 9e101b273..70005c3c6 100644 --- a/flight/PiOS/Common/Libraries/FreeRTOS/library.mk +++ b/flight/PiOS/Common/Libraries/FreeRTOS/library.mk @@ -6,5 +6,5 @@ # FREERTOS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))/Source -SRC += $(wildcard $(FREERTOS_DIR)/*.c) +SRC += $(sort $(wildcard $(FREERTOS_DIR)/*.c)) EXTRAINCDIRS += $(FREERTOS_DIR)/include diff --git a/flight/PiOS/Common/Libraries/dosfs/library.mk b/flight/PiOS/Common/Libraries/dosfs/library.mk index 0e6fa982e..4b8499788 100644 --- a/flight/PiOS/Common/Libraries/dosfs/library.mk +++ b/flight/PiOS/Common/Libraries/dosfs/library.mk @@ -3,5 +3,5 @@ # DOSFS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) -SRC += $(wildcard $(DOSFS_DIR)*.c) +SRC += $(sort $(wildcard $(DOSFS_DIR)*.c)) EXTRAINCDIRS += $(DOSFS_DIR) diff --git a/flight/PiOS/Common/Libraries/msheap/library.mk b/flight/PiOS/Common/Libraries/msheap/library.mk index 84a796e62..80a8b7e25 100644 --- a/flight/PiOS/Common/Libraries/msheap/library.mk +++ b/flight/PiOS/Common/Libraries/msheap/library.mk @@ -3,5 +3,5 @@ # MSHEAP_DIR := $(dir $(lastword $(MAKEFILE_LIST))) -SRC += $(wildcard $(MSHEAP_DIR)*.c) +SRC += $(sort $(wildcard $(MSHEAP_DIR)*.c)) EXTRAINCDIRS += $(MSHEAP_DIR) diff --git a/flight/PiOS/Common/pios_gcsrcvr.c b/flight/PiOS/Common/pios_gcsrcvr.c index 674a88481..89998a5bc 100644 --- a/flight/PiOS/Common/pios_gcsrcvr.c +++ b/flight/PiOS/Common/pios_gcsrcvr.c @@ -122,6 +122,11 @@ extern int32_t PIOS_GCSRCVR_Init(uint32_t *gcsrcvr_id) if (!gcsrcvr_dev) return -1; + for (uint8_t i = 0; i < GCSRECEIVER_CHANNEL_NUMELEM; i++) { + /* Flush channels */ + gcsreceiverdata.Channel[i] = PIOS_RCVR_TIMEOUT; + } + /* Register uavobj callback */ GCSReceiverConnectCallback (gcsreceiver_updated); @@ -133,11 +138,18 @@ extern int32_t PIOS_GCSRCVR_Init(uint32_t *gcsrcvr_id) return 0; } +/** + * Get the value of an input channel + * \param[in] channel Number of the channel desired (zero based) + * \output PIOS_RCVR_INVALID channel not available + * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver + * \output >=0 channel value + */ static int32_t PIOS_GCSRCVR_Get(uint32_t rcvr_id, uint8_t channel) { if (channel >= GCSRECEIVER_CHANNEL_NUMELEM) { /* channel is out of range */ - return -1; + return PIOS_RCVR_INVALID; } return (gcsreceiverdata.Channel[channel]); diff --git a/flight/PiOS/Common/pios_sbus.c b/flight/PiOS/Common/pios_sbus.c index ec8daab62..0444f15ab 100644 --- a/flight/PiOS/Common/pios_sbus.c +++ b/flight/PiOS/Common/pios_sbus.c @@ -166,7 +166,7 @@ out_fail: * \param[in] channel Number of the channel desired (zero based) * \output PIOS_RCVR_INVALID channel not available * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver - * \output >0 channel value + * \output >=0 channel value */ static int32_t PIOS_SBus_Get(uint32_t rcvr_id, uint8_t channel) { diff --git a/flight/PiOS/STM32F10x/library.mk b/flight/PiOS/STM32F10x/library.mk index df95cfc72..d0d5a0809 100644 --- a/flight/PiOS/STM32F10x/library.mk +++ b/flight/PiOS/STM32F10x/library.mk @@ -18,7 +18,7 @@ ARCHFLAGS += -mcpu=cortex-m3 --specs=nano.specs ASRC += $(PIOS_DEVLIB)startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S # PIOS device library source and includes -SRC += $(wildcard $(PIOS_DEVLIB)*.c) +SRC += $(sort $(wildcard $(PIOS_DEVLIB)*.c)) # CMSIS for the F1 include $(PIOS)/Common/Libraries/CMSIS2/library.mk @@ -29,12 +29,12 @@ EXTRAINCDIRS += $(CMSIS_DIR) # ST Peripheral library PERIPHLIB = $(PIOS_DEVLIB)Libraries/STM32F10x_StdPeriph_Driver -SRC += $(wildcard $(PERIPHLIB)/src/*.c) +SRC += $(sort $(wildcard $(PERIPHLIB)/src/*.c)) EXTRAINCDIRS += $(PERIPHLIB)/inc # ST USB Device library USBDEVLIB = $(PIOS_DEVLIB)Libraries/STM32_USB-FS-Device_Driver -SRC += $(wildcard $(USBDEVLIB)/src/*.c) +SRC += $(sort $(wildcard $(USBDEVLIB)/src/*.c)) EXTRAINCDIRS += $(USBDEVLIB)/inc # @@ -45,7 +45,7 @@ EXTRAINCDIRS += $(USBDEVLIB)/inc # ifneq ($(FREERTOS_DIR),) FREERTOS_PORTDIR := $(PIOS_DEVLIB)Libraries/FreeRTOS/Source - SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3/*.c) - SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/MemMang/heap_1.c) + SRC += $(sort $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3/*.c)) + SRC += $(sort $(wildcard $(FREERTOS_PORTDIR)/portable/MemMang/heap_1.c)) EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3 endif diff --git a/flight/PiOS/STM32F10x/pios_dsm.c b/flight/PiOS/STM32F10x/pios_dsm.c index b7e3dcbca..9ec036efa 100644 --- a/flight/PiOS/STM32F10x/pios_dsm.c +++ b/flight/PiOS/STM32F10x/pios_dsm.c @@ -348,7 +348,7 @@ static uint16_t PIOS_DSM_RxInCallback(uint32_t context, * \param[in] channel Number of the channel desired (zero based) * \output PIOS_RCVR_INVALID channel not available * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver - * \output >0 channel value + * \output >=0 channel value */ static int32_t PIOS_DSM_Get(uint32_t rcvr_id, uint8_t channel) { diff --git a/flight/PiOS/STM32F10x/pios_ppm.c b/flight/PiOS/STM32F10x/pios_ppm.c index 153b331a4..63e73fe39 100644 --- a/flight/PiOS/STM32F10x/pios_ppm.c +++ b/flight/PiOS/STM32F10x/pios_ppm.c @@ -146,8 +146,8 @@ extern int32_t PIOS_PPM_Init(uint32_t * ppm_id, const struct pios_ppm_cfg * cfg) for (uint8_t i = 0; i < PIOS_PPM_IN_MAX_NUM_CHANNELS; i++) { /* Flush counter variables */ - ppm_dev->CaptureValue[i] = 0; - ppm_dev->CaptureValueNewFrame[i] = 0; + ppm_dev->CaptureValue[i] = PIOS_RCVR_TIMEOUT; + ppm_dev->CaptureValueNewFrame[i] = PIOS_RCVR_TIMEOUT; } @@ -201,11 +201,12 @@ out_fail: } /** -* Get the value of an input channel -* \param[in] Channel Number of the channel desired -* \output -1 Channel not available -* \output >0 Channel value -*/ + * Get the value of an input channel + * \param[in] channel Number of the channel desired (zero based) + * \output PIOS_RCVR_INVALID channel not available + * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver + * \output >=0 channel value + */ static int32_t PIOS_PPM_Get(uint32_t rcvr_id, uint8_t channel) { struct pios_ppm_dev * ppm_dev = (struct pios_ppm_dev *)rcvr_id; diff --git a/flight/PiOS/STM32F10x/pios_pwm.c b/flight/PiOS/STM32F10x/pios_pwm.c index b4996fc4d..2c6707664 100644 --- a/flight/PiOS/STM32F10x/pios_pwm.c +++ b/flight/PiOS/STM32F10x/pios_pwm.c @@ -171,11 +171,12 @@ out_fail: } /** -* Get the value of an input channel -* \param[in] Channel Number of the channel desired -* \output -1 Channel not available -* \output >0 Channel value -*/ + * Get the value of an input channel + * \param[in] channel Number of the channel desired (zero based) + * \output PIOS_RCVR_INVALID channel not available + * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver + * \output >=0 channel value + */ static int32_t PIOS_PWM_Get(uint32_t rcvr_id, uint8_t channel) { struct pios_pwm_dev * pwm_dev = (struct pios_pwm_dev *)rcvr_id; diff --git a/flight/PiOS/STM32F4xx/library.mk b/flight/PiOS/STM32F4xx/library.mk index 531dbbfb2..a38b2720d 100644 --- a/flight/PiOS/STM32F4xx/library.mk +++ b/flight/PiOS/STM32F4xx/library.mk @@ -20,18 +20,18 @@ CDEFS += -DARM_MATH_CM4 -D__FPU_PRESENT=1 ARCHFLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard # PIOS device library source and includes -SRC += $(wildcard $(PIOS_DEVLIB)*.c) +SRC += $(sort $(wildcard $(PIOS_DEVLIB)*.c)) EXTRAINCDIRS += $(PIOS_DEVLIB)inc # CMSIS for the F4 include $(PIOSCOMMON)/Libraries/CMSIS2/library.mk CMSIS2_DEVICEDIR := $(PIOS_DEVLIB)Libraries/CMSIS2/Device/ST/STM32F4xx -SRC += $(wildcard $(CMSIS2_DEVICEDIR)/Source/$(BOARD_NAME)/*.c) +SRC += $(sort $(wildcard $(CMSIS2_DEVICEDIR)/Source/$(BOARD_NAME)/*.c)) EXTRAINCDIRS += $(CMSIS2_DEVICEDIR)/Include # ST Peripheral library PERIPHLIB = $(PIOS_DEVLIB)Libraries/STM32F4xx_StdPeriph_Driver -SRC += $(wildcard $(PERIPHLIB)/src/*.c) +SRC += $(sort $(wildcard $(PERIPHLIB)/src/*.c)) EXTRAINCDIRS += $(PERIPHLIB)/inc # ST USB OTG library @@ -42,7 +42,7 @@ EXTRAINCDIRS += $(USBOTGLIB)/inc # ST USB Device library USBDEVLIB = $(PIOS_DEVLIB)Libraries/STM32_USB_Device_Library -SRC += $(wildcard $(USBDEVLIB)/Core/src/*.c) +SRC += $(sort $(wildcard $(USBDEVLIB)/Core/src/*.c)) EXTRAINCDIRS += $(USBDEVLIB)/Core/inc # @@ -53,7 +53,7 @@ EXTRAINCDIRS += $(USBDEVLIB)/Core/inc # ifneq ($(FREERTOS_DIR),) FREERTOS_PORTDIR := $(PIOS_DEVLIB)Libraries/FreeRTOS/Source - SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F/*.c) + SRC += $(sort $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F/*.c)) EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F include $(PIOSCOMMON)/Libraries/msheap/library.mk endif diff --git a/flight/PiOS/STM32F4xx/pios_dsm.c b/flight/PiOS/STM32F4xx/pios_dsm.c index 4bcc0187f..8ca685011 100644 --- a/flight/PiOS/STM32F4xx/pios_dsm.c +++ b/flight/PiOS/STM32F4xx/pios_dsm.c @@ -349,7 +349,7 @@ static uint16_t PIOS_DSM_RxInCallback(uint32_t context, * \param[in] channel Number of the channel desired (zero based) * \output PIOS_RCVR_INVALID channel not available * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver - * \output >0 channel value + * \output >=0 channel value */ static int32_t PIOS_DSM_Get(uint32_t rcvr_id, uint8_t channel) { diff --git a/flight/PiOS/STM32F4xx/pios_ppm.c b/flight/PiOS/STM32F4xx/pios_ppm.c index 3040287da..922e7d6e1 100644 --- a/flight/PiOS/STM32F4xx/pios_ppm.c +++ b/flight/PiOS/STM32F4xx/pios_ppm.c @@ -145,8 +145,8 @@ extern int32_t PIOS_PPM_Init(uint32_t * ppm_id, const struct pios_ppm_cfg * cfg) for (uint8_t i = 0; i < PIOS_PPM_IN_MAX_NUM_CHANNELS; i++) { /* Flush counter variables */ - ppm_dev->CaptureValue[i] = 0; - ppm_dev->CaptureValueNewFrame[i] = 0; + ppm_dev->CaptureValue[i] = PIOS_RCVR_TIMEOUT; + ppm_dev->CaptureValueNewFrame[i] = PIOS_RCVR_TIMEOUT; } @@ -200,11 +200,12 @@ out_fail: } /** -* Get the value of an input channel -* \param[in] Channel Number of the channel desired -* \output -1 Channel not available -* \output >0 Channel value -*/ + * Get the value of an input channel + * \param[in] channel Number of the channel desired (zero based) + * \output PIOS_RCVR_INVALID channel not available + * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver + * \output >=0 channel value + */ static int32_t PIOS_PPM_Get(uint32_t rcvr_id, uint8_t channel) { struct pios_ppm_dev * ppm_dev = (struct pios_ppm_dev *)rcvr_id; diff --git a/flight/PiOS/STM32F4xx/pios_pwm.c b/flight/PiOS/STM32F4xx/pios_pwm.c index 4f7f6c942..752dcbaa8 100644 --- a/flight/PiOS/STM32F4xx/pios_pwm.c +++ b/flight/PiOS/STM32F4xx/pios_pwm.c @@ -170,11 +170,12 @@ out_fail: } /** -* Get the value of an input channel -* \param[in] Channel Number of the channel desired -* \output -1 Channel not available -* \output >0 Channel value -*/ + * Get the value of an input channel + * \param[in] channel Number of the channel desired (zero based) + * \output PIOS_RCVR_INVALID channel not available + * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver + * \output >=0 channel value + */ static int32_t PIOS_PWM_Get(uint32_t rcvr_id, uint8_t channel) { struct pios_pwm_dev * pwm_dev = (struct pios_pwm_dev *)rcvr_id; diff --git a/flight/PiOS/inc/pios_rcvr.h b/flight/PiOS/inc/pios_rcvr.h index ab493cd35..6b74c9b52 100644 --- a/flight/PiOS/inc/pios_rcvr.h +++ b/flight/PiOS/inc/pios_rcvr.h @@ -42,11 +42,11 @@ extern int32_t PIOS_RCVR_Read(uint32_t rcvr_id, uint8_t channel); /*! Define error codes for PIOS_RCVR_Get */ enum PIOS_RCVR_errors { /*! Indicates that a failsafe condition or missing receiver detected for that channel */ - PIOS_RCVR_TIMEOUT = 0, + PIOS_RCVR_TIMEOUT = -1, /*! Channel is invalid for this driver (usually out of range supported) */ - PIOS_RCVR_INVALID = -1, + PIOS_RCVR_INVALID = -2, /*! Indicates that the driver for this channel has not been initialized */ - PIOS_RCVR_NODRIVER = -2 + PIOS_RCVR_NODRIVER = -3 }; #endif /* PIOS_RCVR_H */ diff --git a/flight/PiOS/posix/Libraries/FreeRTOS/library.mk b/flight/PiOS/posix/Libraries/FreeRTOS/library.mk index c6267255f..08381319f 100644 --- a/flight/PiOS/posix/Libraries/FreeRTOS/library.mk +++ b/flight/PiOS/posix/Libraries/FreeRTOS/library.mk @@ -6,5 +6,5 @@ # FREERTOS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))/Source -SRC += $(wildcard $(FREERTOS_DIR)/*.c) +SRC += $(sort $(wildcard $(FREERTOS_DIR)/*.c)) EXTRAINCDIRS += $(FREERTOS_DIR)/include diff --git a/flight/PiOS/posix/library.mk b/flight/PiOS/posix/library.mk index 530431210..79cadc5c7 100644 --- a/flight/PiOS/posix/library.mk +++ b/flight/PiOS/posix/library.mk @@ -27,7 +27,7 @@ ARCHFLAGS += -DARCH_POSIX # # PIOS device library source and includes # -SRC += $(wildcard $(PIOS_DEVLIB)*.c) +SRC += $(sort $(wildcard $(PIOS_DEVLIB)*.c)) EXTRAINCDIRS += $(PIOS_DEVLIB)/inc # @@ -68,8 +68,8 @@ EXTRAINCDIRS += $(PIOS_DEVLIB)/inc # ifneq ($(FREERTOS_DIR),) FREERTOS_PORTDIR := $(PIOS_DEVLIB)/Libraries/FreeRTOS/Source -SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/Posix/*.c) -SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/MemMang/*.c) +SRC += $(sort $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/Posix/*.c)) +SRC += $(sort $(wildcard $(FREERTOS_PORTDIR)/portable/MemMang/*.c)) EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/Posix endif diff --git a/flight/targets/CopterControl/Makefile b/flight/targets/CopterControl/Makefile index c2c69871d..361616210 100644 --- a/flight/targets/CopterControl/Makefile +++ b/flight/targets/CopterControl/Makefile @@ -62,7 +62,7 @@ ifndef TESTAPP SRC += $(OPSYSTEM)/coptercontrol.c SRC += $(OPSYSTEM)/pios_board.c SRC += $(OPSYSTEM)/pios_usb_board_data.c - SRC += $(OPSYSTEM)/alarms.c + SRC += $(FLIGHTLIB)/alarms.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c SRC += $(OPUAVOBJ)/eventdispatcher.c diff --git a/flight/targets/CopterControl/System/alarms.c b/flight/targets/CopterControl/System/alarms.c deleted file mode 100644 index a55cbd158..000000000 --- a/flight/targets/CopterControl/System/alarms.c +++ /dev/null @@ -1,214 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotLibraries OpenPilot System Libraries - * @brief OpenPilot System libraries are available to all OP modules. - * @{ - * @file alarms.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Library for setting and clearing system alarms - * @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 "alarms.h" - -// Private constants - -// Private types - -// Private variables -static xSemaphoreHandle lock; - -// Private functions -static int32_t hasSeverity(SystemAlarmsAlarmOptions severity); - -/** - * Initialize the alarms library - */ -int32_t AlarmsInitialize(void) -{ - SystemAlarmsInitialize(); - - lock = xSemaphoreCreateRecursiveMutex(); - //do not change the default states of the alarms, let the init code generated by the uavobjectgenerator handle that - //AlarmsClearAll(); - //AlarmsDefaultAll(); - return 0; -} - -/** - * Set an alarm - * @param alarm The system alarm to be modified - * @param severity The alarm severity - * @return 0 if success, -1 if an error - */ -int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity) -{ - SystemAlarmsData alarms; - - // Check that this is a valid alarm - if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) - { - return -1; - } - - // Lock - xSemaphoreTakeRecursive(lock, portMAX_DELAY); - - // Read alarm and update its severity only if it was changed - SystemAlarmsGet(&alarms); - if ( alarms.Alarm[alarm] != severity ) - { - alarms.Alarm[alarm] = severity; - SystemAlarmsSet(&alarms); - } - - // Release lock - xSemaphoreGiveRecursive(lock); - return 0; - -} - -/** - * Get an alarm - * @param alarm The system alarm to be read - * @return Alarm severity - */ -SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm) -{ - SystemAlarmsData alarms; - - // Check that this is a valid alarm - if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) - { - return 0; - } - - // Read alarm - SystemAlarmsGet(&alarms); - return alarms.Alarm[alarm]; -} - -/** - * Set an alarm to it's default value - * @param alarm The system alarm to be modified - * @return 0 if success, -1 if an error - */ -int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm) -{ - return AlarmsSet(alarm, SYSTEMALARMS_ALARM_DEFAULT); -} - -/** - * Default all alarms - */ -void AlarmsDefaultAll() -{ - uint32_t n; - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - AlarmsDefault(n); - } -} - -/** - * Clear an alarm - * @param alarm The system alarm to be modified - * @return 0 if success, -1 if an error - */ -int32_t AlarmsClear(SystemAlarmsAlarmElem alarm) -{ - return AlarmsSet(alarm, SYSTEMALARMS_ALARM_OK); -} - -/** - * Clear all alarms - */ -void AlarmsClearAll() -{ - uint32_t n; - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - AlarmsClear(n); - } -} - -/** - * Check if there are any alarms with the given or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasWarnings() -{ - return hasSeverity(SYSTEMALARMS_ALARM_WARNING); -} - -/** - * Check if there are any alarms with error or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasErrors() -{ - return hasSeverity(SYSTEMALARMS_ALARM_ERROR); -}; - -/** - * Check if there are any alarms with critical or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasCritical() -{ - return hasSeverity(SYSTEMALARMS_ALARM_CRITICAL); -}; - -/** - * Check if there are any alarms with the given or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -static int32_t hasSeverity(SystemAlarmsAlarmOptions severity) -{ - SystemAlarmsData alarms; - uint32_t n; - - // Lock - xSemaphoreTakeRecursive(lock, portMAX_DELAY); - - // Read alarms - SystemAlarmsGet(&alarms); - - // Go through alarms and check if any are of the given severity or higher - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - if ( alarms.Alarm[n] >= severity) - { - xSemaphoreGiveRecursive(lock); - return 1; - } - } - - // If this point is reached then no alarms found - xSemaphoreGiveRecursive(lock); - return 0; -} -/** - * @} - * @} - */ - diff --git a/flight/targets/CopterControl/System/inc/alarms.h b/flight/targets/CopterControl/System/inc/alarms.h deleted file mode 100644 index 0f0faeb8f..000000000 --- a/flight/targets/CopterControl/System/inc/alarms.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotLibraries OpenPilot System Libraries - * @{ - * @file alarms.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Include file of the alarm library - * @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 ALARMS_H -#define ALARMS_H - -#include "systemalarms.h" -#define SYSTEMALARMS_ALARM_DEFAULT SYSTEMALARMS_ALARM_UNINITIALISED - -int32_t AlarmsInitialize(void); -int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity); -SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm); -int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm); -void AlarmsDefaultAll(); -int32_t AlarmsClear(SystemAlarmsAlarmElem alarm); -void AlarmsClearAll(); -int32_t AlarmsHasWarnings(); -int32_t AlarmsHasErrors(); -int32_t AlarmsHasCritical(); - -#endif // ALARMS_H - -/** - * @} - * @} - */ diff --git a/flight/targets/EntireFlash/Makefile b/flight/targets/EntireFlash/Makefile index 6b2910f94..671514d1a 100644 --- a/flight/targets/EntireFlash/Makefile +++ b/flight/targets/EntireFlash/Makefile @@ -21,6 +21,7 @@ ifndef OPENPILOT_IS_COOL endif include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk +include $(ROOT_DIR)/make/firmware-defs.mk # Paths TOPDIR = . diff --git a/flight/targets/OSD/Makefile b/flight/targets/OSD/Makefile index 2d0deafcd..af54fafc8 100644 --- a/flight/targets/OSD/Makefile +++ b/flight/targets/OSD/Makefile @@ -48,7 +48,7 @@ ifndef TESTAPP SRC += $(OPSYSTEM)/osd.c SRC += $(OPSYSTEM)/pios_board.c SRC += $(OPSYSTEM)/pios_usb_board_data.c - SRC += $(OPSYSTEM)/alarms.c + SRC += $(FLIGHTLIB)/alarms.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c SRC += $(OPUAVOBJ)/eventdispatcher.c diff --git a/flight/targets/OSD/System/alarms.c b/flight/targets/OSD/System/alarms.c deleted file mode 100644 index 6ccd5fb62..000000000 --- a/flight/targets/OSD/System/alarms.c +++ /dev/null @@ -1,210 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotLibraries OpenPilot System Libraries - * @brief OpenPilot System libraries are available to all OP modules. - * @{ - * @file alarms.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Library for setting and clearing system alarms - * @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 "alarms.h" - -// Private constants - -// Private types - -// Private variables -static xSemaphoreHandle lock; - -// Private functions -static int32_t hasSeverity(SystemAlarmsAlarmOptions severity); - -/** - * Initialize the alarms library - */ -int32_t AlarmsInitialize(void) -{ - SystemAlarmsInitialize(); - lock = xSemaphoreCreateRecursiveMutex(); - return 0; -} - -/** - * Set an alarm - * @param alarm The system alarm to be modified - * @param severity The alarm severity - * @return 0 if success, -1 if an error - */ -int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity) -{ - SystemAlarmsData alarms; - - // Check that this is a valid alarm - if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) - { - return -1; - } - - // Lock - xSemaphoreTakeRecursive(lock, portMAX_DELAY); - - // Read alarm and update its severity only if it was changed - SystemAlarmsGet(&alarms); - if ( alarms.Alarm[alarm] != severity ) - { - alarms.Alarm[alarm] = severity; - SystemAlarmsSet(&alarms); - } - - // Release lock - xSemaphoreGiveRecursive(lock); - return 0; - -} - -/** - * Get an alarm - * @param alarm The system alarm to be read - * @return Alarm severity - */ -SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm) -{ - SystemAlarmsData alarms; - - // Check that this is a valid alarm - if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) - { - return 0; - } - - // Read alarm - SystemAlarmsGet(&alarms); - return alarms.Alarm[alarm]; -} - -/** - * Set an alarm to it's default value - * @param alarm The system alarm to be modified - * @return 0 if success, -1 if an error - */ -int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm) -{ - return AlarmsSet(alarm, SYSTEMALARMS_ALARM_DEFAULT); -} - -/** - * Default all alarms - */ -void AlarmsDefaultAll() -{ - uint32_t n; - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - AlarmsDefault(n); - } -} - -/** - * Clear an alarm - * @param alarm The system alarm to be modified - * @return 0 if success, -1 if an error - */ -int32_t AlarmsClear(SystemAlarmsAlarmElem alarm) -{ - return AlarmsSet(alarm, SYSTEMALARMS_ALARM_OK); -} - -/** - * Clear all alarms - */ -void AlarmsClearAll() -{ - uint32_t n; - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - AlarmsClear(n); - } -} - -/** - * Check if there are any alarms with the given or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasWarnings() -{ - return hasSeverity(SYSTEMALARMS_ALARM_WARNING); -} - -/** - * Check if there are any alarms with error or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasErrors() -{ - return hasSeverity(SYSTEMALARMS_ALARM_ERROR); -}; - -/** - * Check if there are any alarms with critical or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasCritical() -{ - return hasSeverity(SYSTEMALARMS_ALARM_CRITICAL); -}; - -/** - * Check if there are any alarms with the given or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -static int32_t hasSeverity(SystemAlarmsAlarmOptions severity) -{ - SystemAlarmsData alarms; - uint32_t n; - - // Lock - xSemaphoreTakeRecursive(lock, portMAX_DELAY); - - // Read alarms - SystemAlarmsGet(&alarms); - - // Go through alarms and check if any are of the given severity or higher - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - if ( alarms.Alarm[n] >= severity) - { - xSemaphoreGiveRecursive(lock); - return 1; - } - } - - // If this point is reached then no alarms found - xSemaphoreGiveRecursive(lock); - return 0; -} -/** - * @} - * @} - */ - diff --git a/flight/targets/PipXtreme/System/inc/alarms.h b/flight/targets/PipXtreme/System/inc/alarms.h deleted file mode 100755 index 0f0faeb8f..000000000 --- a/flight/targets/PipXtreme/System/inc/alarms.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotLibraries OpenPilot System Libraries - * @{ - * @file alarms.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Include file of the alarm library - * @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 ALARMS_H -#define ALARMS_H - -#include "systemalarms.h" -#define SYSTEMALARMS_ALARM_DEFAULT SYSTEMALARMS_ALARM_UNINITIALISED - -int32_t AlarmsInitialize(void); -int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity); -SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm); -int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm); -void AlarmsDefaultAll(); -int32_t AlarmsClear(SystemAlarmsAlarmElem alarm); -void AlarmsClearAll(); -int32_t AlarmsHasWarnings(); -int32_t AlarmsHasErrors(); -int32_t AlarmsHasCritical(); - -#endif // ALARMS_H - -/** - * @} - * @} - */ diff --git a/flight/targets/RevoMini/Makefile b/flight/targets/RevoMini/Makefile index 47f631789..958c575c1 100644 --- a/flight/targets/RevoMini/Makefile +++ b/flight/targets/RevoMini/Makefile @@ -66,7 +66,7 @@ ifndef TESTAPP SRC += $(OPSYSTEM)/revolution.c SRC += $(OPSYSTEM)/pios_board.c SRC += $(OPSYSTEM)/pios_usb_board_data.c - SRC += $(OPSYSTEM)/alarms.c + SRC += $(FLIGHTLIB)/alarms.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c SRC += $(OPUAVOBJ)/eventdispatcher.c diff --git a/flight/targets/RevoMini/System/alarms.c b/flight/targets/RevoMini/System/alarms.c deleted file mode 100644 index 6ccd5fb62..000000000 --- a/flight/targets/RevoMini/System/alarms.c +++ /dev/null @@ -1,210 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotLibraries OpenPilot System Libraries - * @brief OpenPilot System libraries are available to all OP modules. - * @{ - * @file alarms.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Library for setting and clearing system alarms - * @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 "alarms.h" - -// Private constants - -// Private types - -// Private variables -static xSemaphoreHandle lock; - -// Private functions -static int32_t hasSeverity(SystemAlarmsAlarmOptions severity); - -/** - * Initialize the alarms library - */ -int32_t AlarmsInitialize(void) -{ - SystemAlarmsInitialize(); - lock = xSemaphoreCreateRecursiveMutex(); - return 0; -} - -/** - * Set an alarm - * @param alarm The system alarm to be modified - * @param severity The alarm severity - * @return 0 if success, -1 if an error - */ -int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity) -{ - SystemAlarmsData alarms; - - // Check that this is a valid alarm - if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) - { - return -1; - } - - // Lock - xSemaphoreTakeRecursive(lock, portMAX_DELAY); - - // Read alarm and update its severity only if it was changed - SystemAlarmsGet(&alarms); - if ( alarms.Alarm[alarm] != severity ) - { - alarms.Alarm[alarm] = severity; - SystemAlarmsSet(&alarms); - } - - // Release lock - xSemaphoreGiveRecursive(lock); - return 0; - -} - -/** - * Get an alarm - * @param alarm The system alarm to be read - * @return Alarm severity - */ -SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm) -{ - SystemAlarmsData alarms; - - // Check that this is a valid alarm - if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) - { - return 0; - } - - // Read alarm - SystemAlarmsGet(&alarms); - return alarms.Alarm[alarm]; -} - -/** - * Set an alarm to it's default value - * @param alarm The system alarm to be modified - * @return 0 if success, -1 if an error - */ -int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm) -{ - return AlarmsSet(alarm, SYSTEMALARMS_ALARM_DEFAULT); -} - -/** - * Default all alarms - */ -void AlarmsDefaultAll() -{ - uint32_t n; - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - AlarmsDefault(n); - } -} - -/** - * Clear an alarm - * @param alarm The system alarm to be modified - * @return 0 if success, -1 if an error - */ -int32_t AlarmsClear(SystemAlarmsAlarmElem alarm) -{ - return AlarmsSet(alarm, SYSTEMALARMS_ALARM_OK); -} - -/** - * Clear all alarms - */ -void AlarmsClearAll() -{ - uint32_t n; - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - AlarmsClear(n); - } -} - -/** - * Check if there are any alarms with the given or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasWarnings() -{ - return hasSeverity(SYSTEMALARMS_ALARM_WARNING); -} - -/** - * Check if there are any alarms with error or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasErrors() -{ - return hasSeverity(SYSTEMALARMS_ALARM_ERROR); -}; - -/** - * Check if there are any alarms with critical or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasCritical() -{ - return hasSeverity(SYSTEMALARMS_ALARM_CRITICAL); -}; - -/** - * Check if there are any alarms with the given or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -static int32_t hasSeverity(SystemAlarmsAlarmOptions severity) -{ - SystemAlarmsData alarms; - uint32_t n; - - // Lock - xSemaphoreTakeRecursive(lock, portMAX_DELAY); - - // Read alarms - SystemAlarmsGet(&alarms); - - // Go through alarms and check if any are of the given severity or higher - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - if ( alarms.Alarm[n] >= severity) - { - xSemaphoreGiveRecursive(lock); - return 1; - } - } - - // If this point is reached then no alarms found - xSemaphoreGiveRecursive(lock); - return 0; -} -/** - * @} - * @} - */ - diff --git a/flight/targets/RevoMini/System/inc/alarms.h b/flight/targets/RevoMini/System/inc/alarms.h deleted file mode 100644 index 0f0faeb8f..000000000 --- a/flight/targets/RevoMini/System/inc/alarms.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotLibraries OpenPilot System Libraries - * @{ - * @file alarms.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Include file of the alarm library - * @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 ALARMS_H -#define ALARMS_H - -#include "systemalarms.h" -#define SYSTEMALARMS_ALARM_DEFAULT SYSTEMALARMS_ALARM_UNINITIALISED - -int32_t AlarmsInitialize(void); -int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity); -SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm); -int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm); -void AlarmsDefaultAll(); -int32_t AlarmsClear(SystemAlarmsAlarmElem alarm); -void AlarmsClearAll(); -int32_t AlarmsHasWarnings(); -int32_t AlarmsHasErrors(); -int32_t AlarmsHasCritical(); - -#endif // ALARMS_H - -/** - * @} - * @} - */ diff --git a/flight/targets/Revolution/Makefile b/flight/targets/Revolution/Makefile index 42b17ea00..8de424358 100644 --- a/flight/targets/Revolution/Makefile +++ b/flight/targets/Revolution/Makefile @@ -66,7 +66,7 @@ ifndef TESTAPP SRC += $(OPSYSTEM)/revolution.c SRC += $(OPSYSTEM)/pios_board.c SRC += $(OPSYSTEM)/pios_usb_board_data.c - SRC += $(OPSYSTEM)/alarms.c + SRC += $(FLIGHTLIB)/alarms.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c SRC += $(OPUAVOBJ)/eventdispatcher.c diff --git a/flight/targets/Revolution/System/alarms.c b/flight/targets/Revolution/System/alarms.c deleted file mode 100644 index 6ccd5fb62..000000000 --- a/flight/targets/Revolution/System/alarms.c +++ /dev/null @@ -1,210 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotLibraries OpenPilot System Libraries - * @brief OpenPilot System libraries are available to all OP modules. - * @{ - * @file alarms.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Library for setting and clearing system alarms - * @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 "alarms.h" - -// Private constants - -// Private types - -// Private variables -static xSemaphoreHandle lock; - -// Private functions -static int32_t hasSeverity(SystemAlarmsAlarmOptions severity); - -/** - * Initialize the alarms library - */ -int32_t AlarmsInitialize(void) -{ - SystemAlarmsInitialize(); - lock = xSemaphoreCreateRecursiveMutex(); - return 0; -} - -/** - * Set an alarm - * @param alarm The system alarm to be modified - * @param severity The alarm severity - * @return 0 if success, -1 if an error - */ -int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity) -{ - SystemAlarmsData alarms; - - // Check that this is a valid alarm - if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) - { - return -1; - } - - // Lock - xSemaphoreTakeRecursive(lock, portMAX_DELAY); - - // Read alarm and update its severity only if it was changed - SystemAlarmsGet(&alarms); - if ( alarms.Alarm[alarm] != severity ) - { - alarms.Alarm[alarm] = severity; - SystemAlarmsSet(&alarms); - } - - // Release lock - xSemaphoreGiveRecursive(lock); - return 0; - -} - -/** - * Get an alarm - * @param alarm The system alarm to be read - * @return Alarm severity - */ -SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm) -{ - SystemAlarmsData alarms; - - // Check that this is a valid alarm - if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) - { - return 0; - } - - // Read alarm - SystemAlarmsGet(&alarms); - return alarms.Alarm[alarm]; -} - -/** - * Set an alarm to it's default value - * @param alarm The system alarm to be modified - * @return 0 if success, -1 if an error - */ -int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm) -{ - return AlarmsSet(alarm, SYSTEMALARMS_ALARM_DEFAULT); -} - -/** - * Default all alarms - */ -void AlarmsDefaultAll() -{ - uint32_t n; - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - AlarmsDefault(n); - } -} - -/** - * Clear an alarm - * @param alarm The system alarm to be modified - * @return 0 if success, -1 if an error - */ -int32_t AlarmsClear(SystemAlarmsAlarmElem alarm) -{ - return AlarmsSet(alarm, SYSTEMALARMS_ALARM_OK); -} - -/** - * Clear all alarms - */ -void AlarmsClearAll() -{ - uint32_t n; - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - AlarmsClear(n); - } -} - -/** - * Check if there are any alarms with the given or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasWarnings() -{ - return hasSeverity(SYSTEMALARMS_ALARM_WARNING); -} - -/** - * Check if there are any alarms with error or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasErrors() -{ - return hasSeverity(SYSTEMALARMS_ALARM_ERROR); -}; - -/** - * Check if there are any alarms with critical or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasCritical() -{ - return hasSeverity(SYSTEMALARMS_ALARM_CRITICAL); -}; - -/** - * Check if there are any alarms with the given or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -static int32_t hasSeverity(SystemAlarmsAlarmOptions severity) -{ - SystemAlarmsData alarms; - uint32_t n; - - // Lock - xSemaphoreTakeRecursive(lock, portMAX_DELAY); - - // Read alarms - SystemAlarmsGet(&alarms); - - // Go through alarms and check if any are of the given severity or higher - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - if ( alarms.Alarm[n] >= severity) - { - xSemaphoreGiveRecursive(lock); - return 1; - } - } - - // If this point is reached then no alarms found - xSemaphoreGiveRecursive(lock); - return 0; -} -/** - * @} - * @} - */ - diff --git a/flight/targets/Revolution/System/inc/alarms.h b/flight/targets/Revolution/System/inc/alarms.h deleted file mode 100644 index 0f0faeb8f..000000000 --- a/flight/targets/Revolution/System/inc/alarms.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotLibraries OpenPilot System Libraries - * @{ - * @file alarms.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Include file of the alarm library - * @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 ALARMS_H -#define ALARMS_H - -#include "systemalarms.h" -#define SYSTEMALARMS_ALARM_DEFAULT SYSTEMALARMS_ALARM_UNINITIALISED - -int32_t AlarmsInitialize(void); -int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity); -SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm); -int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm); -void AlarmsDefaultAll(); -int32_t AlarmsClear(SystemAlarmsAlarmElem alarm); -void AlarmsClearAll(); -int32_t AlarmsHasWarnings(); -int32_t AlarmsHasErrors(); -int32_t AlarmsHasCritical(); - -#endif // ALARMS_H - -/** - * @} - * @} - */ diff --git a/flight/targets/SimPosix/Makefile b/flight/targets/SimPosix/Makefile index 47b90c6ec..6b948a6fd 100644 --- a/flight/targets/SimPosix/Makefile +++ b/flight/targets/SimPosix/Makefile @@ -78,7 +78,7 @@ SRC += ${OUTDIR}/InitMods.c SRC += ${OPMODULEDIR}/System/systemmod.c SRC += $(OPSYSTEM)/simposix.c SRC += $(OPSYSTEM)/pios_board.c -SRC += $(OPSYSTEM)/alarms.c +SRC += $(FLIGHTLIB)/alarms.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c SRC += $(OPUAVOBJ)/eventdispatcher.c diff --git a/flight/targets/SimPosix/System/alarms.c b/flight/targets/SimPosix/System/alarms.c deleted file mode 100644 index 6ccd5fb62..000000000 --- a/flight/targets/SimPosix/System/alarms.c +++ /dev/null @@ -1,210 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotLibraries OpenPilot System Libraries - * @brief OpenPilot System libraries are available to all OP modules. - * @{ - * @file alarms.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Library for setting and clearing system alarms - * @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 "alarms.h" - -// Private constants - -// Private types - -// Private variables -static xSemaphoreHandle lock; - -// Private functions -static int32_t hasSeverity(SystemAlarmsAlarmOptions severity); - -/** - * Initialize the alarms library - */ -int32_t AlarmsInitialize(void) -{ - SystemAlarmsInitialize(); - lock = xSemaphoreCreateRecursiveMutex(); - return 0; -} - -/** - * Set an alarm - * @param alarm The system alarm to be modified - * @param severity The alarm severity - * @return 0 if success, -1 if an error - */ -int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity) -{ - SystemAlarmsData alarms; - - // Check that this is a valid alarm - if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) - { - return -1; - } - - // Lock - xSemaphoreTakeRecursive(lock, portMAX_DELAY); - - // Read alarm and update its severity only if it was changed - SystemAlarmsGet(&alarms); - if ( alarms.Alarm[alarm] != severity ) - { - alarms.Alarm[alarm] = severity; - SystemAlarmsSet(&alarms); - } - - // Release lock - xSemaphoreGiveRecursive(lock); - return 0; - -} - -/** - * Get an alarm - * @param alarm The system alarm to be read - * @return Alarm severity - */ -SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm) -{ - SystemAlarmsData alarms; - - // Check that this is a valid alarm - if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) - { - return 0; - } - - // Read alarm - SystemAlarmsGet(&alarms); - return alarms.Alarm[alarm]; -} - -/** - * Set an alarm to it's default value - * @param alarm The system alarm to be modified - * @return 0 if success, -1 if an error - */ -int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm) -{ - return AlarmsSet(alarm, SYSTEMALARMS_ALARM_DEFAULT); -} - -/** - * Default all alarms - */ -void AlarmsDefaultAll() -{ - uint32_t n; - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - AlarmsDefault(n); - } -} - -/** - * Clear an alarm - * @param alarm The system alarm to be modified - * @return 0 if success, -1 if an error - */ -int32_t AlarmsClear(SystemAlarmsAlarmElem alarm) -{ - return AlarmsSet(alarm, SYSTEMALARMS_ALARM_OK); -} - -/** - * Clear all alarms - */ -void AlarmsClearAll() -{ - uint32_t n; - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - AlarmsClear(n); - } -} - -/** - * Check if there are any alarms with the given or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasWarnings() -{ - return hasSeverity(SYSTEMALARMS_ALARM_WARNING); -} - -/** - * Check if there are any alarms with error or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasErrors() -{ - return hasSeverity(SYSTEMALARMS_ALARM_ERROR); -}; - -/** - * Check if there are any alarms with critical or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -int32_t AlarmsHasCritical() -{ - return hasSeverity(SYSTEMALARMS_ALARM_CRITICAL); -}; - -/** - * Check if there are any alarms with the given or higher severity - * @return 0 if no alarms are found, 1 if at least one alarm is found - */ -static int32_t hasSeverity(SystemAlarmsAlarmOptions severity) -{ - SystemAlarmsData alarms; - uint32_t n; - - // Lock - xSemaphoreTakeRecursive(lock, portMAX_DELAY); - - // Read alarms - SystemAlarmsGet(&alarms); - - // Go through alarms and check if any are of the given severity or higher - for (n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) - { - if ( alarms.Alarm[n] >= severity) - { - xSemaphoreGiveRecursive(lock); - return 1; - } - } - - // If this point is reached then no alarms found - xSemaphoreGiveRecursive(lock); - return 0; -} -/** - * @} - * @} - */ - diff --git a/flight/targets/SimPosix/System/inc/alarms.h b/flight/targets/SimPosix/System/inc/alarms.h deleted file mode 100644 index 0f0faeb8f..000000000 --- a/flight/targets/SimPosix/System/inc/alarms.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotLibraries OpenPilot System Libraries - * @{ - * @file alarms.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Include file of the alarm library - * @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 ALARMS_H -#define ALARMS_H - -#include "systemalarms.h" -#define SYSTEMALARMS_ALARM_DEFAULT SYSTEMALARMS_ALARM_UNINITIALISED - -int32_t AlarmsInitialize(void); -int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity); -SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm); -int32_t AlarmsDefault(SystemAlarmsAlarmElem alarm); -void AlarmsDefaultAll(); -int32_t AlarmsClear(SystemAlarmsAlarmElem alarm); -void AlarmsClearAll(); -int32_t AlarmsHasWarnings(); -int32_t AlarmsHasErrors(); -int32_t AlarmsHasCritical(); - -#endif // ALARMS_H - -/** - * @} - * @} - */ diff --git a/ground/openpilotgcs/bin/openpilotgcs b/ground/openpilotgcs/bin/openpilotgcs old mode 100644 new mode 100755 diff --git a/ground/openpilotgcs/openpilotgcs.pro b/ground/openpilotgcs/openpilotgcs.pro index 57a5f1ecf..de158d9eb 100644 --- a/ground/openpilotgcs/openpilotgcs.pro +++ b/ground/openpilotgcs/openpilotgcs.pro @@ -4,9 +4,9 @@ # #version check qt -contains(QT_VERSION, ^4\\.[0-5]\\..*) { +contains(QT_VERSION, ^4\\.[0-7]\\..*) { message("Cannot build OpenPilot GCS with Qt version $${QT_VERSION}.") - error("Cannot build OpenPilot GCS with Qt version $${QT_VERSION}. Use at least Qt 4.6!") + error("Cannot build OpenPilot GCS with Qt version $${QT_VERSION}. Use at least Qt 4.8!") } include(openpilotgcs.pri) diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml index 5050e9f23..ebf05396c 100644 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml +++ b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml @@ -1570,6 +1570,28 @@ false + + + false + 0.0.0 + + + %%DATAPATH%%models/boards/Revolution/revolution.3ds + %%DATAPATH%%models/backgrounds/default_background.png + false + + + + + false + 0.0.0 + + + %%DATAPATH%%models/planes/zagi/zagi.3ds + %%DATAPATH%%models/backgrounds/default_background.png + false + + false diff --git a/ground/openpilotgcs/share/openpilotgcs/models/boards/Revolution/Revolution.3DS b/ground/openpilotgcs/share/openpilotgcs/models/boards/Revolution/Revolution.3DS new file mode 100644 index 000000000..58cfe8d6d Binary files /dev/null and b/ground/openpilotgcs/share/openpilotgcs/models/boards/Revolution/Revolution.3DS differ diff --git a/ground/openpilotgcs/share/openpilotgcs/models/boards/Revolution/TEXTURE.PNG b/ground/openpilotgcs/share/openpilotgcs/models/boards/Revolution/TEXTURE.PNG new file mode 100644 index 000000000..cfc4d7f6a Binary files /dev/null and b/ground/openpilotgcs/share/openpilotgcs/models/boards/Revolution/TEXTURE.PNG differ diff --git a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/CC.PNG b/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/CC.PNG deleted file mode 100644 index 467f34a97..000000000 Binary files a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/CC.PNG and /dev/null differ diff --git a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-QT_+.3DS b/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-QT_+.3DS old mode 100644 new mode 100755 index 1879b07c6..9d0d2de8c Binary files a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-QT_+.3DS and b/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-QT_+.3DS differ diff --git a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-QT_X.3DS b/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-QT_X.3DS old mode 100644 new mode 100755 index f26dacb45..a29de2543 Binary files a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-QT_X.3DS and b/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-QT_X.3DS differ diff --git a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-Q_+.3DS b/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-Q_+.3DS old mode 100644 new mode 100755 index 21fbccf01..d4bb3dfbf Binary files a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-Q_+.3DS and b/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-Q_+.3DS differ diff --git a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-Q_X.3DS b/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-Q_X.3DS old mode 100644 new mode 100755 index 529e60fac..cb0f3e995 Binary files a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-Q_X.3DS and b/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/J14-Q_X.3DS differ diff --git a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/TEXTURE.JPG b/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/TEXTURE.JPG new file mode 100644 index 000000000..9e5500340 Binary files /dev/null and b/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/TEXTURE.JPG differ diff --git a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/TEXTURE.PNG b/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/TEXTURE.PNG deleted file mode 100644 index 5d26bb120..000000000 Binary files a/ground/openpilotgcs/share/openpilotgcs/models/multi/joes_cnc/TEXTURE.PNG and /dev/null differ diff --git a/ground/openpilotgcs/share/openpilotgcs/models/planes/zagi/texture.jpg b/ground/openpilotgcs/share/openpilotgcs/models/planes/zagi/texture.jpg new file mode 100755 index 000000000..2d1722d91 Binary files /dev/null and b/ground/openpilotgcs/share/openpilotgcs/models/planes/zagi/texture.jpg differ diff --git a/ground/openpilotgcs/share/openpilotgcs/models/planes/zagi/zagi.3ds b/ground/openpilotgcs/share/openpilotgcs/models/planes/zagi/zagi.3ds new file mode 100755 index 000000000..232cdef5d Binary files /dev/null and b/ground/openpilotgcs/share/openpilotgcs/models/planes/zagi/zagi.3ds differ diff --git a/ground/openpilotgcs/share/openpilotgcs/models/planes/zagi/zagi.jpg b/ground/openpilotgcs/share/openpilotgcs/models/planes/zagi/zagi.jpg new file mode 100755 index 000000000..18d592291 Binary files /dev/null and b/ground/openpilotgcs/share/openpilotgcs/models/planes/zagi/zagi.jpg differ diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/pfd.svg b/ground/openpilotgcs/share/openpilotgcs/pfd/default/pfd.svg index 2fb70210c..abdc4f8c5 100755 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/pfd.svg +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/pfd.svg @@ -15,7 +15,7 @@ id="svg2" version="1.1" inkscape:version="0.48.3.1 r9886" - sodipodi:docname="pfd-6.svg" + sodipodi:docname="pfd-11.svg" style="display:inline" inkscape:export-filename="C:\Users\Nuno\Desktop\OpenPilot\PFD\PFD-4.png" inkscape:export-xdpi="71.993568" @@ -1615,14 +1615,14 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="1" - inkscape:cx="568.94653" - inkscape:cy="247.78161" + inkscape:zoom="1.1617336" + inkscape:cx="415.72223" + inkscape:cy="353.78162" inkscape:document-units="px" - inkscape:current-layer="layer41" + inkscape:current-layer="svg2" showgrid="false" - inkscape:window-width="1680" - inkscape:window-height="987" + inkscape:window-width="1920" + inkscape:window-height="1017" inkscape:window-x="-4" inkscape:window-y="-4" inkscape:window-maximized="1" @@ -1721,7 +1721,7 @@ image/svg+xml - + @@ -2227,6 +2227,66 @@ x1="460.75775" style="fill:none;stroke:#ffffff;stroke-width:2.61937094;display:inline" /> + SPD + + ALT + m/s + m + style="display:inline" + sodipodi:insensitive="true"> + inkscape:label="vsi-window" + style="display:inline" + sodipodi:insensitive="true"> 1 + + + ft/s + VSI + + + id="g10197" + transform="translate(62,-40)"> 1250m diff --git a/ground/openpilotgcs/src/app/gcsversioninfo.pri b/ground/openpilotgcs/src/app/gcsversioninfo.pri index 0dbf3e19e..cc1d9c629 100644 --- a/ground/openpilotgcs/src/app/gcsversioninfo.pri +++ b/ground/openpilotgcs/src/app/gcsversioninfo.pri @@ -5,14 +5,37 @@ # the other dependencies evaluation. # +# We use python to extract git version info, but it may be installed locally. +# This expected python version should be kept in sync with make/tools.mk. +PYTHON_DIR = python-2.7.4 + # Since debug_and_release option is set, we need this !debug_and_release|build_pass { - ROOT_DIR = $$GCS_SOURCE_TREE/../.. + + ROOT_DIR = $$GCS_SOURCE_TREE/../.. + + # Search the python using environment override first + OPENPILOT_TOOLS_DIR = $$(OPENPILOT_TOOLS_DIR) + !isEmpty(OPENPILOT_TOOLS_DIR):exists($$OPENPILOT_TOOLS_DIR/$$PYTHON_DIR/python*) { + PYTHON = \"$$OPENPILOT_TOOLS_DIR/$$PYTHON_DIR/python\" + } else { + # If not found, search the predefined tools path + exists($$ROOT_DIR/tools/$$PYTHON_DIR/python*) { + PYTHON = \"$$ROOT_DIR/tools/$$PYTHON_DIR/python\" + } else { + # not found, hope it's in the path... + PYTHON = \"python\" + } + } + PYTHON = $$replace(PYTHON, \\\\, /) + message(Using python interpreter: $$PYTHON) + + # Define other variables VERSION_INFO_DIR = $$GCS_BUILD_TREE/../openpilotgcs-synthetics VERSION_INFO_HEADER = $$VERSION_INFO_DIR/gcs_version_info.h VERSION_INFO_SCRIPT = $$ROOT_DIR/make/scripts/version-info.py VERSION_INFO_TEMPLATE = $$ROOT_DIR/make/templates/gcs_version_info_template.h - VERSION_INFO_COMMAND = python \"$$VERSION_INFO_SCRIPT\" + VERSION_INFO_COMMAND = $$PYTHON \"$$VERSION_INFO_SCRIPT\" UAVO_DEF_PATH = $$ROOT_DIR/shared/uavobjectdefinition # Create custom version_info target which generates a header diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp index e9c9f8708..67083b941 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp @@ -125,23 +125,23 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : connect(m_config->wzBack,SIGNAL(clicked()),this,SLOT(wzBack())); m_config->stackedWidget->setCurrentIndex(0); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos1,0,1,true); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos2,1,1,true); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos3,2,1,true); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos4,3,1,true); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos5,4,1,true); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos6,5,1,true); - addUAVObjectToWidgetRelation("ManualControlSettings","FlightModeNumber",m_config->fmsPosNum); + addUAVObjectToWidgetRelation("ManualControlSettings", "FlightModePosition", m_config->fmsModePos1, 0, 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "FlightModePosition", m_config->fmsModePos2, 1, 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "FlightModePosition", m_config->fmsModePos3, 2, 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "FlightModePosition", m_config->fmsModePos4, 3, 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "FlightModePosition", m_config->fmsModePos5, 4, 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "FlightModePosition", m_config->fmsModePos6, 5, 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "FlightModeNumber", m_config->fmsPosNum); - addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization1Settings",m_config->fmsSsPos1Roll,"Roll"); - addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization2Settings",m_config->fmsSsPos2Roll,"Roll"); - addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization3Settings",m_config->fmsSsPos3Roll,"Roll"); - addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization1Settings",m_config->fmsSsPos1Pitch,"Pitch"); - addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization2Settings",m_config->fmsSsPos2Pitch,"Pitch"); - addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization3Settings",m_config->fmsSsPos3Pitch,"Pitch"); - addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization1Settings",m_config->fmsSsPos1Yaw,"Yaw"); - addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization2Settings",m_config->fmsSsPos2Yaw,"Yaw"); - addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization3Settings",m_config->fmsSsPos3Yaw,"Yaw"); + addUAVObjectToWidgetRelation("ManualControlSettings", "Stabilization1Settings", m_config->fmsSsPos1Roll, "Roll", 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "Stabilization2Settings", m_config->fmsSsPos2Roll, "Roll", 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "Stabilization3Settings", m_config->fmsSsPos3Roll, "Roll", 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "Stabilization1Settings", m_config->fmsSsPos1Pitch, "Pitch", 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "Stabilization2Settings", m_config->fmsSsPos2Pitch, "Pitch", 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "Stabilization3Settings", m_config->fmsSsPos3Pitch, "Pitch", 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "Stabilization1Settings", m_config->fmsSsPos1Yaw, "Yaw", 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "Stabilization2Settings", m_config->fmsSsPos2Yaw, "Yaw", 1, true); + addUAVObjectToWidgetRelation("ManualControlSettings", "Stabilization3Settings", m_config->fmsSsPos3Yaw, "Yaw", 1, true); addUAVObjectToWidgetRelation("ManualControlSettings","Arming",m_config->armControl); addUAVObjectToWidgetRelation("ManualControlSettings","ArmedTimeout",m_config->armTimeout,0,1000); diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp index 0c2b1698b..b3af75613 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp @@ -101,18 +101,27 @@ void UAVObjectField::constructorInitialize(const QString& name, const QString& u void UAVObjectField::limitsInitialize(const QString &limits) { - /// format - /// (TY)->type (EQ-equal;NE-not equal;BE-between;BI-bigger;SM-smaller) - /// (VALX)->value - /// %TY:VAL1:VAL2:VAL3,%TY,VAL1,VAL2,VAL3 - /// example: first element bigger than 3 and second element inside [2.3,5] - /// "%BI:3,%BE:2.3:5" + // Limit string format: + // % - start char + // XXXX - optional BOARD_TYPE and BOARD_REVISION (4 hex digits) + // TY - rule type (EQ-equal, NE-not equal, BE-between, BI-bigger, SM-smaller) + // VAL - values for TY separated by colon + // , - rule separator (may have leading or trailing spaces) + // ; - element separator (may have leading or trailing spaces) + // + // Examples: + // Disable few flight modes for Revo (00903): + // "%0903NE:Autotune:VelocityControl:PositionHold:ReturnToBase:Land:PathPlanner" + // Original CC board (rev 1), first element bigger than 3 and second element inside [2.3-5.0]: + // "%0401BI:3; %BE:2.3:5" + // Set applicable range [0-500] for 3 elements of array for all boards: + // "%BE:0:500; %BE:0:500; %BE:0:500" if(limits.isEmpty()) return; - QStringList stringPerElement=limits.split(","); + QStringList stringPerElement = limits.split(";"); quint32 index=0; foreach (QString str, stringPerElement) { - QStringList ruleList=str.split(";"); + QStringList ruleList = str.split(","); QList limitList; foreach(QString rule,ruleList) { diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/devicedescriptorstruct.h b/ground/openpilotgcs/src/plugins/uavobjectutil/devicedescriptorstruct.h index d1f1eb523..fb7cf2288 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/devicedescriptorstruct.h +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/devicedescriptorstruct.h @@ -15,28 +15,35 @@ public: static QString idToBoardName(int id) { switch (id) { - case 0x0101://MB + case 0x0101: + // MB return QString("OpenPilot MainBoard"); break; - case 0x0201://INS + case 0x0201: + // INS return QString("OpenPilot INS"); break; - case 0x0301://PipX + case 0x0301: + // OPLink Mini return QString("OPLink"); break; - case 0x0401://Coptercontrol + case 0x0401: + // Coptercontrol return QString("CopterControl"); break; - case 0x0402://Coptercontrol + case 0x0402: + // Coptercontrol 3D // It would be nice to say CC3D here but since currently we use string comparisons // for firmware compatibility and the filename path that would break return QString("CopterControl"); break; - case 0x0901://Revolution + case 0x0901: + // Revolution return QString("Revolution"); break; - case 0x0903://Revomini - return QString("Revomini"); + case 0x0903: + // Revo Mini + return QString("Revolution"); break; default: return QString(""); diff --git a/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp b/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp index 081a847c2..f2e7b9c73 100644 --- a/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp @@ -26,7 +26,7 @@ */ #include "devicewidget.h" -deviceWidget::deviceWidget(QWidget *parent) : +DeviceWidget::DeviceWidget(QWidget *parent) : QWidget(parent) { myDevice = new Ui_deviceWidget(); @@ -47,8 +47,7 @@ deviceWidget::deviceWidget(QWidget *parent) : myDevice->lblCertified->setText(""); } - -void deviceWidget::showEvent(QShowEvent *event) +void DeviceWidget::showEvent(QShowEvent *event) { Q_UNUSED(event) // Thit fitInView method should only be called now, once the @@ -57,18 +56,18 @@ void deviceWidget::showEvent(QShowEvent *event) myDevice->gVDevice->fitInView(devicePic.rect(),Qt::KeepAspectRatio); } -void deviceWidget::resizeEvent(QResizeEvent* event) +void DeviceWidget::resizeEvent(QResizeEvent* event) { Q_UNUSED(event); myDevice->gVDevice->fitInView(devicePic.rect(), Qt::KeepAspectRatio); } - -void deviceWidget::setDeviceID(int devID){ +void DeviceWidget::setDeviceID(int devID) +{ deviceID = devID; } -void deviceWidget::setDfu(DFUObject *dfu) +void DeviceWidget::setDfu(DFUObject *dfu) { m_dfu = dfu; } @@ -76,9 +75,8 @@ void deviceWidget::setDfu(DFUObject *dfu) /** Fills the various fields for the device */ -void deviceWidget::populate() +void DeviceWidget::populate() { - int id = m_dfu->devices[deviceID].ID; myDevice->lbldevID->setText(QString("Device ID: ") + QString::number(id, 16)); // DeviceID tells us what sort of HW we have detected: @@ -89,13 +87,11 @@ void deviceWidget::populate() switch (id) { case 0x0101: - devicePic.load("");//TODO - break; case 0x0201: - devicePic.load("");//TODO + devicePic.load(""); break; case 0x0301: - devicePic.load(":/uploader/images/pipx.png"); + devicePic.load(":/uploader/images/gcs-board-oplink.png"); break; case 0x0401: devicePic.load(":/uploader/images/gcs-board-cc.png"); @@ -103,7 +99,12 @@ void deviceWidget::populate() case 0x0402: devicePic.load(":/uploader/images/gcs-board-cc3d.png"); break; + case 0x0903: + devicePic.load(":/uploader/images/gcs-board-revo.png"); + break; default: + // Clear + devicePic.load(""); break; } myDevice->gVDevice->scene()->addPixmap(devicePic); @@ -141,12 +142,12 @@ void deviceWidget::populate() Freezes the contents of the widget so that a user cannot try to modify the contents */ -void deviceWidget::freeze() +void DeviceWidget::freeze() { updateButtons(false); } -void deviceWidget::updateButtons(bool enabled) +void DeviceWidget::updateButtons(bool enabled) { if (!enabled) { myDevice->description->setEnabled(false); @@ -171,22 +172,19 @@ void deviceWidget::updateButtons(bool enabled) Populates the widget field with the description in case it is structured properly */ -bool deviceWidget::populateBoardStructuredDescription(QByteArray desc) +bool DeviceWidget::populateBoardStructuredDescription(QByteArray desc) { - if(UAVObjectUtilManager::descriptionToStructure(desc,onBoardDescription)) - { + if(UAVObjectUtilManager::descriptionToStructure(desc,onBoardDescription)) { myDevice->lblGitTag->setText(onBoardDescription.gitHash); myDevice->lblBuildDate->setText(onBoardDescription.gitDate.insert(4,"-").insert(7,"-")); - if(onBoardDescription.gitTag.startsWith("RELEASE",Qt::CaseSensitive)) - { + if(onBoardDescription.gitTag.startsWith("RELEASE",Qt::CaseSensitive)) { myDevice->lblDescription->setText(onBoardDescription.gitTag); QPixmap pix = QPixmap(QString(":uploader/images/application-certificate.svg")); myDevice->lblCertified->setPixmap(pix); myDevice->lblCertified->setToolTip(tr("Tagged officially released firmware build")); } - else - { + else { myDevice->lblDescription->setText(onBoardDescription.gitTag); QPixmap pix = QPixmap(QString(":uploader/images/warning.svg")); myDevice->lblCertified->setPixmap(pix); @@ -199,24 +197,20 @@ bool deviceWidget::populateBoardStructuredDescription(QByteArray desc) } return false; - } -bool deviceWidget::populateLoadedStructuredDescription(QByteArray desc) + +bool DeviceWidget::populateLoadedStructuredDescription(QByteArray desc) { - if(UAVObjectUtilManager::descriptionToStructure(desc,LoadedDescription)) - { + if(UAVObjectUtilManager::descriptionToStructure(desc,LoadedDescription)) { myDevice->lblGitTagL->setText(LoadedDescription.gitHash); - myDevice->lblBuildDateL->setText( LoadedDescription.gitDate.insert(4,"-").insert(7,"-")); - if(LoadedDescription.gitTag.startsWith("RELEASE",Qt::CaseSensitive)) - { + myDevice->lblBuildDateL->setText( LoadedDescription.gitDate.insert(4, "-").insert(7, "-")); + if(LoadedDescription.gitTag.startsWith("RELEASE",Qt::CaseSensitive)) { myDevice->lblDescritpionL->setText(LoadedDescription.gitTag); myDevice->description->setText(LoadedDescription.gitTag); QPixmap pix = QPixmap(QString(":uploader/images/application-certificate.svg")); myDevice->lblCertifiedL->setPixmap(pix); myDevice->lblCertifiedL->setToolTip(tr("Tagged officially released firmware build")); - } - else - { + } else { myDevice->lblDescritpionL->setText(LoadedDescription.gitTag); myDevice->description->setText(LoadedDescription.gitTag); QPixmap pix = QPixmap(QString(":uploader/images/warning.svg")); @@ -227,19 +221,18 @@ bool deviceWidget::populateLoadedStructuredDescription(QByteArray desc) return true; } - return false; - } + /** Updates status message for messages coming from DFU */ -void deviceWidget::dfuStatus(QString str) +void DeviceWidget::dfuStatus(QString str) { status(str, STATUSICON_RUNNING); } -void deviceWidget::confirmCB(int value) +void DeviceWidget::confirmCB(int value) { updateButtons(true); } @@ -247,7 +240,7 @@ void deviceWidget::confirmCB(int value) /** Updates status message */ -void deviceWidget::status(QString str, StatusIcon ic) +void DeviceWidget::status(QString str, StatusIcon ic) { QPixmap px; myDevice->statusLabel->setText(str); @@ -267,8 +260,7 @@ void deviceWidget::status(QString str, StatusIcon ic) myDevice->statusIcon->setPixmap(px); } - -void deviceWidget::loadFirmware() +void DeviceWidget::loadFirmware() { myDevice->verticalGroupBox_loaded->setVisible(false); myDevice->groupCustom->setVisible(false); @@ -295,13 +287,12 @@ void deviceWidget::loadFirmware() QPixmap px; if (loadedFW.length()>m_dfu->devices[deviceID].SizeOfCode) { myDevice->lblCRCL->setText(tr("Can't calculate, file too big for device")); - } - else { + } else { myDevice->lblCRCL->setText( QString::number(DFUObject::CRCFromQBArray(loadedFW,m_dfu->devices[deviceID].SizeOfCode))); } + //myDevice->lblFirmwareSizeL->setText(QString("Firmware size: ")+QVariant(loadedFW.length()).toString()+ QString(" bytes")); - if (populateLoadedStructuredDescription(desc)) - { + if (populateLoadedStructuredDescription(desc)) { myDevice->confirmCheckBox->setChecked(true); myDevice->verticalGroupBox_loaded->setVisible(true); myDevice->groupCustom->setVisible(false); @@ -335,7 +326,7 @@ void deviceWidget::loadFirmware() /** Sends a firmware to the device */ -void deviceWidget::uploadFirmware() +void DeviceWidget::uploadFirmware() { // clear progress bar now // this avoids displaying an error message and the progress at 100% at the same time @@ -418,7 +409,7 @@ void deviceWidget::uploadFirmware() /** Retrieves the firmware from the device */ -void deviceWidget::downloadFirmware() +void DeviceWidget::downloadFirmware() { // clear progress bar now // this avoids displaying an error message and the progress at 100% at the same time @@ -462,7 +453,7 @@ void deviceWidget::downloadFirmware() /** Callback for the firmware download result */ -void deviceWidget::downloadFinished() +void DeviceWidget::downloadFinished() { disconnect(m_dfu, SIGNAL(downloadFinished()), this, SLOT(downloadFinished())); disconnect(m_dfu, SIGNAL(progressUpdated(int)), this, SLOT(setProgress(int))); @@ -478,7 +469,7 @@ void deviceWidget::downloadFinished() /** Callback for the firmware upload result */ -void deviceWidget::uploadFinished(OP_DFU::Status retstatus) +void DeviceWidget::uploadFinished(OP_DFU::Status retstatus) { disconnect(m_dfu, SIGNAL(uploadFinished(OP_DFU::Status)), this, SLOT(uploadFinished(OP_DFU::Status))); disconnect(m_dfu, SIGNAL(progressUpdated(int)), this, SLOT(setProgress(int))); @@ -525,7 +516,7 @@ void deviceWidget::uploadFinished(OP_DFU::Status retstatus) /** Slot to update the progress bar */ -void deviceWidget::setProgress(int percent) +void DeviceWidget::setProgress(int percent) { myDevice->progressBar->setValue(percent); } @@ -533,7 +524,7 @@ void deviceWidget::setProgress(int percent) /** *Opens an open file dialog. */ -QString deviceWidget::setOpenFileName() +QString DeviceWidget::setOpenFileName() { QFileDialog::Options options; QString selectedFilter; @@ -572,7 +563,7 @@ QString deviceWidget::setOpenFileName() /** *Set the save file name */ -QString deviceWidget::setSaveFileName() +QString DeviceWidget::setSaveFileName() { QFileDialog::Options options; QString selectedFilter; diff --git a/ground/openpilotgcs/src/plugins/uploader/devicewidget.h b/ground/openpilotgcs/src/plugins/uploader/devicewidget.h index bc44b8883..b87988c16 100644 --- a/ground/openpilotgcs/src/plugins/uploader/devicewidget.h +++ b/ground/openpilotgcs/src/plugins/uploader/devicewidget.h @@ -45,11 +45,11 @@ #include "uploader_global.h" using namespace OP_DFU; -class UPLOADER_EXPORT deviceWidget : public QWidget +class UPLOADER_EXPORT DeviceWidget : public QWidget { Q_OBJECT public: - deviceWidget(QWidget *parent = 0); + DeviceWidget(QWidget *parent = 0); void setDeviceID(int devID); void setDfu(DFUObject* dfu); void populate(); diff --git a/ground/openpilotgcs/src/plugins/uploader/devicewidget.ui b/ground/openpilotgcs/src/plugins/uploader/devicewidget.ui index b7c7849da..cc1aec074 100644 --- a/ground/openpilotgcs/src/plugins/uploader/devicewidget.ui +++ b/ground/openpilotgcs/src/plugins/uploader/devicewidget.ui @@ -6,7 +6,7 @@ 0 0 - 576 + 584 500 @@ -24,18 +24,27 @@ - + 160 160 + + + 350 + 350 + + background: transparent QFrame::NoFrame + + QPainter::HighQualityAntialiasing + diff --git a/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-cc.png b/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-cc.png index ee096b76e..ee6affc3c 100644 Binary files a/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-cc.png and b/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-cc.png differ diff --git a/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-cc3d.png b/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-cc3d.png index 69fd4aa8c..24326c952 100644 Binary files a/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-cc3d.png and b/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-cc3d.png differ diff --git a/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-oplink.png b/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-oplink.png new file mode 100644 index 000000000..34cadf8bf Binary files /dev/null and b/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-oplink.png differ diff --git a/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-revo.png b/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-revo.png new file mode 100644 index 000000000..7580003ba Binary files /dev/null and b/ground/openpilotgcs/src/plugins/uploader/images/gcs-board-revo.png differ diff --git a/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.cpp b/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.cpp index 143d1e81c..539a3042f 100644 --- a/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.cpp @@ -27,7 +27,8 @@ #include "runningdevicewidget.h" #include "devicedescriptorstruct.h" #include "uploadergadgetwidget.h" -runningDeviceWidget::runningDeviceWidget(QWidget *parent) : + +RunningDeviceWidget::RunningDeviceWidget(QWidget *parent) : QWidget(parent) { myDevice = new Ui_runningDeviceWidget(); @@ -35,11 +36,9 @@ runningDeviceWidget::runningDeviceWidget(QWidget *parent) : // Initialization of the Device icon display myDevice->devicePicture->setScene(new QGraphicsScene(this)); - } - -void runningDeviceWidget::showEvent(QShowEvent *event) +void RunningDeviceWidget::showEvent(QShowEvent *event) { Q_UNUSED(event) // Thit fitInView method should only be called now, once the @@ -48,7 +47,7 @@ void runningDeviceWidget::showEvent(QShowEvent *event) myDevice->devicePicture->fitInView(devicePic.rect(),Qt::KeepAspectRatio); } -void runningDeviceWidget::resizeEvent(QResizeEvent* event) +void RunningDeviceWidget::resizeEvent(QResizeEvent* event) { Q_UNUSED(event); myDevice->devicePicture->fitInView(devicePic.rect(), Qt::KeepAspectRatio); @@ -57,31 +56,28 @@ void runningDeviceWidget::resizeEvent(QResizeEvent* event) /** Fills the various fields for the device */ -void runningDeviceWidget::populate() +void RunningDeviceWidget::populate() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); UAVObjectUtilManager* utilMngr = pm->getObject(); int id = utilMngr->getBoardModel(); myDevice->lblDeviceID->setText(QString("Device ID: ") + QString::number(id, 16)); myDevice->lblBoardName->setText(deviceDescriptorStruct::idToBoardName(id)); - myDevice->lblHWRev->setText(QString(tr("HW Revision: "))+QString::number(id & 0x00FF, 16)); - qDebug()<<"CRC"<getFirmwareCRC(); - myDevice->lblCRC->setText(QString(tr("Firmware CRC: "))+QVariant(utilMngr->getFirmwareCRC()).toString()); + myDevice->lblHWRev->setText(QString(tr("HW Revision: ")) + QString::number(id & 0x00FF, 16)); + qDebug() << "CRC" << utilMngr->getFirmwareCRC(); + myDevice->lblCRC->setText(QString(tr("Firmware CRC: ")) + QVariant(utilMngr->getFirmwareCRC()).toString()); // DeviceID tells us what sort of HW we have detected: // display a nice icon: myDevice->devicePicture->scene()->clear(); switch (id) { case 0x0101: - devicePic.load("");//TODO - break; case 0x0201: - devicePic.load("");//TODO + devicePic.load(""); break; case 0x0301: - devicePic.load(":/uploader/images/pipx.png"); + devicePic.load(":/uploader/images/gcs-board-oplink.png"); break; case 0x0401: devicePic.load(":/uploader/images/gcs-board-cc.png"); @@ -89,7 +85,12 @@ void runningDeviceWidget::populate() case 0x0402: devicePic.load(":/uploader/images/gcs-board-cc3d.png"); break; + case 0x0903: + devicePic.load(":/uploader/images/gcs-board-revo.png"); + break; default: + // Clear + devicePic.load(""); break; } myDevice->devicePicture->scene()->addPixmap(devicePic); @@ -97,65 +98,31 @@ void runningDeviceWidget::populate() myDevice->devicePicture->fitInView(devicePic.rect(),Qt::KeepAspectRatio); QString serial = utilMngr->getBoardCPUSerial().toHex(); - myDevice->CPUSerial->setText(serial); + myDevice->CPUSerial->setText(serial); QByteArray description = utilMngr->getBoardDescription(); deviceDescriptorStruct devDesc; - if(UAVObjectUtilManager::descriptionToStructure(description,devDesc)) - { - if(devDesc.gitTag.startsWith("RELEASE",Qt::CaseSensitive)) - { - myDevice->lblFWTag->setText(QString("Firmware tag: ")+devDesc.gitTag); + if(UAVObjectUtilManager::descriptionToStructure(description, devDesc)) { + if(devDesc.gitTag.startsWith("RELEASE",Qt::CaseSensitive)) { + myDevice->lblFWTag->setText(QString("Firmware tag: ") + devDesc.gitTag); QPixmap pix = QPixmap(QString(":uploader/images/application-certificate.svg")); myDevice->lblCertified->setPixmap(pix); myDevice->lblCertified->setToolTip(tr("Tagged officially released firmware build")); - } - else - { - myDevice->lblFWTag->setText(QString("Firmware tag: ")+devDesc.gitTag); + } else { + myDevice->lblFWTag->setText(QString("Firmware tag: ") + devDesc.gitTag); QPixmap pix = QPixmap(QString(":uploader/images/warning.svg")); myDevice->lblCertified->setPixmap(pix); myDevice->lblCertified->setToolTip(tr("Untagged or custom firmware build")); } - myDevice->lblGitCommitTag->setText("Git commit hash: "+devDesc.gitHash); + myDevice->lblGitCommitTag->setText("Git commit hash: " + devDesc.gitHash); myDevice->lblFWDate->setText(QString("Firmware date: ") + devDesc.gitDate.insert(4,"-").insert(7,"-")); - } - else - { - - myDevice->lblFWTag->setText(QString("Firmware tag: ")+QString(description).left(QString(description).indexOf(QChar(255)))); + } else { + myDevice->lblFWTag->setText(QString("Firmware tag: ") + QString(description).left(QString(description).indexOf(QChar(255)))); myDevice->lblGitCommitTag->setText("Git commit tag: Unknown"); myDevice->lblFWDate->setText(QString("Firmware date: Unknown")); QPixmap pix = QPixmap(QString(":uploader/images/warning.svg")); myDevice->lblCertified->setPixmap(pix); myDevice->lblCertified->setToolTip(tr("Custom Firmware Build")); } - //status("Ready...", STATUSICON_INFO); } - - -/** - Updates status message - */ -/* -void runningDeviceWidget::status(QString str, StatusIcon ic) -{ - QPixmap px; - myDevice->statusLabel->setText(str); - switch (ic) { - case STATUSICON_RUNNING: - px.load(QString(":/uploader/images/system-run.svg")); - break; - case STATUSICON_OK: - px.load(QString(":/uploader/images/dialog-apply.svg")); - break; - case STATUSICON_FAIL: - px.load(QString(":/uploader/images/process-stop.svg")); - break; - default: - px.load(QString(":/uploader/images/gtk-info.svg")); - } - myDevice->statusIcon->setPixmap(px); -} -*/ diff --git a/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.h b/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.h index 18b354cce..15a3d5b71 100644 --- a/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.h +++ b/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.h @@ -41,11 +41,11 @@ #include "uavobjectutilmanager.h" #include "uploader_global.h" -class UPLOADER_EXPORT runningDeviceWidget : public QWidget +class UPLOADER_EXPORT RunningDeviceWidget : public QWidget { Q_OBJECT public: - runningDeviceWidget( QWidget *parent = 0); + RunningDeviceWidget( QWidget *parent = 0); void populate(); void freeze(); QString setOpenFileName(); @@ -58,7 +58,6 @@ private: QPixmap devicePic; //void status(QString str, StatusIcon ic); - signals: protected: diff --git a/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.ui b/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.ui index b873ded19..05f5b7eaf 100644 --- a/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.ui +++ b/ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.ui @@ -6,8 +6,8 @@ 0 0 - 516 - 299 + 561 + 387 @@ -22,12 +22,18 @@ - + 160 160 + + + 350 + 350 + + background: transparent @@ -43,12 +49,21 @@ Qt::ScrollBarAlwaysOff + + QPainter::HighQualityAntialiasing + + + + 0 + 0 + + TextLabel @@ -56,6 +71,12 @@ + + + 0 + 0 + + TextLabel @@ -63,6 +84,12 @@ + + + 0 + 0 + + TextLabel @@ -72,6 +99,12 @@ + + + 0 + 0 + + CPU Serial: @@ -79,6 +112,12 @@ + + + 0 + 0 + + true @@ -86,8 +125,34 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + diff --git a/ground/openpilotgcs/src/plugins/uploader/uploader.qrc b/ground/openpilotgcs/src/plugins/uploader/uploader.qrc index 2c21df666..d2cd82ca6 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploader.qrc +++ b/ground/openpilotgcs/src/plugins/uploader/uploader.qrc @@ -16,5 +16,7 @@ images/gcs-board-cc.png images/gcs-board-cc3d.png images/pipx.png + images/gcs-board-oplink.png + images/gcs-board-revo.png diff --git a/ground/openpilotgcs/src/plugins/uploader/uploader.ui b/ground/openpilotgcs/src/plugins/uploader/uploader.ui index 397573535..99f06b2a2 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploader.ui +++ b/ground/openpilotgcs/src/plugins/uploader/uploader.ui @@ -175,7 +175,7 @@ halting a running board. 0 - + Mainboard @@ -186,14 +186,14 @@ halting a running board. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To upgrade the firmware in your boards, proceed as follows:</p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- Connect telemetry</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- Once telemetry is running, press &quot;Halt&quot; above</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- You will get a list of devices.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- You can then upload/download to/from each board as you wish</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- You can resume operations by pressing &quot;Boot&quot;</p></body></html> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">To upgrade the firmware in your boards, proceed as follows:</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">- Connect telemetry</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">- Once telemetry is running, press &quot;Halt&quot; above</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">- You will get a list of devices.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">- You can then upload/download to/from each board as you wish</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">- You can resume operations by pressing &quot;Boot&quot;</span></p></body></html> @@ -208,8 +208,8 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p></body></html> diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp index 86c7ffcd6..1be9aa1ec 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp @@ -118,10 +118,10 @@ QString UploaderGadgetWidget::getPortDevice(const QString &friendName) void UploaderGadgetWidget::connectSignalSlot(QWidget *widget) { - connect(qobject_cast(widget),SIGNAL(uploadStarted()),this,SLOT(uploadStarted())); - connect(qobject_cast(widget),SIGNAL(uploadEnded(bool)),this,SLOT(uploadEnded(bool))); - connect(qobject_cast(widget),SIGNAL(downloadStarted()),this,SLOT(downloadStarted())); - connect(qobject_cast(widget),SIGNAL(downloadEnded(bool)),this,SLOT(downloadEnded(bool))); + connect(qobject_cast(widget),SIGNAL(uploadStarted()),this,SLOT(uploadStarted())); + connect(qobject_cast(widget),SIGNAL(uploadEnded(bool)),this,SLOT(uploadEnded(bool))); + connect(qobject_cast(widget),SIGNAL(downloadStarted()),this,SLOT(downloadStarted())); + connect(qobject_cast(widget),SIGNAL(downloadEnded(bool)),this,SLOT(downloadEnded(bool))); } FlightStatus *UploaderGadgetWidget::getFlightStatus() @@ -147,7 +147,7 @@ void UploaderGadgetWidget::onPhisicalHWConnect() Enables widget buttons if autopilot connected */ void UploaderGadgetWidget::onAutopilotConnect(){ - QTimer::singleShot(1000,this,SLOT(populate())); + QTimer::singleShot(1000, this, SLOT(populate())); } void UploaderGadgetWidget::populate() @@ -166,7 +166,7 @@ void UploaderGadgetWidget::populate() m_config->systemElements->removeTab(0); delete qw; } - runningDeviceWidget* dw = new runningDeviceWidget(this); + RunningDeviceWidget* dw = new RunningDeviceWidget(this); dw->populate(); m_config->systemElements->addTab(dw, QString("Connected Device")); } @@ -175,6 +175,7 @@ void UploaderGadgetWidget::populate() Enables widget buttons if autopilot disconnected */ void UploaderGadgetWidget::onAutopilotDisconnect(){ + m_config->haltButton->setEnabled(false); m_config->resetButton->setEnabled(false); m_config->bootButton->setEnabled(true); @@ -188,7 +189,6 @@ void UploaderGadgetWidget::onAutopilotDisconnect(){ } } - /** Tell the mainboard to go to bootloader: - Send the relevant IAP commands @@ -332,7 +332,7 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success) delete qw; } for(int i=0;inumberOfDevices;i++) { - deviceWidget* dw = new deviceWidget(this); + DeviceWidget* dw = new DeviceWidget(this); connectSignalSlot(dw); dw->setDeviceID(i); dw->setDfu(dfu); @@ -477,7 +477,7 @@ void UploaderGadgetWidget::commonSystemBoot(bool safeboot) for (int i=0; i< m_config->systemElements->count(); i++) { // OP-682 arriving here too "early" (before the devices are refreshed) was leading to a crash // OP-682 the crash was due to an unchecked cast in the line below that would cast a RunningDeviceGadget to a DeviceGadget - deviceWidget *qw = dynamic_cast(m_config->systemElements->widget(i)); + DeviceWidget *qw = dynamic_cast(m_config->systemElements->widget(i)); if (qw) { // OP-682 fixed a second crash by disabling *all* buttons in the device widget // disabling the buttons is only half of the solution as even if the buttons are enabled @@ -729,7 +729,7 @@ void UploaderGadgetWidget::systemRescue() return; } for(int i=0;inumberOfDevices;i++) { - deviceWidget* dw = new deviceWidget(this); + DeviceWidget* dw = new DeviceWidget(this); connectSignalSlot(dw); dw->setDeviceID(i); dw->setDfu(dfu); diff --git a/make/apps-defs.mk b/make/apps-defs.mk index 20bb858c0..1f23dc493 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -101,8 +101,8 @@ SRC += $(MATHLIB)/sin_lookup.c SRC += $(MATHLIB)/pid.c ## Modules -SRC += $(foreach mod, $(MODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c)) -SRC += $(foreach mod, $(OPTMODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c)) +SRC += $(foreach mod, $(MODULES), $(sort $(wildcard $(OPMODULEDIR)/$(mod)/*.c))) +SRC += $(foreach mod, $(OPTMODULES), $(sort $(wildcard $(OPMODULEDIR)/$(mod)/*.c))) # Declare all non-optional modules as built-in to force inclusion. # Built-in modules are always enabled and cannot be disabled. @@ -175,3 +175,6 @@ ifeq ($(MCU),cortex-m3) else ifeq ($(MCU),cortex-m4) LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_APP)) endif + +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) diff --git a/make/boot-defs.mk b/make/boot-defs.mk index 1e8652be4..e6aaeb22e 100644 --- a/make/boot-defs.mk +++ b/make/boot-defs.mk @@ -126,3 +126,6 @@ ifeq ($(MCU),cortex-m3) else ifeq ($(MCU),cortex-m4) LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_BL)) endif + +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) diff --git a/make/common-defs.mk b/make/common-defs.mk index 9b927a9a8..97ee3a818 100644 --- a/make/common-defs.mk +++ b/make/common-defs.mk @@ -223,13 +223,10 @@ $(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 - # Add opfw target $(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) +$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin .PHONY: elf lss sym hex bin bino opfw elf: $(OUTDIR)/$(TARGET).elf diff --git a/make/scripts/win_sdk_install.sh b/make/scripts/win_sdk_install.sh new file mode 100644 index 000000000..94297fa62 --- /dev/null +++ b/make/scripts/win_sdk_install.sh @@ -0,0 +1,96 @@ +#!/bin/bash +# +# win_sdk_install.sh - Windows toolchain install script. +# Copyright (c) 2013, The OpenPilot Team, http://www.openpilot.org +# +# 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 +# + +# This script should be launched from git bash prompt. It assumes MSYS +# environment and expects path names in the form of /C/some/path, where +# C is a drive letter, and paths are in MSYS format. It probably won't +# work under cygwin. +SCRIPT_PATH="`echo "$BASH_SOURCE" | sed 's|\\\\|/|g; s|^\(.\):|/\1|'`" +SCRIPT_NAME="`basename \"$SCRIPT_PATH\"`" +SCRIPT_DIR="`dirname \"$SCRIPT_PATH\"`" +ROOT_DIR="`pushd \"$SCRIPT_DIR/../..\" >/dev/null && pwd && popd >/dev/null`" +TOOLS_DIR="$ROOT_DIR/tools" + +# Tools URLs to fetch +WGET_URL="http://wiki.openpilot.org/download/attachments/18612236/wget.exe" +MAKE_URL="http://wiki.openpilot.org/download/attachments/18612236/make.exe" + +# Expected tools paths +WGET="$TOOLS_DIR/bin/`basename \"$WGET_URL\"`" +MAKE="$TOOLS_DIR/bin/`basename \"$MAKE_URL\"`" + +# wget is necessary to fetch other files +WGET_NAME="`basename \"$WGET\"`" +if [ ! -x "$WGET" ]; then + echo "$SCRIPT_NAME: $WGET_NAME not found, fetching from $WGET_URL" + mkdir -p "`dirname \"$WGET\"`" + + VBSCRIPT="$TOOLS_DIR/fetch.$$.vbs" + cat >"$VBSCRIPT" <<-EOF + url = WScript.Arguments.Item(0) + file = WScript.Arguments.Item(1) + + Dim xHttp: Set xHttp = CreateObject("MSXML2.ServerXMLHTTP") + xHttp.Open "GET", url, False + xHttp.setOption 2, SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS + xHttp.Send + + If xHttp.Status = 200 Then + Dim bStrm: Set bStrm = CreateObject("AdoDb.Stream") + With bStrm + .Type = 1 '// binary + .Open + .Write xHttp.ResponseBody + .SaveToFile file, 2 '// overwrite + .Close + End With + WScript.Quit(0) + Else + WScript.Quit(1) + End IF +EOF + + cscript "$VBSCRIPT" "$WGET_URL" "$WGET" + rc=$? + rm "$VBSCRIPT" + + if [ $rc -ne 0 ]; then + echo "$SCRIPT_NAME: $WGET_NAME fetch error, hope it's in the path..." + WGET="$WGET_NAME" + fi +fi + +# make is necessary to fetch all SDKs +MAKE_NAME="`basename \"$MAKE\"`" +if [ ! -x "$MAKE" ]; then + echo "$SCRIPT_NAME: $MAKE_NAME not found, fetching from $MAKE_URL" + MAKE_DIR="`dirname \"$MAKE\"`" + mkdir -p "$MAKE_DIR" + $WGET -N --content-disposition -P "$MAKE_DIR" "$MAKE_URL" + if [ $? -ne 0 ]; then + echo "$SCRIPT_NAME: $MAKE_NAME fetch error, hope it's in the path..." + MAKE="$MAKE_NAME" + fi +fi + +# Finally we can fetch all SDKs using top level Makefile +cd "$ROOT_DIR" +echo "Run 'tools/bin/make all_sdk_install' to install the other tools" +echo " or 'tools/bin/make help' for more info on make targets" diff --git a/make/tools.mk b/make/tools.mk index a8f8e0b9e..e15d2a69f 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -8,11 +8,11 @@ # # Ready to use: # arm_sdk_install +# qt_sdk_install +# mingw_install (Windows only) +# python_install (Windows only) # # TODO: -# wget_win_install -# make_win_install -# qt_sdk_install # openocd_install # ftd2xx_install # libusb_win_install @@ -52,14 +52,28 @@ endif ############################## ifeq ($(UNAME), Linux) - ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-linux.tar.bz2 + ifeq ($(ARCH), x86_64) + ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-linux-amd64.tar.bz2 + QT_SDK_URL := "Please install native Qt 4.8.x SDK using package manager" + else + ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-linux-i686.tar.bz2 + QT_SDK_URL := "Please install native Qt 4.8.x SDK using package manager" + endif else ifeq ($(UNAME), Darwin) ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-mac.tar.bz2 + QT_SDK_URL := "Please install native Qt 4.8.x SDK using package manager" else ifeq ($(UNAME), Windows) ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-windows.tar.bz2 + QT_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-4.8.4-windows.tar.bz2 + MINGW_URL := http://wiki.openpilot.org/download/attachments/18612236/mingw-4.4.0.tar.bz2 + PYTHON_URL := http://wiki.openpilot.org/download/attachments/18612236/python-2.7.4-windows.tar.bz2 endif -ARM_SDK_DIR := $(TOOLS_DIR)/gcc-arm-none-eabi-4_7-2013q1 +# Changing PYTHON_DIR, also update it in ground\openpilotgcs\src\app\gcsversioninfo.pri +ARM_SDK_DIR := $(TOOLS_DIR)/gcc-arm-none-eabi-4_7-2013q1 +QT_SDK_DIR := $(TOOLS_DIR)/qt-4.8.4 +MINGW_DIR := $(TOOLS_DIR)/mingw-4.4.0 +PYTHON_DIR := $(TOOLS_DIR)/python-2.7.4 ############################## # @@ -67,7 +81,10 @@ ARM_SDK_DIR := $(TOOLS_DIR)/gcc-arm-none-eabi-4_7-2013q1 # ############################## -ALL_SDK_TARGETS := arm_sdk +ALL_SDK_TARGETS := arm_sdk qt_sdk +ifeq ($(UNAME), Windows) + ALL_SDK_TARGETS += mingw python +endif .PHONY: all_sdk_install all_sdk_clean all_sdk_distclean all_sdk_version all_sdk_install: $(addsuffix _install,$(ALL_SDK_TARGETS)) @@ -75,6 +92,47 @@ all_sdk_clean: $(addsuffix _clean,$(ALL_SDK_TARGETS)) all_sdk_distclean: $(addsuffix _distclean,$(ALL_SDK_TARGETS)) all_sdk_version: $(addsuffix _version,$(ALL_SDK_TARGETS)) +############################## +# +# Misc host tools +# +############################## + +export MKDIR := mkdir +export CP := cp +export RM := rm +export LN := ln +export CAT := cat +export SED := sed +export TAR := tar +export ANT := ant +export JAVAC := javac +export JAR := jar +export GIT := git +export CURL := curl +export INSTALL := install +export MD5SUM := md5sum + +# Echo in recipes is a bit tricky in a Windows Git Bash window in some cases. +# It does not work if make started under msysGit installed into a path with spaces. +ifneq ($(UNAME), Windows) + export ECHO := echo +else +# export ECHO := $(PYTHON) -c "import sys; print(' '.join(sys.argv[1:]))" + export ECHO := echo +endif + +# Test if quotes are needed for the echo command +ifeq ($(shell $(ECHO) "test"), test) + export QUOTE := ' +# This line is just to clear out the single quote above ' +else + export QUOTE := +endif + +# Command to extract version info data from the repository and source tree +export VERSION_INFO = $(PYTHON) $(ROOT_DIR)/make/scripts/version-info.py --path=$(ROOT_DIR) + ############################## # # Misc settings @@ -82,17 +140,21 @@ all_sdk_version: $(addsuffix _version,$(ALL_SDK_TARGETS)) ############################## # Define messages +MSG_VERIFYING = $(QUOTE) VERIFY $(QUOTE) MSG_DOWNLOADING = $(QUOTE) DOWNLOAD $(QUOTE) +MSG_CHECKSUMMING = $(QUOTE) MD5 $(QUOTE) MSG_EXTRACTING = $(QUOTE) EXTRACT $(QUOTE) MSG_INSTALLING = $(QUOTE) INSTALL $(QUOTE) +MSG_CONFIGURING = $(QUOTE) CONFIGURE $(QUOTE) MSG_CLEANING = $(QUOTE) CLEAN $(QUOTE) MSG_DISTCLEANING = $(QUOTE) DISTCLEAN $(QUOTE) +MSG_NOTICE = $(QUOTE) NOTE $(QUOTE) # Verbosity level ifeq ($(V), 1) CURL_OPTIONS := else -# CURL_OPTIONS := --silent + CURL_OPTIONS := --silent endif # MSYS tar workaround @@ -102,47 +164,70 @@ else TAR_OPTIONS := endif -# Disable parallel make for sdk install targets to ensure ordered dependences -# like 'arm_sdk_clean | $(DL_DIR) $(TOOLS_DIR)'. They may fail otherwise being -# run in parallel +# Print some useful notes for *_install targets ifneq ($(strip $(filter $(addsuffix _install,all_sdk $(ALL_SDK_TARGETS)),$(MAKECMDGOALS))),) -.NOTPARALLEL: - $(info $(EMPTY) NOTE Parallel make disabled by some of sdk install targets) - $(info $(EMPTY) NOTE If some of install/extract targets failed, try 'make *_distclean' first) - $(info $(EMPTY) NOTE Use all_sdk_version to check toolchain versions) + ifneq ($(shell $(CURL) --version >/dev/null 2>&1 && $(ECHO) "found"), found) + $(error Please install curl first ('apt-get install curl' or similar)) + endif + $(info $(EMPTY) NOTE Use 'make all_sdk_distclean' to remove installation files) + $(info $(EMPTY) NOTE Use 'make all_sdk_version' to check toolchain versions) + $(info $(EMPTY) NOTE Add 'V=1' to make command line to diagnose make problems) endif +############################## +# +# Common tool install template +# $(1) = tool name +# $(2) = tool install directory +# $(3) = tool distribution URL +# $(4) = tool distribution file +# $(5) = optional pre-fetch template +# $(6) = optional post-extract template +# +############################## + +define TOOL_INSTALL_TEMPLATE + +.PHONY: $(addprefix $(1)_, install clean distclean) + +$(1)_install: $(1)_clean | $(DL_DIR) $(TOOLS_DIR) + $(5) + + @$(ECHO) $(MSG_VERIFYING) $$(call toprel, $(DL_DIR)/$(4)) + $(V1) ( \ + cd "$(DL_DIR)" && \ + $(CURL) $(CURL_OPTIONS) -o "$(DL_DIR)/$(4).md5" "$(3).md5" && \ + if ! $(MD5SUM) -c --status "$(DL_DIR)/$(4).md5" 2>/dev/null; then \ + $(ECHO) $(MSG_DOWNLOADING) $(3) && \ + $(CURL) $(CURL_OPTIONS) -o "$(DL_DIR)/$(4)" "$(3)" && \ + $(ECHO) $(MSG_CHECKSUMMING) $$(call toprel, $(DL_DIR)/$(4)) && \ + $(MD5SUM) -c --status "$(DL_DIR)/$(4).md5" 2>/dev/null; \ + fi; \ + ) + + @$(ECHO) $(MSG_EXTRACTING) $$(call toprel, $(2)) + $(V1) $(TAR) $(TAR_OPTIONS) -C $$(call toprel, $(TOOLS_DIR)) -xjf $$(call toprel, $(DL_DIR)/$(4)) + + $(6) + +$(1)_clean: + @$(ECHO) $(MSG_CLEANING) $$(call toprel, $(2)) + $(V1) [ ! -d "$(2)" ] || $(RM) -rf "$(2)" + +$(1)_distclean: + @$(ECHO) $(MSG_DISTCLEANING) $$(call toprel, $$@) + $(V1) [ ! -f "$(DL_DIR)/$(4)" ] || $(RM) "$(DL_DIR)/$(4)" + $(V1) [ ! -f "$(DL_DIR)/$(4).md5" ] || $(RM) "$(DL_DIR)/$(4).md5" + +endef + ############################## # # ARM SDK # ############################## -ARM_SDK_FILE := $(notdir $(ARM_SDK_URL)) - -.PHONY: arm_sdk_install -arm_sdk_install: arm_sdk_clean | $(DL_DIR) $(TOOLS_DIR) - @$(ECHO) $(MSG_DOWNLOADING) $(call toprel, $(DL_DIR)/$(ARM_SDK_FILE)) - $(V1) $(CURL) $(CURL_OPTIONS) \ - $(if $(shell [ -f "$(DL_DIR)/$(ARM_SDK_FILE)" ] && $(ECHO) "exists"),-z "$(DL_DIR)/$(ARM_SDK_FILE)",) \ - -o "$(DL_DIR)/$(ARM_SDK_FILE)" \ - "$(ARM_SDK_URL)" - @$(ECHO) $(MSG_EXTRACTING) $(call toprel, $(ARM_SDK_DIR)) - $(V1) $(TAR) $(TAR_OPTIONS) -C $(call toprel, $(TOOLS_DIR)) -xjf $(call toprel, $(DL_DIR)/$(ARM_SDK_FILE)) - -.PHONY: arm_sdk_clean -arm_sdk_clean: - @$(ECHO) $(MSG_CLEANING) $(call toprel, $(ARM_SDK_DIR)) - $(V1) [ ! -d "$(ARM_SDK_DIR)" ] || $(RM) -r "$(ARM_SDK_DIR)" - -.PHONY: arm_sdk_distclean -arm_sdk_distclean: - @$(ECHO) $(MSG_DISTCLEANING) $(call toprel, $@) - $(V1) [ ! -f "$(DL_DIR)/$(ARM_SDK_FILE)" ] || $(RM) "$(DL_DIR)/$(ARM_SDK_FILE)" - -.PHONY: arm_sdk_version -arm_sdk_version: - $(V1) $(ARM_SDK_PREFIX)gcc --version | head -n1 +$(eval $(call TOOL_INSTALL_TEMPLATE,arm_sdk,$(ARM_SDK_DIR),$(ARM_SDK_URL),$(notdir $(ARM_SDK_URL)))) ifeq ($(shell [ -d "$(ARM_SDK_DIR)" ] && $(ECHO) "exists"), exists) export ARM_SDK_PREFIX := $(ARM_SDK_DIR)/bin/arm-none-eabi- @@ -152,50 +237,151 @@ else export ARM_SDK_PREFIX ?= arm-none-eabi- endif +.PHONY: arm_sdk_version +arm_sdk_version: + $(V1) $(ARM_SDK_PREFIX)gcc --version | head -n1 + +# Template to check ARM toolchain version before building targets +define ARM_GCC_VERSION_CHECK_TEMPLATE + if ! $(ARM_SDK_PREFIX)gcc --version --specs=nano.specs >/dev/null 2>&1; then \ + $(ECHO) $(MSG_NOTICE) Please install ARM toolchain 4.7+ using \'make arm_sdk_install\' && \ + $(ECHO) $(MSG_NOTICE) Older ARM SDKs do not support new \'--specs=nano.specs\' option && \ + exit 1; \ + fi +endef + +############################## +# +# Qt SDK +# +# Windows: native binary package has been provided +# Linux: user should install native Qt SDK package +# Mac OS X: user should install native Qt SDK package +# +############################## + +define QT_SDK_CONFIGURE_TEMPLATE + @$(ECHO) $(MSG_CONFIGURING) $(call toprel, $(QT_SDK_DIR)) + $(V1) $(ECHO) $(QUOTE)[Paths]$(QUOTE) > $(QT_SDK_DIR)/bin/qt.conf + $(V1) $(ECHO) $(QUOTE)Prefix = $(QT_SDK_DIR)$(QUOTE) >> $(QT_SDK_DIR)/bin/qt.conf +endef + +ifeq ($(UNAME), Windows) + + $(eval $(call TOOL_INSTALL_TEMPLATE,qt_sdk,$(QT_SDK_DIR),$(QT_SDK_URL),$(notdir $(QT_SDK_URL)),,$(QT_SDK_CONFIGURE_TEMPLATE))) + +else + +.PHONY: qt_sdk_install +qt_sdk_install: + @$(ECHO) $(MSG_NOTICE) -------------------------------------------------------- + @$(ECHO) $(MSG_NOTICE) Please install native Qt 4.8.x SDK using package manager + @$(ECHO) $(MSG_NOTICE) -------------------------------------------------------- + +.PHONY: qt_sdk_clean +qt_sdk_clean: + +.PHONY: qt_sdk_distclean +qt_sdk_distclean: + +endif + +ifeq ($(shell [ -d "$(QT_SDK_DIR)" ] && $(ECHO) "exists"), exists) + export QMAKE := $(QT_SDK_DIR)/bin/qmake + + # set Qt library search path + ifeq ($(UNAME), Windows) + export PATH := $(QT_SDK_DIR)/bin:$(PATH) + else + export LD_LIBRARY_PATH := $(QT_SDK_DIR)/lib:$(LD_LIBRARY_PATH) + endif +else + # not installed, hope it's in the path... + # $(info $(EMPTY) WARNING $(call toprel, $(QT_SDK_DIR)) not found (make qt_sdk_install), using system PATH) + QMAKE ?= qmake +endif + +.PHONY: qt_sdk_version +qt_sdk_version: + $(V1) $(QMAKE) --version | tail -1 + +############################## +# +# MinGW +# +############################## + +ifeq ($(UNAME), Windows) + +$(eval $(call TOOL_INSTALL_TEMPLATE,mingw,$(MINGW_DIR),$(MINGW_URL),$(notdir $(MINGW_URL)))) + +ifeq ($(shell [ -d "$(MINGW_DIR)" ] && $(ECHO) "exists"), exists) + # set MinGW binary and library paths (QTMINGW is used by qmake, do not rename) + export QTMINGW := $(MINGW_DIR)/bin + export PATH := $(QTMINGW):$(PATH) +else + # not installed, use host gcc compiler + # $(info $(EMPTY) WARNING $(call toprel, $(MINGW_DIR)) not found (make mingw_install), using system PATH) +endif + +.PHONY: mingw_version +mingw_version: + $(V1) gcc --version | head -n1 + +.PHONY: gcc_version +gcc_version: mingw_version + +else # Linux or Mac + +all_sdk_version: gcc_version + +.PHONY: gcc_version +gcc_version: + $(V1) gcc --version | head -n1 + +endif + +############################## +# +# Python +# +############################## + +ifeq ($(UNAME), Windows) + +$(eval $(call TOOL_INSTALL_TEMPLATE,python,$(PYTHON_DIR),$(PYTHON_URL),$(notdir $(PYTHON_URL)))) + +else # Linux or Mac + +all_sdk_version: python_version + +endif + +ifeq ($(shell [ -d "$(PYTHON_DIR)" ] && $(ECHO) "exists"), exists) + export PYTHON := $(PYTHON_DIR)/python + export PATH := $(PYTHON_DIR):$(PATH) +else + # not installed, hope it's in the path... + # $(info $(EMPTY) WARNING $(call toprel, $(PYTHON_DIR)) not found (make python_install), using system PATH) + export PYTHON := python +endif + +.PHONY: python_version +python_version: + $(V1) $(PYTHON) --version + + + + + + + ############################## # # TODO: code below is not revised yet # ############################## -# Set up QT toolchain -QT_SDK_DIR := $(TOOLS_DIR)/qtsdk-v1.2.1 - -.PHONY: qt_sdk_install -# Choose the appropriate installer based on host architecture -ifneq (,$(filter $(ARCH), x86_64 amd64)) -# 64-bit -QT_SDK_QMAKE_PATH := $(QT_SDK_DIR)/Desktop/Qt/4.8.1/gcc/bin/qmake -qt_sdk_install: QT_SDK_FILE := QtSdk-offline-linux-x86_64-v1.2.1.run -qt_sdk_install: QT_SDK_URL := http://www.developer.nokia.com/dp?uri=http://sw.nokia.com/id/14b2039c-0e1f-4774-a4f2-9aa60b6d5313/Qt_SDK_Lin64_offline -else -# 32-bit -QT_SDK_QMAKE_PATH := $(QT_SDK_DIR)/Desktop/Qt/4.8.1/gcc/bin/qmake -qt_sdk_install: QT_SDK_URL := http://www.developer.nokia.com/dp?uri=http://sw.nokia.com/id/8ea74da4-fec1-4277-8b26-c58cc82e204b/Qt_SDK_Lin32_offline -qt_sdk_install: QT_SDK_FILE := QtSdk-offline-linux-x86-v1.2.1.run -endif -# order-only prereq on directory existance: -qt_sdk_install : | $(DL_DIR) $(TOOLS_DIR) -qt_sdk_install: qt_sdk_clean - # download the source only if it's newer than what we already have - $(V1) $(WGET) -N --content-disposition -P "$(DL_DIR)" "$(QT_SDK_URL)" - # tell the user exactly which path they should select in the GUI - $(V1) echo "*** NOTE NOTE NOTE ***" - $(V1) echo "*" - $(V1) echo "* In the GUI, please use exactly this path as the installation path:" - $(V1) echo "* $(QT_SDK_DIR)" - $(V1) echo "*" - $(V1) echo "*** NOTE NOTE NOTE ***" - - #installer is an executable, make it executable and run it - $(V1) chmod u+x "$(DL_DIR)/$(QT_SDK_FILE)" - $(V1) "$(DL_DIR)/$(QT_SDK_FILE)" -style cleanlooks - -.PHONY: qt_sdk_clean -qt_sdk_clean: - $(V1) [ ! -d "$(QT_SDK_DIR)" ] || $(RM) -rf $(QT_SDK_DIR) - - # Set up openocd tools OPENOCD_DIR := $(TOOLS_DIR)/openocd OPENOCD_WIN_DIR := $(TOOLS_DIR)/openocd_win @@ -480,14 +666,6 @@ gtest_clean: # ############################## -# Set up paths to tools -ifeq ($(shell [ -d "$(QT_SDK_DIR)" ] && $(ECHO) "exists"), exists) - QMAKE := $(QT_SDK_QMAKE_PATH) -else - # not installed, hope it's in the path... - QMAKE ?= qmake -endif - ifeq ($(shell [ -d "$(OPENOCD_DIR)" ] && $(ECHO) "exists"), exists) export OPENOCD := $(OPENOCD_DIR)/bin/openocd else diff --git a/package/linux/deb_common/postinst b/package/linux/deb_common/postinst index df8022075..e58a3e1a3 100644 --- a/package/linux/deb_common/postinst +++ b/package/linux/deb_common/postinst @@ -20,7 +20,7 @@ set -e case "$1" in configure) - sudo udevadm control --reload-rules >&2 + /sbin/udevadm control --reload-rules >&2 ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/shared/uavobjectdefinition/manualcontrolsettings.xml b/shared/uavobjectdefinition/manualcontrolsettings.xml index ccb7cb54e..a15b9039f 100644 --- a/shared/uavobjectdefinition/manualcontrolsettings.xml +++ b/shared/uavobjectdefinition/manualcontrolsettings.xml @@ -20,13 +20,55 @@ - - - + + + - + + diff --git a/shared/uavobjectdefinition/stabilizationsettings.xml b/shared/uavobjectdefinition/stabilizationsettings.xml index 519a3078a..0be267cf6 100644 --- a/shared/uavobjectdefinition/stabilizationsettings.xml +++ b/shared/uavobjectdefinition/stabilizationsettings.xml @@ -4,15 +4,15 @@ - - + + - - - - - - + + + + + + diff --git a/shared/uavobjectdefinition/systemalarms.xml b/shared/uavobjectdefinition/systemalarms.xml index b3796d43a..fedeef14a 100644 --- a/shared/uavobjectdefinition/systemalarms.xml +++ b/shared/uavobjectdefinition/systemalarms.xml @@ -1,12 +1,13 @@ - Alarms from OpenPilot to indicate failure conditions or warnings. Set by various modules. + Alarms from OpenPilot to indicate failure conditions or warnings. Set by various modules. Some modules may have a module defined Status and Substatus fields that details its condition. + SystemConfiguration + BootFault OutOfMemory StackOverflow CPUOverload - SystemConfiguration EventSystem Telemetry ManualControl @@ -19,10 +20,26 @@ FlightTime I2C GPS - BootFault Power + + + SystemConfiguration + BootFault + + + + + + + + + + SystemConfiguration + BootFault + +