mirror of
https://github.com/nonoo/kappanhang.git
synced 2025-12-06 08:02:00 +01:00
Parse hex number instead of decimal for the CI-V address
This commit is contained in:
parent
0ad3d4a151
commit
c71f75fc8a
15
args.go
15
args.go
|
|
@ -3,6 +3,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pborman/getopt"
|
"github.com/pborman/getopt"
|
||||||
|
|
@ -29,7 +31,7 @@ func parseArgs() {
|
||||||
a := getopt.StringLong("address", 'a', "IC-705", "Connect to address")
|
a := getopt.StringLong("address", 'a', "IC-705", "Connect to address")
|
||||||
u := getopt.StringLong("username", 'u', "beer", "Username")
|
u := getopt.StringLong("username", 'u', "beer", "Username")
|
||||||
p := getopt.StringLong("password", 'p', "beerbeer", "Password")
|
p := getopt.StringLong("password", 'p', "beerbeer", "Password")
|
||||||
c := getopt.UintLong("civ-address", 'c', 0xa4, "CI-V address")
|
c := getopt.StringLong("civ-address", 'c', "0xa4", "CI-V address")
|
||||||
t := getopt.Uint16Long("serial-tcp-port", 't', 4531, "Expose radio's serial port on this TCP port")
|
t := getopt.Uint16Long("serial-tcp-port", 't', 4531, "Expose radio's serial port on this TCP port")
|
||||||
s := getopt.BoolLong("enable-serial-device", 's', "Expose radio's serial port as a virtual serial port")
|
s := getopt.BoolLong("enable-serial-device", 's', "Expose radio's serial port as a virtual serial port")
|
||||||
r := getopt.Uint16Long("rigctld-port", 'r', 4532, "Use this TCP port for the internal rigctld")
|
r := getopt.Uint16Long("rigctld-port", 'r', 4532, "Use this TCP port for the internal rigctld")
|
||||||
|
|
@ -51,7 +53,16 @@ func parseArgs() {
|
||||||
connectAddress = *a
|
connectAddress = *a
|
||||||
username = *u
|
username = *u
|
||||||
password = *p
|
password = *p
|
||||||
civAddress = byte(*c)
|
|
||||||
|
*c = strings.Replace(*c, "0x", "", -1)
|
||||||
|
*c = strings.Replace(*c, "0X", "", -1)
|
||||||
|
civAddressInt, err := strconv.ParseInt(*c, 16, 64)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("invalid CI-V address: can't parse", *c)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
civAddress = byte(civAddressInt)
|
||||||
|
|
||||||
serialTCPPort = *t
|
serialTCPPort = *t
|
||||||
enableSerialDevice = *s
|
enableSerialDevice = *s
|
||||||
rigctldPort = *r
|
rigctldPort = *r
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue