-
Notifications
You must be signed in to change notification settings - Fork 171
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
base: level3
Are you sure you want to change the base?
Completed Onboarding #130
Conversation
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.
Overall good, just use existing logging macros and change the logic of osHandler function
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; | ||
} |
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.
Use RETURN_IF_ERROR_CODE()
macro instead as it will also log the error code
|
||
if(xQueueSend(thermalMgrQueueHandle, event, 0) == errQUEUE_FULL){ |
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.
Use pdFAIL
instead of errQUEUE_FULL
float temp; | ||
readTempLM75BD(LM75BD_OBC_I2C_ADDR, &temp); | ||
|
||
if(temp > LM75BD_DEFAULT_HYST_THRESH){ | ||
overTemperatureDetected(); | ||
} | ||
else if(temp <= LM75BD_DEFAULT_HYST_THRESH){ | ||
safeOperatingConditions(); | ||
} | ||
|
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.
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); |
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.
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 */ |
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.
nit
#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){ |
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.
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.
Passed unit tests and integration tests.
Completed building Temperature Sensor Driver Functions, Thermal Management Task, and OS handler.