Skip to content

Commit

Permalink
Cabrillo: treat multi-phone as SSB and RTTY+digital as DIGI
Browse files Browse the repository at this point in the history
Previously a log with SSB & FM or a log with RTTY & PSK would be MIXED.
  • Loading branch information
flwyd committed Sep 2, 2024
1 parent 2a5c8e8 commit bc8b685
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
38 changes: 22 additions & 16 deletions adif/cabrillo.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,28 +319,34 @@ func (o *CabrilloIO) getCategories(l *Logfile) map[string]string {
}
if cats["MODE"] == "" {
modes := fieldValues(l, "MODE")
var mode string
if len(modes) == 1 {
switch maps.Keys(modes)[0] {
case "CW":
mode = "CW"
var phone, fm, cw, rtty, digi int
for m := range modes {
switch m {
case "SSB", "AM", "DIGITALVOICE":
mode = "SSB"
phone++
case "FM":
mode = "FM"
fm++
case "CW":
cw++
case "RTTY":
mode = "RTTY"
rtty++
default:
mode = "DIGI"
digi++
}
} else if len(modes) > 1 {
}
var mode string
if fm == len(modes) {
mode = "FM"
} else if phone+fm == len(modes) {
mode = "SSB"
} else if cw == len(modes) {
mode = "CW"
} else if rtty == len(modes) {
mode = "RTTY"
} else if digi+rtty == len(modes) {
mode = "DIGI"
for m := range modes {
if m == "CW" || m == "SSB" || m == "FM" || m == "AM" {
mode = "MIXED"
break
}
}
} else {
mode = "MIXED"
}
cats["MODE"] = mode
}
Expand Down
18 changes: 18 additions & 0 deletions adif/cabrillo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,24 @@ func TestInferrCabrilloCategories(t *testing.T) {
wantBand: "ALL",
wantPower: "HIGH",
},
{
name: "rtty and digi",
modes: []string{"RTTY", "RTTY", "RTTY", "HELL"},
bands: []string{"40m", "20m", "15m", "10m"},
powers: []string{"5", "25", "50", "100"},
wantMode: "DIGI",
wantBand: "ALL",
wantPower: "HIGH",
},
{
name: "multi phone",
modes: []string{"DIGITALVOICE", "FM", "AM", "SSB"},
bands: []string{"70cm", "2m", "6m", "10m"},
powers: []string{"1", "2", "3", "4"},
wantMode: "SSB",
wantBand: "ALL",
wantPower: "QRP",
},
{
name: "mixed mode",
modes: []string{"FT8", "SSB"},
Expand Down

0 comments on commit bc8b685

Please sign in to comment.