Skip to content

Commit

Permalink
print output of pattern and add parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
julian59189 committed Nov 5, 2021
1 parent 2619160 commit fe3929b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 13 deletions.
27 changes: 14 additions & 13 deletions cmd/kd6ctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,22 +346,23 @@ func main() {
Exec: func(_ context.Context, args []string) error {

cis := kd6rmx.Sensor{Port: *port}
err := cis.ReadRegister("BR")
err = cis.ReadRegister("OF")
err = cis.ReadRegister("OC")
err = cis.ReadRegisterWithVal("OC", "C0")
err = cis.ReadRegister("RC")
err = cis.ReadRegister("SS")
err = cis.ReadRegister("DC")
err = cis.ReadRegister("LC")
err = cis.ReadRegisterWithVal("LC", "A0")
err = cis.ReadRegisterWithVal("LC", "C0")
err = cis.ReadRegister("WC")
cis.ReadRegister("BR")
cis.ReadRegister("OF")
cis.ReadRegister("OC")
cis.ReadRegisterWithVal("OC", "C0")
cis.ReadRegister("RC")
cis.ReadRegister("SS")
cis.ReadRegister("DC")
cis.ReadRegister("LC")
cis.ReadRegisterWithVal("LC", "A0")
cis.ReadRegisterWithVal("LC", "C0")
cis.ReadRegister("WC")
// cis.ReadRegister("PG")
// cis.ReadRegister("GC")
// cis.ReadRegister("TP")
cis.ReadRegister("TP")
cis.ReadRegisterWithVal("TP", "A0")

return err
return nil
},
}

Expand Down
34 changes: 34 additions & 0 deletions kd6rmx.go
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,38 @@ func parseWhiteCorr(short_res string) error {
return nil
}

func parseTestPattern(short_res, val string) error {
switch val {
case "80":
var val string
switch short_res {
case "00":
val = "Image output"
case "01":
val = "Test pattern output"
default:
return errors.New("output mode")
}
fmt.Printf("(%s)\n", val)
case "A0":
var val string
switch short_res {
case "20":
val = "Stripe pattern output"
case "21":
val = "Ramp pattern output"
default:
return errors.New("invalid test pattern")
}
fmt.Printf("(%s)\n", val)
default:
return errors.New("Test Pattern")

}

return nil
}

func (cis Sensor) ReadRegisterWithVal(register, val string) error {
result, err := cis.SendCommand(register, val)
if err != nil {
Expand Down Expand Up @@ -961,6 +993,8 @@ func (cis Sensor) ReadRegisterWithVal(register, val string) error {

case "WC":
return parseWhiteCorr(short_res)
case "TP":
parseTestPattern(short_res, val)

default:
fmt.Printf("(default)")
Expand Down

0 comments on commit fe3929b

Please sign in to comment.