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

Ahmed: Onboarding tasks implemented #185

Closed
wants to merge 8 commits into from
Closed

Conversation

elsaigh
Copy link

@elsaigh elsaigh commented Oct 22, 2024

Purpose

Would like to have my thermalMgr task reviewed as it is having some issue.

New Changes

  • Added the temperature sensor driver functions and the thermal management task that utilizes it.

Testing

  • Ran the integration test and failing to receive any items from the thermal queue.

@elsaigh elsaigh changed the title Thermal queue items not being received in thermal management task Onboarding tasks implemented Oct 30, 2024
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 start. Some changes are needed to improve the code quality

lm75bd/lm75bd.c Show resolved Hide resolved
lm75bd/lm75bd.c Outdated Show resolved Hide resolved
lm75bd/lm75bd.c Outdated Show resolved Hide resolved
lm75bd/lm75bd.c Outdated Show resolved Hide resolved
lm75bd/lm75bd.c Outdated Show resolved Hide resolved
services/thermal_mgr/thermal_mgr.c Outdated Show resolved Hide resolved
services/thermal_mgr/thermal_mgr.c Outdated Show resolved Hide resolved
services/thermal_mgr/thermal_mgr.c Outdated Show resolved Hide resolved
services/thermal_mgr/thermal_mgr.c Outdated Show resolved Hide resolved
services/thermal_mgr/thermal_mgr.c Show resolved Hide resolved
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.

Some changes are needed to improve error handling

services/thermal_mgr/thermal_mgr.c Outdated Show resolved Hide resolved
return ERR_CODE_INVALID_ARG;
}

xQueueSend(thermalMgrQueueHandle, event, (TickType_t) 0);

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

}

static void thermalMgr(void *pvParameters) {
static void thermalMgr(void *pvParameters) { // what is pvParameters used for?

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 Show resolved Hide resolved
services/thermal_mgr/thermal_mgr.c Show resolved Hide resolved
Comment on lines 59 to 60
thermal_mgr_event_t osEvent = {0};
osEvent.type = THERMAL_MGR_EVENT_OS_CMD;

Choose a reason for hiding this comment

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

Suggested change
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.

@Yarik-Popov Yarik-Popov changed the title Onboarding tasks implemented Ahmed: Onboarding tasks implemented Nov 2, 2024
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.

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 Show resolved Hide resolved
return ERR_CODE_INVALID_STATE;
}

error_code_t sendErrorCode = xQueueSend(thermalMgrQueueHandle, event, (TickType_t) 0);

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

Comment on lines 48 to 50
if (thermalMgrQueueHandle == NULL || event == NULL) {
return ERR_CODE_INVALID_STATE;
}

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

@Yarik-Popov
Copy link

Lgtm, dm me your email and I'll add you to the notion

@Yarik-Popov Yarik-Popov closed this Nov 4, 2024
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.

2 participants