Skip to content

Commit

Permalink
parse sn
Browse files Browse the repository at this point in the history
  • Loading branch information
julian59189 authored and deadprogram committed Mar 31, 2022
1 parent 0221d55 commit bbff56e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/kd6ctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ func main() {
// cis.ReadRegister("GC")
cis.ReadRegister("TP")
cis.ReadRegisterWithVal("TP", "A0")
cis.ReadRegisterWithVal("SI", "C0")

return nil
},
Expand Down
15 changes: 14 additions & 1 deletion kd6rmx.go
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,18 @@ func parseTestPattern(short_res, val string) error {
return nil
}

func parseName(short_res, result, val string) error {
prod_num_p2 := result[4:6]
prod_num_p1 := result[6:8]
id := result[8:10]
m := result[10:12]
y := result[12:14]

sn := y + m + id + prod_num_p1 + prod_num_p2
fmt.Printf("(SN: %s)\n", sn)
return nil
}

func (cis Sensor) ReadRegisterWithVal(register, val string) error {
result, err := cis.SendCommand(register, val)
if err != nil {
Expand Down Expand Up @@ -1034,7 +1046,8 @@ func (cis Sensor) ReadRegisterWithVal(register, val string) error {
return parseWhiteCorr(short_res)
case "TP":
parseTestPattern(short_res, val)

case "SI":
return parseName(short_res, result, val)
default:
fmt.Printf("(default)")
}
Expand Down

0 comments on commit bbff56e

Please sign in to comment.