From eed5c098ab787f16e67a13b4815e264514bd739f Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 6 Apr 2014 19:12:00 +0200 Subject: [PATCH] OP-1294 Allow to specify different stack sizes for rx and tx telemetry task. --- flight/modules/Telemetry/telemetry.c | 15 +++++++++------ .../coptercontrol/firmware/inc/pios_config.h | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/flight/modules/Telemetry/telemetry.c b/flight/modules/Telemetry/telemetry.c index 55c201369..2626d4647 100644 --- a/flight/modules/Telemetry/telemetry.c +++ b/flight/modules/Telemetry/telemetry.c @@ -41,7 +41,13 @@ // Private constants #define MAX_QUEUE_SIZE TELEM_QUEUE_SIZE -#define STACK_SIZE_BYTES PIOS_TELEM_STACK_SIZE +#ifdef PIOS_TELEM_RX_STACK_SIZE +#define STACK_SIZE_RX_BYTES PIOS_TELEM_RX_STACK_SIZE +#define STACK_SIZE_TX_BYTES PIOS_TELEM_TX_STACK_SIZE +#else +#define STACK_SIZE_RX_BYTES PIOS_TELEM_STACK_SIZE +#define STACK_SIZE_TX_BYTES PIOS_TELEM_STACK_SIZE +#endif #define TASK_PRIORITY_RX (tskIDLE_PRIORITY + 2) #define TASK_PRIORITY_TX (tskIDLE_PRIORITY + 2) #define TASK_PRIORITY_RADRX (tskIDLE_PRIORITY + 2) @@ -110,9 +116,9 @@ int32_t TelemetryStart(void) GCSTelemetryStatsConnectQueue(priorityQueue); // Start telemetry tasks - xTaskCreate(telemetryTxTask, (signed char *)"TelTx", STACK_SIZE_BYTES / 4, NULL, TASK_PRIORITY_TX, &telemetryTxTaskHandle); + xTaskCreate(telemetryTxTask, (signed char *)"TelTx", STACK_SIZE_TX_BYTES / 4, NULL, TASK_PRIORITY_TX, &telemetryTxTaskHandle); PIOS_TASK_MONITOR_RegisterTask(TASKINFO_RUNNING_TELEMETRYTX, telemetryTxTaskHandle); - xTaskCreate(telemetryRxTask, (signed char *)"TelRx", STACK_SIZE_BYTES / 4, NULL, TASK_PRIORITY_RX, &telemetryRxTaskHandle); + xTaskCreate(telemetryRxTask, (signed char *)"TelRx", STACK_SIZE_RX_BYTES / 4, NULL, TASK_PRIORITY_RX, &telemetryRxTaskHandle); PIOS_TASK_MONITOR_RegisterTask(TASKINFO_RUNNING_TELEMETRYRX, telemetryRxTaskHandle); #ifdef PIOS_INCLUDE_RFM22B @@ -391,7 +397,6 @@ static void telemetryTxTask(__attribute__((unused)) void *parameters) if (xQueueReceive(queue, &ev, 0) == pdTRUE) { // Process event processObjEvent(&ev); - // if both queues are empty, wait on priority queue for updates (1 tick) then repeat cycle } else if (xQueueReceive(priorityQueue, &ev, 1) == pdTRUE) { // Process event @@ -458,8 +463,6 @@ static void radioRxTask(__attribute__((unused)) void *parameters) } } } - - /** * Transmit data buffer to the radioport. * \param[in] data Data buffer to send diff --git a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h index 8acb0e0c5..59572cdc9 100644 --- a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h +++ b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h @@ -164,7 +164,8 @@ #else #define PIOS_SYSTEM_STACK_SIZE 660 #endif -#define PIOS_TELEM_STACK_SIZE 540 +#define PIOS_TELEM_RX_STACK_SIZE 410 +#define PIOS_TELEM_TX_STACK_SIZE 560 #define PIOS_EVENTDISPATCHER_STACK_SIZE 160 /* This can't be too high to stop eventdispatcher thread overflowing */