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
10 changes: 7 additions & 3 deletions radsat-sk/framework/fileio/RFram.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <hal/errors.h>
#include <hal/Storage/FRAM.h>
#include <RCommon.h>
#include <RErrorManager.h>


/***************************************************************************************************
Expand All @@ -34,7 +35,8 @@ int framInit(void) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ missed error

int error = FRAM_start();

// TODO: record errors (if present) to System Manager
if (error != SUCCESS)
errorReportComponent(componentHalFram , error);

return error;
}
Expand All @@ -57,7 +59,8 @@ int framRead(uint8_t* data, uint32_t address, uint32_t size) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ missed error

int error = FRAM_read(data, address, size);

// TODO: record errors (if present) to System Manager
if (error != SUCCESS)
errorReportComponent(componentHalFram , error);

return error;
}
Expand All @@ -80,7 +83,8 @@ int framWrite(uint8_t* data, uint32_t address, uint32_t size) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ missed error

int error = FRAM_writeAndVerify(data, address, size);

// TODO: record errors (if present) to System Manager
if (error != SUCCESS)
errorReportComponent(componentHalFram , error);

return error;
}
19 changes: 14 additions & 5 deletions radsat-sk/operation/message/crypt/RKey.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <RKey.h>
#include <RFram.h>
#include <RDebug.h>
#include <RErrorManager.h>


/***************************************************************************************************
Expand Down Expand Up @@ -55,13 +56,22 @@ uint8_t privateKey(void) {
int error = 0;

// read from FRAM
error = framRead(&key1, PRIVATE_KEY_ADDR_ONE, sizeof(key1));
if (error) return 0;
error = framRead(&key1, PRIVATE_KEY_ADDR_ONE, sizeof(key1))

if (error != SUCCESS)
errorReportModule(moduleFram , error);
return error;
Comment on lines +61 to +63
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (error != SUCCESS)
errorReportModule(moduleFram , error);
return error;
if (error != SUCCESS) {
errorReportModule(moduleFram , error);
return error;
}


error = framRead(&key2, PRIVATE_KEY_ADDR_TWO, sizeof(key2));
if (error) return 0;

if (error != SUCCESS)
errorReportModule(moduleFram , error);
return error;
Comment on lines +67 to +69
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (error != SUCCESS)
errorReportModule(moduleFram , error);
return error;
if (error != SUCCESS) {
errorReportModule(moduleFram , error);
return error;
}

error = framRead(&key3, PRIVATE_KEY_ADDR_THREE, sizeof(key3));
if (error) return 0;

if (error != SUCCESS)
errorReportModule(moduleFram , error);
return error;
Comment on lines +72 to +74
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (error != SUCCESS)
errorReportModule(moduleFram , error);
return error;
if (error != SUCCESS) {
errorReportModule(moduleFram , error);
return error;
}

// all of the keys are the same
if ((key1 == key2) && (key1 == key3) && (key2 == key3)) {
key = key1;
Expand Down Expand Up @@ -108,7 +118,6 @@ uint8_t privateKey(void) {

debugPrint("RKey: all three keys are different (Key1 = %d, Key2 = %d, Key3 = %d). Sending Key1...\n", key1, key2, key3);

// TODO: report an error to the system manager

key = key1;
Comment on lines 120 to 122
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to produce error.

}
Expand Down
1 change: 1 addition & 0 deletions radsat-sk/operation/services/RFileTransferService.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <RMessage.h>
#include <string.h>
#include <RCommon.h>
#include <RErrorManager.h>


/**
Expand Down
55 changes: 37 additions & 18 deletions radsat-sk/operation/subsystems/RAntenna.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <hal/errors.h>
#include <hal/Timing/Time.h>
#include <RCommon.h>
#include <RErrorManager.h>


/***************************************************************************************************
Expand Down Expand Up @@ -54,7 +55,9 @@ int antennaInit(void) {
if (error == 0)
antennaInitialized = 1;

// TODO: record errors (if present) to System Manager
if (error != SUCCESS)
errorReportComponent(moduleFram , error)

return error;
}

Expand All @@ -80,7 +83,7 @@ int antennaDeploymentAttempt(void) {
// Error check for requesting antenna status
if(error != 0) {

// TODO: record errors (if present) to System Manager
errorReportComponent(componentSsiAntenna,error);
return error;
}

Expand All @@ -101,7 +104,9 @@ int antennaDeploymentAttempt(void) {
// Error check for Arming A Side
if(error != 0) {

// TODO: record errors (if present) to System Manager

errorReportComponent(componentSsiAntenna,error);

return error;
}

Expand All @@ -111,7 +116,8 @@ int antennaDeploymentAttempt(void) {
// Error check for antenna status
if(error != 0) {

// TODO: record errors (if present) to System Manager
errorReportComponent(componentSsiAntenna,error);

return error;
}

Expand All @@ -127,7 +133,8 @@ int antennaDeploymentAttempt(void) {
// Check if autoDeployment failed
if(error != 0) {

// TODO: record errors (if present) to System Manager
errorReportComponent(componentSsiAntenna,error);

return error;
}

Expand All @@ -137,7 +144,8 @@ int antennaDeploymentAttempt(void) {
// Check if disarm failed
if(error != 0) {

// TODO: record errors (if present) to System Manager
errorReportComponent(componentSsiAntenna,error);

return error;
}
}
Expand All @@ -159,7 +167,8 @@ int antennaDeploymentAttempt(void) {
// Error check for requesting antenna status
if(error != 0) {

// TODO: record errors (if present) to System Manager
errorReportComponent(componentSsiAntenna,error);

return error;
}

Expand All @@ -180,7 +189,8 @@ int antennaDeploymentAttempt(void) {
// Error check for requesting antenna status
if(error != 0) {

// TODO: record errors (if present) to System Manager
errorReportComponent(componentSsiAntenna,error);

return error;
}

Expand All @@ -190,7 +200,8 @@ int antennaDeploymentAttempt(void) {
// Error check for antenna status
if(error != 0) {

// TODO: record errors (if present) to System Manager
errorReportComponent(componentSsiAntenna,error);

return error;
}

Expand All @@ -206,7 +217,9 @@ int antennaDeploymentAttempt(void) {
// Check if autoDeployment failed
if(error != 0) {

// TODO: record errors (if present) to System Manager

errorReportComponent(componentSsiAntenna,error);

return error;
}

Expand All @@ -216,7 +229,8 @@ int antennaDeploymentAttempt(void) {
// Check if disarm failed
if(error != 0) {

// TODO: record errors (if present) to System Manager
errorReportComponent(componentSsiAntenna,error);

return error;
}
}
Expand Down Expand Up @@ -253,7 +267,8 @@ int antennaTelemetry(antenna_telemetry_t* telemetry) {
// Error check for Isis Antenna function
if(error != 0) {

// TODO: record errors (if present) to System Manager
errorReportComponent(componentSsiAntenna,error);

return error;
}

Expand All @@ -272,7 +287,8 @@ int antennaTelemetry(antenna_telemetry_t* telemetry) {
// Error check for Isis Antenna function
if(error != 0) {

// TODO: record errors (if present) to System Manager
errorReportComponent(componentSsiAntenna,error);

return error;
}

Expand All @@ -299,15 +315,17 @@ int antennaReset(void) {
int error = IsisAntS_reset(ANTENNA_INDEX, isisants_sideA);

if (error != SUCCESS) {
// TODO: record errors (if present) to System Manager

errorReportComponent(componentSsiAntenna,error);

return error;
}

// Reset side B antenna. See section 6.2 of Antenna System User Manual
error = IsisAntS_reset(ANTENNA_INDEX, isisants_sideB);

if (error != SUCCESS) {
// TODO: record errors (if present) to System Manager
if (error != SUCCESS) {
errorReportComponent(componentSsiAntenna,error);
}

return error;
Expand All @@ -328,7 +346,8 @@ int antennaTemperature(float* temperatureOne, float* temperatureTwo) {
int error = IsisAntS_getTemperature(ANTENNA_INDEX, isisants_sideA, &temperature);

if (error != SUCCESS) {
// TODO: record errors (if present) to System Manager
errorReportComponent(componentSsiAntenna,error);

return error;
}

Expand All @@ -339,7 +358,7 @@ int antennaTemperature(float* temperatureOne, float* temperatureTwo) {
*temperatureTwo = ((float)temperature * -0.2922) + 190.65;

if (error != SUCCESS) {
// TODO: record errors (if present) to System Manager
errorReportComponent(componentSsiAntenna,error);
}

return error;
Expand Down
20 changes: 20 additions & 0 deletions radsat-sk/operation/subsystems/RBattery.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ static uint32_t batteryTemperatureCommandBytes[4] = {
0x10E3B8 // Daughterboard 3 Temperature
};

/**
* Command for Resetting Battery Watchdog (0x2200)
*/
static uint8_t batteryWatchdogResetCommand[2] = {0x22, 0x00};

/***************************************************************************************************
PRIVATE FUNCTION STUBS
***************************************************************************************************/
Expand Down Expand Up @@ -246,6 +251,21 @@ int batteryIsNotSafe(uint8_t* safeFlag) {
return SUCCESS;
}

/**
* Pet the Communications watchdog on the Battery using code 0x22
* @return either an error if it occurred, or 0
*/
int batteryPetWatchDog(void) {
// One way communication so just use transmit using reset watchdog command 0x22
int error = i2cTransmit(BATTERY_I2C_SLAVE_ADDR, batteryWatchdogResetCommand, BATTERY_COMMAND_LENGTH);

if (error != SUCCESS) {
return error;
}
Comment on lines +262 to +264
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was missed


return SUCCESS;
}


/***************************************************************************************************
PRIVATE FUNCTIONS
Expand Down
2 changes: 1 addition & 1 deletion radsat-sk/operation/subsystems/RBattery.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ typedef struct _battery_status_t {

int batteryTelemetry(battery_status_t* dataStorage);
int batteryIsNotSafe(uint8_t* safeFlag);

int batteryPetWatchdog(void);

#endif /* RBATTERY_H_ */
3 changes: 2 additions & 1 deletion radsat-sk/operation/subsystems/RObc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <hal/errors.h>
#include <hal/Timing/WatchDogTimer.h>
#include <hal/Timing/RTC.h>
#include <RErrorManager.h>

/***************************************************************************************************
PUBLIC API
Expand All @@ -24,7 +25,7 @@ int obcTelemetry(obc_telemetry_t* telemetry){
int error = RTC_getTemperature(&temperature);

if (error != SUCCESS) {
// TODO: record errors (if present) to System Manager
errorReportComponent(componentObc,error);
return error;
}

Expand Down
1 change: 1 addition & 0 deletions radsat-sk/operation/subsystems/RPdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <RI2c.h>
#include <string.h>
#include <RCommon.h>
#include <RErrorManager.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Incude can go into RCommon just like RDebug.h and then you don't Need to have it in every file.



/***************************************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion radsat-sk/operation/subsystems/RPdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ typedef struct _pdb_status_t {

int pdbSunSensorData(sun_sensor_status_t* sunData);
int pdbTelemetry(pdb_status_t* dataStorage);
int pdbPetWatchdog(void);
int pdbPetWatchDog(void);

#endif /* RPdb_H_ */
Loading