Skip to content

Commit d1e0684

Browse files
committed
Merge branch 'release/0.31.0'
2 parents f004fd1 + 41961c3 commit d1e0684

Some content is hidden

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

50 files changed

+1246
-234
lines changed

.github/workflows/coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ jobs:
77
name: Coverage
88
runs-on: ubuntu-20.04
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111
- name: Setup Node
1212
run: yarn install --immutable --immutable-cache --check-cache
1313

1414
- name: Generate coverage report
1515
run: yarn test:coverage
1616

1717
- name: Upload coverage to Codecov
18-
uses: codecov/codecov-action@v2
18+
uses: codecov/codecov-action@v3
1919
with:
2020
directory: ./coverage
2121
version: v0.1.15

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ jobs:
1111
name: Test
1212
runs-on: ubuntu-20.04
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
15+
- run: yarn global add node-gyp
1516
- run: yarn install --immutable --immutable-cache --check-cache
1617
- run: yarn lint
1718
- run: yarn test

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=true

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ The build is then available from the build directory and can be served by simply
7272
yarn test:watch
7373
yarn test:coverage
7474

75+
### Docker setup
76+
77+
A Dockerfile is supplied that will build esc-configurator into a container image. A companion script called 'run.sh' is also supplied, which will trigger a build, start a container with the image and open the app in a google chrome.
78+
7579
## History & Credits
7680
This configurator is based on [BLHeli Configurator](https://github.com/blheli-configurator/blheli-configurator) which was based on [Cleanflight Configurator](https://github.com/cleanflight/cleanflight-configurator) which itself was based on [Baseflight Configurator](https://github.com/multiwii/baseflight-configurator). I would like to thank everyone who contributed to one of those projects, without you this project would not be possible.
7781

docker/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM ubuntu:23.10
2+
3+
# Node installation instructions:
4+
# https://github.com/nodesource/distributions#installation-instructions
5+
ENV NODE_MAJOR=16
6+
7+
ENV DEBIAN_FRONTEND="noninteractive"
8+
9+
# Default version to check out is master. Use --build-arg to customize this
10+
ARG VERSION
11+
ENV VERSION=${VERSION:-master}
12+
13+
# Install node, npm and a few utilities used for debugging
14+
RUN apt-get update \
15+
&& apt-get install -y ca-certificates gnupg sudo curl wget build-essential git vim \
16+
&& sudo mkdir -p /etc/apt/keyrings \
17+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
18+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list \
19+
&& sudo apt-get update \
20+
&& sudo apt-get install -y npm \
21+
&& npm install -g yarn
22+
23+
# Build the app
24+
RUN git clone https://github.com/stylesuxx/esc-configurator.git \
25+
&& cd esc-configurator \
26+
&& git checkout $VERSION \
27+
&& yarn \
28+
&& yarn global add serve \
29+
&& yarn build
30+
31+
CMD ["serve", "-s", "/esc-configurator/build", "-l", "1234"]

docker/run.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash -eux
2+
3+
# Port on your local machine that you want esc-configurator to be listening on
4+
LOCAL_PORT=8234
5+
6+
# Fetch tag of latest release version
7+
VERSION=$(curl --silent "https://api.github.com/repos/stylesuxx/esc-configurator/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
8+
9+
docker buildx \
10+
build \
11+
--build-arg VERSION=$VERSION \
12+
--progress plain \
13+
--platform linux/amd64 \
14+
--tag esc-configurator:latest \
15+
.
16+
17+
docker run \
18+
--detach \
19+
--interactive \
20+
--privileged \
21+
--publish $LOCAL_PORT:1234 \
22+
--volume /dev/bus/usb:/dev/bus/usb \
23+
esc-configurator:latest
24+
25+
# This bit tries to guess the binary name of google chrome
26+
BIN1=google-chrome
27+
BIN2=google-chrome-stable
28+
BIN3=google-chrome-unstable
29+
BIN4=google-chrome-beta
30+
31+
if (which $BIN1 &>/dev/null); then
32+
$BIN1 http://localhost:$LOCAL_PORT
33+
elif (which $BIN2 &>/dev/null); then
34+
$BIN2 http://localhost:$LOCAL_PORT
35+
elif (which $BIN3 &>/dev/null); then
36+
$BIN3 http://localhost:$LOCAL_PORT
37+
elif (which $BIN4 &>/dev/null); then
38+
$BIN4 http://localhost:$LOCAL_PORT
39+
else
40+
echo
41+
echo "The $BIN1 binary was not found on this machine."
42+
echo "It is required to open esc-configurator."
43+
echo "Exiting."
44+
echo
45+
exit 1
46+
fi

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "esc-configurator",
3-
"version": "0.30.2",
3+
"version": "0.31.0",
44
"private": false,
55
"license": "AGPL-3.0",
66
"dependencies": {
@@ -93,6 +93,7 @@
9393
"eslint-config-react-app": "^7.0.0",
9494
"eslint-plugin-jest": "^25.7.0",
9595
"eslint-plugin-react": "^7.28.0",
96+
"node-gyp": "^10.0.0",
9697
"postcss": "^8.4.5",
9798
"pre-commit": "^1.2.2",
9899
"pre-push": "^0.1.1",
@@ -126,5 +127,8 @@
126127
"plugins": [
127128
"remark-preset-lint-recommended"
128129
]
130+
},
131+
"engines": {
132+
"node": ">=16.16.0 <19.0.0"
129133
}
130134
}

src/Components/FirmwareSelector/__tests__/index.test.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,10 @@ describe('FirmwareSelector', () => {
386386
expect(onSubmit).toHaveBeenCalled();
387387
});
388388

389-
//TODO: Once v0.20.0 is released, add this test
389+
//TODO: Once v0.22.0 is released, add this test
390390
/*
391-
it('should not show PMW selection for Bluejay v0.20.0 and up', async() => {
392-
const json = `[{ "tag_name": "v0.20.0", "assets": [{}] }]`;
391+
it('should not show PMW selection for Bluejay v0.22.0 and up', async() => {
392+
const json = `[{ "tag_name": "v0.22.0", "assets": [{}] }]`;
393393
global.caches = {
394394
open: jest.fn().mockImplementation(() =>
395395
new Promise((resolve) => {
@@ -445,7 +445,7 @@ describe('FirmwareSelector', () => {
445445
446446
fireEvent.change(screen.getByRole(/combobox/i, { name: 'Version' }), {
447447
target: {
448-
value: 'https://github.com/bird-sanctuary/bluejay/releases/download/v0.20.0/',
448+
value: 'https://github.com/bird-sanctuary/bluejay/releases/download/v0.22.0/',
449449
name: 'Version',
450450
},
451451
});

src/Components/FirmwareSelector/index.jsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function FirmwareSelector({
6666
version: null,
6767
url: null,
6868
pwm: null,
69+
releaseUrl: null,
6970
});
7071

7172
const [layoutSelectionDisabled, setLayoutSelectionDisabled] = useState(false);
@@ -133,6 +134,7 @@ function FirmwareSelector({
133134
key: version.key,
134135
value: version.url,
135136
name: version.name,
137+
releaseUrl: version.releaseUrl ? version.releaseUrl : null,
136138
}));
137139

138140
const firmwareOptions = validFirmware.map((key) => ({
@@ -205,6 +207,8 @@ function FirmwareSelector({
205207
const selected = e.target.options.selectedIndex;
206208
const selectedOption = e.target.options[selected];
207209

210+
const releaseUrl = options.versions[selected - 1].releaseUrl;
211+
208212
const firmwareName = selection.firmware;
209213
const firmwareVersion = options.versions[selected - 1].key;
210214

@@ -223,6 +227,7 @@ function FirmwareSelector({
223227
setSelection({
224228
...selection,
225229
url: e.target.value,
230+
releaseUrl,
226231
version: selectedOption && options.versions[selected - 1].key,
227232
});
228233
}, [options, selection]);
@@ -375,6 +380,42 @@ function FirmwareSelector({
375380
/>}
376381
</>}
377382

383+
<div className="alert">
384+
<p>
385+
<strong>
386+
{t('selectionAttention')}
387+
</strong>
388+
</p>
389+
390+
<p>
391+
{t('selectionHint')}
392+
</p>
393+
394+
<p>
395+
<ul>
396+
<li>
397+
{t('selectionLi1')}
398+
</li>
399+
400+
<li>
401+
{t('selectionLi2')}
402+
</li>
403+
404+
<li>
405+
{t('selectionLi3')}
406+
</li>
407+
</ul>
408+
</p>
409+
410+
{selection.releaseUrl &&
411+
<a
412+
href={selection.releaseUrl}
413+
target="_blank"
414+
>
415+
{t('selectionLinkText')}
416+
</a>}
417+
</div>
418+
378419
<div className="default-btn">
379420
<button
380421
className={disableFlashButton ? "disabled" : ""}

src/Components/Flash/Escs/Esc/__tests__/index.test.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ describe('Esc', () => {
341341
}));
342342

343343
const esc = {
344+
index: 0,
344345
firmwareName: 'Bluejay',
345346
layoutRevision: 207,
346347
settings: { DITHERING: 0 },
@@ -374,6 +375,7 @@ describe('Esc', () => {
374375
}));
375376

376377
const esc = {
378+
index: 0,
377379
firmwareName: 'Bluejay',
378380
layoutRevision: 207,
379381
settings: { DITHERING: 1 },

src/Components/Home/index.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ function HomeColumnCenter() {
110110
}, [dispatch]);
111111

112112
return(
113-
<div className="column third_center text2">
113+
<div className="column third_center text2 tab">
114114
<div className="wrap">
115-
116115
<div className="alert">
117116
<strong>
118117
Attention Bluejay users!

src/Components/Home/style.scss

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,4 @@
219219
list-style: disc;
220220
}
221221
}
222-
223-
.alert {
224-
color: #721c24;
225-
background-color: #f8d7da;
226-
border-color: #f5c6cb;
227-
position: relative;
228-
padding: 0.75rem 1.25rem;
229-
margin-bottom: 1rem;
230-
border: 1px solid transparent;
231-
border-radius: 0.25rem;
232-
}
233222
}

src/Components/MainContent/style.scss

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313

1414
.note {
1515
background-color: #fff3cd;
16-
border: 1px solid #ffeeba;
16+
border-color: #ffeeba;
1717
color: #856404;
18-
margin-top: 5px;
19-
margin-bottom: 25px;
20-
border-radius: 3px;
21-
font-size: 11px;
22-
font-family: 'open_sansregular', Arial, sans-serif;
23-
padding: 5px 7px;
18+
19+
position: relative;
20+
padding: 0.75rem 1.25rem;
21+
margin-bottom: 10px;
22+
border: 1px solid transparent;
23+
border-radius: 0.25rem;
2424

2525
@media screen and (width <= 768px) {
2626
margin-bottom: 18px;
@@ -104,6 +104,36 @@
104104
}
105105
}
106106

107+
.alert {
108+
color: #721c24;
109+
background-color: #f8d7da;
110+
border-color: #f5c6cb;
111+
position: relative;
112+
padding: 0.75rem 1.25rem;
113+
margin-bottom: 10px;
114+
border: 1px solid transparent;
115+
border-radius: 0.25rem;
116+
117+
p {
118+
margin-bottom: 10px;
119+
font-weight: normal;
120+
121+
ul {
122+
font-weight: normal;
123+
li {
124+
list-style-type: disc;
125+
margin-left: 20px;
126+
}
127+
}
128+
}
129+
130+
span,
131+
a {
132+
color: #721c24;
133+
font-size: inherit;
134+
}
135+
}
136+
107137
.checkbox,
108138
.number,
109139
.number-text,

src/Containers/App/escsSlice.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import { createSlice } from '@reduxjs/toolkit';
22

3+
/**
4+
* NOTE: The individual array holds individual ESC settings, the actual index
5+
* in the array does not represent the actual index of the ESC. If for
6+
* example only one ESC is attached, the individual length will have a
7+
* length of 1. The actual index of the ESC must be reat from that object.
8+
*
9+
* Eg.: Only one ESC is attached to motor pin 2 an an FC where 4 ESCs
10+
* are expected. The individual array will have a length of 1, but
11+
* at index 0 it will have the settings for the ESC attached to motor
12+
* pin 2.
13+
*/
14+
315
const initialState = {
416
connected: 0,
517
master: {},
@@ -42,10 +54,16 @@ export const escsSlice = createSlice({
4254
settings,
4355
} = action.payload;
4456

45-
state.individual[index] = {
46-
...state.individual[index],
47-
...settings,
48-
};
57+
for(let i = 0; i < state.individual.length; i += 1) {
58+
if(state.individual[i].index === index) {
59+
state.individual[i] = {
60+
...state.individual[i],
61+
...settings,
62+
};
63+
64+
break;
65+
}
66+
}
4967
},
5068
},
5169
});

0 commit comments

Comments
 (0)