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

Feat/recover on crash #487

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
78adad9
Save to file every 10s in data logger; Fix formatting in readme
tsvetelinpetrov Jan 7, 2025
f73a424
Add RecoverManager
tsvetelinpetrov Jan 8, 2025
b4d1695
Move RecoveryManager to a new dir
tsvetelinpetrov Jan 9, 2025
10086a2
Add search for orphan sessions
tsvetelinpetrov Jan 9, 2025
67634f7
Add recovery dialogs
tsvetelinpetrov Jan 12, 2025
c52559a
Make processSession a microtask
tsvetelinpetrov Jan 17, 2025
37dfcbe
Change search sessions to be a task
tsvetelinpetrov Jan 17, 2025
a332d10
Add file exist check
tsvetelinpetrov Jan 19, 2025
993f0a8
Add recovery dialogs
tsvetelinpetrov Jan 19, 2025
23bdb5f
Remove non existing session files from the ppksess file
tsvetelinpetrov Jan 19, 2025
4a8bc78
Enxancing session recovery dialogs
tsvetelinpetrov Jan 19, 2025
2e6e67d
Add/remove sessions to ppksess file when sampling
tsvetelinpetrov Jan 20, 2025
8b3f3ee
Mock session file read/write in tests
tsvetelinpetrov Jan 20, 2025
9829549
Add confirm dialog on session recover
tsvetelinpetrov Jan 20, 2025
1d8b925
Add sessions delete functionality
tsvetelinpetrov Jan 21, 2025
0212c1d
Add confirmation dialog for all actions in session recovery
tsvetelinpetrov Jan 21, 2025
bf9186b
Add onClose confirmation while recovering
tsvetelinpetrov Jan 21, 2025
cd9d2f2
Use the existing TimeComponent for tracking the recovery progress
tsvetelinpetrov Jan 21, 2025
4d82bda
Refactor RecoveryManager
tsvetelinpetrov Jan 22, 2025
65335a3
Load the recovered session charts
tsvetelinpetrov Jan 22, 2025
25005ea
Add flag for recovered or loaded sessions
tsvetelinpetrov Jan 23, 2025
c6f783b
Refactor RecoveryDialogs
tsvetelinpetrov Jan 23, 2025
a891de3
Merge branch 'main' into feat/recover-on-crash
tsvetelinpetrov Jan 24, 2025
6724e8d
Enhance the text for already recovered sessions
tsvetelinpetrov Jan 24, 2025
b7007d1
Update version & changelog; Minor changes in RecoveryManager
tsvetelinpetrov Feb 4, 2025
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
7 changes: 7 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 4.3.0 - UNRELEASED

### Added

- Session recovery: option to recover a session after a crash or unexpected
shutdown.

## 4.2.1 - 2024-11-11

### Changed
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ with

## Installation

The Power Profiler app is installed from nRF Connect from Desktop. For
detailed steps, see
The Power Profiler app is installed from nRF Connect from Desktop. For detailed
steps, see
[Installing nRF Connect for Desktop apps](https://docs.nordicsemi.com/bundle/nrf-connect-desktop/page/installing_apps.html)
in the nRF Connect from Desktop documentation.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pc-nrfconnect-ppk",
"version": "4.2.1",
"version": "4.3.0",
"displayName": "Power Profiler",
"description": "App for use with Nordic Power Profiler Kits",
"homepage": "https://github.com/NordicSemiconductor/pc-nrfconnect-ppk",
Expand Down
4 changes: 4 additions & 0 deletions src/__tests__/globals-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

import { DataManager, timestampToIndex } from '../globals';

jest.mock('../features/recovery/SessionsListFileHandler', () => ({
ReadSessions: jest.fn(() => []),
}));

beforeEach(() => {
DataManager().reset();
});
Expand Down
5 changes: 5 additions & 0 deletions src/actions/__tests__/exportChartAction-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ const buffer = [7, 8, 9, 10];
const bitsData = [0xaaaa, 0x5555, 0x6566];
const startingPoint = 2;

jest.mock('../../features/recovery/SessionsListFileHandler', () => ({
ReadSessions: jest.fn(() => []),
WriteSessions: jest.fn(),
}));

// There seems to be a discrepancy between the length parameter
// (in this example we have a length of 2, but the resulting string has 3 samples)
// and the actual number of samples we get. However, the solution as a whole seems
Expand Down
3 changes: 3 additions & 0 deletions src/actions/deviceActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@ export const setupOptions =
dispatch(resetChartTime());
dispatch(resetMinimap());

const sampleFreq = getSampleFrequency(getState());

switch (recordingMode) {
case 'DataLogger':
DataManager().setSamplesPerSecond(sampleFreq);
DataManager().initializeLiveSession(
getSessionRootFolder(getState())
);
Expand Down
7 changes: 7 additions & 0 deletions src/actions/fileActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
showProgressDialog,
updateProgress,
} from '../features/ProgressDialog/progressSlice';
import { ChangeSessionStatus } from '../features/recovery/SessionsListFileHandler';
import { DataManager } from '../globals';
import type { RootState } from '../slices';
import {
Expand Down Expand Up @@ -106,6 +107,12 @@ export const save =
}
);

const sessionPath = DataManager().getSessionFolder();
if (sessionPath) {
const filePath = join(sessionPath, 'session.raw');
ChangeSessionStatus(filePath, true);
}

dispatch(setSavePending(false));
dispatch(closeProgressDialog());

Expand Down
5 changes: 5 additions & 0 deletions src/components/__tests__/ExportDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import { chartCursorAction, chartWindowAction } from '../../slices/chartSlice';
import { fireEvent, render, screen } from '../../utils/testUtils';
import ExportDialog from '../SaveExport/ExportDialog';

jest.mock('../../features/recovery/SessionsListFileHandler', () => ({
ReadSessions: jest.fn(() => []),
WriteSessions: jest.fn(),
}));

jest.mock('../../utils/persistentStore', () => ({
getLastSaveDir: () => 'mocked/save/dir',
getMaxBufferSize: () => 200,
Expand Down
5 changes: 5 additions & 0 deletions src/components/__tests__/SidePanel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import { setLatestDataTimestamp } from '../../slices/chartSlice';
import { fireEvent, render, screen } from '../../utils/testUtils';
import SidePanel from '../SidePanel/SidePanel';

jest.mock('../../features/recovery/SessionsListFileHandler', () => ({
ReadSessions: jest.fn(() => []),
WriteSessions: jest.fn(),
}));

jest.mock('../../utils/persistentStore', () => ({
getLastSaveDir: () => 'mocked/save/dir',
getMaxBufferSize: () => 200,
Expand Down
Loading