Skip to content

Show Mode in DXCluster (preparation for passing it to the gate) #2233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 49 additions & 15 deletions application/models/Dxcluster_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function dxc_spotlist($band = '20m', $maxage = 60, $de = '', $mode = 'All
continue;
}
$singlespot->band=$spotband;
$singlespot->mode=$this->get_mode($singlespot);
if (($band != 'All') && ($band != $spotband)) { continue; }
if (($mode != 'All') && ($mode != $this->modefilter($singlespot, $mode))) { continue; }
$datetimecurrent = new DateTime("now", new DateTimeZone('UTC')); // Today's Date/Time
Expand Down Expand Up @@ -134,6 +135,25 @@ public function dxc_spotlist($band = '20m', $maxage = 60, $de = '', $mode = 'All

// We need to build functions that check the frequency limit
// Right now this is just a proof of concept to determine mode
function get_mode($spot) {
if ($this->Frequency2Mode($spot->frequency) != '') {
return $this->Frequency2Mode($spot->frequency);
}

// Fallbacks using message keywords
if (isset($spot->message)) {
$message = strtolower($spot->message);
if (strpos($message, 'cw') !== false) {
return 'cw';;
}
if ((strpos($message, 'ft8') !== false || strpos($message, 'rtty') !== false || strpos($message, 'sstv') !== false)) {
return 'digi';;
}
}

return '';
}

function modefilter($spot, $mode) {
$mode = strtolower($mode); // Normalize case

Expand All @@ -155,22 +175,36 @@ function modefilter($spot, $mode) {
return false;
}

public function Frequency2Mode($frequency) {
// Ensure frequency is in Hz if input is in kHz
if ($frequency < 1_000_000) {
$frequency *= 1000;
}

foreach ($this->bandedges as $band) {
if ($frequency >= $band['frequencyfrom'] && $frequency < $band['frequencyto']) {
return $band['mode'];
}
}
return '';
}

public function isFrequencyInMode($frequency, $mode) {
// Ensure frequency is in Hz if input is in kHz
if ($frequency < 1_000_000) {
$frequency *= 1000;
}

foreach ($this->bandedges as $band) {
if (strtolower($band['mode']) === strtolower($mode)) {
if ($frequency >= $band['frequencyfrom'] && $frequency < $band['frequencyto']) {
return true;
}
}
}

return false;
}
// Ensure frequency is in Hz if input is in kHz
if ($frequency < 1_000_000) {
$frequency *= 1000;
}

foreach ($this->bandedges as $band) {
if (strtolower($band['mode']) === strtolower($mode)) {
if ($frequency >= $band['frequencyfrom'] && $frequency < $band['frequencyto']) {
return true;
}
}
}

return false;
}

public function dxc_qrg_lookup($qrg, $maxage = 120) {
$this->load->helper(array('psr4_autoloader'));
Expand Down
1 change: 1 addition & 0 deletions application/views/bandmap/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
<th style="width:150px;"><?= __("Spotter"); ?></th>
<th><?= __("Message"); ?></th>
<th><?= __("Last Worked"); ?></th>
<th><?= __("Mode"); ?></th>
</tr>
</thead>

Expand Down
16 changes: 13 additions & 3 deletions assets/js/sections/bandmap_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ $(function() {
$(td).addClass("spotted_call");
$(td).attr( "title", lang_click_to_prepare_logging);
}
}
},
{
'targets': 8,
'createdCell': function (td, cellData, rowData, row, col) {
$(td).addClass("mode");
}
},
],
"language": {
url: getDataTablesLanguageUrl(),
Expand Down Expand Up @@ -117,6 +123,7 @@ $(function() {
} else {
data[0].push('');
}
data[0].push(single.mode || '');
if (oldtable.length > 0) {
let update=false;
oldtable.each( function (srow) {
Expand Down Expand Up @@ -233,15 +240,18 @@ $(function() {
let ready_listener = true;
let call=this.innerText;
let qrg=''
let mode='';
if (this.parentNode.parentNode.className.indexOf('spotted_call')>=0) {
qrg=this.parentNode.parentNode.parentNode.cells[1].textContent*1000;
mode=this.parentNode.parentNode.parentNode.cells[8].textContent;
} else {
qrg=this.parentNode.parentNode.cells[1].textContent*1000;
mode=this.parentNode.parentNode.cells[8].textContent;
}

try {
irrelevant=fetch(CatCallbackURL + '/'+qrg).catch(() => {
openedWindow = window.open(CatCallbackURL + '/' + qrg);
irrelevant=fetch(CatCallbackURL + '/'+qrg+'/'+mode).catch(() => {
openedWindow = window.open(CatCallbackURL + '/' + qrg + '/' + mode);
openedWindow.close();
});
} finally {}
Expand Down