From 34ca854f46938369ec19c994b0cc5de11a131aec Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 12 Jul 2022 19:55:52 -0600 Subject: [PATCH 1/5] Modified main.c to initialize and deploy antenna --- radsat-sk/src/main.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/radsat-sk/src/main.c b/radsat-sk/src/main.c index d72c9c77..750b4d1d 100644 --- a/radsat-sk/src/main.c +++ b/radsat-sk/src/main.c @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -220,6 +221,22 @@ static int initTime(void) { } +/** + * Attempt to deploy the antenna. + */ +static int attemptAntennaDeployment(void) { + + int error = SUCCESS; + + error = antennaDeploymentAttempt(); + if (error != SUCCESS) + debugPrint("attemptAntennaDeployment(): failed to deploy antenna.\n"); + + return error; +} + + + /** * Initialize external subsystem modules and the Satellite Subsystem Interface library. */ @@ -234,6 +251,13 @@ static int initSubsystems(void) { return error; } + // initialize the antenna module + error = antennaInit(); + if (error != SUCCESS){ + debugPrint("initSubsystems(): failed to initialized Antenna subsystem.\n"); + return error; + } + // TODO: initialize the other subsystems that require explicit initialization return error; @@ -414,6 +438,13 @@ void MissionInitTask(void* parameters) { debugPrint("MissionInitTask(): failed to initialize the time.\n"); } + // attempt to deploy the antenna + error = attemptAntennaDeployment(); + if (error != SUCCESS) { + // TODO: report system manager + debugPrint("attemptAntennaDeployment(): failed to deploy the antenna.\n") + } + // initialize the FreeRTOS Tasks used for typical mission operation initMissionTasks(); if (error != SUCCESS) { From f50283779463ac105c84d10806cf3a982ecb9ea2 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 19 Jul 2022 12:34:44 -0600 Subject: [PATCH 2/5] improve antenna deployment sequences. add delays between deployment attempts and disarm only after all deployment attempts for that side. --- radsat-sk/operation/subsystems/RAntenna.c | 49 +++++++++++++---------- radsat-sk/operation/subsystems/RAntenna.h | 3 ++ 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/radsat-sk/operation/subsystems/RAntenna.c b/radsat-sk/operation/subsystems/RAntenna.c index 1c5c7432..ec8cdb87 100644 --- a/radsat-sk/operation/subsystems/RAntenna.c +++ b/radsat-sk/operation/subsystems/RAntenna.c @@ -127,24 +127,27 @@ int antennaDeploymentAttempt(void) { // TODO: record errors (if present) to System Manager return error; } - - // Disarm A Side Antenna system - error = IsisAntS_setArmStatus(ANTENNA_INDEX, isisants_sideA, isisants_disarm); - - // Check if disarm failed - if(error != 0) { - - // TODO: record errors (if present) to System Manager - return error; - } } } // Increment deployment attempts for side A antennaDeploymentAttempts += 1; + + // Wait between deployment attempts to ensure disarming doesn't happen too quickly + vTaskDelay(INTER_DEPLOYMENT_DELAY_MS); } - // reset_t attempt counter for Side B + // Disarm A Side Antenna system + error = IsisAntS_setArmStatus(ANTENNA_INDEX, isisants_sideA, isisants_disarm); + + // Check if disarm failed + if(error != 0) { + + // TODO: record errors (if present) to System Manager + return error; + } + + // reset attempt counter for Side B antennaDeploymentAttempts = 0; // B Side deployment Attempt @@ -206,21 +209,23 @@ int antennaDeploymentAttempt(void) { // TODO: record errors (if present) to System Manager return error; } - - //disarm B Side Antenna system - error = IsisAntS_setArmStatus(ANTENNA_INDEX, isisants_sideB, isisants_disarm); - - // Check if disarm failed - if(error != 0) { - - // TODO: record errors (if present) to System Manager - return error; - } } - } // Increment deployment attempts for side B antennaDeploymentAttempts += 1; + + // Wait between deployment attempts to ensure disarming doesn't happen too quickly + vTaskDelay(INTER_DEPLOYMENT_DELAY_MS); + } + + //disarm B Side Antenna system + error = IsisAntS_setArmStatus(ANTENNA_INDEX, isisants_sideB, isisants_disarm); + + // Check if disarm failed + if(error != 0) { + + // TODO: record errors (if present) to System Manager + return error; } diff --git a/radsat-sk/operation/subsystems/RAntenna.h b/radsat-sk/operation/subsystems/RAntenna.h index 751d0e65..44d95f27 100644 --- a/radsat-sk/operation/subsystems/RAntenna.h +++ b/radsat-sk/operation/subsystems/RAntenna.h @@ -28,6 +28,9 @@ /** Max Time allowed for a deployment for an Antenna in seconds */ #define MAX_DEPLOYMENT_TIMEOUT 60 +/** Time delay between deployment attempts in milliseconds */ +#define INTER_DEPLOYMENT_DELAY_MS 10*1000 + /** Antenna Deployment status Struct */ typedef struct _antenna_deployment_status_t { int DeployedAntennaOne; From 53a2208db7a35fb96a2d5636023d0c2f9f2c774f Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 20 Jul 2022 18:56:14 -0600 Subject: [PATCH 3/5] add antenna initialization to the startup procedure --- radsat-sk/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radsat-sk/src/main.c b/radsat-sk/src/main.c index 750b4d1d..3b1a4db7 100644 --- a/radsat-sk/src/main.c +++ b/radsat-sk/src/main.c @@ -442,7 +442,7 @@ void MissionInitTask(void* parameters) { error = attemptAntennaDeployment(); if (error != SUCCESS) { // TODO: report system manager - debugPrint("attemptAntennaDeployment(): failed to deploy the antenna.\n") + debugPrint("attemptAntennaDeployment(): failed to deploy the antenna.\n"); } // initialize the FreeRTOS Tasks used for typical mission operation From 87daa7b67f8ffba47117782d55a017236a49843d Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 20 Jul 2022 19:00:11 -0600 Subject: [PATCH 4/5] add antenna initialization to the startup procedure --- radsat-sk/src/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/radsat-sk/src/main.c b/radsat-sk/src/main.c index 3b1a4db7..27ccaec8 100644 --- a/radsat-sk/src/main.c +++ b/radsat-sk/src/main.c @@ -115,11 +115,10 @@ int main(void) { #else /* TEST */ - // TODO: Antenna Diagnostic & Deployment (if necessary) - // TODO: Satellite Diagnostic Check (if applicable - may be done later instead) // initialize the Mission Initialization Task + // Antenna Deployment happens in here. error = xTaskCreate(MissionInitTask, (const signed char*)"Mission Initialization Task", DEFAULT_TASK_STACK_SIZE, From 1ad02ff758663f039f80a32ccd58c83513d11c27 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 20 Jul 2022 20:15:38 -0600 Subject: [PATCH 5/5] Change inter-deployment delay to 2 seconds from 10 seconds --- radsat-sk/operation/subsystems/RAntenna.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radsat-sk/operation/subsystems/RAntenna.h b/radsat-sk/operation/subsystems/RAntenna.h index 44d95f27..3306747e 100644 --- a/radsat-sk/operation/subsystems/RAntenna.h +++ b/radsat-sk/operation/subsystems/RAntenna.h @@ -29,7 +29,7 @@ #define MAX_DEPLOYMENT_TIMEOUT 60 /** Time delay between deployment attempts in milliseconds */ -#define INTER_DEPLOYMENT_DELAY_MS 10*1000 +#define INTER_DEPLOYMENT_DELAY_MS 2*1000 /** Antenna Deployment status Struct */ typedef struct _antenna_deployment_status_t {