mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
OP-251 Watchdog: Get rid of the old extra watchdog module and instead have
tasks directly update a flag for each module (which they register) and when all flags set clear the watchdog then. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2365 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
1e78cc7a30
commit
ed11e64bb2
@ -57,7 +57,7 @@ FLASH_TOOL = OPENOCD
|
||||
USE_THUMB_MODE = YES
|
||||
|
||||
# List of modules to include
|
||||
MODULES = Actuator Telemetry GPS ManualControl Altitude AHRSComms Stabilization Guidance Watchdog FirmwareIAP
|
||||
MODULES = Actuator Telemetry GPS ManualControl Altitude AHRSComms Stabilization Guidance FirmwareIAP
|
||||
|
||||
#MODULES = Telemetry Example
|
||||
#MODULES = Telemetry MK/MKSerial
|
||||
@ -201,6 +201,7 @@ SRC += $(OPUAVOBJ)/flightplancontrol.c
|
||||
SRC += $(OPUAVOBJ)/flightplanstatus.c
|
||||
SRC += $(OPUAVOBJ)/flightplansettings.c
|
||||
SRC += $(OPUAVOBJ)/taskinfo.c
|
||||
SRC += $(OPUAVOBJ)/watchdogstatus.c
|
||||
endif
|
||||
|
||||
## PIOS Hardware (STM32F10x)
|
||||
|
@ -65,9 +65,6 @@ static xTaskHandle taskHandle;
|
||||
// Private functions
|
||||
static void ahrscommsTask(void *parameters);
|
||||
|
||||
// Global update flag
|
||||
volatile uint8_t ahrs_updated;
|
||||
|
||||
/**
|
||||
* Initialise the module, called on startup
|
||||
* \returns 0 on success or -1 if initialisation failed
|
||||
@ -79,6 +76,7 @@ int32_t AHRSCommsInitialize(void)
|
||||
// Start main task
|
||||
xTaskCreate(ahrscommsTask, (signed char *)"AHRSComms", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_AHRSCOMMS, taskHandle);
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_AHRS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -94,7 +92,7 @@ static void ahrscommsTask(void *parameters)
|
||||
|
||||
// Main task loop
|
||||
while (1) {
|
||||
ahrs_updated = 1;
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_AHRS);
|
||||
|
||||
AHRSSettingsData settings;
|
||||
AHRSSettingsGet(&settings);
|
||||
|
@ -71,9 +71,6 @@ float ProcessMixer(const int index, const float curve1, const float curve2,
|
||||
MixerSettingsData* mixerSettings, ActuatorDesiredData* desired,
|
||||
const float period);
|
||||
|
||||
// External watchdog update flag
|
||||
volatile uint8_t actuator_updated;
|
||||
|
||||
//this structure is equivalent to the UAVObjects for one mixer.
|
||||
typedef struct {
|
||||
uint8_t type;
|
||||
@ -96,7 +93,8 @@ int32_t ActuatorInitialize()
|
||||
// Start main task
|
||||
xTaskCreate(actuatorTask, (signed char*)"Actuator", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_ACTUATOR, taskHandle);
|
||||
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_ACTUATOR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -143,7 +141,7 @@ static void actuatorTask(void* parameters)
|
||||
lastSysTime = xTaskGetTickCount();
|
||||
while (1)
|
||||
{
|
||||
actuator_updated = 1;
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_ACTUATOR);
|
||||
|
||||
// Wait until the ActuatorDesired object is updated, if a timeout then go to failsafe
|
||||
if ( xQueueReceive(queue, &ev, FAILSAFE_TIMEOUT_MS / portTICK_RATE_MS) != pdTRUE )
|
||||
|
@ -63,9 +63,6 @@ static void manualControlTask(void *parameters);
|
||||
static float scaleChannel(int16_t value, int16_t max, int16_t min, int16_t neutral);
|
||||
static uint32_t timeDifferenceMs(portTickType start_time, portTickType end_time);
|
||||
|
||||
// Global updated variable
|
||||
volatile uint8_t manual_updated;
|
||||
|
||||
/**
|
||||
* Module initialization
|
||||
*/
|
||||
@ -74,7 +71,7 @@ int32_t ManualControlInitialize()
|
||||
// Start main task
|
||||
xTaskCreate(manualControlTask, (signed char *)"ManualControl", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &taskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_MANUALCONTROL, taskHandle);
|
||||
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_MANUAL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -109,8 +106,7 @@ static void manualControlTask(void *parameters)
|
||||
while (1) {
|
||||
// Wait until next update
|
||||
vTaskDelayUntil(&lastSysTime, UPDATE_PERIOD_MS / portTICK_RATE_MS);
|
||||
|
||||
manual_updated = 1;
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_MANUAL);
|
||||
|
||||
// Read settings
|
||||
ManualControlSettingsGet(&settings);
|
||||
|
@ -78,9 +78,6 @@ static float bound(float val);
|
||||
static void ZeroPids(void);
|
||||
static void SettingsUpdatedCb(UAVObjEvent * ev);
|
||||
|
||||
// Global updated variable
|
||||
volatile uint8_t stabilization_updated;
|
||||
|
||||
/**
|
||||
* Module initialization
|
||||
*/
|
||||
@ -100,7 +97,8 @@ int32_t StabilizationInitialize()
|
||||
// Start main task
|
||||
xTaskCreate(stabilizationTask, (signed char*)"Stabilization", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &taskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_STABILIZATION, taskHandle);
|
||||
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_STABILIZATION);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -128,9 +126,8 @@ static void stabilizationTask(void* parameters)
|
||||
lastSysTime = xTaskGetTickCount();
|
||||
ZeroPids();
|
||||
while(1) {
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_STABILIZATION);
|
||||
|
||||
stabilization_updated = 1;
|
||||
|
||||
// Wait until the AttitudeRaw object is updated, if a timeout then go to failsafe
|
||||
if ( xQueueReceive(queue, &ev, FAILSAFE_TIMEOUT_MS / portTICK_RATE_MS) != pdTRUE )
|
||||
{
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "manualcontrolcommand.h"
|
||||
#include "systemstats.h"
|
||||
#include "i2cstats.h"
|
||||
#include "watchdogstatus.h"
|
||||
#include "taskmonitor.h"
|
||||
|
||||
|
||||
@ -72,6 +73,7 @@ static int32_t stackOverflow;
|
||||
static void objectUpdatedCb(UAVObjEvent * ev);
|
||||
static void updateStats();
|
||||
static void updateI2Cstats();
|
||||
static void updateWDGstats();
|
||||
static void updateSystemAlarms();
|
||||
static void systemTask(void *parameters);
|
||||
|
||||
@ -117,6 +119,7 @@ static void systemTask(void *parameters)
|
||||
// Update the system alarms
|
||||
updateSystemAlarms();
|
||||
updateI2Cstats();
|
||||
updateWDGstats();
|
||||
|
||||
// Update the task status object
|
||||
TaskMonitorUpdateAll();
|
||||
@ -232,6 +235,14 @@ static void updateI2Cstats()
|
||||
}
|
||||
#endif
|
||||
|
||||
static void updateWDGstats()
|
||||
{
|
||||
WatchdogStatusData watchdogStatus;
|
||||
watchdogStatus.BootupFlags = PIOS_WDG_GetBootupFlags();
|
||||
watchdogStatus.ActiveFlags = PIOS_WDG_GetActiveFlags();
|
||||
WatchdogStatusSet(&watchdogStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called periodically to update the system stats
|
||||
*/
|
||||
|
@ -1,33 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file watchdog.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Watchdog module which must run every 250 ms
|
||||
*
|
||||
* @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 WATCHDOG_H
|
||||
#define WATCHDOG_H
|
||||
extern volatile uint8_t actuator_updated;
|
||||
extern volatile uint8_t stabilization_updated;
|
||||
extern volatile uint8_t ahrs_updated;
|
||||
extern volatile uint8_t manual_updated;
|
||||
#endif /* WATCHDOG_H */
|
@ -1,99 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file watchdog.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Watchdog module which must run every 250 ms
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Input object: none
|
||||
* Output object: none
|
||||
*
|
||||
* This module initializes the PIOS Watchdog and then periodically resets the timeout
|
||||
*
|
||||
* The module executes in its own thread in this example.
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "pios_wdg.h"
|
||||
#include "watchdog.h"
|
||||
|
||||
// Private constants
|
||||
// TODO: Look up maximum task priority and set this to it. Not trying to replicate CPU load.
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY+5)
|
||||
#define STACK_SIZE_BYTES 324
|
||||
#define WATCHDOG_TIMEOUT 250
|
||||
|
||||
// Private types
|
||||
|
||||
// Private variables
|
||||
static xTaskHandle taskHandle;
|
||||
|
||||
// Private functions
|
||||
static void watchdogTask(void *parameters);
|
||||
|
||||
|
||||
/**
|
||||
* Initialise the module, called on startup
|
||||
* \returns 0 on success or -1 if initialisation failed
|
||||
*/
|
||||
int32_t WatchdogInitialize()
|
||||
{
|
||||
actuator_updated = 0;
|
||||
stabilization_updated = 0;
|
||||
ahrs_updated = 0;
|
||||
manual_updated = 0;
|
||||
|
||||
// Start main task
|
||||
xTaskCreate(watchdogTask, (signed char *)"Watchdog", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &taskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_WATCHDOG, taskHandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Module thread, should not return.
|
||||
*
|
||||
* Initializes the PIOS watchdog and periodically resets it
|
||||
*/
|
||||
static void watchdogTask(void *parameters)
|
||||
{
|
||||
uint32_t delay;
|
||||
portTickType lastSysTime;
|
||||
|
||||
delay = PIOS_WDG_Init(WATCHDOG_TIMEOUT) / portTICK_RATE_MS;
|
||||
|
||||
// Main task loop
|
||||
lastSysTime = xTaskGetTickCount();
|
||||
while (1) {
|
||||
if(actuator_updated && stabilization_updated &&
|
||||
ahrs_updated && manual_updated) {
|
||||
PIOS_WDG_Clear();
|
||||
actuator_updated = 0;
|
||||
stabilization_updated = 0;
|
||||
ahrs_updated = 0;
|
||||
manual_updated = 0;
|
||||
}
|
||||
|
||||
vTaskDelayUntil(&lastSysTime, delay);
|
||||
}
|
||||
}
|
@ -57,6 +57,7 @@
|
||||
#define PIOS_INCLUDE_FREERTOS
|
||||
#define PIOS_INCLUDE_GPIO
|
||||
#define PIOS_INCLUDE_EXTI
|
||||
#define PIOS_INCLUDE_WDG
|
||||
|
||||
|
||||
/* Defaults for Logging */
|
||||
@ -78,4 +79,4 @@
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
@ -83,6 +83,7 @@ void PIOS_Board_Init(void) {
|
||||
#endif
|
||||
PIOS_I2C_Init();
|
||||
PIOS_IAP_Init();
|
||||
PIOS_WDG_Init();
|
||||
}
|
||||
|
||||
/* MicroSD Interface
|
||||
|
@ -70,6 +70,7 @@
|
||||
#include "telemetrysettings.h"
|
||||
#include "velocityactual.h"
|
||||
#include "velocitydesired.h"
|
||||
#include "watchdogstatus.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -120,5 +121,6 @@ void UAVObjectsInitializeAll()
|
||||
TelemetrySettingsInitialize();
|
||||
VelocityActualInitialize();
|
||||
VelocityDesiredInitialize();
|
||||
WatchdogStatusInitialize();
|
||||
|
||||
}
|
||||
|
@ -86,6 +86,16 @@ TIM8 | Servo 5 | Servo 6 | Servo 7 | Servo 8
|
||||
#define BOARD_WRITABLA TRUE
|
||||
#define MAX_DEL_RETRYS 3
|
||||
|
||||
//------------------------
|
||||
// WATCHDOG_SETTINGS
|
||||
//------------------------
|
||||
#define PIOS_WATCHDOG_TIMEOUT 250
|
||||
#define PIOS_WDG_REGISTER BKP_DR4
|
||||
#define PIOS_WDG_ACTUATOR 0x0001
|
||||
#define PIOS_WDG_STABILIZATION 0x0002
|
||||
#define PIOS_WDG_AHRS 0x0004
|
||||
#define PIOS_WDG_MANUAL 0x0008
|
||||
|
||||
//------------------------
|
||||
// PIOS_LED
|
||||
//------------------------
|
||||
|
@ -36,6 +36,11 @@
|
||||
#include "stm32f10x_iwdg.h"
|
||||
#include "stm32f10x_dbgmcu.h"
|
||||
|
||||
static struct wdg_configuration {
|
||||
uint16_t used_flags;
|
||||
uint16_t bootup_flags;
|
||||
} wdg_configuration;
|
||||
|
||||
/**
|
||||
* @brief Initialize the watchdog timer for a specified timeout
|
||||
*
|
||||
@ -53,9 +58,10 @@
|
||||
* @param[in] delayMs The delay period in ms
|
||||
* @returns Maximum recommended delay between updates
|
||||
*/
|
||||
uint16_t PIOS_WDG_Init(uint16_t delayMs)
|
||||
void PIOS_WDG_Init()
|
||||
{
|
||||
uint16_t delay = ((uint32_t) delayMs * 60) / 16;
|
||||
#if defined(PIOS_INCLUDE_WDG)
|
||||
uint16_t delay = ((uint32_t) PIOS_WATCHDOG_TIMEOUT * 60) / 16;
|
||||
if (delay > 0x0fff)
|
||||
delay = 0x0fff;
|
||||
|
||||
@ -66,7 +72,91 @@ uint16_t PIOS_WDG_Init(uint16_t delayMs)
|
||||
IWDG_ReloadCounter();
|
||||
IWDG_Enable();
|
||||
|
||||
return ((((uint32_t) delay * 16) / 60) * .75f);
|
||||
// watchdog flags now stored in backup registers
|
||||
PWR_BackupAccessCmd(ENABLE);
|
||||
|
||||
wdg_configuration.bootup_flags = BKP_ReadBackupRegister(PIOS_WDG_REGISTER);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register a module against the watchdog
|
||||
*
|
||||
* There are two ways to use PIOS WDG: this is for when
|
||||
* multiple modules must be monitored. In this case they
|
||||
* must first register against the watchdog system and
|
||||
* only when all of the modules have been updated with the
|
||||
* watchdog be cleared. Each module must have its own
|
||||
* bit in the 16 bit
|
||||
*
|
||||
* @param[in] flag the bit this module wants to use
|
||||
* @returns True if that bit is unregistered
|
||||
*/
|
||||
bool PIOS_WDG_RegisterFlag(uint16_t flag_requested)
|
||||
{
|
||||
|
||||
/* Fail if flag already registered */
|
||||
if(wdg_configuration.used_flags & flag_requested)
|
||||
return false;
|
||||
|
||||
// FIXME: Protect with semaphore
|
||||
wdg_configuration.used_flags |= flag_requested;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function called by modules to indicate they are still running
|
||||
*
|
||||
* This function will set this flag in the active flags register (which is
|
||||
* a backup regsiter) and if all the registered flags are set will clear
|
||||
* the watchdog and set only this flag in the backup register
|
||||
*
|
||||
* @param[in] flag the flag to set
|
||||
* @return true if the watchdog cleared, false if flags are pending
|
||||
*/
|
||||
bool PIOS_WDG_UpdateFlag(uint16_t flag)
|
||||
{
|
||||
// we can probably avoid using a semaphore here which will be good for
|
||||
// efficiency and not blocking critical tasks. race condition could
|
||||
// overwrite their flag update, but unlikely to block _all_ of them
|
||||
// for the timeout window
|
||||
uint16_t cur_flags = BKP_ReadBackupRegister(PIOS_WDG_REGISTER);
|
||||
|
||||
if((cur_flags | flag) == wdg_configuration.used_flags) {
|
||||
PIOS_WDG_Clear();
|
||||
BKP_WriteBackupRegister(PIOS_WDG_REGISTER, flag);
|
||||
return true;
|
||||
} else {
|
||||
BKP_WriteBackupRegister(PIOS_WDG_REGISTER, cur_flags | flag);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the flags that were set at bootup
|
||||
*
|
||||
* This is used for diagnostics, if only one flag not set this
|
||||
* was likely the module that wasn't running before reset
|
||||
*
|
||||
* @return The active flags register from bootup
|
||||
*/
|
||||
uint16_t PIOS_WDG_GetBootupFlags()
|
||||
{
|
||||
return wdg_configuration.bootup_flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the currently active flags
|
||||
*
|
||||
* For external monitoring
|
||||
*
|
||||
* @return The active flags register
|
||||
*/
|
||||
uint16_t PIOS_WDG_GetActiveFlags()
|
||||
{
|
||||
return BKP_ReadBackupRegister(PIOS_WDG_REGISTER);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,5 +166,7 @@ uint16_t PIOS_WDG_Init(uint16_t delayMs)
|
||||
*/
|
||||
void PIOS_WDG_Clear(void)
|
||||
{
|
||||
#if defined(PIOS_INCLUDE_WDG)
|
||||
IWDG_ReloadCounter();
|
||||
#endif
|
||||
}
|
||||
|
@ -31,7 +31,11 @@
|
||||
#ifndef PIOS_WDG
|
||||
#define PIOS_WDG
|
||||
|
||||
uint16_t PIOS_WDG_Init(uint16_t delayMs);
|
||||
void PIOS_WDG_Init();
|
||||
bool PIOS_WDG_RegisterFlag(uint16_t flag_requested);
|
||||
bool PIOS_WDG_UpdateFlag(uint16_t flag);
|
||||
uint16_t PIOS_WDG_GetBootupFlags();
|
||||
uint16_t PIOS_WDG_GetActiveFlags();
|
||||
void PIOS_WDG_Clear(void);
|
||||
|
||||
#endif
|
||||
|
@ -7,8 +7,6 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
65003B2D1212499100C183DD /* watchdog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = watchdog.h; sourceTree = "<group>"; };
|
||||
65003B2E1212499100C183DD /* watchdog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = watchdog.c; sourceTree = "<group>"; };
|
||||
65003B31121249CA00C183DD /* pios_wdg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_wdg.c; sourceTree = "<group>"; };
|
||||
6502584212CA4D2600583CDF /* insgps13state.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = insgps13state.c; path = ../../AHRS/insgps13state.c; sourceTree = SOURCE_ROOT; };
|
||||
6509C7E912CA57DC002E5DC2 /* insgps16state.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = insgps16state.c; path = ../../AHRS/insgps16state.c; sourceTree = SOURCE_ROOT; };
|
||||
@ -43,6 +41,9 @@
|
||||
6549E0D21279B3C800C5476F /* fifo_buffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fifo_buffer.c; sourceTree = "<group>"; };
|
||||
6549E0D31279B3CF00C5476F /* fifo_buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fifo_buffer.h; sourceTree = "<group>"; };
|
||||
655268BC121FBD2900410C6E /* ahrscalibration.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = ahrscalibration.xml; sourceTree = "<group>"; };
|
||||
655DBA5212DA5B6A00341B9A /* pios_iap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_iap.h; sourceTree = "<group>"; };
|
||||
655DBA5312DA5E9900341B9A /* watchdogstatus.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = watchdogstatus.xml; sourceTree = "<group>"; };
|
||||
655DBA8A12DA644300341B9A /* taskmonitor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = taskmonitor.c; sourceTree = "<group>"; };
|
||||
65632CBF124E09D900469B77 /* guidance.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = guidance.c; sourceTree = "<group>"; };
|
||||
65632CC1124E09D900469B77 /* guidance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = guidance.h; sourceTree = "<group>"; };
|
||||
65632DF51251650300469B77 /* pios_board.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_board.h; sourceTree = "<group>"; };
|
||||
@ -2903,23 +2904,6 @@
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65003B2B1212499100C183DD /* Watchdog */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65003B2C1212499100C183DD /* inc */,
|
||||
65003B2E1212499100C183DD /* watchdog.c */,
|
||||
);
|
||||
path = Watchdog;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65003B2C1212499100C183DD /* inc */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65003B2D1212499100C183DD /* watchdog.h */,
|
||||
);
|
||||
path = inc;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
651F32EC1281DE7E00D065F8 /* FirmwareIAP */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -6802,6 +6786,7 @@
|
||||
65B367FD121C2620003EAD18 /* systemstats.xml */,
|
||||
65B367FE121C2620003EAD18 /* telemetrysettings.xml */,
|
||||
65408AA812BB1648004DACC5 /* i2cstats.xml */,
|
||||
655DBA5312DA5E9900341B9A /* watchdogstatus.xml */,
|
||||
);
|
||||
path = uavobjectdefinition;
|
||||
sourceTree = "<group>";
|
||||
@ -6869,7 +6854,6 @@
|
||||
65E8EF4F11EEA61E00BBF654 /* Stabilization */,
|
||||
65E8EF5311EEA61E00BBF654 /* System */,
|
||||
65E8EF5711EEA61E00BBF654 /* Telemetry */,
|
||||
65003B2B1212499100C183DD /* Watchdog */,
|
||||
);
|
||||
name = Modules;
|
||||
path = ../../OpenPilot/Modules;
|
||||
@ -7129,6 +7113,7 @@
|
||||
65E8EF5B11EEA61E00BBF654 /* System */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
655DBA8A12DA644300341B9A /* taskmonitor.c */,
|
||||
65E8EF5C11EEA61E00BBF654 /* alarms.c */,
|
||||
65E8EF5D11EEA61E00BBF654 /* inc */,
|
||||
65E8EF6511EEA61E00BBF654 /* openpilot.c */,
|
||||
@ -7313,6 +7298,7 @@
|
||||
65E8F03811EFF25C00BBF654 /* inc */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
655DBA5212DA5B6A00341B9A /* pios_iap.h */,
|
||||
6526645A122DF972006F9A3C /* pios_i2c_priv.h */,
|
||||
6526645B122DF972006F9A3C /* pios_wdg.h */,
|
||||
651CF9EF120B700D00EEFD70 /* pios_usb_hid_desc.h */,
|
||||
|
@ -413,6 +413,11 @@ function [] = OPLogConvert()
|
||||
VelocityDesired(1).East = 0;
|
||||
VelocityDesired(1).Down = 0;
|
||||
|
||||
watchdogstatusIdx = 1;
|
||||
WatchdogStatus.timestamp = 0;
|
||||
WatchdogStatus(1).BootupFlags = 0;
|
||||
WatchdogStatus(1).ActiveFlags = 0;
|
||||
|
||||
|
||||
%% Open file
|
||||
%fid = fopen('log.opl');
|
||||
@ -574,6 +579,9 @@ function [] = OPLogConvert()
|
||||
case 305094202
|
||||
VelocityDesired(velocitydesiredIdx) = ReadVelocityDesiredObject(fid, timestamp);
|
||||
velocitydesiredIdx = velocitydesiredIdx + 1;
|
||||
case 3594971408
|
||||
WatchdogStatus(watchdogstatusIdx) = ReadWatchdogStatusObject(fid, timestamp);
|
||||
watchdogstatusIdx = watchdogstatusIdx + 1;
|
||||
|
||||
otherwise
|
||||
disp('Unknown object ID');
|
||||
@ -587,7 +595,7 @@ function [] = OPLogConvert()
|
||||
fclose(fid);
|
||||
|
||||
matfile = strrep(logfile,'opl','mat');
|
||||
save(matfile ,'ActuatorCommand','ActuatorDesired','ActuatorSettings','AHRSCalibration','AHRSSettings','AhrsStatus','AttitudeActual','AttitudeDesired','AttitudeRaw','BaroAltitude','BatterySettings','FirmwareIAPObj','FlightBatteryState','FlightPlanControl','FlightPlanSettings','FlightPlanStatus','FlightTelemetryStats','GCSTelemetryStats','GPSPosition','GPSSatellites','GPSTime','GuidanceSettings','HomeLocation','I2CStats','ManualControlCommand','ManualControlSettings','MixerSettings','MixerStatus','ObjectPersistence','PipXtremeModemSettings','PipXtremeModemStatus','PositionActual','PositionDesired','RateDesired','StabilizationSettings','SystemAlarms','SystemSettings','SystemStats','TaskInfo','TelemetrySettings','VelocityActual','VelocityDesired');
|
||||
save(matfile ,'ActuatorCommand','ActuatorDesired','ActuatorSettings','AHRSCalibration','AHRSSettings','AhrsStatus','AttitudeActual','AttitudeDesired','AttitudeRaw','BaroAltitude','BatterySettings','FirmwareIAPObj','FlightBatteryState','FlightPlanControl','FlightPlanSettings','FlightPlanStatus','FlightTelemetryStats','GCSTelemetryStats','GPSPosition','GPSSatellites','GPSTime','GuidanceSettings','HomeLocation','I2CStats','ManualControlCommand','ManualControlSettings','MixerSettings','MixerStatus','ObjectPersistence','PipXtremeModemSettings','PipXtremeModemStatus','PositionActual','PositionDesired','RateDesired','StabilizationSettings','SystemAlarms','SystemSettings','SystemStats','TaskInfo','TelemetrySettings','VelocityActual','VelocityDesired','WatchdogStatus');
|
||||
|
||||
end
|
||||
|
||||
@ -1425,6 +1433,21 @@ function [VelocityDesired] = ReadVelocityDesiredObject(fid, timestamp)
|
||||
fread(fid, 1, 'uint8');
|
||||
end
|
||||
|
||||
function [WatchdogStatus] = ReadWatchdogStatusObject(fid, timestamp)
|
||||
if 1
|
||||
headerSize = 8;
|
||||
else
|
||||
WatchdogStatus.instanceID = fread(fid, 1, 'uint16');
|
||||
headerSize = 10;
|
||||
end
|
||||
|
||||
WatchdogStatus.timestamp = timestamp;
|
||||
WatchdogStatus.BootupFlags = double(fread(fid, 1, 'uint16'));
|
||||
WatchdogStatus.ActiveFlags = double(fread(fid, 1, 'uint16'));
|
||||
% read CRC
|
||||
fread(fid, 1, 'uint8');
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -52,7 +52,8 @@ HEADERS += uavobjects_global.h \
|
||||
taskinfo.h \
|
||||
flightplanstatus.h \
|
||||
flightplansettings.h \
|
||||
flightplancontrol.h
|
||||
flightplancontrol.h \
|
||||
watchdogstatus.h
|
||||
|
||||
SOURCES += uavobject.cpp \
|
||||
uavmetaobject.cpp \
|
||||
@ -102,5 +103,7 @@ SOURCES += uavobject.cpp \
|
||||
taskinfo.cpp \
|
||||
flightplanstatus.cpp \
|
||||
flightplansettings.cpp \
|
||||
flightplancontrol.cpp
|
||||
flightplancontrol.cpp \
|
||||
watchdogstatus.cpp
|
||||
|
||||
OTHER_FILES += UAVObjects.pluginspec
|
||||
|
@ -72,6 +72,7 @@
|
||||
#include "telemetrysettings.h"
|
||||
#include "velocityactual.h"
|
||||
#include "velocitydesired.h"
|
||||
#include "watchdogstatus.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -122,5 +123,6 @@ void UAVObjectsInitialize(UAVObjectManager* objMngr)
|
||||
objMngr->registerObject( new TelemetrySettings() );
|
||||
objMngr->registerObject( new VelocityActual() );
|
||||
objMngr->registerObject( new VelocityDesired() );
|
||||
objMngr->registerObject( new WatchdogStatus() );
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user