Skip to content
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

Completed Onboarding #130

Open
wants to merge 1 commit into
base: level3
Choose a base branch
from
Open

Completed Onboarding #130

wants to merge 1 commit into from

Conversation

ErikTsai
Copy link

@ErikTsai ErikTsai commented Mar 5, 2024

Passed unit tests and integration tests.

Completed building Temperature Sensor Driver Functions, Thermal Management Task, and OS handler.

Copy link

@Yarik-Popov Yarik-Popov left a comment

Choose a reason for hiding this comment

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

Overall good, just use existing logging macros and change the logic of osHandler function

Comment on lines +40 to +48
error_code_t errCode = i2cSendTo(devAddr, &writeBuf, 1);
if (errCode != ERR_CODE_SUCCESS){
return errCode;
}

errCode = i2cReceiveFrom(devAddr, &readBuf, 2);
if (errCode != ERR_CODE_SUCCESS){
return errCode;
}

Choose a reason for hiding this comment

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

Use RETURN_IF_ERROR_CODE() macro instead as it will also log the error code


if(xQueueSend(thermalMgrQueueHandle, event, 0) == errQUEUE_FULL){

Choose a reason for hiding this comment

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

Use pdFAIL instead of errQUEUE_FULL

Comment on lines +63 to +72
float temp;
readTempLM75BD(LM75BD_OBC_I2C_ADDR, &temp);

if(temp > LM75BD_DEFAULT_HYST_THRESH){
overTemperatureDetected();
}
else if(temp <= LM75BD_DEFAULT_HYST_THRESH){
safeOperatingConditions();
}

Choose a reason for hiding this comment

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

As this is being called in it should be short, send an event to the queue indicating that it is an overtemperature event

if(copiedData.type == THERMAL_MGR_EVENT_MEASURE_TEMP_CMD){
errCode = readTempLM75BD(LM75BD_OBC_I2C_ADDR, &temp);
if(errCode != ERR_CODE_SUCCESS){
printConsole("%d\n", errCode);

Choose a reason for hiding this comment

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

Use LOG_ERROR_CODE() instead

@@ -9,6 +9,7 @@

/* LM75BD Registers (p.8) */
#define LM75BD_REG_CONF 0x01U /* Configuration Register (R/W) */
#define LM75BD_REG_TEMP 0b00000000 /* Temperature Register */
Copy link
Member

Choose a reason for hiding this comment

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

nit

Suggested change
#define LM75BD_REG_TEMP 0b00000000 /* Temperature Register */
#define LM75BD_REG_TEMP 0x0U /* Temperature Register (R) */

thermal_mgr_event_t copiedData;
error_code_t errCode;

if(xQueueReceive(thermalMgrQueueHandle, &copiedData, (TickType_t)10) == pdTRUE){
Copy link
Member

Choose a reason for hiding this comment

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

Since this task doesn't do anything unless an event is received, just block indefinitely instead of using a block time of 10. This reduces CPU usage since the task would only unblock if it needs to.

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