Skip to content

Prithika tharan/intro project#3

Open
PrithikaTharan wants to merge 4 commits intomainfrom
PrithikaTharan/intro_project
Open

Prithika tharan/intro project#3
PrithikaTharan wants to merge 4 commits intomainfrom
PrithikaTharan/intro_project

Conversation

@PrithikaTharan
Copy link

No description provided.

…dded a state machine to transition between states, updated calculation for wheelspin RPM, and initalized missing things from setup(). Also added a safe gaurd for torque_update() and fixed some errors.
…n on LCD. Wrote more relevant info to lcd. Fixed a few bugs
Copy link

@AveryLor AveryLor left a comment

Choose a reason for hiding this comment

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

Overall really well done, didn't find any actual issues, you handled thread safety very well with the different mutexes you used.

Most of my comments are about small stuff and fun facts lol :), but again very well done


void state_machine_task(void* parameters) {
// set all relay pins as outputs
pinMode(AIR_MINUS_PIN, arduino::OUTPUT);

Choose a reason for hiding this comment

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

I would init your pins in some sort of setup loop not necesarilly something that is wrong, but the actual pin mode only needs to be set once, not every time the state_machine_task is run.

You weren't given a setup loop so this was probably the best place to do it lol

// precharge sequence
digitalWrite(AIR_MINUS_PIN, arduino::HIGH); // close AIR-
digitalWrite(PRECHARGE_PIN, arduino::HIGH); // close precharge relay
vTaskDelay(pdMS_TO_TICKS(5000)); // wait 5 seconds

Choose a reason for hiding this comment

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

You have good logic for checking the carstate after the 5 second delay before actually changing the pins. I noticed that you had a bool in the project for bms fault. Ideally that should be checked as well considering that is another possible action that could have occurred during the 5 second delay.

wheel_speed_last_pulse = current;
}

float sensor_wheel_speed_get(void) {

Choose a reason for hiding this comment

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

I believe this calculation also works:

return wheel_speed_interval * 17;

I think floating point math is harder on hardware, but I doubt its an issue.

/*
Initialize the LCD peripheral
*/
extern void lcd_init(uint8_t mosi, uint8_t miso, uint8_t sck, uint8_t lcs_cs);

Choose a reason for hiding this comment

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

Not an issue at all, but just pointing out in case you ever end up in this situation, but since we don't expect any input from the LCD (it can take touch feedback I believe) you can technically get away with not using MISO at all. It will save you a GPIO, just wanted to point that out despite it being included in the project.

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