-
Notifications
You must be signed in to change notification settings - Fork 173
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 Challenge #103
Changes from all commits
17681a7
d453594
a4f78d4
0c1594f
c571d44
1f83d84
0ed88c8
fb1b03e
8c180a1
381670c
f88e9ee
fbf8d86
a6917c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Start testing: Dec 18 23:32 EST | ||
---------------------------------------------------------- | ||
End testing: Dec 18 23:32 EST |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
#include "errors.h" | ||
#include "lm75bd.h" | ||
#include "console.h" | ||
|
||
#include "logging.h" | ||
#include <FreeRTOS.h> | ||
#include <os_task.h> | ||
#include <os_queue.h> | ||
|
@@ -42,19 +42,50 @@ void initThermalSystemManager(lm75bd_config_t *config) { | |
} | ||
|
||
error_code_t thermalMgrSendEvent(thermal_mgr_event_t *event) { | ||
/* Send an event to the thermal manager queue */ | ||
|
||
if (&thermalMgrQueueHandle == NULL) | ||
return ERR_CODE_INVALID_STATE; | ||
|
||
if (event == NULL) | ||
return ERR_CODE_INVALID_ARG; | ||
|
||
if (xQueueSend(thermalMgrQueueHandle, (void *) event, (TickType_t) 0) != pdPASS) | ||
return ERR_CODE_QUEUE_FULL; | ||
|
||
return ERR_CODE_SUCCESS; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also note that when your doing multiple errror checks like this it's a lot cleaner to just use multiple if statements with early returns rather than a bunch of nested if statements. For example something like ``` if(errCodeCondition){
|
||
|
||
void osHandlerLM75BD(void) { | ||
/* Implement this function */ | ||
thermal_mgr_event_t event; | ||
event.type = THERMAL_MGR_EVENT_INTERRUPT_CMD; | ||
thermalMgrSendEvent(&event); | ||
} | ||
|
||
static void thermalMgr(void *pvParameters) { | ||
/* Implement this task */ | ||
while (1) { | ||
|
||
thermal_mgr_event_t eventBuf; | ||
|
||
float temp; | ||
|
||
if (xQueueReceive(thermalMgrQueueHandle, &eventBuf, 10) == pdPASS) { | ||
if (eventBuf.type == THERMAL_MGR_EVENT_MEASURE_TEMP_CMD) { | ||
error_code_t errCode = readTempLM75BD(LM75BD_OBC_I2C_ADDR, &temp); | ||
if (errCode == ERR_CODE_SUCCESS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make sure to log the error if it was no successful |
||
addTemperatureTelemetry(temp); | ||
else | ||
LOG_ERROR_CODE(errCode); | ||
} | ||
else if (eventBuf.type == THERMAL_MGR_EVENT_INTERRUPT_CMD) { | ||
error_code_t errCode = readTempLM75BD(LM75BD_OBC_I2C_ADDR, &temp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check if the function call was successful or not |
||
if (errCode == ERR_CODE_SUCCESS) { | ||
if (temp > 75) | ||
overTemperatureDetected(); | ||
else | ||
safeOperatingConditions(); | ||
} | ||
else | ||
LOG_ERROR_CODE(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.
your integration test run looks wrong