Skip to content

Commit

Permalink
Merge pull request #29 from tcavenezuela/task/add-new-offsets
Browse files Browse the repository at this point in the history
Task/add new offsets
  • Loading branch information
carl0shd authored Jul 9, 2024
2 parents 0e5b0b3 + f2434dd commit 1db8655
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-drinks-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fsuipc.js/api': patch
---

add missing radio imports and improve nav1, nav2 convert function
5 changes: 5 additions & 0 deletions .changeset/old-pots-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fsuipc.js/api': patch
---

add new radio offsets: com1, com2 and improve transponder convert function
32 changes: 26 additions & 6 deletions packages/api/src/utils/offsets/plane/radios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,29 @@ import { OffsetCategory } from '@shared/offset-category';
import { OffsetList } from '@shared/offset-list';
import { Offset } from '@shared/offset';

import { ADF1 } from './radios/adf1';
import { ADF2 } from './radios/adf2';
import { NAV1 } from './radios/nav1';
import { NAV2 } from './radios/nav2';
import { ILS } from './radios/ils';

export const radios: OffsetList = {
comFreq: new Offset({
com1Freq: new Offset({
value: 0x34e,
name: 'comFreq',
name: 'com1Freq',
category: OffsetCategory.RADIOS,
description: 'Com1 frequency',
type: Type.UInt16,
convert: 'parseInt(`1` + ({VAL}).toString(16))/100',
permission: 'rw'
}),
com2Freq: new Offset({
value: 0x3118,
name: 'com2Freq',
category: OffsetCategory.RADIOS,
description: 'Com frequency',
description: 'Com2 frequency',
type: Type.UInt16,
convert: 'parseInt(`1` + ({VAL}).toString(16))',
convert: 'parseInt(`1` + ({VAL}).toString(16))/100',
permission: 'rw'
}),
transponderFreq: new Offset({
Expand All @@ -20,7 +35,7 @@ export const radios: OffsetList = {
category: OffsetCategory.RADIOS,
description: 'XPND transponder frequency',
type: Type.UInt16,
convert: 'parseInt(`1` + ({VAL}).toString(16))',
convert: 'parseInt(({VAL}).toString(16))',
permission: 'rw'
}),
nav12Select: new Offset({
Expand Down Expand Up @@ -78,5 +93,10 @@ export const radios: OffsetList = {
description: 'outer marker - activated when TRUE',
type: Type.Int16,
permission: 'r'
})
}),
...ADF1,
...ADF2,
...ILS,
...NAV1,
...NAV2
};
2 changes: 1 addition & 1 deletion packages/api/src/utils/offsets/plane/radios/nav1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const NAV1: OffsetList = {
category: OffsetCategory.RADIOS,
description: 'NAV1 frequency',
type: Type.UInt16,
convert: 'parseInt(`1` + ({VAL}).toString(16))',
convert: '100 + parseInt(({VAL}).toString(16))/100',
permission: 'rw'
}),
hasNav1: new Offset({
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/utils/offsets/plane/radios/nav2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const NAV2: OffsetList = {
category: OffsetCategory.RADIOS,
description: 'NAV2 frequency',
type: Type.UInt16,
convert: 'parseInt(`1` + ({VAL}).toString(16))',
convert: '100 + parseInt(({VAL}).toString(16))/100',
permission: 'rw'
}),
hasNav2: new Offset({
Expand Down

0 comments on commit 1db8655

Please sign in to comment.