-
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
Ahmed: Onboarding tasks implemented #185
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 start. Some changes are needed to improve the code quality
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.
Some changes are needed to improve error handling
services/thermal_mgr/thermal_mgr.c
Outdated
return ERR_CODE_INVALID_ARG; | ||
} | ||
|
||
xQueueSend(thermalMgrQueueHandle, event, (TickType_t) 0); |
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.
In general, you should always check the return value of non-void functions for an error code and handle it accordingly. In this case, return queue full if an error occurs
services/thermal_mgr/thermal_mgr.c
Outdated
} | ||
|
||
static void thermalMgr(void *pvParameters) { | ||
static void thermalMgr(void *pvParameters) { // what is pvParameters used for? |
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 is just a comment, you can resolve this once you read it. pvParameters
isn't used but i can be used to send values to the task on start at runtime that can't be done via macros at compile time
services/thermal_mgr/thermal_mgr.c
Outdated
thermal_mgr_event_t osEvent = {0}; | ||
osEvent.type = THERMAL_MGR_EVENT_OS_CMD; |
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.
thermal_mgr_event_t osEvent = {0}; | |
osEvent.type = THERMAL_MGR_EVENT_OS_CMD; | |
thermal_mgr_event_t osEvent = {.type=THERMAL_MGR_EVENT_OS_CMD}; |
Just so you know, you can also do this.
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.
There is only the thermal mgr send function that has requested changes left. Once those are addressed, you should be done the onboarding.
services/thermal_mgr/thermal_mgr.c
Outdated
return ERR_CODE_INVALID_STATE; | ||
} | ||
|
||
error_code_t sendErrorCode = xQueueSend(thermalMgrQueueHandle, event, (TickType_t) 0); |
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.
The xQueueSend function doesn't return an error_code_t but a different type of error. The easier way to handle this is just to move this so that its inside the if statement comparison so you don't need to care about the type of the return value
services/thermal_mgr/thermal_mgr.c
Outdated
if (thermalMgrQueueHandle == NULL || event == NULL) { | ||
return ERR_CODE_INVALID_STATE; | ||
} |
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.
Event being null will still return invalid state
Lgtm, dm me your email and I'll add you to the notion |
Purpose
Would like to have my thermalMgr task reviewed as it is having some issue.
New Changes
Testing