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

Removing serial print #215

Merged
merged 4 commits into from
Nov 7, 2024
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,7 @@ types_c.taghl
ctrlp.root

#html
*.html
*.html

# nixos files
*.nix
1 change: 0 additions & 1 deletion Core/Inc/cerberus_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#define SHUTDOWN_MONITOR_DELAY 500 /* ms */
#define NERO_DELAY_TIME 100 /* ms*/
#define LV_READ_DELAY 1000
#define SERIAL_MONITOR_DELAY
#define CAN_ROUTER_DELAY
#define CAN_DISPATCH_DELAY 5
#define BMS_CAN_MONITOR_DELAY 4000
Expand Down
14 changes: 0 additions & 14 deletions Core/Inc/serial_monitor.h

This file was deleted.

1 change: 0 additions & 1 deletion Core/Src/bms.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "timer.h"
#include "fault.h"
#include "can.h"
#include "serial_monitor.h"
#include "cerberus_conf.h"
#include <assert.h>
#include <stdlib.h>
Expand Down
1 change: 0 additions & 1 deletion Core/Src/can_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "cerberus_conf.h"
#include "fault.h"
#include "steeringio.h"
#include "serial_monitor.h"
#include "bms.h"
#include <assert.h>
#include <stdlib.h>
Expand Down
3 changes: 1 addition & 2 deletions Core/Src/dti.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <string.h>
#include <stdio.h>
#include "bms.h"
#include "serial_monitor.h"
#include "nero.h"

#define CAN_QUEUE_SIZE 5 /* messages */
Expand Down Expand Up @@ -66,7 +65,7 @@ void dti_set_torque(int16_t torque)
/* Motor controller expects AC current target to be received as multiplied by 10 */
int16_t ac_current = (((float)average / EMRAX_KT) * 10);

// serial_print("Commanded Current: %d \r\n", ac_current);
// printf("Commanded Current: %d \r\n", ac_current);

dti_set_current(ac_current);
}
Expand Down
6 changes: 2 additions & 4 deletions Core/Src/fault.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "fault.h"
#include "serial_monitor.h"
#include "task.h"
#include <assert.h>
#include <stdio.h>
Expand Down Expand Up @@ -55,9 +54,8 @@ void vFaultHandler(void *pv_params)
sizeof(defcon));

queue_can_msg(msg);
serial_print(
"\r\nFault Handler! Diagnostic Info:\t%s\r\n\r\n",
fault_data.diag);
printf("\r\nFault Handler! Diagnostic Info:\t%s\r\n\r\n",
fault_data.diag);

switch (fault_data.severity) {
case DEFCON1: /* Highest(1st) Priority */
Expand Down
3 changes: 0 additions & 3 deletions Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "queues.h"
#include "fault.h"
#include "can_handler.h"
#include "serial_monitor.h"
#include "state_machine.h"
#include "bms.h"
#include "pdu.h"
Expand Down Expand Up @@ -230,8 +229,6 @@ int main(void)
assert(can_dispatch_handle);
can_receive_thread = osThreadNew(vCanReceive, mc, &can_receive_attributes);
assert(can_receive_thread);
serial_monitor_handle = osThreadNew(vSerialMonitor, NULL, &serial_monitor_attributes);
assert(serial_monitor_handle);

/* Control Logic */
fault_handle = osThreadNew(vFaultHandler, NULL, &fault_handle_attributes);
Expand Down
5 changes: 2 additions & 3 deletions Core/Src/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "mpu.h"
#include "pdu.h"
#include "queues.h"
#include "serial_monitor.h"
#include "sht30.h"
#include "state_machine.h"
#include "steeringio.h"
Expand Down Expand Up @@ -266,7 +265,7 @@ void vTempMonitor(void *pv_params)
queue_fault(&fault_data);
}

serial_print("MPU Board Temperature:\t%d\r\n", temp);
printf("MPU Board Temperature:\t%d\r\n", temp);

temp_msg.data[0] = temp & 0xFF;
temp_msg.data[1] = (temp >> 8) & 0xFF;
Expand Down Expand Up @@ -362,7 +361,7 @@ void vIMUMonitor(void *pv_params)
mpu_t *mpu = (mpu_t *)pv_params;

for (;;) {
// serial_print("IMU Task\r\n");
// printf("IMU Task\r\n");
/* Take measurement */
if (read_accel(mpu)) {
fault_data.diag = "Failed to get IMU acceleration";
Expand Down
1 change: 0 additions & 1 deletion Core/Src/nero.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "stdbool.h"
#include "can_handler.h"
#include "state_machine.h"
#include "serial_monitor.h"
#include "queues.h"
#include "c_utils.h"
#include "stdio.h"
Expand Down
1 change: 0 additions & 1 deletion Core/Src/pdu.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "pdu.h"
#include "serial_monitor.h"
#include "fault.h"
#include <assert.h>
#include <stdio.h>
Expand Down
1 change: 0 additions & 1 deletion Core/Src/pedals.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "cerberus_conf.h"
#include "dti.h"
#include "queues.h"
#include "serial_monitor.h"
#include "bms.h"
#include "emrax.h"
#include "monitor.h"
Expand Down
72 changes: 0 additions & 72 deletions Core/Src/serial_monitor.c

This file was deleted.

8 changes: 4 additions & 4 deletions Core/Src/state_machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "nero.h"
#include "queues.h"
#include "monitor.h"
#include "serial_monitor.h"
#include "nero.h"
#include "queues.h"
#include "pedals.h"
Expand Down Expand Up @@ -71,7 +70,7 @@ static int transition_functional_state(func_state_t new_state, pdu_t *pdu,
// write_fan_battbox(pdu, false);
write_pump(pdu, false);
write_fault(pdu, false);
serial_print("READY\r\n");
printf("READY\r\n");
break;
case F_PIT:
case F_PERFORMANCE:
Expand All @@ -92,7 +91,7 @@ static int transition_functional_state(func_state_t new_state, pdu_t *pdu,
// write_fan_battbox(pdu, true);
write_pump(pdu, true);
write_fault(pdu, false);
serial_print("ACTIVE STATE\r\n");
printf("ACTIVE STATE\r\n");
break;
case REVERSE:
/* Can only enter reverse mode if already in pit mode */
Expand All @@ -105,9 +104,10 @@ static int transition_functional_state(func_state_t new_state, pdu_t *pdu,
write_pump(pdu, false);
cerberus_state.nero =
(nero_state_t){ .nero_index = OFF, .home_mode = false };

osDelay(1000); /* Delay for 1 sec before faulting car */
write_fault(pdu, true);
serial_print("FAULTED\r\n");
printf("FAULTED\r\n");
break;
default:
// Do Nothing
Expand Down
7 changes: 3 additions & 4 deletions Core/Src/steeringio.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <stdlib.h>
#include <string.h>
#include "state_machine.h"
#include "serial_monitor.h"
#include "nero.h"
#include "stdio.h"
#include "cerb_utils.h"
Expand Down Expand Up @@ -99,11 +98,11 @@ static void debounce_cb(void *arg)
paddle_right_cb();
break;
case NERO_BUTTON_UP:
serial_print("Up button pressed \r\n");
printf("Up button pressed \r\n");
decrement_nero_index();
break;
case NERO_BUTTON_DOWN:
serial_print("Down button pressed \r\n");
printf("Down button pressed \r\n");
increment_nero_index();
break;
case NERO_BUTTON_LEFT:
Expand All @@ -117,7 +116,7 @@ static void debounce_cb(void *arg)
select_nero_index();
break;
case NERO_HOME:
serial_print("Home button pressed \r\n");
printf("Home button pressed \r\n");
set_home_mode();
break;
default:
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Core/Src/stm32f4xx_hal_msp.c \
Core/Src/monitor.c \
Core/Src/fault.c \
Core/Src/can_handler.c \
Core/Src/serial_monitor.c \
Core/Src/dti.c \
Core/Src/state_machine.c \
Core/Src/bms.c \
Expand Down