Skip to content

Commit ad4f494

Browse files
Merge pull request #85 from makers-for-life/dev
Refactor directory structure (normalize & de-dup & clear unused files)
2 parents 9c4d683 + e3ed4e4 commit ad4f494

18 files changed

+51
-82
lines changed

.github/workflows/firmware-release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ jobs:
3939
- name: Build production HW3
4040
run: |
4141
sed -Ei 's/#define MODE .+/#define MODE MODE_PROD/' includes/config.h
42-
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output output/respirator-production
42+
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output builds/respirator-production
4343
mkdir -p dist/
4444
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h)
45-
cp output/respirator-production.bin "dist/respirator-production-HW3-$VERSION-$GITHUB_SHA.bin"
45+
cp builds/respirator-production.bin "dist/respirator-production-HW3-$VERSION-$GITHUB_SHA.bin"
4646
4747
- name: Build production HW3 without mass flow meter
4848
run: |
4949
sed -Ei 's/#define MODE .+/#define MODE MODE_PROD/' includes/config.h
5050
sed -Ei 's/#define MASS_FLOW_METER_ENABLED/\/\/ #define MASS_FLOW_METER_ENABLED/' includes/config.h
51-
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output output/respirator-production
51+
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output builds/respirator-production
5252
mkdir -p dist/
5353
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h)
54-
cp output/respirator-production.bin "dist/respirator-production-HW3-NOMASSFLOWMETER-$VERSION-$GITHUB_SHA.bin"
54+
cp builds/respirator-production.bin "dist/respirator-production-HW3-NOMASSFLOWMETER-$VERSION-$GITHUB_SHA.bin"
5555
5656
- name: Archive binaries
5757
uses: actions/upload-artifact@v1

.github/workflows/firmware-unit-tests.yml.disabled

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
# build unit test
2727
mkdir build_test
2828
cd build_test
29-
cmake $GITHUB_WORKSPACE/test/
29+
cmake $GITHUB_WORKSPACE/tests/
3030
cmake --build .
3131
# Run tests
3232
ctest

.gitignore

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
/.pio/
22
/.vscode/
3+
34
/local/
5+
/builds/*
6+
!/builds/.gitkeep
7+
48
.DS_Store
5-
/output/*
6-
!/output/.gitkeep
7-
/*.csv
8-
/*.ods
9-
/*.csv#
10-
/*.ods#
11-
build/*
129
.scannerwork
1310

14-
flash.sh
15-
1611
srcs/srcs.ino

.sonarcloud/build-and-analyse-all.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ do
1616
export MODE=${softwareModes[$softwareIndex]}
1717
export HARDWARE_VERSION=${hardwareVersions[$hardwareIndex]}
1818

19-
path="build/${SOFTWARE_FULLNAME}/bo"
19+
path="builds/${SOFTWARE_FULLNAME}/bo"
2020

2121
mkdir -p "$path"
2222

.sonarcloud/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
sed -Ei "s/#define HARDWARE_VERSION [0-9]+/#define HARDWARE_VERSION ${HARDWARE_VERSION}/" includes/config.h
44
sed -Ei "s/#define MODE .+/#define MODE ${MODE}/" includes/config.h
5-
arduino-cli compile --build-path "$PWD/build/$SOFTWARE_FULLNAME" --fqbn STM32:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output "output/$SOFTWARE_FULLNAME"
5+
arduino-cli compile --build-path "$PWD/builds/$SOFTWARE_FULLNAME" --fqbn STM32:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output "builds/$SOFTWARE_FULLNAME"

.travis.yml.disabled

-43
This file was deleted.

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ In order to setup your environment and build the code, please follow the followi
4444
Then, compile the project:
4545

4646
```sh
47-
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output output/respirator-production
47+
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output builds/respirator-production
4848
```
4949

5050
## How To Flash?
@@ -56,7 +56,7 @@ In order to flash the firmware that you just built using the instructions above:
5656
3. Make sure that [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html) is installed on your computer, and run:
5757

5858
```sh
59-
arduino-cli upload --port {SERIAL_PORT} --fqbn STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_F411RE,upload_method=swdMethod --input output/respirator-production
59+
arduino-cli upload --port {SERIAL_PORT} --fqbn STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_F411RE,upload_method=swdMethod --input builds/respirator-production
6060
```
6161

6262
_Make sure to replace {SERIAL_PORT} with your serial port, which should begin with `/dev/`._
@@ -66,6 +66,7 @@ _Make sure to replace {SERIAL_PORT} with your serial port, which should begin wi
6666
A few scripts are available, eg. to automate repeated manual actions:
6767

6868
1. **Compile & Flash**: `./scripts/compile_and_flash.sh` (compiles firmware and flashes it over the plugged STM32 programmer);
69+
2. **Compile Only**: `./scripts/compile_only.sh` (compiles firmware, useful to check for code mistakes);
6970

7071
## Configuration
7172

build/build.sh

-3
This file was deleted.

build/build_deploy_and_monitor.sh

-7
This file was deleted.

output/.gitkeep builds/.gitkeep

File renamed without changes.

flash.sh

-2
This file was deleted.

scripts/compile_and_flash.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pushd "$BASE_DIR" > /dev/null
1919

2020
sleep 0.5
2121

22-
rm -f ./output/* || exit 1
22+
rm -f ./builds/* || exit 1
2323

2424
echo "Old builds cleared."
2525

@@ -28,14 +28,14 @@ pushd "$BASE_DIR" > /dev/null
2828

2929
sleep 0.5
3030

31-
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output output/respirator-production || exit 1
31+
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output builds/respirator-production || exit 1
3232

3333
# Flash new firmware
3434
echo ">> [3] Flashing new firmware..."
3535

3636
sleep 0.5
3737

38-
arduino-cli upload --port "$SERIAL_PORT" --fqbn STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_F411RE,upload_method=swdMethod --input output/respirator-production || exit 1
38+
arduino-cli upload --port "$SERIAL_PORT" --fqbn STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_F411RE,upload_method=swdMethod --input builds/respirator-production || exit 1
3939

4040
sleep 0.5
4141

scripts/compile_only.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
ABSPATH=$(cd "$(dirname "$0")"; pwd)
4+
BASE_DIR="$ABSPATH/../"
5+
6+
pushd "$BASE_DIR" > /dev/null
7+
# Clear out built code
8+
echo ">> [1] Clearing old builds..."
9+
10+
sleep 0.5
11+
12+
rm -f ./builds/* || exit 1
13+
14+
echo "Old builds cleared."
15+
16+
# Compile new firmware
17+
echo ">> [2] Compiling new firmware..."
18+
19+
sleep 0.5
20+
21+
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output builds/respirator-production || exit 1
22+
23+
sleep 0.5
24+
25+
echo "Success: All done. Firmware was compiled successfully."
26+
popd > /dev/null
27+
28+
exit 0

srcs/end_of_line_test.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void eolScreenMessage(char* message, bool isFailed) {
6262
screen.print(eolTestNumber);
6363
if (isFailed) {
6464
screen.setCursor(15, 0);
65-
screen.print("ECHEC");
65+
screen.print("FAIL");
6666
} else {
6767
screen.setCursor(18, 0);
6868
screen.print("OK");
@@ -306,7 +306,7 @@ void millisecondTimerEOL(void)
306306
totalPushed += buttonsPushed[i];
307307
}
308308
(void)snprintf(eolScreenBuffer, EOLSCREENSIZE,
309-
"Please press each\nbutton... \n %d / 11 OK", totalPushed);
309+
"Please press each\nbutton... \n %d / %d OK", totalPushed, EOL_TOTALBUTTONS);
310310
if (totalPushed == EOL_TOTALBUTTONS) {
311311
eolTestNumber++;
312312
while (digitalRead(PIN_BTN_START) == HIGH) {
@@ -361,7 +361,7 @@ void millisecondTimerEOL(void)
361361
} else if (eolstep == MAX_PRESSURE_NOT_REACHED) {
362362
// FAIL: Case max pressure was not reached
363363
blower.stop();
364-
(void)snprintf(eolScreenBuffer, EOLSCREENSIZE, "Pressure increase\nimpossible ! ");
364+
(void)snprintf(eolScreenBuffer, EOLSCREENSIZE, "Pressure increase\nimpossible! ");
365365
} else if (eolstep == MAX_PRESSURE_REACHED_OK) {
366366
// Close the valves and wait 1000 ms
367367
inspiratoryValve.close();
@@ -418,7 +418,7 @@ void millisecondTimerEOL(void)
418418
}
419419
} else if (eolstep == MIN_PRESSURE_NOT_REACHED) {
420420
// FAIL: Case emptying the system did not work
421-
(void)snprintf(eolScreenBuffer, EOLSCREENSIZE, "Opening valves\nimpossible ! ");
421+
(void)snprintf(eolScreenBuffer, EOLSCREENSIZE, "Opening valves\nimpossible! ");
422422
} else if (eolstep == USER_CONFIRMATION_BEFORE_O2_TEST) {
423423
// Ask the operator to open the oxygen entrance, and wait for confirmation
424424
(void)snprintf(eolScreenBuffer, EOLSCREENSIZE,
@@ -455,7 +455,7 @@ void millisecondTimerEOL(void)
455455
} else if (eolstep == O2_PRESSURE_NOT_REACH) {
456456
// FAIL: the pressure did not bo above 100 mmh2O during O2 test
457457
blower.stop();
458-
(void)snprintf(eolScreenBuffer, EOLSCREENSIZE, "Pipe O2\nBlocked ! ");
458+
(void)snprintf(eolScreenBuffer, EOLSCREENSIZE, "Pipe O2\nBlocked! ");
459459
} else if (eolstep == WAIT_USER_BEFORE_LONG_RUN) {
460460
// Wait for user to press start before long run.
461461
blower.stop();

srcs/srcs.ino

Whitespace-only changes.
File renamed without changes.

test/README.md tests/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
1. Create a build folder and navigate to it
1717
2. Run:
1818
```
19-
cmake PATH/TO/test
19+
cmake PATH/TO/tests
2020
cmake --build .
2121
```
2222
In the build folder, the test executable will be created.
File renamed without changes.

0 commit comments

Comments
 (0)