Skip to content

Commit

Permalink
add gain value to dumpreg
Browse files Browse the repository at this point in the history
  • Loading branch information
julian59189 committed Apr 4, 2022
1 parent 6f26733 commit d3923fa
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 7 deletions.
4 changes: 4 additions & 0 deletions cmd/kd6ctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@ func main() {
cis.ReadRegisterWithVal("TP", "A0")
cis.ReadRegisterWithVal("SI", "C0")

// PGA
cis.ReadRegisterWithVal("PG", "80")
cis.ReadRegisterWithVal("PG", "A0")

return nil
},
}
Expand Down
43 changes: 36 additions & 7 deletions kd6rmx.go
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,39 @@ func parseTestPattern(short_res, val string) error {
return nil
}

func parsePGA(short_res, res, val string) error {
switch val {
case "80":
var val string
switch short_res {
case "00":
val = "OFF"
case "01":
val = "ON"
default:
return errors.New("parsePGA")
}
fmt.Printf("(PGA Status: %s)\n", val)
case "A0":
var val string
switch short_res {
case "20":
val = "+"
case "21":
val = "-"
default:
return errors.New("invalid test pattern")
}
value, _ := strconv.ParseInt(res[4:8], 16, 64)
fmt.Printf("(PGA Gain value: %s%d)\n", val, value)
default:
return errors.New("Test Pattern")

}

return nil
}

func parseName(short_res, result, val string) error {
prod_num_p2 := result[4:6]
prod_num_p1 := result[6:8]
Expand Down Expand Up @@ -1032,30 +1065,26 @@ func (cis Sensor) ReadRegisterWithVal(register, val string) error {
switch register {
case "BR":
return parseRate(short_res)

case "OF":
return parseFreq(short_res)

case "OC":
return parseComm(short_res, val)

case "RC":
return parseRes(short_res)

case "SS":
return parseSync(short_res)
case "LC":
return parseLED(short_res, result, val)

case "DC":
return parseDarkCorr(short_res)

case "WC":
return parseWhiteCorr(short_res)
case "TP":
parseTestPattern(short_res, val)
return parseTestPattern(short_res, val)
case "SI":
return parseName(short_res, result, val)
case "PG":
return parsePGA(short_res, result, val)
default:
fmt.Printf("(default)")
}
Expand Down

0 comments on commit d3923fa

Please sign in to comment.