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

Fixed some minor issues #222

Merged
merged 3 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions can/src/can.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ StatusCode run_can_tx_cycle()
return STATUS_CODE_OK;
}

TASK(CAN_RX, TASK_STACK_512)
TASK(CAN_RX, TASK_MIN_STACK_SIZE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these changes to reduce the memory usage? I'm guessing that's what we're running into on hardware?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea, after we fixed the changes in power, we were still running into issues when running all the tasks together. This was causing it to fail.

{
int counter = 0;
while (true)
Expand All @@ -59,7 +59,7 @@ TASK(CAN_RX, TASK_STACK_512)
}
}

TASK(CAN_TX, TASK_STACK_512)
TASK(CAN_TX, TASK_MIN_STACK_SIZE)
{
int counter = 0;
while (true)
Expand Down
2 changes: 1 addition & 1 deletion projects/centre_console/inc/power_fsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "task.h"

#define NUM_POWER_STATES 14
#define NUM_POWER_TRANSITIONS 40
#define NUM_POWER_TRANSITIONS 36

#define START_BUTTON_EVENT 0

Expand Down
2 changes: 1 addition & 1 deletion projects/centre_console/src/drive_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "fsm_shared_mem.h"
#include "power_fsm.h"

FSM(drive, NUM_DRIVE_TRANSITIONS);
FSM(drive, NUM_DRIVE_STATES);

#define NUM_DRIVE_FSM_BUTTONS 3

Expand Down
2 changes: 1 addition & 1 deletion projects/centre_console/src/power_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ StatusCode init_power_fsm(PowerFsmStateId inital_state) {
.num_transitions = NUM_POWER_TRANSITIONS,
.initial_state = inital_state,
};
fsm_shared_mem_init();
// fsm_shared_mem_init();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this commented out because it'll just be initialized once in main?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It should be getting initialized in line 48 in main.c. I ran the tests, but if theres an error with it later, it should present itself

power_context.latest_state = 0;
power_context.target_state = 0;
fsm_init(power, settings, NULL);
Expand Down
9 changes: 5 additions & 4 deletions projects/centre_console/test/test_drive_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ void test_neutral_to_reverse() {
LOG_DEBUG("T2.1: (Neutral->DoPrecharge->Reverse)\n");
notify(drive, REVERSE_BUTTON_EVENT);
fsm_shared_mem_set_power_state(POWER_FSM_STATE_MAIN);
g_rx_struct.motor_velocity_velocity_l = -1;
g_rx_struct.motor_velocity_velocity_r = -1;
g_rx_struct.motor_velocity_velocity_l = (uint16_t)-1;
g_rx_struct.motor_velocity_velocity_r = (uint16_t)-1;
g_rx_struct.mc_status_precharge_status = 1; // precharge status is not complete
neutral_to_precharge();
precharge_to_reverse();
Expand All @@ -177,8 +177,9 @@ void test_neutral_to_reverse() {
LOG_DEBUG("T2.4: (Neutral->Reverse) (no precharge)\n");
notify(drive, REVERSE_BUTTON_EVENT);
fsm_shared_mem_set_power_state(POWER_FSM_STATE_MAIN);
g_rx_struct.motor_velocity_velocity_l = -1;
g_rx_struct.motor_velocity_velocity_r = -1;
g_rx_struct.motor_velocity_velocity_l = (uint16_t)-1;
g_rx_struct.motor_velocity_velocity_l = (uint16_t)-1;
g_rx_struct.motor_velocity_velocity_r = (uint16_t)-1;
g_rx_struct.mc_status_precharge_status = 2; // precharge status is not complete
neutral_to_reverse();

Expand Down
Loading