Skip to content

Commit 7295a9f

Browse files
authored
Merge pull request #46 from Formula-Electric-Berkeley/zb/time_versioning_csv
Zb/time versioning csv
2 parents 28bf6ee + 3f8c56b commit 7295a9f

109 files changed

Lines changed: 7265 additions & 1701 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cubemx-manifest.json

Lines changed: 81 additions & 21 deletions
Large diffs are not rendered by default.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Auto-bump minor on PR merge
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches: [main]
7+
8+
permissions:
9+
contents: write
10+
11+
# Serialize back-to-back merges so two workflows don't race each other
12+
# when both try to commit to main.
13+
concurrency:
14+
group: auto-bump-main
15+
cancel-in-progress: false
16+
17+
jobs:
18+
bump:
19+
if: github.event.pull_request.merged == true
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout main
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
ref: main
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Configure git identity
30+
run: |
31+
git config user.name "github-actions[bot]"
32+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
33+
34+
- name: Bump minor versions
35+
env:
36+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
37+
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
38+
PR_NUMBER: ${{ github.event.pull_request.number }}
39+
run: ./scripts/auto-bump-merge.sh "$BASE_SHA" "$MERGE_SHA" "$PR_NUMBER"
40+
41+
- name: Push commit and tags
42+
run: |
43+
# Only push if the script actually made a commit. `auto-bump-merge.sh`
44+
# exits 0 without committing when the PR didn't touch any board or
45+
# common/ path — in that case there's nothing new on HEAD to push.
46+
if [ "$(git rev-list --count origin/main..HEAD)" -gt 0 ]; then
47+
# --atomic makes the branch update and tag push a single transaction:
48+
# if the server rejects either, neither is applied, so we never end
49+
# up with a bump commit on main without its matching tag.
50+
git push --atomic origin main --tags
51+
else
52+
echo "No version bump commit produced; nothing to push."
53+
fi

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,13 @@ repos:
4848
language: script
4949
pass_filenames: false
5050
always_run: true
51+
52+
# Auto-increment patch version on each commit for affected boards + repo.
53+
# No-ops if a VERSION file is already staged (so /version stays authoritative).
54+
- id: auto-bump-patch
55+
name: auto-bump-patch
56+
entry: ./scripts/auto-bump-commit.sh
57+
language: script
58+
pass_filenames: false
59+
always_run: true
60+
stages: [pre-commit]

.vscode/tasks.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,42 @@
138138
"cwd": "${workspaceFolder}"
139139
},
140140
"problemMatcher": []
141+
},
142+
{
143+
"type": "shell",
144+
"label": "Firmware: Bump Board Version",
145+
"detail": "Bump <BOARD>/VERSION, commit, tag <BOARD>-v<X.Y.Z>, push",
146+
"command": "bash",
147+
"args": ["${workspaceFolder}/scripts/bump-version.sh", "${input:bumpBoard}", "${input:bumpType}"],
148+
"options": { "cwd": "${workspaceFolder}" },
149+
"problemMatcher": []
150+
},
151+
{
152+
"type": "shell",
153+
"label": "Firmware: Bump Repo Version",
154+
"detail": "Bump top-level VERSION, commit, tag v<X.Y.Z>, push",
155+
"command": "bash",
156+
"args": ["${workspaceFolder}/scripts/bump-version.sh", "repo", "${input:bumpType}"],
157+
"options": { "cwd": "${workspaceFolder}" },
158+
"problemMatcher": []
159+
},
160+
{
161+
"type": "shell",
162+
"label": "Firmware: Bump All (Common Changed)",
163+
"detail": "Bump every board + repo + common, tag each, push. Use when common/ changed.",
164+
"command": "bash",
165+
"args": ["${workspaceFolder}/scripts/bump-version.sh", "all", "${input:bumpType}", "--yes"],
166+
"options": { "cwd": "${workspaceFolder}" },
167+
"problemMatcher": []
168+
},
169+
{
170+
"type": "shell",
171+
"label": "Firmware: Bump Auto-Detect",
172+
"detail": "Inspect staged/unstaged diff, bump affected boards (or all if common/ changed), push",
173+
"command": "bash",
174+
"args": ["${workspaceFolder}/scripts/bump-version.sh"],
175+
"options": { "cwd": "${workspaceFolder}" },
176+
"problemMatcher": []
141177
}
142178
],
143179
"inputs": [
@@ -147,6 +183,20 @@
147183
"description": "Select board to flash",
148184
"options": ["BMS", "DASH", "DART", "DCU", "LVPDB", "PCU", "Sensor_Nodes", "UART", "UART_TEST"],
149185
"default": "LVPDB"
186+
},
187+
{
188+
"id": "bumpBoard",
189+
"type": "pickString",
190+
"description": "Which board's firmware version to bump",
191+
"options": ["BMS", "DASH", "DART", "DCU", "LVPDB", "PCU", "Sensor_Nodes", "UART", "UART_TEST"],
192+
"default": "BMS"
193+
},
194+
{
195+
"id": "bumpType",
196+
"type": "pickString",
197+
"description": "Semantic version bump",
198+
"options": ["patch", "minor", "major"],
199+
"default": "patch"
150200
}
151201
]
152202
}

BMS/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ add_executable(${PROJECT_NAME} ${ALL_SOURCES})
105105

106106
target_include_directories(${PROJECT_NAME} PRIVATE ${BASE_INCLUDES})
107107

108-
target_link_libraries(${PROJECT_NAME} PRIVATE m feb_io feb_tps feb_rtos_utils feb_uart feb_log feb_console)
108+
target_link_libraries(${PROJECT_NAME} PRIVATE m feb_io feb_version feb_tps feb_rtos_utils feb_uart feb_log feb_console)
109+
110+
# Embed version + build provenance (reads VERSION + git, generates feb_build_info.c)
111+
include(${CMAKE_SOURCE_DIR}/cmake/FEB_Version.cmake)
112+
feb_apply_version(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR})
109113

110114
# Enable floating-point printf/scanf for newlib-nano
111115
target_link_options(${PROJECT_NAME} PRIVATE

BMS/Core/User/Inc/FEB_ADBMS6830B.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,8 @@ float FEB_ADBMS_GET_ACC_AVG_Temp(void);
106106
float FEB_ADBMS_GET_ACC_MIN_Temp(void);
107107
float FEB_ADBMS_GET_ACC_MAX_Temp(void);
108108
float FEB_ADBMS_GET_Cell_Temperature(uint8_t bank, uint16_t cell);
109-
110-
// ********************************** Print Accumulator **************************
111-
112-
void FEB_ADBMS_Print_Accumulator(void);
109+
uint16_t FEB_ADBMS_GET_Therm_Raw_Code(uint8_t bank, uint16_t sensor);
110+
float FEB_ADBMS_GET_Therm_Raw_mV(uint8_t bank, uint16_t sensor);
113111

114112
// ********************************** Balancing **********************************
115113

BMS/Core/User/Inc/FEB_Commands.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,4 @@
2222
*/
2323
void BMS_RegisterCommands(void);
2424

25-
/**
26-
* @brief Print CSV data (voltages and/or temperatures)
27-
* @param argc Argument count (2 for mode)
28-
* @param argv Arguments: argv[1] = "volts", "temps", or "all"
29-
*/
30-
void subcmd_csv(int argc, char *argv[]);
31-
3225
#endif /* FEB_COMMANDS_H */

BMS/Core/User/Inc/FEB_Const.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@
1818
// Total number of cells per bank
1919
#define FEB_NUM_CELLS_PER_BANK (FEB_NUM_CELLS_PER_IC * FEB_NUM_ICPBANK)
2020

21-
// Alias for compatibility
22-
#define FEB_NUM_CELL_PER_BANK FEB_NUM_CELLS_PER_BANK
21+
// Number of temperature sensors per IC: 6 MUXes × 7 channels = 42
22+
#define FEB_NUM_TEMP_SENSE_PER_IC 42
2323

24-
// Number of temperature sensors per IC (for MUX reading)
25-
#define FEB_NUM_TEMP_SENSE_PER_IC 41
26-
27-
// Total number of temperature sensors per bank (10 per IC × 2 ICs)
24+
// Total number of temperature sensors per bank
2825
#define FEB_NUM_TEMP_SENSORS (FEB_NUM_TEMP_SENSE_PER_IC * FEB_NUM_ICPBANK)
2926

3027
// ********************************** ADBMS6830B ADC Conversion Constants ********
@@ -129,6 +126,8 @@ typedef struct
129126
uint8_t badReadV; // Bad voltage read counter
130127
float temp_sensor_readings_V[FEB_NUM_TEMP_SENSORS]; // Temperature sensor readings
131128
uint8_t temp_violations[FEB_NUM_TEMP_SENSORS]; // Per-sensor violation counters
129+
uint16_t therm_raw_codes[FEB_NUM_TEMP_SENSORS]; // Raw ADC codes (0xFFFF = PEC failure)
130+
float therm_raw_voltages_mV[FEB_NUM_TEMP_SENSORS]; // Converted mV (NaN = PEC failure)
132131
} bank_data_t;
133132

134133
typedef struct

0 commit comments

Comments
 (0)