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

Flag for remote dev hex #204

Merged
merged 5 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15,207 changes: 7,616 additions & 7,591 deletions public/firmware/radio-sender.hex → public/firmware/local-sensors-v0.1.0.hex

Large diffs are not rendered by default.

16,507 changes: 16,507 additions & 0 deletions public/firmware/radio-bridge-v0.1.0.hex

Large diffs are not rendered by default.

15,264 changes: 7,703 additions & 7,561 deletions public/firmware/radio-bridge.hex → public/firmware/radio-remote-v0.1.0-dev.hex

Large diffs are not rendered by default.

16,573 changes: 16,573 additions & 0 deletions public/firmware/radio-remote-v0.1.0.hex

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/__tests__/microbit-facade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ describe('Microbit facade tests', () => {
'firmware/ml-microbit-cpp-version-combined.hex',
);
expect(getHexFileUrl(2, 'bluetooth')).toEqual('firmware/MICROBIT.hex');
expect(getHexFileUrl(2, 'radio-bridge')).toEqual('firmware/radio-bridge.hex');
expect(getHexFileUrl(2, 'radio-sender')).toEqual('firmware/radio-sender.hex');
expect(getHexFileUrl(2, 'radio-local')).toEqual('firmware/radio-local.hex');
expect(getHexFileUrl(2, 'radio-bridge')).toMatch(/^firmware\/radio-bridge-v.*\.hex$/);
expect(getHexFileUrl(2, 'radio-sender')).toMatch(/^firmware\/radio-remote-v.*\.hex$/);
expect(getHexFileUrl(2, 'radio-local')).toMatch(/^firmware\/local-sensors-v.*\.hex$/);
});

test('Input should not be connected before connecting', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
return 'radio-local';
}
if (flashStage === 'radio-sender') {
return 'radio-sender';
return flags.radioRemoteDev ? 'radio-sender-dev' : 'radio-sender';
}
return 'radio-bridge';
};
Expand Down
9 changes: 7 additions & 2 deletions src/script/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ import { Stage, stage as stageFromEnvironment } from './environment';
*/
export type Flag =
/**
* Flashes a hex that acts as a sender and receiver for radio bridge testing.
* Changes radio bridge hexes to one that acts as a sender and receiver for radio bridge testing.
*/
'radioLocal';
| 'radioLocal'
/**
* Changes the remote radio bridge hex to one that uses button A to stop sending data.
*/
| 'radioRemoteDev';

interface FlagMetadata {
defaultOnStages: Stage[];
Expand All @@ -29,6 +33,7 @@ interface FlagMetadata {
const allFlags: FlagMetadata[] = [
// Alphabetical order.
{ name: 'radioLocal', defaultOnStages: [] },
{ name: 'radioRemoteDev', defaultOnStages: [] },
];

type Flags = Record<Flag, boolean>;
Expand Down
14 changes: 10 additions & 4 deletions src/script/microbit-interfacing/Microbits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ export enum HexOrigin {
}

export type FlashStage = 'bluetooth' | 'radio-sender' | 'radio-bridge';
export type HexType = 'bluetooth' | 'radio-sender' | 'radio-bridge' | 'radio-local';
export type HexType =
| 'bluetooth'
| 'radio-sender'
| 'radio-bridge'
| 'radio-local'
| 'radio-sender-dev';

type UARTMessageType = 'g' | 's';

Expand All @@ -47,9 +52,10 @@ export const getHexFileUrl = (version: 1 | 2 | 'universal', type: HexType) => {
throw new Error('Only V2 is supported');
}
return {
'radio-sender': 'firmware/radio-sender.hex',
'radio-bridge': 'firmware/radio-bridge.hex',
'radio-local': 'firmware/radio-local.hex',
'radio-sender-dev': 'firmware/radio-remote-v0.1.0-dev.hex',
'radio-sender': 'firmware/radio-remote-v0.1.0.hex',
'radio-bridge': 'firmware/radio-bridge-v0.1.0.hex',
'radio-local': 'firmware/local-sensors-v0.1.0.hex',
}[type];
};

Expand Down
Loading