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

Sardor/thermal mgr task #283

Closed
wants to merge 14 commits into from
Closed

Sardor/thermal mgr task #283

wants to merge 14 commits into from

Conversation

sardormirk
Copy link
Contributor

Purpose

Implement Thermal Manager Task
Created a skeleton thermal manager task function to replace the health collector

New Changes

  • Created a new thermal manager module to replace health collector
  • Added the task configuration to obc_scheduler_config
  • added necessary declarations to obc watchdog and digital watchdog

Outstanding Changes

  • Needs to measure other ICs (not just LM75BD temp sensor) and log their telemetry data
  • Needs to add alerts for fault conditions
  • Needs algorithm to control battery heater

Copy link
Contributor

@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.

Check to see if there are any changes you made relative to the existing temp testing merged in by #216.


static obc_error_code_t collectObcLm75bdTemp(void);

void obcTaskInitThermalMgr(void) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should init the lm75bd not the state manager

Comment on lines +51 to +55
while (1) {
LOG_IF_ERROR_CODE(collectObcLm75bdTemp());
feedDigitalWatchdog();
vTaskDelayUntil(&xLastWakeTime, pdMS_TO_TICKS(THERMAL_MGR_PERIOD_MS));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should receive from the queue and then handle each event accordingly.

Copy link
Member

Choose a reason for hiding this comment

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

This task shouldn't need an event queue. It just periodically runs (similar to the gnc_mgr task). I'd just remove all the code related to events/queues from this task

Comment on lines +39 to +43
/* payload queue config */
#define THERMAL_MANAGER_QUEUE_LENGTH 10U
#define THERMAL_MANAGER_QUEUE_ITEM_SIZE sizeof(thermal_mgr_event_t)
#define THERMAL_MANAGER_QUEUE_RX_WAIT_PERIOD pdMS_TO_TICKS(10)
#define THERMAL_MANAGER_QUEUE_TX_WAIT_PERIOD pdMS_TO_TICKS(10)
Copy link
Contributor

Choose a reason for hiding this comment

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

These should be moved to the .c file as they shouldn't be available to caller of module

obc/modules/thermal_mgr/thermal_mgr.h Show resolved Hide resolved
@@ -97,7 +97,7 @@ void obcTaskFunctionStateMgr(void *pvParameters) {
obcSchedulerInitTask(OBC_SCHEDULER_CONFIG_ID_COMMS_DOWNLINK_ENCODER);
obcSchedulerInitTask(OBC_SCHEDULER_CONFIG_ID_EPS_MGR);
obcSchedulerInitTask(OBC_SCHEDULER_CONFIG_ID_PAYLOAD_MGR);
obcSchedulerInitTask(OBC_SCHEDULER_CONFIG_ID_HEALTH_COLLECTOR);
obcSchedulerInitTask(OBC_SCHEDULER_CONFIG_ID_THERMAL_MGR);
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this to the top of the schedule init section

Copy link
Member

@dgobalak dgobalak left a comment

Choose a reason for hiding this comment

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

Looks like there are some merge conflicts to fix

@@ -23,7 +23,7 @@
#define TASK_PAYLOAD_MGR_WATCHDOG_TIMEOUT portMAX_DELAY
#define TASK_TIMEKEEPER_WATCHDOG_TIMEOUT portMAX_DELAY
#define TASK_ALARM_MGR_WATCHDOG_TIMEOUT portMAX_DELAY
#define TASK_HEALTH_COLLECTOR_WATCHDOG_TIMEOUT portMAX_DELAY
#define TASK_THERMAL_MGR_WATCHDOG_TIMEOUT portMAX_DELAY
Copy link
Member

Choose a reason for hiding this comment

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

This should be 2x the period of the thermal mgr task


while (1) {
LOG_IF_ERROR_CODE(collectObcLm75bdTemp());
feedDigitalWatchdog();
Copy link
Member

Choose a reason for hiding this comment

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

Use digitalWatchdogTaskCheckIn (instead of feedDigitalWatchdog) to check in with the watchdog task. Look at gnc_mgr as an example

Comment on lines +51 to +55
while (1) {
LOG_IF_ERROR_CODE(collectObcLm75bdTemp());
feedDigitalWatchdog();
vTaskDelayUntil(&xLastWakeTime, pdMS_TO_TICKS(THERMAL_MGR_PERIOD_MS));
}
Copy link
Member

Choose a reason for hiding this comment

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

This task shouldn't need an event queue. It just periodically runs (similar to the gnc_mgr task). I'd just remove all the code related to events/queues from this task

Copy link
Member

Choose a reason for hiding this comment

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

Didn't we already merge in the lm75bd test code? This should be removed from this PR.

See https://github.com/UWOrbital/OBC-firmware/tree/main/obc/app/tools/interface_debug_tool


#include <gio.h>

#define THERMAL_MGR_PERIOD_MS 60
Copy link
Member

Choose a reason for hiding this comment

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

Is this task supposed to run every 60ms?

cc @Navtajh04

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was to be determined later, I just put 60 as a place holder

Copy link
Contributor

Choose a reason for hiding this comment

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

Based on our telemetry it seems that we read temperature values very min

#include <os_task.h>
#include <os_queue.h>

#include <gio.h>
Copy link
Member

Choose a reason for hiding this comment

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

What're we using gio.h for here?

@Yarik-Popov
Copy link
Contributor

Being handled by #285

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.

4 participants