Skip to content

Commit

Permalink
feat: provide default board definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ccoors committed Nov 15, 2023
1 parent 11def69 commit bdf1128
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ repos:
rev: v3.0.2
hooks:
- id: prettier
exclude: \.vscode/.*
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
Expand Down
12 changes: 8 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["platformio.platformio-ide"],
"unwantedRecommendations": ["ms-vscode.cpptools-extension-pack"]
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Open the project folder in a PlatformIO IDE (VS Codium, etc.) and build it. If y
$ HSHB_BOARD=1 pio run
```

Replace `HSHB_BOARD=1` with the number of your board (sticker on the back).
Replace `HSHB_BOARD=1` with the number of your board (sticker on the back), which is used to select the proper battery calibration values. If you do not provide the `HSHB_BOARD` variable, the code will compile with the calibration data of board 1 by default.

## Flashing

Expand Down
5 changes: 5 additions & 0 deletions get_build_flags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python

import os;

print(f"-Os -DBoard{os.getenv('HSHB_BOARD', '1')}")
2 changes: 1 addition & 1 deletion include/logo.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ void logoDrawCircle(int8_t x, int8_t y, int8_t r, uint8_t brightness);
void setLogoXY(uint8_t x, uint8_t y, uint8_t brightness);
void fillLogoPercent(int8_t perc, uint8_t full, uint8_t onB, uint8_t offB);

#endif // LOGO_H_
#endif
3 changes: 1 addition & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ board_hardware.oscillator = internal
framework = arduino

monitor_speed = 300
build_flags =
-DBoard${sysenv.HSHB_BOARD} -Os
build_flags = !python get_build_flags.py
upload_protocol = arduino
upload_port = /dev/ttyUSB0
board_upload.speed = 38400

0 comments on commit bdf1128

Please sign in to comment.