mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
OP-1245 Changed the code that saves the logging metadata for all objects and DebugLogSettings object.
This commit is contained in:
parent
786d3c97a1
commit
77f9294548
@ -56,6 +56,9 @@ FlightLogManager::FlightLogManager(QObject *parent) :
|
|||||||
m_telemtryManager = pluginManager->getObject<TelemetryManager>();
|
m_telemtryManager = pluginManager->getObject<TelemetryManager>();
|
||||||
Q_ASSERT(m_telemtryManager);
|
Q_ASSERT(m_telemtryManager);
|
||||||
|
|
||||||
|
m_objectUtilManager = pluginManager->getObject<UAVObjectUtilManager>();
|
||||||
|
Q_ASSERT(m_objectUtilManager);
|
||||||
|
|
||||||
m_flightLogControl = DebugLogControl::GetInstance(m_objectManager);
|
m_flightLogControl = DebugLogControl::GetInstance(m_objectManager);
|
||||||
Q_ASSERT(m_flightLogControl);
|
Q_ASSERT(m_flightLogControl);
|
||||||
|
|
||||||
@ -493,8 +496,8 @@ void FlightLogManager::resetSettings(bool clear)
|
|||||||
|
|
||||||
void FlightLogManager::saveSettingsToBoard()
|
void FlightLogManager::saveSettingsToBoard()
|
||||||
{
|
{
|
||||||
|
|
||||||
m_flightLogSettings->setLoggingEnabled(m_loggingEnabled);
|
m_flightLogSettings->setLoggingEnabled(m_loggingEnabled);
|
||||||
|
m_flightLogSettings->updated();
|
||||||
saveUAVObjectToFlash(m_flightLogSettings);
|
saveUAVObjectToFlash(m_flightLogSettings);
|
||||||
|
|
||||||
foreach(UAVOLogSettingsWrapper * wrapper, m_uavoEntries) {
|
foreach(UAVOLogSettingsWrapper * wrapper, m_uavoEntries) {
|
||||||
@ -502,6 +505,9 @@ void FlightLogManager::saveSettingsToBoard()
|
|||||||
UAVObject::Metadata meta = wrapper->object()->getMetadata();
|
UAVObject::Metadata meta = wrapper->object()->getMetadata();
|
||||||
wrapper->object()->SetLoggingUpdateMode(meta, wrapper->settingAsUpdateMode());
|
wrapper->object()->SetLoggingUpdateMode(meta, wrapper->settingAsUpdateMode());
|
||||||
meta.loggingUpdatePeriod = wrapper->period();
|
meta.loggingUpdatePeriod = wrapper->period();
|
||||||
|
|
||||||
|
// As metadata are set up to update via telemetry on change
|
||||||
|
// this call will send the update to the board.
|
||||||
wrapper->object()->setMetadata(meta);
|
wrapper->object()->setMetadata(meta);
|
||||||
|
|
||||||
if (saveUAVObjectToFlash(wrapper->object()->getMetaObject())) {
|
if (saveUAVObjectToFlash(wrapper->object()->getMetaObject())) {
|
||||||
@ -513,18 +519,8 @@ void FlightLogManager::saveSettingsToBoard()
|
|||||||
|
|
||||||
bool FlightLogManager::saveUAVObjectToFlash(UAVObject *object)
|
bool FlightLogManager::saveUAVObjectToFlash(UAVObject *object)
|
||||||
{
|
{
|
||||||
UAVObjectUpdaterHelper helper;
|
m_objectUtilManager->saveObjectToSD(object);
|
||||||
if (helper.doObjectAndWait(object, 3000) == UAVObjectUpdaterHelper::SUCCESS) {
|
return true;
|
||||||
ObjectPersistence::DataFields data;
|
|
||||||
data.Operation = ObjectPersistence::OPERATION_SAVE;
|
|
||||||
data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT;
|
|
||||||
data.ObjectID = object->getObjID();
|
|
||||||
data.InstanceID = object->getInstID();
|
|
||||||
m_objectPersistence->setData(data);
|
|
||||||
|
|
||||||
return (helper.doObjectAndWait(m_objectPersistence, 3000) == UAVObjectUpdaterHelper::SUCCESS);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlightLogManager::updateFlightEntries(quint16 currentFlight)
|
void FlightLogManager::updateFlightEntries(quint16 currentFlight)
|
||||||
@ -680,9 +676,17 @@ UAVOLogSettingsWrapper::~UAVOLogSettingsWrapper()
|
|||||||
|
|
||||||
void UAVOLogSettingsWrapper::reset(bool clear)
|
void UAVOLogSettingsWrapper::reset(bool clear)
|
||||||
{
|
{
|
||||||
setSetting(clear ? 0 : m_object->GetLoggingUpdateMode(m_object->getMetadata()));
|
setSetting(m_object->GetLoggingUpdateMode(m_object->getMetadata()));
|
||||||
setPeriod(clear ? 0 : m_object->getMetadata().loggingUpdatePeriod);
|
setPeriod(m_object->getMetadata().loggingUpdatePeriod);
|
||||||
setDirty(false);
|
if (clear) {
|
||||||
|
int oldSetting = setting();
|
||||||
|
int oldPeriod = period();
|
||||||
|
setSetting(0);
|
||||||
|
setPeriod(0);
|
||||||
|
setDirty(oldSetting != setting() || oldPeriod != period());
|
||||||
|
} else {
|
||||||
|
setDirty(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UAVObject::UpdateMode UAVOLogSettingsWrapper::settingAsUpdateMode()
|
UAVObject::UpdateMode UAVOLogSettingsWrapper::settingAsUpdateMode()
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
#include "uavobjectmanager.h"
|
#include "uavobjectmanager.h"
|
||||||
|
#include "uavobjectutilmanager.h"
|
||||||
#include "debuglogentry.h"
|
#include "debuglogentry.h"
|
||||||
#include "debuglogstatus.h"
|
#include "debuglogstatus.h"
|
||||||
#include "debuglogsettings.h"
|
#include "debuglogsettings.h"
|
||||||
@ -316,6 +317,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
UAVObjectManager *m_objectManager;
|
UAVObjectManager *m_objectManager;
|
||||||
|
UAVObjectUtilManager *m_objectUtilManager;
|
||||||
TelemetryManager *m_telemtryManager;
|
TelemetryManager *m_telemtryManager;
|
||||||
DebugLogControl *m_flightLogControl;
|
DebugLogControl *m_flightLogControl;
|
||||||
DebugLogStatus *m_flightLogStatus;
|
DebugLogStatus *m_flightLogStatus;
|
||||||
|
Loading…
Reference in New Issue
Block a user