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

SendCarCAN Restructure #337

Merged
merged 33 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
771a916
Merged functionality of SendCarCAN into Telemetry and removed SendCar…
NathanielDelgado Jul 8, 2023
cfd0b7c
renamed telemetry to send car can
IshDeshpa Jul 9, 2023
de426c5
adapted CAN_Queue into a library file and integrated with SendCarCAN
IshDeshpa Jul 10, 2023
6f69ba9
merge conflict resolved
IshDeshpa Sep 25, 2023
2f45100
merged in master, now builds. test still needs to be written and bugf…
IshDeshpa Sep 26, 2023
2d7dbbf
Started a test file for SendCarCAN.
KnockbackNemo Oct 7, 2023
5185426
Changed main loop to check the queue periodically instead of pending …
KnockbackNemo Oct 14, 2023
90cb9c6
Deleted most putIOStateTimer thigns, added a macro and counter in the…
KnockbackNemo Oct 20, 2023
73dddf7
Added line to put messages from the motor into the CarCAN queue to be…
KnockbackNemo Oct 20, 2023
3d1d906
Altered test macros so that we can define __TEST_SENDTRITIUM and prin…
KnockbackNemo Oct 20, 2023
ad84abf
Made aa first draft of the SendCarCAN test file and attempted to get …
KnockbackNemo Oct 21, 2023
c38a3d7
SendCarCAN test file compiles! But at what cost...
KnockbackNemo Oct 21, 2023
489a494
Cleaned up and worked on test file, removed attempt to put fifo in he…
KnockbackNemo Oct 27, 2023
9c755ba
Added ability to print FIFO queue indexes, added ReadTritium task in …
KnockbackNemo Nov 4, 2023
d303e9b
Test file updates from testing on hardware.
KnockbackNemo Nov 10, 2023
a5e63df
Merge branch 'master' into sendcarcan-telemetry-merge
KnockbackNemo Nov 10, 2023
9043b7b
Deleted extra lines added when merging.
KnockbackNemo Nov 10, 2023
ce1d74a
Moved mutex, semaphore creation and fifo renewal to a new SendCarCAN_…
KnockbackNemo Nov 11, 2023
77dbc2a
Changed PutIOState to send directly instead of putting messages in th…
KnockbackNemo Nov 11, 2023
ff4bf0a
Updates from hardware testing: added counter array to reduce frequenc…
KnockbackNemo Nov 11, 2023
de12ac1
Added while loop to putIOState
KnockbackNemo Nov 11, 2023
0079ce4
Test file changes for last minute panic debugging. Added an array to …
KnockbackNemo Nov 11, 2023
8bdf6bb
Addressing review comments: updated SendTritium macros, removed motor…
KnockbackNemo Nov 13, 2023
362628e
Revisions to SendCarCAN and test file to allow messages to be inspect…
KnockbackNemo Nov 17, 2023
03f262c
Merge branch 'master' into sendcarcan-telemetry-merge
KnockbackNemo Nov 17, 2023
347ef98
Updated NUM_CAN_IDS to MAX_CAN_ID in the CANId enum.
KnockbackNemo Nov 17, 2023
5d3ddfb
Added commas to enum to match new enum generation format.
KnockbackNemo Nov 17, 2023
2755a69
Memset the gTxMessage.Data to zero since one-byte messages weren't cl…
KnockbackNemo Nov 17, 2023
f72917b
Fixed accidental deletion in docs.
KnockbackNemo Nov 17, 2023
6cf7996
Changes from integration with BPS: flipped reading of ignition pins i…
KnockbackNemo Dec 3, 2023
893c2e7
Addressed review comments: Shifted task priorities to be next to each…
KnockbackNemo Dec 14, 2023
69bc819
addressed review comments
IshDeshpa Dec 16, 2023
192692f
Merge branch 'master' into sendcarcan-telemetry-merge
IshDeshpa Dec 16, 2023
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
25 changes: 0 additions & 25 deletions Apps/Inc/CAN_Queue.h

This file was deleted.

21 changes: 21 additions & 0 deletions Apps/Inc/SendCarCAN.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef __SENDCARCAN_H
#define __SENDCARCAN_H

#include "CANbus.h"

/**
* @brief Initialize SendCarCAN
*/
void SendCarCAN_Init();

/**
* @brief Wrapper to put new message in the CAN queue
*/
void SendCarCAN_Put(CANDATA_t message);

/**
* @brief print SendCarCAN_Q put/get for debug purposes
*/
void print_SendCarCAN_Q(void);

#endif
25 changes: 21 additions & 4 deletions Apps/Inc/SendTritium.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@

#include "common.h"

// #define SENDTRITIUM_PRINT_MES
#define SENDTRITIUM_PRINT_MES

#define MOTOR_MSG_PERIOD 100
#define FSM_PERIOD 100
#define DEBOUNCE_PERIOD 2 // in units of FSM_PERIOD
#define MOTOR_MSG_COUNTER_THRESHOLD (MOTOR_MSG_PERIOD)/(FSM_PERIOD)

#define FOREACH_Gear(GEAR) \
GEAR(FORWARD_GEAR) \
GEAR(NEUTRAL_GEAR) \
GEAR(REVERSE_GEAR) \
GEAR(FORWARD_GEAR), \
GEAR(NEUTRAL_GEAR), \
GEAR(REVERSE_GEAR), \

typedef enum GEAR_ENUM {
FOREACH_Gear(GENERATE_ENUM)
Expand All @@ -49,6 +49,23 @@ typedef struct TritiumState{
void (*stateDecider)(void);
} TritiumState_t;

#ifdef SENDTRITIUM_EXPOSE_VARS
// Inputs
extern bool cruiseEnable;
extern bool cruiseSet;
extern bool onePedalEnable;
extern bool regenEnable;

extern uint8_t brakePedalPercent;
extern uint8_t accelPedalPercent;

extern Gear_t gear;

extern TritiumState_t state;
extern float velocityObserved;
extern float cruiseVelSetpoint;
#endif

// Getter functions for local variables in SendTritium.c
EXPOSE_GETTER(bool, cruiseEnable)
EXPOSE_GETTER(bool, cruiseSet)
Expand Down
6 changes: 0 additions & 6 deletions Apps/Inc/Tasks.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#define TASK_READ_CAR_CAN_PRIO 5
#define TASK_UPDATE_DISPLAY_PRIO 6
#define TASK_SEND_CAR_CAN_PRIO 8
#define TASK_TELEMETRY_PRIO 9
#define TASK_DEBUG_DUMP_PRIO 10
KnockbackNemo marked this conversation as resolved.
Show resolved Hide resolved
#define TASK_COMMAND_LINE_PRIO 11

Expand All @@ -49,7 +48,6 @@
#define TASK_UPDATE_DISPLAY_STACK_SIZE DEFAULT_STACK_SIZE
#define TASK_READ_TRITIUM_STACK_SIZE DEFAULT_STACK_SIZE
#define TASK_SEND_CAR_CAN_STACK_SIZE DEFAULT_STACK_SIZE
#define TASK_TELEMETRY_STACK_SIZE DEFAULT_STACK_SIZE
#define TASK_DEBUG_DUMP_STACK_SIZE DEFAULT_STACK_SIZE
#define TASK_COMMAND_LINE_STACK_SIZE DEFAULT_STACK_SIZE

Expand All @@ -73,8 +71,6 @@ void Task_ReadTritium(void* p_arg);

void Task_SendCarCAN(void* p_arg);

void Task_Telemetry(void* p_arg);

void Task_DebugDump(void *p_arg);

void Task_CommandLine(void* p_arg);
Expand All @@ -90,7 +86,6 @@ extern OS_TCB ReadCarCAN_TCB;
extern OS_TCB UpdateDisplay_TCB;
extern OS_TCB ReadTritium_TCB;
extern OS_TCB SendCarCAN_TCB;
extern OS_TCB Telemetry_TCB;
extern OS_TCB DebugDump_TCB;
extern OS_TCB CommandLine_TCB;

Expand All @@ -104,7 +99,6 @@ extern CPU_STK ReadCarCAN_Stk[TASK_READ_CAR_CAN_STACK_SIZE];
extern CPU_STK UpdateDisplay_Stk[TASK_UPDATE_DISPLAY_STACK_SIZE];
extern CPU_STK ReadTritium_Stk[TASK_READ_TRITIUM_STACK_SIZE];
extern CPU_STK SendCarCAN_Stk[TASK_SEND_CAR_CAN_STACK_SIZE];
extern CPU_STK Telemetry_Stk[TASK_TELEMETRY_STACK_SIZE];
extern CPU_STK DebugDump_Stk[TASK_DEBUG_DUMP_STACK_SIZE];
extern CPU_STK CommandLine_Stk[TASK_COMMAND_LINE_STACK_SIZE];

Expand Down
4 changes: 2 additions & 2 deletions Apps/Inc/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include "config.h"

/* Used for generating ENUMS */
#define GENERATE_ENUM(ENUM) ENUM,
#define GENERATE_STRING(STRING) #STRING,
#define GENERATE_ENUM(ENUM) ENUM
#define GENERATE_STRING(STRING) #STRING

/**
* Used for creating getter functions (returns the value based on given inputs)
Expand Down
2 changes: 2 additions & 0 deletions Apps/Inc/fifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#ifndef __FIFO_H
#define __FIFO_H
#include <stdbool.h>
#include <string.h>
#include "common.h"
IshDeshpa marked this conversation as resolved.
Show resolved Hide resolved
#endif

// The type of the fifo
Expand Down
69 changes: 0 additions & 69 deletions Apps/Src/CAN_Queue.c

This file was deleted.

1 change: 0 additions & 1 deletion Apps/Src/DebugDump.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "Tasks.h"
#include "bsp.h"
#include "CANbus.h"
#include "CAN_Queue.h"
#include "Pedals.h"
#include "Minions.h"
#include "Contactors.h"
Expand Down
8 changes: 4 additions & 4 deletions Apps/Src/ReadTritium.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

#include "ReadTritium.h"
#include "CAN_Queue.h"
#include "CANbus.h"
#include "UpdateDisplay.h"
#include "SendCarCAN.h"
#include <string.h>

//status limit flag masks
Expand All @@ -29,7 +29,7 @@ Objective 1:
- if error
- assertOSError
- determine information important to telementry
- SendCarCAN
- Telemetry
- determine information important for storage
- acquire mutex on Storage Array
- Store information in Storage Array (based on index)
Expand Down Expand Up @@ -82,8 +82,8 @@ void Task_ReadTritium(void *p_arg){
}

}


SendCarCAN_Put(dataBuf); // Forward message on CarCAN for telemetry
}

OSTimeDlyHMSM(0, 0, 0, 10, OS_OPT_TIME_HMSM_NON_STRICT, &err);
Expand Down
Loading
Loading