Skip to content

Commit

Permalink
Merge pull request #91 from senseshift/develop
Browse files Browse the repository at this point in the history
Release 0.7.0-rc.1
  • Loading branch information
leon0399 authored Feb 26, 2024
2 parents 3e2ba09 + 17a13e9 commit 184a493
Show file tree
Hide file tree
Showing 168 changed files with 9,805 additions and 5,893 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AllowAllConstructorInitializersOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: 'false'
Expand Down
52 changes: 52 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu

ARG CLANG_VERSION=16

RUN apt-get update \
&& apt-get -qqy install \
lsb-release \
wget \
software-properties-common \
gnupg \
bc \
sudo \
build-essential \
ca-certificates \
clang \
curl \
gcc \
git \
python3 \
python3-dev \
python3-pip \
python3-venv \
python3-distutils \
python3-setuptools \
libpython2.7-dev \
srecord \
udev \
xz-utils \
&& wget --quiet https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh $CLANG_VERSION && rm -rf llvm.sh \
&& apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION \
&& ln -s /usr/bin/clang-format-$CLANG_VERSION /usr/bin/clang-format \
&& ln -s /usr/bin/clang-tidy-$CLANG_VERSION /usr/bin/clang-tidy \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

RUN curl -fLo /etc/udev/rules.d/99-platformio-udev.rules --create-dirs https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules

USER $USERNAME

# RUN wget https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py -O get-platformio.py \
# && python3 get-platformio.py \
# && rm -rf get-platformio.py

RUN python -m pip install --upgrade pip \
&& pip install --upgrade platformio

RUN sudo wget -O /usr/local/bin/wokwi-cli https://github.com/wokwi/wokwi-cli/releases/latest/download/wokwi-cli-linuxstatic-x64 \
&& sudo chmod +x /usr/local/bin/wokwi-cli
60 changes: 60 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
// "name": "SenseShift",
"build": {
"dockerfile": "Dockerfile"
},
"runArgs": [
"--privileged"
],
"forwardPorts": [
8008
],
"mounts": [
"source=/dev/,target=/dev/,type=bind,consistency=consistent"
],
"updateContentCommand": {
"submodule": "git submodule update --init --recursive",
"pio": "pio pkg install"
},
"postAttachCommand": [
"sudo",
"service",
"udev",
"restart"
],
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"platformio-ide.useBuiltinPIOCore": false,
"platformio-ide.useBuiltinPython": false,
"platformio-ide.disablePIOHomeStartup": true,
"platformio-ide.pioHomeServerHttpPort": 8008,
"platformio-ide.autoOpenPlatformIOIniFile": false,
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true
},
"files.associations": {
"**/.vscode/*.json": "jsonc"
},
"C_Cpp.clang_format_path": "clang-format"
},
"extensions": [
"ms-vscode.cpptools",
"redhat.vscode-yaml",
"platformio.platformio-ide",
"Wokwi.wokwi-vscode",
"xaver.clang-format",
"editorconfig.editorconfig",
"GitHub.copilot",
"GitHub.copilot-labs",
"GitHub.copilot-chat",
"wakatime.vscode-wakatime"
]
}
}
}
57 changes: 32 additions & 25 deletions .github/scripts/get_firmware_name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,16 @@ getBhapticsName() {
echo "::debug::Getting bHaptics name for $target"
echo "::debug::Flags are $flags"

if [[ $flags =~ BLUETOOTH_USE_NIMBLE=true ]]; then
if [[ $flags =~ SS_BLE_USE_NIMBLE=true ]]; then
echo "::debug::Nimble is enabled, appending +nimble to the target"
target="$target+nimble"
fi

if [[ $flags =~ BATTERY_ENABLED=true ]]; then
if [[ $flags =~ SS_BATTERY_ENABLED=true ]]; then
echo "::debug::Battery is enabled, appending +battery to the target"
target="$target+battery"
fi

if [[ $flags =~ SERIAL_PLOTTER=true ]]; then
echo "::debug::Serial Plotter is enabled, appending +serialplotter to the target"
target="$target+serialplotter"
fi

echo "firmware=$target"
if [[ -n "$GITHUB_ACTIONS" ]]; then
echo "firmware=$target" >> "$GITHUB_OUTPUT"
Expand All @@ -32,6 +27,22 @@ getBhapticsName() {
fi
}

handleCalibrationFlag() {
local target=$1
local flag=$2
local prefix=$3

if [[ $flag =~ MinMaxCalibrator ]]; then
target="$target+${prefix}_minmax"
elif [[ $flag =~ FixedCenterPointDeviationCalibrator ]]; then
target="$target+${prefix}_fcpd"
elif [[ $flag =~ CenterPointDeviationCalibrator ]]; then
target="$target+${prefix}_cpd"
fi

echo "$target"
}

getOpenGlovesName() {
local target=$1
# rest of params
Expand All @@ -43,27 +54,23 @@ getOpenGlovesName() {
if [[ $flags =~ OPENGLOVES_COMM_SERIAL ]]; then
echo "::debug::Serial is enabled, appending +serial to the target"
target="$target+serial"
fi

if [[ $flags =~ OPENGLOVES_COMM_BTSERIAL ]]; then
elif [[ $flags =~ OPENGLOVES_COMM_BTSERIAL ]]; then
echo "::debug::Bluetooth Serial is enabled, appending +bluetooth to the target"
target="$target+bluetooth"
elif [[ $flags =~ OPENGLOVES_COMM_BLESERIAL ]]; then
echo "::debug::BLE Serial is enabled, appending +ble to the target"
target="$target+ble"
fi

if [[ $flags =~ CALIBRATION_CURL=OH::MinMaxCalibrator ]]; then
echo "::debug::MinMaxCalibrator is enabled, appending +curl_minmax to the target"
target="$target+curl_minmaxcalib"
fi
for flag in "${@:2}"; do
if [[ $flag =~ CALIBRATION_CURL ]]; then
target=$(handleCalibrationFlag "$target" "$flag" "curl_calib")
fi

if [[ $flags =~ CALIBRATION_CURL=OH::CenterPointDeviationCalibrator ]]; then
echo "::debug::CenterPointDeviationCalibrator is enabled, appending +curl_cpcalib to the target"
target="$target+curl_cpcalib"
fi

if [[ $flags =~ CALIBRATION_CURL=OH::FixedCenterPointDeviationCalibrator ]]; then
echo "::debug::FixedCenterPointDeviationCalibrator is enabled, appending +curl_fcpcalib to the target"
target="$target+curl_fcpcalib"
fi
if [[ $flag =~ CALIBRATION_SPLAY ]]; then
target=$(handleCalibrationFlag "$target" "$flag" "splay_calib")
fi
done

echo "firmware=$target"
if [[ -n "$GITHUB_ACTIONS" ]]; then
Expand All @@ -77,9 +84,9 @@ getOpenGlovesName() {
target=$1
echo "::debug::Target is $target"
if [[ $target =~ ^(bhaptics) ]]; then
getBhapticsName $@
getBhapticsName "${@}"
elif [[ $target =~ ^(opengloves|lucidgloves|indexer) ]]; then
getOpenGlovesName $@
getOpenGlovesName "${@}"
else
echo "::error::Unknown target $target"
exit 1
Expand Down
Loading

0 comments on commit 184a493

Please sign in to comment.