@nordicsemiconductor/pc-nrfconnect-shared 135.0.0 → 137.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Changelog.md CHANGED
@@ -7,6 +7,34 @@ This project does _not_ adhere to
7
7
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html) but contrary to it
8
8
  every new version is a new major version.
9
9
 
10
+ ## 137.0.0 - 2023-12-04
11
+
12
+ ### Added
13
+
14
+ - `jprogDeviceSetup` take in aan optional boolean to skip the device setup if
15
+ device is protected. Default remain to show dialog. Apps will need to opt-in
16
+
17
+ ## 136.0.0 - 2023-12-01
18
+
19
+ ### Fixed
20
+
21
+ - `useStopWatch` milliseconds was not correctly calculated
22
+ - External JLink devices would not connect to apps device list properly if
23
+ selected before they are connected to the debug-in heder of the device
24
+
25
+ ### Changed
26
+
27
+ - `useStopWatch` reset and start no longer force a rerender if these are a
28
+ dependency of a useEffect
29
+ - `useStopWatch` start optional time param no longer default to the last time
30
+ when paused but 0.
31
+ - `nrfutil device` `device-info` return undefined if reading info throws
32
+
33
+ ### Steps to upgrade when using this package
34
+
35
+ - `useStopWatch` If start() was used after a pause() with no call to reset()
36
+ start need to be called with time i.e. start(time)
37
+
10
38
  ## 135.0.0 - 2023-11-29
11
39
 
12
40
  ### Changed
@@ -56,15 +56,20 @@ export default async (
56
56
  core?: DeviceCore,
57
57
  onProgress?: (progress: Progress) => void,
58
58
  controller?: AbortController
59
- ) =>
60
- device.traits.jlink || device.traits.nordicDfu
61
- ? (
62
- await deviceSingleTaskEndOperation<DeviceInfoRaw>(
63
- device,
64
- 'device-info',
65
- onProgress,
66
- controller,
67
- core ? ['--core', core] : []
68
- )
69
- ).deviceInfo
70
- : undefined;
59
+ ) => {
60
+ try {
61
+ return device.traits.jlink || device.traits.nordicDfu
62
+ ? (
63
+ await deviceSingleTaskEndOperation<DeviceInfoRaw>(
64
+ device,
65
+ 'device-info',
66
+ onProgress,
67
+ controller,
68
+ core ? ['--core', core] : []
69
+ )
70
+ ).deviceInfo
71
+ : undefined;
72
+ } catch (_) {
73
+ return undefined;
74
+ }
75
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordicsemiconductor/pc-nrfconnect-shared",
3
- "version": "135.0.0",
3
+ "version": "137.0.0",
4
4
  "description": "Shared commodities for developing pc-nrfconnect-* packages",
5
5
  "repository": {
6
6
  "type": "git",
@@ -135,7 +135,8 @@ const firmwareOptions = (
135
135
 
136
136
  export const jprogDeviceSetup = (
137
137
  firmware: JprogEntry[],
138
- needSerialport = false
138
+ needSerialport = false,
139
+ hideDeviceSetupWhenProtected = false
139
140
  ): DeviceSetup => ({
140
141
  supportsProgrammingMode: device =>
141
142
  (needSerialport === !!device.traits.serialPorts || !needSerialport) &&
@@ -176,6 +177,16 @@ export const jprogDeviceSetup = (
176
177
  });
177
178
  }
178
179
 
180
+ if (
181
+ hideDeviceSetupWhenProtected &&
182
+ readbackProtection === 'protected'
183
+ ) {
184
+ return Promise.resolve({
185
+ device,
186
+ validFirmware: true,
187
+ });
188
+ }
189
+
179
190
  return Promise.resolve({
180
191
  device,
181
192
  validFirmware: false,
@@ -88,7 +88,7 @@ describe('Stop Watch', () => {
88
88
  expect(stopwatch.isRunning).toBeFalsy();
89
89
  });
90
90
 
91
- test('Start a paused timer will continue timer', () => {
91
+ test('Start a paused timer will continue timer from provided time', () => {
92
92
  const stopwatch = setup({
93
93
  autoStart: true,
94
94
  resolution: 1000,
@@ -120,7 +120,7 @@ describe('Stop Watch', () => {
120
120
  mockNow.mockReturnValue(5000);
121
121
 
122
122
  act(() => {
123
- stopwatch.start();
123
+ stopwatch.start(500);
124
124
  stopwatch;
125
125
  });
126
126
 
@@ -37,7 +37,7 @@ const splitMS = (ms: number) => {
37
37
  ms -= minutes * 60 * 1000;
38
38
 
39
39
  const seconds = Math.floor(ms / 1000);
40
- const millisecond = ms - seconds * 60 * 1000;
40
+ const millisecond = ms - seconds * 1000;
41
41
 
42
42
  return {
43
43
  time,
@@ -89,7 +89,7 @@ export default ({
89
89
  );
90
90
 
91
91
  const start = useCallback(
92
- (elapsedTime = time) => {
92
+ (elapsedTime = 0) => {
93
93
  if (pauseTimeout.current === null) {
94
94
  previousTickTime.current = timer.now();
95
95
  expectedTickTime.current =
@@ -98,7 +98,7 @@ export default ({
98
98
  pauseTimeout.current = nextTick(elapsedTime);
99
99
  }
100
100
  },
101
- [nextTick, resolution, time, timer]
101
+ [nextTick, resolution, timer]
102
102
  );
103
103
 
104
104
  const pause = useCallback(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"deviceInfo.d.ts","sourceRoot":"","sources":["../../../../nrfutil/device/deviceInfo.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACH,UAAU,EAEV,aAAa,EAChB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,MAAM;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CAC1B;AACD,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,MA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,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,cAAc,CAAC,EAAE,cAAc,CAAC;CACnC;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;CAC1B;iCAGW,aAAa,SACd,UAAU,2BACO,QAAQ,KAAK,IAAI,4BAC5B,eAAe;AAJhC,wBAqBE"}
@@ -1,3 +1,3 @@
1
1
  import { DeviceSetup, JprogEntry } from './deviceSetup';
2
- export declare const jprogDeviceSetup: (firmware: JprogEntry[], needSerialport?: boolean) => DeviceSetup;
2
+ export declare const jprogDeviceSetup: (firmware: JprogEntry[], needSerialport?: boolean, hideDeviceSetupWhenProtected?: boolean) => DeviceSetup;
3
3
  //# sourceMappingURL=jprogOperations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jprogOperations.d.ts","sourceRoot":"","sources":["../../../../src/Device/jprogOperations.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA4HxD,eAAO,MAAM,gBAAgB,aACf,UAAU,EAAE,+BAEvB,WAgDD,CAAC"}
1
+ {"version":3,"file":"jprogOperations.d.ts","sourceRoot":"","sources":["../../../../src/Device/jprogOperations.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA4HxD,eAAO,MAAM,gBAAgB,aACf,UAAU,EAAE,uEAGvB,WA0DD,CAAC"}