Adding utility function to adjust frequency by modulation.

This commit is contained in:
Marat Fayzullin 2023-11-03 20:53:17 -04:00
parent 783bbfade8
commit 8425a46e20
2 changed files with 21 additions and 5 deletions

View File

@ -292,11 +292,7 @@ FeatureMarker.prototype.getInfoHTML = function(name, receiverMarker = null) {
for (var j=0 ; j<this.schedule.length ; ++j) {
var freq = this.schedule[j].freq;
var mode = this.schedule[j].mode;
var tune = mode === 'cw'? freq - 800
: mode === 'fax'? freq - 1900
: mode === 'rtty450'? freq - 1000
: mode === 'sitorb'? freq - 1000
: freq;
var tune = Utils.offsetFreq(freq, mode);
var name = ('0000' + this.schedule[j].time1).slice(-4)
+ '&#8209;' + ('0000' + this.schedule[j].time2).slice(-4)

View File

@ -22,6 +22,26 @@ Utils.htmlEscape = function(input) {
return $('<div/>').text(input).html()
};
// Change frequency as required by given modulation
Utils.offsetFreq = function(freq, mod) {
switch(mod) {
case 'cw':
return freq - 800;
case 'fax':
return freq - 1900;
case 'cwdecoder':
case 'rtty450':
case 'rtty170':
case 'rtty85':
case 'sitorb':
case 'bpsk31':
case 'bpsk63':
return freq - 1000;
}
return freq;
}
// Wrap given callsign or other ID into a clickable link.
Utils.linkify = function(id, url = null, content = null, tip = null) {
// If no specific content, use the ID itself