mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-01 17:52:12 +01:00
Merge remote-tracking branch 'origin/next' into ins
This commit is contained in:
commit
b1c522def3
@ -79,6 +79,7 @@ CREATEHANDLE(10, FirmwareIAPObj);
|
|||||||
static void ObjectUpdatedCb(UAVObjEvent * ev);
|
static void ObjectUpdatedCb(UAVObjEvent * ev);
|
||||||
|
|
||||||
#define ADDHANDLE(idx,obj) {\
|
#define ADDHANDLE(idx,obj) {\
|
||||||
|
obj##Initialize();\
|
||||||
int n = idx;\
|
int n = idx;\
|
||||||
objectHandles[n].data = &obj;\
|
objectHandles[n].data = &obj;\
|
||||||
objectHandles[n].uavHandle = obj##Handle();\
|
objectHandles[n].uavHandle = obj##Handle();\
|
||||||
|
@ -100,8 +100,6 @@ int32_t GuidanceInitialize()
|
|||||||
|
|
||||||
GuidanceSettingsInitialize();
|
GuidanceSettingsInitialize();
|
||||||
PositionDesiredInitialize();
|
PositionDesiredInitialize();
|
||||||
ManualControlCommandInitialize();
|
|
||||||
FlightStatusInitialize();
|
|
||||||
NedAccelInitialize();
|
NedAccelInitialize();
|
||||||
VelocityDesiredInitialize();
|
VelocityDesiredInitialize();
|
||||||
|
|
||||||
|
@ -117,8 +117,7 @@ int32_t ManualControlInitialize()
|
|||||||
FlightStatusInitialize();
|
FlightStatusInitialize();
|
||||||
StabilizationDesiredInitialize();
|
StabilizationDesiredInitialize();
|
||||||
|
|
||||||
// ManualControlSettingsInitialize(); // this is initialized in
|
ManualControlSettingsInitialize();
|
||||||
// pios_board.c
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -244,6 +244,11 @@ static void objectUpdatedCb(UAVObjEvent * ev)
|
|||||||
|| objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLOBJECTS) {
|
|| objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLOBJECTS) {
|
||||||
retval = UAVObjDeleteMetaobjects();
|
retval = UAVObjDeleteMetaobjects();
|
||||||
}
|
}
|
||||||
|
} else if (objper.Operation == OBJECTPERSISTENCE_OPERATION_FULLERASE) {
|
||||||
|
retval = -1;
|
||||||
|
#if defined(PIOS_INCLUDE_FLASH_SECTOR_SETTINGS)
|
||||||
|
retval = PIOS_FLASHFS_Format();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if(retval == 0) {
|
if(retval == 0) {
|
||||||
objper.Operation = OBJECTPERSISTENCE_OPERATION_COMPLETED;
|
objper.Operation = OBJECTPERSISTENCE_OPERATION_COMPLETED;
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
//#define PIOS_INCLUDE_HCSR04
|
//#define PIOS_INCLUDE_HCSR04
|
||||||
#define PIOS_INCLUDE_OPAHRS
|
#define PIOS_INCLUDE_OPAHRS
|
||||||
#define PIOS_INCLUDE_COM
|
#define PIOS_INCLUDE_COM
|
||||||
|
#define PIOS_INCLUDE_GPS
|
||||||
#define PIOS_INCLUDE_SDCARD
|
#define PIOS_INCLUDE_SDCARD
|
||||||
#define PIOS_INCLUDE_SETTINGS
|
#define PIOS_INCLUDE_SETTINGS
|
||||||
#define PIOS_INCLUDE_FREERTOS
|
#define PIOS_INCLUDE_FREERTOS
|
||||||
|
@ -525,6 +525,7 @@ static const struct pios_spektrum_cfg pios_spektrum_cfg = {
|
|||||||
#define PIOS_COM_TELEM_RF_TX_BUF_LEN 192
|
#define PIOS_COM_TELEM_RF_TX_BUF_LEN 192
|
||||||
|
|
||||||
#define PIOS_COM_GPS_RX_BUF_LEN 96
|
#define PIOS_COM_GPS_RX_BUF_LEN 96
|
||||||
|
#define PIOS_COM_GPS_TX_BUF_LEN 96
|
||||||
|
|
||||||
#define PIOS_COM_TELEM_USB_RX_BUF_LEN 192
|
#define PIOS_COM_TELEM_USB_RX_BUF_LEN 192
|
||||||
#define PIOS_COM_TELEM_USB_TX_BUF_LEN 192
|
#define PIOS_COM_TELEM_USB_TX_BUF_LEN 192
|
||||||
@ -1074,10 +1075,12 @@ void PIOS_Board_Init(void) {
|
|||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
}
|
}
|
||||||
uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_GPS_RX_BUF_LEN);
|
uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_GPS_RX_BUF_LEN);
|
||||||
|
uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_GPS_TX_BUF_LEN);
|
||||||
PIOS_Assert(rx_buffer);
|
PIOS_Assert(rx_buffer);
|
||||||
|
PIOS_Assert(tx_buffer);
|
||||||
if (PIOS_COM_Init(&pios_com_gps_id, &pios_usart_com_driver, pios_usart_gps_id,
|
if (PIOS_COM_Init(&pios_com_gps_id, &pios_usart_com_driver, pios_usart_gps_id,
|
||||||
rx_buffer, PIOS_COM_GPS_RX_BUF_LEN,
|
rx_buffer, PIOS_COM_GPS_RX_BUF_LEN,
|
||||||
NULL, 0)) {
|
tx_buffer, PIOS_COM_GPS_TX_BUF_LEN)) {
|
||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <uavobjectsinit.h>
|
#include <uavobjectsinit.h>
|
||||||
|
|
||||||
#include "attituderaw.h"
|
#include "attituderaw.h"
|
||||||
|
#include "attitudeactual.h"
|
||||||
#include "positionactual.h"
|
#include "positionactual.h"
|
||||||
#include "velocityactual.h"
|
#include "velocityactual.h"
|
||||||
|
|
||||||
@ -177,6 +178,7 @@ void PIOS_Board_Init(void) {
|
|||||||
|
|
||||||
// Initialize these here as posix has no AHRSComms
|
// Initialize these here as posix has no AHRSComms
|
||||||
AttitudeRawInitialize();
|
AttitudeRawInitialize();
|
||||||
|
AttitudeActualInitialize();
|
||||||
VelocityActualInitialize();
|
VelocityActualInitialize();
|
||||||
PositionActualInitialize();
|
PositionActualInitialize();
|
||||||
|
|
||||||
|
@ -79,8 +79,15 @@ void PIOS_DEBUG_Panic(const char *msg)
|
|||||||
PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, "\r%s @0x%x\r", msg, lr);
|
PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, "\r%s @0x%x\r", msg, lr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Stay put
|
// tell the user whats going on on commandline too
|
||||||
while (1) ;
|
fprintf(stderr,"CRITICAL ERROR: %s\n",msg);
|
||||||
|
|
||||||
|
// this helps debugging: causing a div by zero allows a backtrace
|
||||||
|
// and/or ends execution
|
||||||
|
int b = 0;
|
||||||
|
int a = (2/b);
|
||||||
|
b=a;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,6 +116,19 @@ int32_t PIOS_FLASHFS_Init()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Erase the whole flash chip and create the file system
|
||||||
|
* @return 0 if successful, -1 if not
|
||||||
|
*/
|
||||||
|
int32_t PIOS_FLASHFS_Format()
|
||||||
|
{
|
||||||
|
if(PIOS_Flash_W25X_EraseChip() != 0)
|
||||||
|
return -1;
|
||||||
|
if(PIOS_FLASHFS_ClearObjectTableHeader() != 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Erase the headers for all objects in the flash chip
|
* @brief Erase the headers for all objects in the flash chip
|
||||||
* @return 0 if successful, -1 if not
|
* @return 0 if successful, -1 if not
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "uavobjectmanager.h"
|
#include "uavobjectmanager.h"
|
||||||
|
|
||||||
int32_t PIOS_FLASHFS_Init();
|
int32_t PIOS_FLASHFS_Init();
|
||||||
|
int32_t PIOS_FLASHFS_Format();
|
||||||
int32_t PIOS_FLASHFS_ObjSave(UAVObjHandle obj, uint16_t instId, uint8_t * data);
|
int32_t PIOS_FLASHFS_ObjSave(UAVObjHandle obj, uint16_t instId, uint8_t * data);
|
||||||
int32_t PIOS_FLASHFS_ObjLoad(UAVObjHandle obj, uint16_t instId, uint8_t * data);
|
int32_t PIOS_FLASHFS_ObjLoad(UAVObjHandle obj, uint16_t instId, uint8_t * data);
|
||||||
int32_t PIOS_FLASHFS_ObjDelete(UAVObjHandle obj, uint16_t instId);
|
int32_t PIOS_FLASHFS_ObjDelete(UAVObjHandle obj, uint16_t instId);
|
@ -30,7 +30,7 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
#include "objectpersistence.h"
|
||||||
|
|
||||||
ConfigPlugin::ConfigPlugin()
|
ConfigPlugin::ConfigPlugin()
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ bool ConfigPlugin::initialize(const QStringList& args, QString *errMsg)
|
|||||||
"ConfigPlugin.EraseAll",
|
"ConfigPlugin.EraseAll",
|
||||||
QList<int>() <<
|
QList<int>() <<
|
||||||
Core::Constants::C_GLOBAL_ID);
|
Core::Constants::C_GLOBAL_ID);
|
||||||
cmd->action()->setText("Erase all settings from board...");
|
cmd->action()->setText(tr("Erase all settings from board..."));
|
||||||
|
|
||||||
ac->menu()->addSeparator();
|
ac->menu()->addSeparator();
|
||||||
ac->appendGroup("Utilities");
|
ac->appendGroup("Utilities");
|
||||||
@ -80,6 +80,17 @@ bool ConfigPlugin::initialize(const QStringList& args, QString *errMsg)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return handle to object manager
|
||||||
|
*/
|
||||||
|
UAVObjectManager * ConfigPlugin::getObjectManager()
|
||||||
|
{
|
||||||
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
|
UAVObjectManager * objMngr = pm->getObject<UAVObjectManager>();
|
||||||
|
Q_ASSERT(objMngr);
|
||||||
|
return objMngr;
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigPlugin::extensionsInitialized()
|
void ConfigPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
cmd->action()->setEnabled(false);
|
cmd->action()->setEnabled(false);
|
||||||
@ -122,18 +133,19 @@ void ConfigPlugin::eraseAllSettings()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
settingsErased = false;
|
settingsErased = false;
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
ObjectPersistence* objper = ObjectPersistence::GetInstance(getObjectManager());
|
||||||
UAVObjectManager * objMngr = pm->getObject<UAVObjectManager>();
|
|
||||||
Q_ASSERT(objMngr);
|
|
||||||
ObjectPersistence* objper = dynamic_cast<ObjectPersistence*>( objMngr->getObject(ObjectPersistence::NAME) );
|
|
||||||
Q_ASSERT(objper);
|
Q_ASSERT(objper);
|
||||||
|
|
||||||
connect(objper, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(eraseDone(UAVObject *)));
|
connect(objper, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(eraseDone(UAVObject *)));
|
||||||
ObjectPersistence::DataFields data;
|
|
||||||
data.Operation = ObjectPersistence::OPERATION_DELETE;
|
ObjectPersistence::DataFields data = objper->getData();
|
||||||
data.Selection = ObjectPersistence::SELECTION_ALLSETTINGS;
|
data.Operation = ObjectPersistence::OPERATION_FULLERASE;
|
||||||
|
|
||||||
|
// No need for manual updated event, this is triggered by setData
|
||||||
|
// based on UAVO meta data
|
||||||
objper->setData(data);
|
objper->setData(data);
|
||||||
objper->updated();
|
objper->updated();
|
||||||
QTimer::singleShot(1500,this,SLOT(eraseFailed()));
|
QTimer::singleShot(6000,this,SLOT(eraseFailed()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,37 +153,47 @@ void ConfigPlugin::eraseFailed()
|
|||||||
{
|
{
|
||||||
if (settingsErased)
|
if (settingsErased)
|
||||||
return;
|
return;
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
||||||
UAVObjectManager * objMngr = pm->getObject<UAVObjectManager>();
|
ObjectPersistence* objper = ObjectPersistence::GetInstance(getObjectManager());
|
||||||
Q_ASSERT(objMngr);
|
|
||||||
ObjectPersistence* objper = dynamic_cast<ObjectPersistence*>( objMngr->getObject(ObjectPersistence::NAME));
|
ObjectPersistence::DataFields data = objper->getData();
|
||||||
disconnect(objper, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(eraseDone(UAVObject *)));
|
if(data.Operation == ObjectPersistence::OPERATION_FULLERASE) {
|
||||||
QMessageBox msgBox;
|
// First attempt via flash erase failed. Fall back on erase all settings
|
||||||
msgBox.setText(tr("Error trying to erase settings."));
|
data.Operation = ObjectPersistence::OPERATION_DELETE;
|
||||||
msgBox.setInformativeText(tr("Power-cycle your board. Settings might be inconsistent."));
|
data.Selection = ObjectPersistence::SELECTION_ALLSETTINGS;
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
objper->setData(data);
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
objper->updated();
|
||||||
msgBox.exec();
|
QTimer::singleShot(1500,this,SLOT(eraseFailed()));
|
||||||
|
} else {
|
||||||
|
disconnect(objper, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(eraseDone(UAVObject *)));
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(tr("Error trying to erase settings."));
|
||||||
|
msgBox.setInformativeText(tr("Power-cycle your board after removing all blades. Settings might be inconsistent."));
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
msgBox.exec();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigPlugin::eraseDone(UAVObject * obj)
|
void ConfigPlugin::eraseDone(UAVObject * obj)
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
ObjectPersistence* objper = dynamic_cast<ObjectPersistence*>(sender());
|
ObjectPersistence* objper = ObjectPersistence::GetInstance(getObjectManager());
|
||||||
Q_ASSERT(obj->getName().compare("ObjectPersistence") == 0);
|
ObjectPersistence::DataFields data = objper->getData();
|
||||||
QString tmp = obj->getField("Operation")->getValue().toString();
|
Q_ASSERT(obj->getInstID() == objper->getInstID());
|
||||||
if (obj->getField("Operation")->getValue().toString().compare(QString("Delete")) == 0 ) {
|
|
||||||
|
if(data.Operation != ObjectPersistence::OPERATION_COMPLETED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnect(objper, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(eraseDone(UAVObject *)));
|
disconnect(objper, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(eraseDone(UAVObject *)));
|
||||||
if (obj->getField("Operation")->getValue().toString().compare(QString("Completed")) == 0) {
|
if (data.Operation == ObjectPersistence::OPERATION_COMPLETED) {
|
||||||
settingsErased = true;
|
settingsErased = true;
|
||||||
msgBox.setText(tr("Settings are now erased."));
|
msgBox.setText(tr("Settings are now erased."));
|
||||||
msgBox.setInformativeText(tr("Please now power-cycle your board to complete reset."));
|
msgBox.setInformativeText(tr("Please now power-cycle your board to complete reset."));
|
||||||
} else {
|
} else {
|
||||||
msgBox.setText(tr("Error trying to erase settings."));
|
msgBox.setText(tr("Error trying to erase settings."));
|
||||||
msgBox.setInformativeText(tr("Power-cycle your board. Settings might be inconsistent."));
|
msgBox.setInformativeText(tr("Power-cycle your board after removing all blades. Settings might be inconsistent."));
|
||||||
}
|
}
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
@ -48,6 +48,7 @@ public:
|
|||||||
ConfigPlugin();
|
ConfigPlugin();
|
||||||
~ConfigPlugin();
|
~ConfigPlugin();
|
||||||
|
|
||||||
|
UAVObjectManager * getObjectManager();
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
bool initialize(const QStringList & arguments, QString * errorString);
|
bool initialize(const QStringList & arguments, QString * errorString);
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<xml>
|
<xml>
|
||||||
<object name="ObjectPersistence" singleinstance="true" settings="false">
|
<object name="ObjectPersistence" singleinstance="true" settings="false">
|
||||||
<description>Someone who knows please enter this</description>
|
<description>Someone who knows please enter this</description>
|
||||||
<field name="Operation" units="" type="enum" elements="1" options="NOP,Load,Save,Delete,Completed"/>
|
<field name="Operation" units="" type="enum" elements="1" options="NOP,Load,Save,Delete,FullErase,Completed"/>
|
||||||
<field name="Selection" units="" type="enum" elements="1" options="SingleObject,AllSettings,AllMetaObjects,AllObjects"/>
|
<field name="Selection" units="" type="enum" elements="1" options="SingleObject,AllSettings,AllMetaObjects,AllObjects"/>
|
||||||
<field name="ObjectID" units="" type="uint32" elements="1"/>
|
<field name="ObjectID" units="" type="uint32" elements="1"/>
|
||||||
<field name="InstanceID" units="" type="uint32" elements="1"/>
|
<field name="InstanceID" units="" type="uint32" elements="1"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user