Skip to content

Commit

Permalink
Merge branch 'master' into sendcarcan-telemetry-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
KnockbackNemo committed Nov 17, 2023
2 parents 362628e + e6c9fb6 commit 03f262c
Show file tree
Hide file tree
Showing 60 changed files with 2,702 additions and 1,045 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ __pycache__
*.csv
.vscode
*.swp

!.vscode/LHR.code-workspace
!.vscode/c_cpp_properties.json
298 changes: 298 additions & 0 deletions .vscode/LHR.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
{
"folders": [
{
"path": "../"
},
{
"path": "../../Embedded-Sharepoint"
},
{
"path": "../../BPS"
}
],
"settings": {
"liveServer.settings.multiRootWorkspaceName": "renode",
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
"icon": "terminal-bash",
"args": ["-i"]
},
},
},
"tasks": {
"version": "2.0.0",
"tasks": [
{
"label": "Build Controls",
"type": "process",
"command": "make",
"args": [
"${input:target}",
"TEST=${input:test}",
"DEBUG=${input:debug}"
],
"presentation": {
"echo": false,
"reveal": "always",
"panel": "dedicated",
"focus": true,
"clear": true,
"group": "build"
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "Start Renode",
"type": "shell",
"command": "${workspaceFolder:Controls}/Scripts/start_renode.sh",
"presentation": {
"echo": false,
"reveal": "always",
"panel": "dedicated",
"focus": true,
"clear": true,
"group": "debug"
},
"isBackground": true,
"problemMatcher": {
"owner": "custom",
"pattern": {
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
},
"background": {
"activeOnStart": true,
"beginsPattern": "^.*",
"endsPattern": "^\"Renode Simulator is now active\".*"
}
}
},
{
"label": "Open UART2 Telnet",
"type": "shell",
"command": "echo \"Controls Leaderboard UART2\"; while ! nc -z localhost ${RENODE_UART2_TELNET}; do sleep 2; echo .; done; echo Connected && nc localhost ${RENODE_UART2_TELNET}",
"presentation": {
"echo": false,
"reveal": "always",
"panel": "dedicated",
"focus": true,
"group": "debug"
},
"isBackground": true,
"problemMatcher": {
"owner": "custom",
"pattern": {
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
},
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "."
}
}
},
{
"label": "Start OpenOCD debugger",
"type": "shell",
"command": "openocd",
"presentation": {
"echo": false,
"reveal": "always",
"panel": "dedicated",
"focus": true,
"group": "debug"
},
"problemMatcher": []
},
{
"label": "Open Terminal GDB",
"type": "shell",
"command": "arm-none-eabi-gdb ${workspaceFolder:Controls}/Objects/controls-leader.elf",
"presentation": {
"echo": false,
"reveal": "always",
"panel": "dedicated",
"focus": true,
"group": "debug"
},
"problemMatcher": []
},
{
"label": "Start Renode Tools",
"dependsOn": [
"Start Renode",
"Open UART2 Telnet"
],
"dependsOrder": "sequence",
"problemMatcher": []
},
{
"label": "Start Renode Tools & Terminal GDB",
"dependsOn": [
"Start Renode Tools",
"Open Terminal GDB"
],
"dependsOrder": "sequence",
"problemMatcher": []
},
{
"label": "Start Hardware Tools",
"dependsOn": [
"Start OpenOCD debugger",
"Open Terminal GDB"
],
"dependsOrder": "sequence",
"problemMatcher": []
},
{
"label": "Build Controls & Start OpenOCD",
"dependsOn": [
"Build Controls",
"Start OpenOCD debugger"
],
"dependsOrder": "sequence",
"problemMatcher": []
},
{
"label": "Build Controls & Start Hardware Tools",
"dependsOn": [
"Build Controls",
"Start Hardware Tools"
],
"dependsOrder": "sequence",
"problemMatcher": []
},
{
"label": "Build Controls & Start Renode Tools",
"dependsOn": [
"Build Controls",
"Start Renode Tools"
],
"dependsOrder": "sequence",
"problemMatcher": []
},
{
"label": "Kill Processes",
"type": "process",
"command": [
"${command:workbench.action.tasks.terminate}",
"${command:workbench.action.acceptSelectedQuickOpenItem}"
],
"problemMatcher": []
}
],
"inputs": [
{
"id": "target",
"type": "pickString",
"description": "Target to compile.",
"options": [
"leader",
"flash",
"clean"
]
},
{
"id": "test",
"type": "promptString",
"description": "Test file to compile and run.",
"default": ""
},
{
"id": "debug",
"type": "pickString",
"description": "Debug ",
"options": [
"1",
"0"
],
"default": "1"
}
],
},
"launch": {
"version": "2.0.0",
"configurations": [
{
"name": "Renode Build & Debug Controls",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder:Controls}",
"program": "${workspaceFolder:Controls}/Objects/controls-leader.elf",
"preLaunchTask": "Build Controls & Start Renode Tools",
"postDebugTask": "Kill Processes",

"stopAtEntry": true,
"stopAtConnect": true,

"customLaunchSetupCommands": [
{"text": "target extended-remote :3333", "ignoreFailures": false},
{"text": "file Objects/controls-leader.elf"}
],

"MIMode": "gdb",
"miDebuggerPath": "arm-none-eabi-gdb",
"miDebuggerServerAddress": "localhost:3333",
"miDebuggerArgs": "--cd=${workspaceFolder:Controls}",
"hardwareBreakpoints": {"require": true},

"targetArchitecture": "arm64",
"logging": {
"engineLogging": false,
"traceResponse": false
}
},
{
"name": "Hardware Build & Debug Controls",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder:Controls}",
"program": "${workspaceFolder:Controls}/Objects/controls-leader.elf",
"preLaunchTask": "Build Controls & Start OpenOCD",
"postDebugTask": "Kill Processes",

"stopAtEntry": true,
"stopAtConnect": true,

"customLaunchSetupCommands": [
{"text": "target extended-remote :3333", "ignoreFailures": false},
{"text": "file Objects/controls-leader.elf"}
],

"MIMode": "gdb",
"miDebuggerPath": "arm-none-eabi-gdb",
"miDebuggerServerAddress": "localhost:3333",
"miDebuggerArgs": "--cd=${workspaceFolder:Controls}",
"hardwareBreakpoints": {"require": true},

"targetArchitecture": "arm64",
"logging": {
"engineLogging": false,
"traceResponse": false
}
}

]
},
"extensions": {
"recommendations": [
"ms-vscode.cpptools-extension-pack", // For Controls C code
"GitHub.vscode-pull-request-github", // For reviewing pull requests directly from VSCode
"xaver.clang-format", // For auto-formatting code on VSCode
"eamodio.gitlens", // For better github stuff
"ritwickdey.liveserver", // For quick viewing test reports
]
}

}
8 changes: 1 addition & 7 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,18 @@
"${workspaceFolder}/**",
"${workspaceFolder}/Apps/Inc",
"${workspaceFolder}/Apps/Src",

"${workspaceFolder}/Drivers/Inc",
"${workspaceFolder}/Drivers/Src",

"${workspaceFolder}/Config/Inc",

"${workspaceFolder}/BSP/STM32F413/Src",
"${workspaceFolder}/BSP/Inc",
"${workspaceFolder}/BSP/STM32F413/STM32F4xx_StdPeriph_Driver/Src",
"${workspaceFolder}/BSP/STM32F413/STM32F4xx_StdPeriph_Driver/Inc",
"${workspaceFolder}/BSP/Template/Src",

"${workspaceFolder}/RTOS/uCOS-III-STM32F4/uC-CPU",
"${workspaceFolder}/RTOS/uCOS-III-STM32F4/uC-CPU/ARM-Cortex-M4/GNU",
"${workspaceFolder}/RTOS/uCOS-III-STM32F4/uC-LIB",
"${workspaceFolder}/RTOS/uCOS-III-STM32F4/uCOS-III/Source",
"${workspaceFolder}/RTOS/uCOS-III-STM32F4/uCOS-III/Ports/ARM-Cortex-M4/Generic/GNU",

"${workspaceFolder}/CMSIS/Include",
"${workspaceFolder}/CMSIS/Device/ST/STM32F4xx/Include"
],
Expand All @@ -32,7 +27,6 @@
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
Expand Down
14 changes: 11 additions & 3 deletions Apps/Inc/ReadCarCAN.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,24 @@
#include "os.h"
#include "common.h"
#include "Tasks.h"

#include "CANbus.h"

#define SAT_BUF_LENGTH 5
/**
* Error types
*/
typedef enum{
READCARCAN_ERR_NONE,
READCARCAN_ERR_CHARGE_DISABLE, // Received a charge disable msg
READCARCAN_ERR_MISSED_MSG, // Didn't receive a BPS charge msg in time
READCARCAN_ERR_DISABLE_CONTACTORS_MSG, // Ignition is turned to neither (off due to LV) or both at the same time (impossible) are on at
READCARCAN_ERR_BPS_TRIP // Received a BPS trip msg (0 or 1)
} ReadCarCAN_error_code_t;

/**
* @brief Returns whether regen braking / charging is enabled or not
* @return Whether regen braking / charging is enabled or not
*/
bool ChargeEnable_Get();
bool ChargeEnable_Get(void);

#endif

Expand Down
1 change: 1 addition & 0 deletions Apps/Inc/ReadTritium.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ typedef enum{
T_DESAT_FAULT_ERR = (1<<7),
T_MOTOR_OVER_SPEED_ERR = (1<<8),
T_INIT_FAIL = (1<<9), //motor controller fails to restart or initialize
T_MOTOR_WATCHDOG_TRIP = (1 << 15),
T_NONE = 0x00,
} tritium_error_code_t;

Expand Down
5 changes: 4 additions & 1 deletion Apps/Inc/Tasks.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ void throwTaskError(error_code_t errorCode, callback_t errorCallback, error_sche
void _assertOSError (OS_ERR err); //TODO: This should be changed to enforce only enum usage

#if DEBUG == 1
#define assertOSError(err)
#define assertOSError(err) \
if (err != OS_ERR_NONE) { \
printf("Error asserted at %s, line %d: %d\n\r", __FILE__, __LINE__, err); \
} \
_assertOSError(err);
#else
#define assertOSError(err) _assertOSError(err);
Expand Down
2 changes: 1 addition & 1 deletion Apps/Inc/UpdateDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ UpdateDisplayError_t UpdateDisplay_SetCruiseState(TriState_t state);
void UpdateDisplay_ClearQueue(void);

#endif
/* @} */
/* @} */
Loading

0 comments on commit 03f262c

Please sign in to comment.