fix(yaesu): the power ceiling is the radio's, not a constant
Reported on an FTDX101MP: the slider sprang back to 100 W. The console was not wrong about the rig — yaesuMaxPower already answered 200 for that model, and the slider was drawn to it. The SET path carried its own hard-coded 100, so asking for 200 W sent PC100, the radio obeyed, and the next poll read back what had actually been set. One ceiling now, the one the console draws to, so the two cannot say different things. Pinned with the model list, including the unknown-rig case: crediting a radio with power it does not have would be commands it NAKs, so silence still means 100.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package cat
|
||||
|
||||
import "testing"
|
||||
|
||||
// Reported on an FTDX101MP: the power slider sprang back to 100 W. The console
|
||||
// already knew the rig could do 200 — yaesuMaxPower says so — but the SET path
|
||||
// clamped to 100, so the radio was politely given half what was asked for.
|
||||
func TestYaesuPowerCeilingFollowsTheModel(t *testing.T) {
|
||||
cases := []struct {
|
||||
model string
|
||||
want int
|
||||
}{
|
||||
{"FTDX101MP", 200},
|
||||
{"FT-DX5000", 200},
|
||||
{"FTDX9000", 200},
|
||||
{"FTDX101D", 100},
|
||||
{"FTDX10", 100},
|
||||
{"Yaesu (0999)", 100}, // unknown: ask for too little, never too much
|
||||
}
|
||||
for _, c := range cases {
|
||||
if got := yaesuMaxPower(c.model, 0); got != c.want {
|
||||
t.Errorf("%s ceiling = %d W, want %d", c.model, got, c.want)
|
||||
}
|
||||
}
|
||||
// A rig REPORTING more than the table expects has just proved what it can do.
|
||||
if got := yaesuMaxPower("FTDX10", 150); got != 150 {
|
||||
t.Errorf("a rig reporting 150 W was capped at %d", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user