Merge branch 'master' into master

This commit is contained in:
pdxlocations 2023-06-05 06:19:43 -07:00 committed by GitHub
commit 4e60da6994
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -263,21 +263,24 @@ export const FrequencyCalculator = (): JSX.Element => {
useEffect(() => {
const selectedRegion = RegionData.get(region);
const selectedModemPreset = modemPresets.get(modemPreset);
setNumChannels(
Math.floor(
(selectedRegion.freq_end - selectedRegion.freq_start) /
(selectedRegion.spacing + selectedModemPreset.bw / 1000),
),
const calculatedNumChannels = Math.floor(
(selectedRegion.freq_end - selectedRegion.freq_start) /
(selectedRegion.spacing + selectedModemPreset.bw / 1000),
);
if (channel >= numChannels) {
setChannel(numChannels - 1);
setNumChannels(calculatedNumChannels);
let updatedChannel = channel;
if (updatedChannel >= calculatedNumChannels) {
updatedChannel = 0;
}
setChannel(updatedChannel);
setChannelFrequency(
selectedRegion.freq_start +
selectedModemPreset.bw / 2000 +
channel * (selectedModemPreset.bw / 1000),
updatedChannel * (selectedModemPreset.bw / 1000),
);
}, [modemPreset, region, channel]);