Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 27 additions & 22 deletions radsat-sk/operation/subsystems/RAntenna.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,24 +130,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
Expand Down Expand Up @@ -209,21 +212,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;
}


Expand Down
3 changes: 3 additions & 0 deletions radsat-sk/operation/subsystems/RAntenna.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 2*1000

/** Antenna Deployment status Struct */
typedef struct _antenna_deployment_status_t {
int DeployedAntennaOne;
Expand Down
34 changes: 32 additions & 2 deletions radsat-sk/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <RUart.h>

#include <RTransceiver.h>
#include <RAntenna.h>
#include <RCommon.h>

#include <RCommunicationTasks.h>
Expand Down Expand Up @@ -114,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,
Expand Down Expand Up @@ -220,6 +220,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.
*/
Expand All @@ -234,6 +250,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;
Expand Down Expand Up @@ -414,6 +437,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) {
Expand Down