File tree Expand file tree Collapse file tree 3 files changed +27
-5
lines changed
Components/Flash/Escs/Esc/__tests__ Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,7 @@ describe('Esc', () => {
341
341
} ) ) ;
342
342
343
343
const esc = {
344
+ index : 0 ,
344
345
firmwareName : 'Bluejay' ,
345
346
layoutRevision : 207 ,
346
347
settings : { DITHERING : 0 } ,
@@ -374,6 +375,7 @@ describe('Esc', () => {
374
375
} ) ) ;
375
376
376
377
const esc = {
378
+ index : 0 ,
377
379
firmwareName : 'Bluejay' ,
378
380
layoutRevision : 207 ,
379
381
settings : { DITHERING : 1 } ,
Original file line number Diff line number Diff line change 1
1
import { createSlice } from '@reduxjs/toolkit' ;
2
2
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
+
3
15
const initialState = {
4
16
connected : 0 ,
5
17
master : { } ,
@@ -42,10 +54,16 @@ export const escsSlice = createSlice({
42
54
settings,
43
55
} = action . payload ;
44
56
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
+ }
49
67
} ,
50
68
} ,
51
69
} ) ;
Original file line number Diff line number Diff line change 2
2
{
3
3
"title" : " Unreleased" ,
4
4
"items" : [
5
- " AM32: Fix running brake range" ,
5
+ " Bugfix: Fix running brake range on AM32" ,
6
+ " Bugfix: Update correct ESC when only a single ESC is attached (when multiple would be expected)" ,
7
+ " Bugfix: Allow recovery via UI if ESC can still be read, but previous flash failed" ,
6
8
" Bluejay: Adjust min/max startup power defaults" ,
7
9
" Enhancement: Show checklist when chosing new firmware version" ,
8
10
" Enhancement: Link to release notes of new versions if available" ,
You can’t perform that action at this time.
0 commit comments