Skip to content

Conversation

@AnshRoutray
Copy link

@AnshRoutray AnshRoutray commented Jan 20, 2026

Purpose

Closes #285.
Explain the purpose of the PR here if it doesn't match the linked issue. Be sure to add a comment in the linked issue explaining the changes.

New Changes

Explain new changes below in short bullet points.

  • Replaced the entire Health Collector Module with Thermal Manager.
  • Added a statically allocated mailbox queue to ensure thermal manager can read temperature values from multiple sensors without directly accessing the drivers.
  • Added temperature input from RTC and CC1120 (currently commented out) apart from just lm75bd.

Testing

Explain tests that you ran to verify code functionality.

  • [ X] I have unit-tested this PR. Otherwise, explain why it cannot be unit-tested.
  • [ X] I have tested this PR on a board if the code will run on a board (Only required for firmware developers).
  • I have tested this PR by running the ARO website (Only required if the code will impact the ARO website).
  • I have tested this PR by running the MCC website (Only required if the code will impact the MCC website).
  • [ X] I have included screenshots of the tests performed below.

Outstanding Changes

If there are non-critical changes (i.e. additional features) that can be made to this feature in the future, indicate them here.

Output logs

2026-01-19_20-23-34

@github-actions
Copy link

Pull reviewers stats

Stats of the last 120 days for UWOrbital:

User Total reviews Time to review Total comments
Adityya-K
🥇
37
▀▀▀▀
3d 35m
107
▀▀▀
camspec
🥈
34
▀▀▀
3d 3h 23m
191
▀▀▀▀▀
proprogrammer504
🥉
13
7d 1h 30m
▀▀
44
Syzygicality
8
8h 20m
17
kepler452b123
5
1d 11h 18m
2
joannalauu
3
4d 21h 20m
19
c4bae
1
13d 1h 35m
▀▀▀▀
2
panthpatel2016
1
4h 30m
6

⚡️ Pull request stats

Copy link
Member

@camspec camspec left a comment

Choose a reason for hiding this comment

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

Great work overall, but there a few issues throughout

}

static obc_error_code_t postCommsManagerTempQueue() {
float value = 0.0f; // dummy value, replace with actual temp reading function
Copy link
Member

Choose a reason for hiding this comment

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

Label this as a TODO: and add it to outstanding changes

*/
obc_error_code_t sendToCommsManagerQueue(comms_event_t *event);

/**
Copy link
Member

Choose a reason for hiding this comment

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

I recognize that this declaration is commented out due to what is mentioned in the PR description, but you also have the same declaration written below, uncommented

// Send Unix time to fram
// Post temperature into mailbox queue

postRtcTempQueue();
Copy link
Member

Choose a reason for hiding this comment

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

Ignoring the return value of this function, which is an error code?

static obc_error_code_t postRtcTempQueue();

void obcTaskInitTimekeeper(void) {
ASSERT((rtcTempQueueStack != NULL) && (&rtcTempQueue != NULL));
Copy link
Member

Choose a reason for hiding this comment

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

Taking the address of a static variable like rtcTempQueue will never result in NULL


void obcTaskInitTimekeeper(void) {}
#define RTC_TEMP_QUEUE_LENGTH 1
#define RTC_TEMP_QUEUE_ITEM_SIZE sizeof(uint32_t)
Copy link
Member

Choose a reason for hiding this comment

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

Even though we can assume floats on our architecture are 32 bit, a type mismatch like this is unideal and not portable. We should define the size as being the same as the type of data we store in the queue.
Separate from this task, the driver function should probably be written to read this value as a fixed-point value rather than a floating-point number, which would avoid floats altogether

/* Uncomment this if comms manager task being suspened issue is fixed.
float cc1120Temp = 0.0f;
RETURN_IF_ERROR_CODE(readCC1120Temp(&cc1120Temp));
telemetry_data_t cc1120TempVal = {.obcTemp = lm75bdTemp, .id = TELEM_OBC_TEMP, .timestamp = getCurrentUnixTime()};
Copy link
Member

Choose a reason for hiding this comment

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

This code is commented out, but this should not be lm75bdTemp


float lm75bdTemp = 0.0f;
RETURN_IF_ERROR_CODE(readTempLM75BD(LM75BD_OBC_I2C_ADDR, &lm75bdTemp));
telemetry_data_t lm75bdTempVal = {.obcTemp = lm75bdTemp, .id = TELEM_OBC_TEMP, .timestamp = getCurrentUnixTime()};
Copy link
Member

Choose a reason for hiding this comment

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

Why do all three temp structs have the same id?


float lm75bdTemp = 0.0f;
RETURN_IF_ERROR_CODE(readTempLM75BD(LM75BD_OBC_I2C_ADDR, &lm75bdTemp));
telemetry_data_t lm75bdTempVal = {.obcTemp = lm75bdTemp, .id = TELEM_OBC_TEMP, .timestamp = getCurrentUnixTime()};
Copy link
Member

Choose a reason for hiding this comment

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

You call getCurrentUnixTime() separately for each temp value, but this can cause a race condition if time increases between these calls and we may get a discrepancy

0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};

#define CC1120_TEMP_QUEUE_LENGTH 1
#define CC1120_TEMP_QUEUE_ITEM_SIZE sizeof(uint32_t)
Copy link
Member

Choose a reason for hiding this comment

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

Same type mismatch as mentioned in the other comment


QueueHandle_t cc1120TempQueueHandle = NULL;
static StaticQueue_t cc1120TempQueue;
static uint8_t cc1120TempQueueStack[COMMS_MANAGER_QUEUE_LENGTH * CC1120_TEMP_QUEUE_ITEM_SIZE];
Copy link
Member

Choose a reason for hiding this comment

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

Why are you using the queue length of the comms manager here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants