Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.7.0-rc.3 #105

Merged
merged 89 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
2a88d35
Merge remote-tracking branch 'origin/master' into develop
leon0399 Feb 27, 2024
e17d0a0
refactor(OpenGloves): decouple from Arduino SDK
leon0399 Feb 27, 2024
b246d00
feat(OpenGloves): add Serial Plotter for data
leon0399 Feb 27, 2024
2040226
chore(OpenGloves): tweak default sensitivity
leon0399 Feb 27, 2024
ff83152
Merge pull request #100 from senseshift/feature/opengloves-plotter
leon0399 Feb 27, 2024
41ae1ec
chore(CodiumAI): config PR agent (#101)
leon0399 Feb 27, 2024
38a24bd
feat: add CD74HC4057 input
leon0399 Feb 27, 2024
2fb4da4
refactor(Arduino): use Filter to invert analog sensors
leon0399 Feb 28, 2024
e2277d8
refactor: make multiplexers universal with templates
leon0399 Feb 28, 2024
b2249d7
Merge pull request #102 from senseshift/feature/cd74hc4067
leon0399 Feb 28, 2024
b6c0b83
refactor(Sensor): change core sensor dir structure
leon0399 Feb 28, 2024
85460c0
Merge pull request #103 from senseshift/feature/sensor-namespace
leon0399 Feb 28, 2024
bbd9c89
refactor(Arduino): add pin_mode option to DigitalSensor
leon0399 Feb 28, 2024
1733316
feat(Arduino): add digital MUX sensor
leon0399 Feb 28, 2024
728d03e
Merge pull request #106 from senseshift/feature/advanced-digital-sensor
leon0399 Feb 28, 2024
6816354
Merge branch 'master' into develop
leon0399 Mar 13, 2024
ad7460a
Merge branch 'master' into develop
leon0399 Mar 13, 2024
423dd82
Merge branch 'master' into develop
leon0399 Jun 5, 2024
dc5d252
Merge branch 'master' into develop
leon0399 Jul 2, 2024
18c5217
ci(GitHub): upload only cleaned coverage
leon0399 Jul 2, 2024
55d9ee4
Merge pull request #124 from senseshift/feature/codecov-only-cleared
leon0399 Jul 2, 2024
742681d
Merge branch 'master' into develop
leon0399 Jul 14, 2024
7072ca5
build(PlatformIO): use arduino-esp32 3.0.0 (#120)
leon0399 Jul 14, 2024
df8bbc4
refactor(BLE): use library for BLE Serial
leon0399 Jul 18, 2024
dc6d36a
chore: change NimBLE flag name
leon0399 Jul 18, 2024
1616eb2
chore(OpenGloves): don't use deprecated API
leon0399 Jul 18, 2024
07e1295
ci(GitHub): use correct flag for OpenGloves transport
leon0399 Jul 18, 2024
295ec7b
Merge pull request #126 from senseshift/feature/ble-library
leon0399 Jul 18, 2024
500aab8
Merge branch 'master' into develop
leon0399 Jul 26, 2024
92b062e
refactor(OpenGloves): use `opengloves-lib` for encoding
leon0399 Jul 26, 2024
6569b28
refactor(OpenGloves): use template parameter for encoding
leon0399 Jul 27, 2024
05b5d99
Merge pull request #128 from senseshift/feature/opengloves-lib-repo
leon0399 Jul 27, 2024
2f858d0
style: update clang-format
leon0399 Jul 27, 2024
11e88ad
Merge pull request #129 from senseshift/feature/clang-format-update
leon0399 Jul 27, 2024
9864864
refactor: use template params for auto-mapping
leon0399 Jul 27, 2024
a9817ea
refactor: remove unused buffer types
leon0399 Jul 27, 2024
1e673a0
refactor: remove unused container helpers
leon0399 Jul 27, 2024
efe64f0
chore: remove irrelevant example
leon0399 Jul 27, 2024
291c428
chore: update `.editorconfig`
leon0399 Jul 27, 2024
6177138
Merge pull request #130 from senseshift/feature/remove-unused
leon0399 Jul 27, 2024
24a3780
refactor: remove unused Adafruit dependencies
leon0399 Jul 27, 2024
62f7399
refactor(PCA9685): use own I2CDevLibContrib
leon0399 Jul 27, 2024
69d280b
chore(deps): pin I2CDevLibContrib to exact hash
leon0399 Jul 27, 2024
082fb6f
chore: log I2C errors
leon0399 Jul 28, 2024
cc3bf17
feat(Battery): add MAX170xx support
leon0399 Jul 28, 2024
9849339
docs(Readme): mention I2CDevLibContrib
leon0399 Jul 28, 2024
2798087
Merge pull request #107 from senseshift/feature/i2cdevlib
leon0399 Jul 28, 2024
d4b786d
ci(GitHub): run Semgrep SAST
leon0399 Jul 30, 2024
2715fed
style: remove extra semicolons
leon0399 Jul 30, 2024
6d842d3
ci(GitHub): add flawfinder
leon0399 Jul 30, 2024
d96b2d1
Merge pull request #132 from senseshift/feature/semgrep-ci
leon0399 Jul 30, 2024
ccfde57
feat: upgrade xtensa-esp32 toolchain
leon0399 Feb 23, 2024
161e6f3
refactor(bHaptics): deduct battery templates
leon0399 Feb 23, 2024
227108e
feat(bHaptics): deduct update task template
leon0399 Feb 23, 2024
b8e0f3b
chore: upgrade `framework-arduinoespressif32`
leon0399 Aug 1, 2024
f425296
Merge pull request #99 from senseshift/feature/upgrade-toolchain
leon0399 Aug 1, 2024
32cc34a
ci(GitHub): upload memory usage artifact
leon0399 Aug 1, 2024
8b0ae13
perf(Input): reduce vtable usage, lessen coupling
leon0399 Aug 1, 2024
a02db2d
fix(tests): add missing functions for some architectures
leon0399 Aug 1, 2024
22c634e
ci(GitHub): compare memory usage
leon0399 Aug 2, 2024
4851aea
refactor(Input): change sensor.h dir
leon0399 Aug 2, 2024
c4c3b59
refactor(bHaptics): use initializer list for map
leon0399 Aug 2, 2024
fa1e331
perf(bHaptics): constexpr map outputs
leon0399 Aug 2, 2024
e7f8a9a
refactor: do not use virtual component
leon0399 Aug 2, 2024
e76662c
chore: remove unnecessary inheritance
leon0399 Aug 4, 2024
3852b4d
chore: remove unnecessary `[[nodiscard]]` attributes
leon0399 Aug 4, 2024
905c910
Merge pull request #133 from senseshift/feature/reduce-overhead
leon0399 Aug 4, 2024
392bb90
ci(GitHub): don't fail if can't get previous memory usage
leon0399 Aug 4, 2024
8b848c5
ci(GitHub): use env build flags
leon0399 Aug 4, 2024
ed9cbb9
chore: enable NimBLE by default
leon0399 Aug 4, 2024
bb9e07b
ci(GitHub): fix memory report checks
leon0399 Aug 4, 2024
49d6f08
ci(GitHub): update firmware-name script
leon0399 Aug 4, 2024
5f54f91
ci(GitHub): lessen OpenGloves matrix
leon0399 Aug 5, 2024
1ca09b0
ci(GitHub): reusable `setup-platfromio` action
leon0399 Aug 5, 2024
b2935a3
build: add custom `release-archive` target
leon0399 Aug 5, 2024
09cfc48
build: refactor PlatformIO bHaptics configuration
leon0399 Aug 7, 2024
558374e
build: refactor PlatformIO OpenGloves configuration
leon0399 Aug 8, 2024
10b42c9
style: change back include brackets
leon0399 Aug 8, 2024
5b9fdcd
fix(ESP32): bring back info logging
leon0399 Aug 8, 2024
3a04e15
feat(FreeRTOS): pass config by reference
leon0399 Aug 8, 2024
c87d789
ci(Wokwi): start calibration for lucidgloves proto4
leon0399 Aug 8, 2024
41e53cb
fix(OpenGloves): don't reset calibration while holding button
leon0399 Aug 8, 2024
ac19530
Merge pull request #135 from senseshift/feature/ini-refactor
leon0399 Aug 8, 2024
bbe0225
ci(GitHub): setup GCC problem matcher
leon0399 Aug 8, 2024
3465d35
feat(OpenGloves): upgrade lib
leon0399 Aug 9, 2024
9cc1e42
fix: resolve compiler warnings
leon0399 Aug 9, 2024
a76672d
ci(GitHub): run `pio check`
leon0399 Aug 9, 2024
f549035
fix: resolve `cppcheck` warnings
leon0399 Aug 9, 2024
0018cd3
Merge pull request #137 from senseshift/feature/cppcheck
leon0399 Aug 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ AlignEscapedNewlines: Left
AllowAllArgumentsOnNextLine: 'false'
AllowAllConstructorInitializersOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: Inline

# Always break after if to get accurate coverage
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: 'false'
AllowShortLambdasOnASingleLine: None
AllowShortLoopsOnASingleLine: false

AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'true'
AlwaysBreakTemplateDeclarations: 'Yes'
Expand Down Expand Up @@ -39,7 +42,7 @@ IndentWrappedFunctionNames: 'true'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
Language: Cpp
MaxEmptyLinesToKeep: '1'
NamespaceIndentation: All
NamespaceIndentation: None
PointerAlignment: Left
ReflowComments: 'true'
SortIncludes: 'true'
Expand Down
37 changes: 36 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
Checks: 'bugprone-*,clang-analyzer-*,google-*,hicpp-*,misc-*,modernize-*,performance-*,portability-*,readability-*'
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,cppcoreguidelines-*,modernize-*,-modernize-use-trailing-return-type'
WarningsAsErrors: true
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: google
CheckOptions:
- key: cert-dcl16-c.NewSuffixes
value: 'L;LL;LU;LLU'
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
value: '0'
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
value: '1'
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
...
7 changes: 7 additions & 0 deletions .cppcheck-suppressions
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// no real downside on these
unusedFunction
unusedPrivateFunction

*:.pio/*
*:*/libdeps/*
*:*/generated/*
5 changes: 3 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ end_of_line = lf
insert_final_newline = true

# Tab indentation (no size specified)
[Makefile]
[{Makefile,*.mk}]
indent_style = tab

[CMakeLists.txt]
Expand All @@ -18,7 +18,8 @@ indent_size = 4
max_line_length = 80

[*.{c++,cc,cpp,cxx,h,h++,hh,hpp,hxx,inl,ipp,tlh,tli}]
indent_size = 4
indent_size = 2
indent_style = space
cpp_indent_case_contents_when_block = true
cpp_new_line_before_open_brace_namespace = same_line

Expand Down
67 changes: 67 additions & 0 deletions .github/actions/setup-platformio/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: "Setup PlatformIO"
description: "Setup PlatformIO for building and checking firmware"

inputs:
cache:
required: false
description: "Specify things to cache. Supported values are: 'pip', 'cache', 'packages', 'platforms', 'build_cache', 'build_dir'."
default: 'pip cache'
cache_dir:
description: https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/directory/cache_dir.html
required: false
default: '~/.platformio/.cache'
packages_dir:
description: https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/directory/packages_dir.html
required: false
default: '~/.platformio/packages'
platforms_dir:
description: https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/directory/platforms_dir.html
required: false
default: '~/.platformio/platforms'
build_cache_dir:
description: https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/directory/build_cache_dir.html
required: false
build_dir:
description: https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/directory/build_dir.html
required: false

runs:
using: composite
steps:
- name: Prepare
shell: bash
run: |
touch ./requirements.txt

${{ inputs.cache_dir && format('echo "PLATFORMIO_CACHE_DIR={0}" >> $GITHUB_ENV', inputs.cache_dir) || '' }}
${{ inputs.packages_dir && format('echo "PLATFORMIO_PACKAGES_DIR={0}" >> $GITHUB_ENV', inputs.packages_dir) || '' }}
${{ inputs.platforms_dir && format('echo "PLATFORMIO_PLATFORMS_DIR={0}" >> $GITHUB_ENV', inputs.platforms_dir) || '' }}
${{ inputs.build_cache_dir && format('echo "PLATFORMIO_BUILD_CACHE_DIR={0}" >> $GITHUB_ENV', inputs.build_cache_dir) || '' }}
${{ inputs.build_dir && format('echo "PLATFORMIO_BUILD_DIR={0}" >> $GITHUB_ENV', inputs.build_dir) || '' }}

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: ${{ contains(inputs.cache, 'pip') && 'pip' || '' }}

- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: |
${{ contains(inputs.cache, 'cache') && inputs.cache_dir || '' }}
${{ contains(inputs.cache, 'packages') && inputs.packages_dir || '' }}
${{ contains(inputs.cache, 'platforms') && inputs.platforms_dir || '' }}
${{ contains(inputs.cache, 'build_cache') && inputs.build_cache_dir || '' }}
${{ contains(inputs.cache, 'build_dir') && inputs.build_dir || '' }}
key: setup-platformio-${{ runner.os }}-pio-${{ hashFiles('**/*.ini') }}
restore-keys: |
setup-platformio-${{ runner.os }}-pio-

- name: Install PlatformIO
shell: bash
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pio upgrade --dev
pio pkg update --global
87 changes: 87 additions & 0 deletions .github/scripts/compare-memory-usage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import json
import pandas as pd
import argparse


# Function to load JSON data from files
def load_json(filename):
with open(filename, 'r') as f:
return json.load(f)


# Function to compare values and create formatted strings
def compare_values(base, current, key):
if key not in base and key not in current:
return None
if key not in base:
return f"🆕 {current[key]}"
if key not in current:
return f"❌"

base_value = base[key]
current_value = current[key]

if base_value == current_value:
return f"🆗 {base_value}"

change = current_value - base_value
sign = "+" if change > 0 else "-"
symbol = "⚠️" if change > 0 else "⬇️"

# round to 2 decimal places
change = round(abs(change), 2)
return f"{symbol} {current_value} <sub>{sign}{change}</sub>"


# Function to generate Markdown table
def generate_markdown_table(base_data, current_data):
table_data = []

all_keys = set(base_data.keys()).union(set(current_data.keys()))
all_keys = sorted(all_keys)

for key in all_keys:
base_ram = base_data.get(key, {}).get("ram", {})
current_ram = current_data.get(key, {}).get("ram", {})

base_flash = base_data.get(key, {}).get("flash", {})
current_flash = current_data.get(key, {}).get("flash", {})

row = [
key.replace("-usage", ""),
compare_values(base_ram, current_ram, "percentage"),
compare_values(base_ram, current_ram, "used"),
compare_values(base_flash, current_flash, "percentage"),
compare_values(base_flash, current_flash, "used")
]
table_data.append(row)

df = pd.DataFrame(table_data, columns=["Variant", "RAM, %", "RAM, bytes", "Flash, %", "Flash, bytes"])

return df.to_markdown(index=False)


# Main function to handle CLI arguments and execute the script
def main():
parser = argparse.ArgumentParser(description='Compare JSON files and generate a markdown table.')
parser.add_argument('base', type=str, help='Path to the base JSON file')
parser.add_argument('current', type=str, help='Path to the current JSON file')
parser.add_argument('--output', type=str, help='Path to the output markdown file')
args = parser.parse_args()

base_data = load_json(args.base)
current_data = load_json(args.current)

markdown_table = generate_markdown_table(base_data, current_data)

if args.output:
with open(args.output, 'w') as f:
f.write(markdown_table)
print(f"Markdown table generated and saved to {args.output}")
else:
print(markdown_table)


# usage: python compare-memory-usage.py base.json current.json --output table.md
if __name__ == "__main__":
main()
135 changes: 135 additions & 0 deletions .github/scripts/get-firmware-name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import os
import sys
import re
import argparse


def github_debug(message):
"""
Print a debug message in GitHub Actions format.

Args:
message (str): The debug message.
"""
print(f"::debug::{message}")


def strip_flags(flags):
return [flag[2:] if flag.startswith('-D') and flag != '-D' else flag for flag in flags if flag != '-D']


def store_firmware_name(target):
print(f"firmware={target}")
if os.getenv('GITHUB_ACTIONS'):
with open(os.getenv('GITHUB_OUTPUT'), 'a') as github_output:
github_output.write(f"firmware={target}\n")
else:
print("::error::Not in GitHub Actions")


def get_bhaptics_name(target, flags):
"""
Get bHaptics name based on target and flags.

Args:
target (str): The target name.
flags (list): List of flags.
"""
github_debug(f"Getting bHaptics name for {target}")
github_debug(f"Flags are {flags}")

if "SS_USE_NIMBLE=true" in flags:
github_debug("Nimble is enabled, appending +nimble to the target")
target += "+nimble"

if "SS_BATTERY_ENABLED=true" in flags:
github_debug("Battery is enabled, appending +battery to the target")
target += "+battery"

store_firmware_name(target)


def handle_calibration_flag(target, flag, prefix):
"""
Handle calibration flags.

Args:
target (str): The target name.
flag (str): The flag name.
prefix (str): The prefix for the calibration.
"""
if "MinMaxCalibrator" in flag:
target += f"+{prefix}_minmax"
elif "FixedCenterPointDeviationCalibrator" in flag:
target += f"+{prefix}_fcpd"
elif "CenterPointDeviationCalibrator" in flag:
target += f"+{prefix}_cpd"

return target


def handle_opengloves_comm_flag(target, flag):
"""
Handle OpenGloves communication flags.

Args:
target (str): The target name.
flag (str): The flag name.
"""
if "OPENGLOVES_COMM_SERIAL" in flag:
github_debug("Serial is enabled, appending +serial to the target")
target += "+serial"
elif "OPENGLOVES_COMM_BTSERIAL" in flag:
github_debug("Bluetooth Serial is enabled, appending +bluetooth to the target")
target += "+bluetooth"
elif "OPENGLOVES_COMM_BLESERIAL" in flag:
github_debug("BLE Serial is enabled, appending +ble to the target")
target += "+ble"

return target


def get_opengloves_name(target, flags):
"""
Get OpenGloves name based on target and flags.

Args:
target (str): The target name.
flags (list): List of flags.
"""
github_debug(f"Getting OpenGloves name for {target}")
github_debug(f"Flags are {flags}")

for flag in flags:
if "OPENGLOVES_COMMUNICATION" in flag:
target = handle_opengloves_comm_flag(target, flag)
if "CALIBRATION_CURL" in flag:
target = handle_calibration_flag(target, flag, "curl_calib")
if "CALIBRATION_SPLAY" in flag:
target = handle_calibration_flag(target, flag, "splay_calib")

store_firmware_name(target)


def main():
parser = argparse.ArgumentParser(description='Get firmware name based on target and flags.')
parser.add_argument('target', type=str, help='The target name')
parser.add_argument('flags', type=str, help='List of flags', default='')
args = parser.parse_args()

target = args.target
flags = strip_flags(args.flags.split(' '))

github_debug(f"Target is {target}")

if re.match(r'^(bhaptics)', target):
get_bhaptics_name(target, flags)
elif re.match(r'^(opengloves|lucidgloves|indexer)', target):
get_opengloves_name(target, flags)
else:
print(f"::error::Unknown target {target}")
sys.exit(1)


if __name__ == "__main__":
main()
Loading
Loading