Skip to content

Review eFuse thread to toggle states based on temperature#133

Open
medamawa wants to merge 4 commits intomainfrom
efuse-control
Open

Review eFuse thread to toggle states based on temperature#133
medamawa wants to merge 4 commits intomainfrom
efuse-control

Conversation

@medamawa
Copy link
Copy Markdown
Contributor

@medamawa medamawa commented Feb 5, 2026

Changes

Refactored the eFuse thread to simplify the code and added a new method to control eFuse states based on motor and motor controller (MC) temperatures.

Notes

  • Temperature constants are defined in u_efuses.h.
  • These constants are derived from the previous repo Cerberus.

Test Cases

To Do

  • Read CAN and toggle eFuses.
  • Add tests.
  • ...

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please reach out to your Project Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • No merge conflicts
  • All checks passing
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes # (issue #130 )

Copy link
Copy Markdown
Contributor

@caiodasilva2005 caiodasilva2005 left a comment

Choose a reason for hiding this comment

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

Awesome Sogo thank you for your work on this.

We also need an array that stores the states that telemetry want all efuses in. For instance, we want to be able to receive a can message with an efuse id (0 = EFUSE_PUMP1, 1 = EFUSE_PUMP2 etc...) and a state (ON = 1, OFF = 0) to determine if we want to enable a particular efuse on or off over CAN.

I suggest having a global array called calypso_states that is the size of the number of EFUSES all initialized to 0. if we receive a CAN messagewith id 1, and state 1 then you update index 1 of the array to 1. If the index of the array is 1 then enable the efuse automatically. If the Array is 0 then do one of two things:

  • Automatically disable it if it does not rely on a temperature/threshold
  • Let it continue in its original loop and turn off when it goes under the temperature/threshold

TLDR the state of the array should take priority, and then we should fall back on what the default functionality is

uint16_t motor_temp = dti_get_motor_temp();
uint16_t controller_temp = dti_get_controller_temp();

if (motor_temp > PUMP1_UPPER_MOTOR_TEMP) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Take a look at our debounce() implementation in debounce.c in Embedded-Base. We should be able to configure hoe long this condition stays true for the efuse to be enabled

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