mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
OP-1464 Rename things as requested Implement autodisable as advised by Alessio
This commit is contained in:
parent
55a43d1815
commit
ced0d4725b
@ -480,7 +480,7 @@ void gps_set_fc_baud_from_arg(uint8_t baud)
|
||||
previous_baud = baud;
|
||||
// Set Revo port hwsettings_baud
|
||||
PIOS_COM_ChangeBaud(PIOS_COM_GPS, hwsettings_gpsspeed_enum_to_baud(baud));
|
||||
GPSPositionSensorCurrentBaudRateSet(&baud);
|
||||
GPSPositionSensorBaudRateSet(&baud);
|
||||
}
|
||||
}
|
||||
--mutex;
|
||||
|
@ -458,7 +458,7 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionSensorData *GpsData)
|
||||
#endif
|
||||
if (gpsDataUpdated && (GpsData->Status == GPSPOSITIONSENSOR_STATUS_NOFIX)) {
|
||||
// leave my new field alone!
|
||||
GPSPositionSensorCurrentBaudRateGet(&GpsData->CurrentBaudRate);
|
||||
GPSPositionSensorBaudRateGet(&GpsData->BaudRate);
|
||||
GPSPositionSensorSet(GpsData);
|
||||
}
|
||||
return false;
|
||||
@ -471,7 +471,7 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionSensorData *GpsData)
|
||||
DEBUG_MSG("U");
|
||||
#endif
|
||||
// leave my new field alone!
|
||||
GPSPositionSensorCurrentBaudRateGet(&GpsData->CurrentBaudRate);
|
||||
GPSPositionSensorBaudRateGet(&GpsData->BaudRate);
|
||||
GPSPositionSensorSet(GpsData);
|
||||
}
|
||||
|
||||
|
@ -529,7 +529,7 @@ uint32_t parse_ubx_message(struct UBXPacket *ubx, GPSPositionSensorData *GpsPosi
|
||||
|
||||
if (msgtracker.msg_received == ALL_RECEIVED) {
|
||||
// leave my new field alone!
|
||||
GPSPositionSensorCurrentBaudRateGet(&GpsPosition->CurrentBaudRate);
|
||||
GPSPositionSensorBaudRateGet(&GpsPosition->BaudRate);
|
||||
GPSPositionSensorSet(GpsPosition);
|
||||
msgtracker.msg_received = NONE_RECEIVED;
|
||||
id = GPSPOSITIONSENSOR_OBJID;
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "inc/ubx_autoconfig.h"
|
||||
#include <pios_mem.h>
|
||||
#include "taskinfo.h"
|
||||
|
||||
// private type definitions
|
||||
|
||||
@ -156,7 +157,9 @@ ubx_cfg_msg_t msg_config_ubx7[] = {
|
||||
|
||||
// we can enable this when we know how to make the Flight Controller save an object to permanent storage
|
||||
// also see comment about simple edit in gpssettings.xml
|
||||
// #define AUTOBAUD_CONFIGURE_STORE_AND_DISABLE
|
||||
#define AUTOBAUD_CONFIGURE_STORE_AND_DISABLE
|
||||
// Alessio Morale May 20 3:16 AM
|
||||
// @Cliff you should update the ObjectPersistence uavo passing the object id and the desired operation.
|
||||
|
||||
// private variables
|
||||
|
||||
@ -459,17 +462,40 @@ static void enable_sentences(__attribute__((unused)) uint16_t *bytes_to_send)
|
||||
#if defined(AUTOBAUD_CONFIGURE_STORE_AND_DISABLE)
|
||||
// permanently store our version of GPSSettings.UbxAutoConfig
|
||||
// we use this to disable after AbConfigStoreAndDisable is complete
|
||||
// FIXME: this does not store it permanently
|
||||
// all that is needed is for the following to store it permanently like HomeLocation is stored by the flight code
|
||||
// GPSSettingsUbxAutoConfigSet((GPSSettingsUbxAutoConfigOptions *) &status->currentSettings.UbxAutoConfig);
|
||||
static void setGpsSettings()
|
||||
{
|
||||
// trying to do this as perfectly as possible we must realize that they may have pressed Send on some fields
|
||||
// and so those fields are not stored permanently
|
||||
// if we write the memory copy to flash, we will have made those permanent
|
||||
|
||||
// we could save off the uavo memory copy to a local buffer with a standard GPSSettingsGet()
|
||||
// load from flash to uavo memory with a UAVObjLoad()
|
||||
// update our one setting in uavo memory with a standard GPSSettingsUbxAutoConfigSet()
|
||||
// save from uavo memory to flash with a UAVObjSave()
|
||||
// modify our saved off copy to have our new setting in it too
|
||||
// and finally copy the local buffer back out to uavo memory
|
||||
|
||||
// that would do it as correctly as possible, but it doesn't work
|
||||
// so we do it the way autotune.c does it
|
||||
|
||||
#if 0
|
||||
// get the "in memory" version to a local buffer
|
||||
GPSSettingsGet((void *) &status->gpsSettings);
|
||||
// load the permanent version into memory
|
||||
UAVObjLoad(GPSSettingsHandle(), 0);
|
||||
#endif
|
||||
// change the in memory version of the field we want to change
|
||||
GPSSettingsUbxAutoConfigSet((GPSSettingsUbxAutoConfigOptions *) &status->currentSettings.UbxAutoConfig);
|
||||
// save the in memory version to permanent
|
||||
UAVObjSave(GPSSettingsHandle(), 0);
|
||||
#if 0
|
||||
// copy the setting into the struct we will use to Set()
|
||||
status->gpsSettings.UbxAutoConfig = status->currentSettings.UbxAutoConfig;
|
||||
// try casting it correctly and it says:
|
||||
// expected 'struct GPSSettingsData *' but argument is of type 'struct GPSSettingsData *'
|
||||
// probably a volatile or align issue
|
||||
GPSSettingsGet((void *) &status->gpsSettings);
|
||||
status->gpsSettings.UbxAutoConfig = status->currentSettings.UbxAutoConfig;
|
||||
GPSSettingsSet((void *) &status->gpsSettings);
|
||||
GPSSettingsSet((void *) &status->gpsSettings); // set the "in memory" version back into use
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -614,9 +640,9 @@ void gps_ubx_autoconfig_run(char * *buffer, uint16_t *bytes_to_send)
|
||||
// if user requests that settings be saved, we will reset here too
|
||||
// that makes sure that all strange settings are reset to factory default
|
||||
// else these strange settings may persist because we don't reset all settings by table
|
||||
if (status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_ABCONFIGANDSTORE
|
||||
if (status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_AUTOBAUDCONFIGUREANDSTORE
|
||||
#if defined(AUTOBAUD_CONFIGURE_STORE_AND_DISABLE)
|
||||
|| status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_ABCONFIGSTOREANDDISABLE
|
||||
|| status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_AUTOBAUDCONFIGURESTOREANDDISABLE
|
||||
#endif
|
||||
)
|
||||
#endif
|
||||
@ -639,9 +665,9 @@ void gps_ubx_autoconfig_run(char * *buffer, uint16_t *bytes_to_send)
|
||||
// if user requests that settings be saved, we will reset here too
|
||||
// that makes sure that all strange settings are reset to factory default
|
||||
// else these strange settings may persist because we don't reset all settings by hand
|
||||
if (status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_ABCONFIGANDSTORE
|
||||
if (status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_AUTOBAUDCONFIGUREANDSTORE
|
||||
#if defined(AUTOBAUD_CONFIGURE_STORE_AND_DISABLE)
|
||||
|| status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_ABCONFIGSTOREANDDISABLE
|
||||
|| status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_AUTOBAUDCONFIGURESTOREANDDISABLE
|
||||
#endif
|
||||
)
|
||||
#endif
|
||||
@ -768,9 +794,9 @@ void gps_ubx_autoconfig_run(char * *buffer, uint16_t *bytes_to_send)
|
||||
// all configurations have been made
|
||||
case INIT_STEP_SAVE:
|
||||
// now decide whether to save them permanently into the GPS
|
||||
if (status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_ABCONFIGANDSTORE
|
||||
if (status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_AUTOBAUDCONFIGUREANDSTORE
|
||||
#if defined(AUTOBAUD_CONFIGURE_STORE_AND_DISABLE)
|
||||
|| status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_ABCONFIGSTOREANDDISABLE
|
||||
|| status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_AUTOBAUDCONFIGURESTOREANDDISABLE
|
||||
#endif
|
||||
) {
|
||||
config_save(bytes_to_send);
|
||||
@ -797,8 +823,8 @@ void gps_ubx_autoconfig_run(char * *buffer, uint16_t *bytes_to_send)
|
||||
// the autoconfig has completed normally
|
||||
case INIT_STEP_PRE_DONE:
|
||||
#if defined(AUTOBAUD_CONFIGURE_STORE_AND_DISABLE)
|
||||
// determine if we need to disable autoconfig via the autoconfig==CONFIGSTOREANDDISABLE setting
|
||||
if (status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_ABCONFIGSTOREANDDISABLE) {
|
||||
// determine if we need to disable autoconfig via the autoconfig==AUTOBAUDCONFIGSTOREANDDISABLE setting
|
||||
if (status->currentSettings.UbxAutoConfig == GPSSETTINGS_UBXAUTOCONFIG_AUTOBAUDCONFIGURESTOREANDDISABLE) {
|
||||
enabled = false;
|
||||
status->currentSettings.UbxAutoConfig = GPSSETTINGS_UBXAUTOCONFIG_DISABLED;
|
||||
// like it says
|
||||
@ -841,7 +867,7 @@ void gps_ubx_autoconfig_set(ubx_autoconfig_settings_t *config)
|
||||
if (config != NULL) {
|
||||
status->currentSettings = *config;
|
||||
}
|
||||
if (status->currentSettings.UbxAutoConfig >= GPSSETTINGS_UBXAUTOCONFIG_ABANDCONFIGURE) {
|
||||
if (status->currentSettings.UbxAutoConfig >= GPSSETTINGS_UBXAUTOCONFIG_AUTOBAUDANDCONFIGURE) {
|
||||
new_step = INIT_STEP_START;
|
||||
} else {
|
||||
new_step = INIT_STEP_DISABLED;
|
||||
@ -857,7 +883,7 @@ void gps_ubx_autoconfig_set(ubx_autoconfig_settings_t *config)
|
||||
status->currentStep = new_step;
|
||||
status->currentStepSave = new_step;
|
||||
|
||||
if (status->currentSettings.UbxAutoConfig >= GPSSETTINGS_UBXAUTOCONFIG_ABANDCONFIGURE) {
|
||||
if (status->currentSettings.UbxAutoConfig >= GPSSETTINGS_UBXAUTOCONFIG_AUTOBAUDANDCONFIGURE) {
|
||||
// enabled refers to autoconfigure
|
||||
// note that sensor type (gps type) detection happens even if completely disabled
|
||||
// also note that AutoBaud is less than Configure
|
||||
|
@ -184,12 +184,12 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
|
||||
break;
|
||||
case VehicleConfigurationSource::GPS_UBX:
|
||||
gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_UBX;
|
||||
gpsData.UbxAutoConfig = GPSSettings::UBXAUTOCONFIG_ABANDCONFIGURE;
|
||||
gpsData.UbxAutoConfig = GPSSettings::UBXAUTOCONFIG_AUTOBAUDANDCONFIGURE;
|
||||
break;
|
||||
case VehicleConfigurationSource::GPS_PLATINUM:
|
||||
{
|
||||
gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_UBX;
|
||||
gpsData.UbxAutoConfig = GPSSettings::UBXAUTOCONFIG_ABANDCONFIGURE;
|
||||
gpsData.UbxAutoConfig = GPSSettings::UBXAUTOCONFIG_AUTOBAUDANDCONFIGURE;
|
||||
AuxMagSettings *magSettings = AuxMagSettings::GetInstance(m_uavoManager);
|
||||
Q_ASSERT(magSettings);
|
||||
AuxMagSettings::DataFields magsData = magSettings->getData();
|
||||
|
@ -14,7 +14,7 @@
|
||||
<field name="VDOP" units="" type="float" elements="1"/>
|
||||
<field name="SensorType" units="" type="enum" elements="1" options="Unknown,NMEA,UBX,UBX7,UBX8" defaultvalue="Unknown" />
|
||||
<field name="AutoConfigStatus" units="" type="enum" elements="1" options="DISABLED,RUNNING,DONE,ERROR" defaultvalue="DISABLED" />
|
||||
<field name="CurrentBaudRate" units="" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200,230400,Unknown" defaultvalue="Unknown" />
|
||||
<field name="BaudRate" units="" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200,230400,Unknown" defaultvalue="Unknown" />
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
||||
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<!-- Ubx self configuration. Enable to allow the flight board to auto configure ubx GPS options,
|
||||
store does AutoConfig and save GPS settings (i.e. to prevent issues if gps is power cycled) -->
|
||||
<!-- add AbConfigStoreAndDisable after AbConfigAndStore and uncomment AUTOBAUD_CONFIGURE_STORE_AND_DISABLE in ubx_autoconfig.c-->
|
||||
<field name="UbxAutoConfig" units="" type="enum" elements="1" options="Disabled,AutoBaud,AbAndConfigure,AbConfigAndStore" defaultvalue="AbAndConfigure"/>
|
||||
<field name="UbxAutoConfig" units="" type="enum" elements="1" options="Disabled,AutoBaud,AutoBaudAndConfigure,AutoBaudConfigureAndStore,AutoBaudConfigureStoreAndDisable" defaultvalue="AutoBaudAndConfigure"/>
|
||||
<!-- Ubx position update rate, -1 for auto -->
|
||||
<field name="UbxRate" units="Hz" type="int8" elements="1" defaultvalue="5" />
|
||||
<!-- Ubx dynamic model, see UBX datasheet for more details -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user