diff --git a/flight/Modules/GPS/GPS.c b/flight/Modules/GPS/GPS.c index fcf6c7171..52df5679d 100644 --- a/flight/Modules/GPS/GPS.c +++ b/flight/Modules/GPS/GPS.c @@ -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() { diff --git a/flight/Modules/Telemetry/telemetry.c b/flight/Modules/Telemetry/telemetry.c index ae989f738..e0f8b2d5f 100644 --- a/flight/Modules/Telemetry/telemetry.c +++ b/flight/Modules/Telemetry/telemetry.c @@ -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