feat: Flexradio/Icom, click on signal to fill the RST tx
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// sMeterRST turns an S-meter reading into the RST report you SEND to the other
|
||||
// station (RST tx / rst_sent) — because your S-meter is how strong THEY are.
|
||||
//
|
||||
// s : S-unit 0-9 (used when below S9)
|
||||
// overDb : dB over S9 (0 when at/below S9)
|
||||
// mode : operating mode — CW/digital get a 3-digit RST, phone a 2-digit RS
|
||||
//
|
||||
// For S9+ the dB is rounded UP to the nearest 5 (a 9+3 reading reports 59+5,
|
||||
// 9+12 reports 59+15, …), matching how operators give strong-signal reports.
|
||||
export function sMeterRST(s: number, overDb: number, mode?: string): string {
|
||||
const cw = /CW|RTTY|PSK|FT[0-9]|JT|JS8|MFSK|OLIVIA|DATA|DIG/i.test(mode || '');
|
||||
const strength = Math.max(1, Math.min(9, Math.round(s)));
|
||||
if (cw) return overDb > 0 ? '599' : `5${strength}9`;
|
||||
if (overDb > 0) return `59+${Math.ceil(overDb / 5) * 5}`;
|
||||
return `5${strength}`;
|
||||
}
|
||||
Reference in New Issue
Block a user