1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

Merge remote-tracking branch 'origin/steve/OP-1904_Display_current_TxPID_settings_on_OSD' into rel-nano-15.05

This commit is contained in:
abeck70 2015-06-02 08:22:10 +10:00
commit 66aeac834b
7 changed files with 39 additions and 1 deletions

View File

@ -64,6 +64,7 @@
#include "stabilizationsettingsbank2.h"
#include "stabilizationsettingsbank3.h"
#include "flightstatus.h"
#include "txpidstatus.h"
#include "hwsettings.h"
//
@ -114,6 +115,7 @@ int32_t TxPIDInitialize(void)
if (txPIDEnabled) {
TxPIDSettingsInitialize();
TxPIDStatusInitialize();
AccessoryDesiredInitialize();
UAVObjEvent ev = {
@ -138,7 +140,14 @@ int32_t TxPIDInitialize(void)
metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC;
metadata.telemetryUpdatePeriod = TELEMETRY_UPDATE_PERIOD_MS;
StabilizationSettingsSetMetadata(&metadata);
#endif
AttitudeSettingsInitialize();
AttitudeSettingsGetMetadata(&metadata);
metadata.telemetryAcked = 0;
metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC;
metadata.telemetryUpdatePeriod = TELEMETRY_UPDATE_PERIOD_MS;
AttitudeSettingsSetMetadata(&metadata);
#endif /* if (TELEMETRY_UPDATE_PERIOD_MS != 0) */
return 0;
}
@ -206,6 +215,9 @@ static void updatePIDs(UAVObjEvent *ev)
#endif
AccessoryDesiredData accessory;
TxPIDStatusData txpid_status;
TxPIDStatusGet(&txpid_status);
uint8_t needsUpdateBank = 0;
uint8_t needsUpdateStab = 0;
uint8_t needsUpdateAtt = 0;
@ -234,6 +246,8 @@ static void updatePIDs(UAVObjEvent *ev)
continue;
}
TxPIDStatusCurPIDToArray(txpid_status.CurPID)[i] = value;
switch (TxPIDSettingsPIDsToArray(inst.PIDs)[i]) {
case TXPIDSETTINGS_PIDS_ROLLRATEKP:
needsUpdateBank |= update(&bank.RollRatePID.Kp, value);
@ -432,6 +446,15 @@ static void updatePIDs(UAVObjEvent *ev)
return;
}
}
if (needsUpdateStab ||
needsUpdateAtt ||
#ifdef REVOLUTION
needsUpdateAltitude ||
#endif /* REVOLUTION */
needsUpdateBank) {
TxPIDStatusSet(&txpid_status);;
}
}
/**

View File

@ -122,6 +122,7 @@ UAVOBJSRCFILENAMES += poilocation
UAVOBJSRCFILENAMES += poilearnsettings
UAVOBJSRCFILENAMES += mpugyroaccelsettings
UAVOBJSRCFILENAMES += txpidsettings
UAVOBJSRCFILENAMES += txpidstatus
UAVOBJSRCFILENAMES += takeofflocation
UAVOBJSRCFILENAMES += perfcounter

View File

@ -122,6 +122,7 @@ UAVOBJSRCFILENAMES += poilocation
UAVOBJSRCFILENAMES += poilearnsettings
UAVOBJSRCFILENAMES += mpugyroaccelsettings
UAVOBJSRCFILENAMES += txpidsettings
UAVOBJSRCFILENAMES += txpidstatus
UAVOBJSRCFILENAMES += takeofflocation
UAVOBJSRCFILENAMES += perfcounter

View File

@ -122,6 +122,7 @@ UAVOBJSRCFILENAMES += poilocation
UAVOBJSRCFILENAMES += poilearnsettings
UAVOBJSRCFILENAMES += mpugyroaccelsettings
UAVOBJSRCFILENAMES += txpidsettings
UAVOBJSRCFILENAMES += txpidstatus
UAVOBJSRCFILENAMES += takeofflocation
UAVOBJSRCFILENAMES += perfcounter

View File

@ -122,6 +122,7 @@ UAVOBJSRCFILENAMES += poilocation
UAVOBJSRCFILENAMES += poilearnsettings
UAVOBJSRCFILENAMES += mpugyroaccelsettings
UAVOBJSRCFILENAMES += txpidsettings
UAVOBJSRCFILENAMES += txpidstatus
UAVOBJSRCFILENAMES += takeofflocation
UAVOBJSRC = $(foreach UAVOBJSRCFILE,$(UAVOBJSRCFILENAMES),$(OPUAVSYNTHDIR)/$(UAVOBJSRCFILE).c )

View File

@ -139,6 +139,7 @@ UAVOBJS = \
$${UAVOBJ_XML_DIR}/takeofflocation.xml \
$${UAVOBJ_XML_DIR}/taskinfo.xml \
$${UAVOBJ_XML_DIR}/txpidsettings.xml \
$${UAVOBJ_XML_DIR}/txpidstatus.xml \
$${UAVOBJ_XML_DIR}/velocitydesired.xml \
$${UAVOBJ_XML_DIR}/velocitystate.xml \
$${UAVOBJ_XML_DIR}/vtolpathfollowersettings.xml \

View File

@ -0,0 +1,10 @@
<xml>
<object name="TxPIDStatus" singleinstance="true" settings="false" category="Control" priority="true">
<description>Status of @ref TxPID optional module used to tune PID settings using R/C transmitter.</description>
<field name="CurPID" units="" type="float" elementnames="Instance1,Instance2,Instance3" defaultvalue="0"/>
<access gcs="readonly" flight="readwrite"/>
<telemetrygcs acked="false" updatemode="manual" period="0"/>
<telemetryflight acked="false" updatemode="periodic" period="2000"/>
<logging updatemode="manual" period="0"/>
</object>
</xml>