fix: CW decoder was loosing first caracters
This commit is contained in:
@@ -118,6 +118,26 @@ func TestDecodeWithQRM(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeFirstCharStrong(t *testing.T) {
|
||||
const fs = 16000
|
||||
var sb strings.Builder
|
||||
d := New(fs, func(s string) { sb.WriteString(s) }, nil)
|
||||
// Strong signal: the very first element (T = a dash) must not be eaten by
|
||||
// lock acquisition. Output should begin with the first character.
|
||||
samples := keyMessageAmp("TEST DE", fs, 20, 700, 16000)
|
||||
for i := 0; i < len(samples); i += 200 {
|
||||
end := i + 200
|
||||
if end > len(samples) {
|
||||
end = len(samples)
|
||||
}
|
||||
d.Process(samples[i:end])
|
||||
}
|
||||
got := strings.ToUpper(strings.TrimSpace(sb.String()))
|
||||
if !strings.HasPrefix(got, "TEST") {
|
||||
t.Fatalf("first chars lost on a strong signal: decoded %q, want it to start with TEST", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeNumbersAndProsign(t *testing.T) {
|
||||
const fs = 16000
|
||||
var sb strings.Builder
|
||||
|
||||
Reference in New Issue
Block a user