A JavaScript library, written in TypeScript, to lookup 5.8GHz FPV channels.
npm i -D @fpvcult/frequency
config
- Band organization, valid inputs arelaprf
orrx5808
. If no argument is provided, it will default tolaprf
. It will also throw an error if called with an invalid argument.
Examples:
const freqs = new Frequency();
const freqs = new Frequency("rx5808");
get(name: string): Channel | undefinded
get(band: number, channel: number): Channel | undefined
As aruments, takes either a string representing a channel name F7
or e2
,
or two numbers first for band and second for channel.
freqs.get("F2"); // => Channel { band: 1, channel: 2, frequency: 5760, name: 'F2' }
freqs.get(2, 8); // => Channel { band: 2, channel: 8, frequency: 5917, name: 'R8' }
getByFrequency(frequency: number): Channel | Channel[] | undefined
Takes a frequency number as an argument. There is one frequency that is shared between bands, 5880. So this method returns either a single channel, an array of channels or undefined.
freqs.getByFrequency(5880); // => [ Channel { band: 1, channel: 8, frequency: 5880, name: 'F8' },
// Channel { band: 2, channel: 7, frequency: 5880, name: 'R7' } ]
freqs.getByFrequency(5800); // => Channel { band: 1, channel: 4, frequency: 5800, name: 'F4' }
export class Channel {
constructor(
readonly band: number,
readonly channel: number,
readonly frequency: number,
readonly name: string
) {}
}