1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-16 08:29:15 +01:00

HwSettings: disable GPS and telemetry port speed updates at run-time

This is to be consistent across the HwSettings object fields which are
read on boot only by convention.
This commit is contained in:
Oleg Semyonov 2011-10-31 23:04:17 +02:00
parent 2a98a52f4c
commit a8b36ddd28
2 changed files with 13 additions and 33 deletions

View File

@ -50,7 +50,6 @@
// Private functions
static void gpsTask(void *parameters);
static void SettingsUpdatedCb(UAVObjEvent * ev);
static void updateSettings();
#ifdef PIOS_GPS_SETS_HOMELOCATION
@ -120,7 +119,6 @@ int32_t GPSInitialize(void)
gpsPort = PIOS_COM_GPS;
if (gpsPort) {
GPSPositionInitialize();
#if !defined(PIOS_GPS_MINIMAL)
GPSTimeInitialize();
@ -130,13 +128,8 @@ int32_t GPSInitialize(void)
HomeLocationInitialize();
#endif
HwSettingsInitialize();
// TODO: Get gps settings object
updateSettings();
// Listen for settings updates, connect a callback function
HwSettingsConnectCallback(&SettingsUpdatedCb);
gps_rx_buffer = pvPortMalloc(NMEA_MAX_PACKET_LENGTH);
PIOS_Assert(gps_rx_buffer);
@ -351,21 +344,12 @@ static void setHomeLocation(GPSPositionData * gpsData)
}
#endif
// ****************
/**
* Settings callback, called each time the settings object is updated
*/
static void SettingsUpdatedCb(UAVObjEvent * ev)
{
if (ev->obj == HwSettingsHandle())
updateSettings();
}
/**
* Update the GPS settings, called on startup and
* each time the settings object is updated
* Update the GPS settings, called on startup.
* FIXME: This should be in the GPSSettings object. But objects have
* too much overhead yet. Also the GPS has no any specific settings
* like protocol, etc. Thus the HwSettings object which contains the
* GPS port speed is used for now.
*/
static void updateSettings()
{

View File

@ -93,7 +93,6 @@ int32_t TelemetryStart(void)
// Listen to objects of interest
GCSTelemetryStatsConnectQueue(priorityQueue);
HwSettingsConnectQueue(priorityQueue);
// Start telemetry tasks
xTaskCreate(telemetryTxTask, (signed char *)"TelTx", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY_TX, &telemetryTxTaskHandle);
@ -116,11 +115,8 @@ int32_t TelemetryStart(void)
*/
int32_t TelemetryInitialize(void)
{
UAVObjEvent ev;
FlightTelemetryStatsInitialize();
GCSTelemetryStatsInitialize();
HwSettingsInitialize();
// Initialize vars
timeOfLastObjectUpdate = 0;
@ -132,6 +128,8 @@ int32_t TelemetryInitialize(void)
#endif
// Update telemetry settings
telemetryPort = PIOS_COM_TELEM_RF;
HwSettingsInitialize();
updateSettings();
// Initialise UAVTalk
@ -140,9 +138,9 @@ int32_t TelemetryInitialize(void)
// Create periodic event that will be used to update the telemetry stats
txErrors = 0;
txRetries = 0;
UAVObjEvent ev;
memset(&ev, 0, sizeof(UAVObjEvent));
EventPeriodicQueueCreate(&ev, priorityQueue, STATS_UPDATE_PERIOD_MS);
return 0;
}
@ -225,8 +223,6 @@ static void processObjEvent(UAVObjEvent * ev)
updateTelemetryStats();
} else if (ev->obj == GCSTelemetryStatsHandle()) {
gcsTelemetryStatsUpdated();
} else if (ev->obj == HwSettingsHandle()) {
updateSettings();
} else {
// Only process event if connected to GCS or if object FlightTelemetryStats is updated
FlightTelemetryStatsGet(&flightStats);
@ -508,14 +504,14 @@ static void updateTelemetryStats()
}
/**
* Update the telemetry settings, called on startup and
* each time the settings object is updated
* Update the telemetry settings, called on startup.
* FIXME: This should be in the TelemetrySettings object. But objects
* have too much overhead yet. Also the telemetry has no any specific
* settings, etc. Thus the HwSettings object which contains the
* telemetry port speed is used for now.
*/
static void updateSettings()
{
// Set port
telemetryPort = PIOS_COM_TELEM_RF;
if (telemetryPort) {
// Retrieve settings