bug fix for getFreqFromBand

This commit is contained in:
HB9HIL 2023-11-09 21:49:17 +01:00
parent 4d997c1e70
commit bb5355d32f
3 changed files with 12 additions and 6 deletions

View File

@ -57,7 +57,7 @@ class Bands extends CI_Model {
$results = array();
foreach($result as $band) {
$results['b'.strtoupper($band->band)] = array('cw' => $band->cw, 'ssb' => $band->ssb, 'digi' => $band->data);
$results['b'.strtoupper($band->band)] = array('CW' => $band->cw, 'SSB' => $band->ssb, 'DIGI' => $band->data);
}
return $results;

View File

@ -1,6 +1,7 @@
<script type="text/javascript">
var Bands = <?php echo json_encode($bands); ?>;
var user_id = <?php echo $this->session->userdata('user_id'); ?>;
console.log("Bands Data:", Bands);
</script>
<div class="container">

View File

@ -123,6 +123,7 @@ function handleInput() {
var rst_r = null;
items = row.startsWith("day ") ? [row] : row.split(" ");
var itemNumber = 0;
var freq = 0;
items.forEach((item) => {
if (item === "") {
return;
@ -415,11 +416,15 @@ function getBandFromFreq(freq) {
}
function getFreqFromBand(band, mode) {
const settingsMode = getSettingsMode(mode.toUpperCase());
const id = "#" + band + settingsMode;
if ($(id).length) {
return $(id).val();
}
var settingsMode = getSettingsMode(mode.toUpperCase());
var settingsBand = "b" + band.toUpperCase();
var bandData = Bands[settingsBand];
if (bandData) {
return bandData[settingsMode] / 1000000;
}
}
function getSettingsMode(mode) {