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(); $results = array();
foreach($result as $band) { 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; return $results;

View File

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

View File

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