-
Notifications
You must be signed in to change notification settings - Fork 31
Added new Thermal Manager with more temperature telemetry (besides lm75bd) #657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…until the task suspension issue is solved.
Pull reviewers statsStats of the last 120 days for UWOrbital:
|
camspec
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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); | ||
|
|
||
| /** |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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()}; |
There was a problem hiding this comment.
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()}; |
There was a problem hiding this comment.
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()}; |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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]; |
There was a problem hiding this comment.
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?
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.
Testing
Explain tests that you ran to verify code functionality.
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