From fee14ac57d646c7136104f88dc3f3165dbd7859a Mon Sep 17 00:00:00 2001 From: Danny <179722984+DanielProano@users.noreply.github.com> Date: Wed, 7 Oct 2026 07:51:38 -0400 Subject: [PATCH 1/4] Formatting + vscode setup --- .vscode/settings.json | 12 +++++++- firmware/core/include/types.hpp | 49 ++++++++++++++++----------------- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c5c2fbb..6a472e2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,15 @@ ], "cmake.preferredGenerators": [ "Ninja" - ] + ], + "stm32cube-ide-clangd.path": "cube", + "stm32cube-ide-clangd.arguments": [ + "starm-clangd", + "--query-driver=${env:CUBE_BUNDLE_PATH}/gnu-tools-for-stm32/14.3.1+st.2/bin/arm-none-eabi-gcc*", + "--query-driver=${env:CUBE_BUNDLE_PATH}/gnu-tools-for-stm32/14.3.1+st.2/bin/arm-none-eabi-g++*" + ], + "[c][cpp]": { + "editor.defaultFormatter": "stmicroelectronics.stm32cube-ide-clangd", + "editor.formatOnSave": true + } } \ No newline at end of file diff --git a/firmware/core/include/types.hpp b/firmware/core/include/types.hpp index 3429188..06f088c 100644 --- a/firmware/core/include/types.hpp +++ b/firmware/core/include/types.hpp @@ -1,43 +1,40 @@ #pragma once #include -typedef enum { -DIRECTION_FORWARD, -DIRECTION_REVERSE -} Direction; +typedef enum { DIRECTION_FORWARD, DIRECTION_REVERSE } Direction; typedef enum { - COMMUTATION_STEP_0, - COMMUTATION_STEP_1, - COMMUTATION_STEP_2, - COMMUTATION_STEP_3, - COMMUTATION_STEP_4, - COMMUTATION_STEP_5, - COMMUTATION_STEP_COUNT + COMMUTATION_STEP_0, + COMMUTATION_STEP_1, + COMMUTATION_STEP_2, + COMMUTATION_STEP_3, + COMMUTATION_STEP_4, + COMMUTATION_STEP_5, + COMMUTATION_STEP_COUNT } CommutationStep; typedef enum { - FAULT_NONE, - FAULT_OVER_CURRENT, - FAULT_OVER_VOLTAGE, - FAULT_UNDER_VOLTAGE, - FAULT_HALL_DESYNC, - FAULT_STALL + FAULT_NONE, + FAULT_OVER_CURRENT, + FAULT_OVER_VOLTAGE, + FAULT_UNDER_VOLTAGE, + FAULT_HALL_DESYNC, + FAULT_STALL } FaultCode; -typedef enum { -MOTOR_STATE_STOPPED, -MOTOR_STATE_RUNNING, -MOTOR_STATE_FAULTED +typedef enum { + MOTOR_STATE_STOPPED, + MOTOR_STATE_RUNNING, + MOTOR_STATE_FAULTED } MotorState; typedef struct { - bool high_side; - bool low_side; + bool high_side; + bool low_side; } PhaseDrive; typedef struct { - PhaseDrive phase_a; - PhaseDrive phase_b; - PhaseDrive phase_c; + PhaseDrive phase_a; + PhaseDrive phase_b; + PhaseDrive phase_c; } CommutationPattern; From 95b2f38b32a623e40855c5c190ecfeddd7ae1de2 Mon Sep 17 00:00:00 2001 From: Danny <179722984+DanielProano@users.noreply.github.com> Date: Wed, 7 Oct 2026 09:43:34 -0400 Subject: [PATCH 2/4] naming on types --- firmware/core/include/types.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware/core/include/types.hpp b/firmware/core/include/types.hpp index 06f088c..eed1ac8 100644 --- a/firmware/core/include/types.hpp +++ b/firmware/core/include/types.hpp @@ -23,9 +23,9 @@ typedef enum { } FaultCode; typedef enum { - MOTOR_STATE_STOPPED, - MOTOR_STATE_RUNNING, - MOTOR_STATE_FAULTED + MOTOR_STOPPED, + MOTOR_RUNNING, + MOTOR_FAULTED } MotorState; typedef struct { From 6b9e115e221c438138030b679b4d2676ecb640a3 Mon Sep 17 00:00:00 2001 From: Danny <179722984+DanielProano@users.noreply.github.com> Date: Wed, 7 Oct 2026 11:23:17 -0400 Subject: [PATCH 3/4] naming --- firmware/core/include/fault.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/core/include/fault.hpp b/firmware/core/include/fault.hpp index 276e04d..2b339de 100644 --- a/firmware/core/include/fault.hpp +++ b/firmware/core/include/fault.hpp @@ -1,10 +1,10 @@ #pragma once #include "types.hpp" -struct FaultLimits { +typedef struct { float over_current_amps; float over_voltage_volts; float under_voltage_volts; -}; +} FaultLimits; FaultCode fault_check(const FaultLimits* limits); From fcb11cbfa12ba7bdeba2f58663f07e04a229f54d Mon Sep 17 00:00:00 2001 From: Danny <179722984+DanielProano@users.noreply.github.com> Date: Wed, 7 Oct 2026 11:31:16 -0400 Subject: [PATCH 4/4] readme updates --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1a4aab9..996e361 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,16 @@ cmake -B build cmake --build build ./build/motorcontroller_app ``` + +## Install + +Any VS Code user should install the STM32 Cube IDE extension + ## AI Policy -A.I. is both allowed and encouraged but -only responsibly. We do prefer handwritten -code for its educational value and suggest +A.I. is both allowed but only responsibly. +We do prefer handwritten code for its +educational value and suggest LLM's be used as sanity checkers. Either way, quality code is non-negotiable and every line of code merged must be understood.