Skip to content

Commit

Permalink
Merge pull request #52 from synfinatic/lx200-precision
Browse files Browse the repository at this point in the history
disable high precision LX200 by default and add option
  • Loading branch information
synfinatic authored Dec 7, 2021
2 parents 61bdaf6 + bc522c9 commit 73f8754
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 71 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Install X11
run: sudo apt-get install -y xorg-dev
- name: Install X11/OpenGL
run: sudo apt-get update && sudo apt-get install -y xorg-dev

- name: Set up Go 1.15
uses: actions/setup-go@v1
Expand Down
27 changes: 22 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# AlpacaScope Changelog

## v2.2.3 - 2021-12-06

Fixed:

- LX200 mode now defaults to disabling "high precision" mode #51
- GUI now consistently (un)shades text labels associated with disabled widgets

Changed:

- Both GUI and CLI now support toggling high precision mode to be on or
off by default on startup so that you can enable high precision
by default to replicate the old behavior.
- Clients providing goto coordinates in LX200 mode can now specify
high or low precision values and we will parse it appropriately
regardless of the specified mode.


## v2.2.2 - 2021-11-11

Added:
Expand All @@ -22,8 +39,8 @@ Changed:
Added:

- SkySafari's "Stop" action will disable tracking which for some mounts
will prevent future goto's until tracking is re-enabled. AlpacaScope
will now optionally check for this situation and re-enable tracking
will prevent future goto's until tracking is re-enabled. AlpacaScope
will now optionally check for this situation and re-enable tracking
for goto's to be successful. #41

Changed:
Expand All @@ -43,7 +60,7 @@ Added:

Changed:

- Selecting mount type is only supported with NexStar protocol
- Selecting mount type is only supported with NexStar protocol
- Updated makefile targets
- Updated readme
- Add improved docs for configuration
Expand Down Expand Up @@ -98,7 +115,7 @@ Fixed:

Added:

- Info about viruses and how to build on Windows
- Info about viruses and how to build on Windows
- Git workflow for building & testing
- Add Linux-ARM binary for RasPi
- Add support for Alpaca discovery via: --alpaca-host auto
Expand Down Expand Up @@ -129,7 +146,7 @@ Fixed:

## v0.0.2 - 2020-12-23

Fixed:
Fixed:

- Properly close Nexstar client TCP sockets that are no longer in use.

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ endif
BUILDINFOSDET ?=
PROGRAM_ARGS ?=

PROJECT_VERSION := 2.2.2
PROJECT_VERSION := 2.2.3
BUILD_ID := 1
DOCKER_REPO := synfinatic
PROJECT_NAME := alpacascope
Expand Down
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,31 @@ Alpaca standards.

No! AlpacaScope works with any telescope / mount supported by Alpaca or
ASCOM. The LX200 and NexStar protocols are only for communicating with software
like SkySafari. You can even use the LX200 protocol with your Celestron scope
if you want because AlpacaScope does all the translating between the different
protocols.
like SkySafari or StarryNight. You can even use the LX200 protocol with your
Celestron scope if you want because AlpacaScope does all the translating between
the different protocols.

#### Should I use NexStar or LX200 protocol?

Short version:

No matter what kind of telescope you have, you probably want
to pick `NexStar` in AlpacaScope. In SkySafari and StarryNight, you should choose
`Celestron NexStar/Advanced GT`.

Longer story:

The protocol spec for Celestron NexStar is more consistently implimented
in my experience and users report a lot more issues with LX200. So I would
definitely recommend people try `NexStar` before `LX200`. Yes, this even
means people with a Meade LX200 series telescope should probably choose
`NexStar`! Yes, that is _very confusing_ but trust me. :)

That said, I understand there are cases where you might need to use LX200
and I do my very best to support it. If you experience any compatibility
issues, please let me know so I can try to either fix the bug in my code
or develop a work-around for poorly behaved clients.


#### What do I need at minimum?

Expand Down
20 changes: 11 additions & 9 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ const (
)

func main() {
var lport int32 // listen port
var lip string // listen IP
var clientid uint32 // alpaca client id
var debug bool // enable debugging
var sport int32 // Alpaca server port
var shost string // Alpaca server IP
var version bool // Version info
var _mode string // Comms mode
var lport int32 // listen port
var lip string // listen IP
var clientid uint32 // alpaca client id
var debug bool // enable debugging
var sport int32 // Alpaca server port
var shost string // Alpaca server IP
var version bool // Version info
var _mode string // Comms mode
var highPrecision bool // used for LX200
var noAutoTrack bool
var mode TeleComms
var telescopeId uint32 // Alpaca telescope id. Usually 0-10
Expand All @@ -74,6 +75,7 @@ func main() {
flag.Uint32Var(&telescopeId, "telescope-id", 0, "Alpaca Telescope ID")
flag.StringVar(&_mount_type, "mount-type", "altaz", "Mount type: [altaz|eqn|eqs]")
flag.BoolVar(&noAutoTrack, "no-auto-track", false, "Do not enable auto-track")
flag.BoolVar(&highPrecision, "high-precision", false, "Default to High Precision LX200 mode")

flag.Parse()

Expand Down Expand Up @@ -186,7 +188,7 @@ func main() {
if err != nil {
log.Errorf("Unable to query axis rates: %s", err.Error())
}
tscope = telescope.NewLX200(!noAutoTrack, true, true, minmax, 100000)
tscope = telescope.NewLX200(!noAutoTrack, highPrecision, true, minmax, 100000)
case NexStar:
tscope = telescope.NewNexStar(!noAutoTrack)
default:
Expand Down
52 changes: 27 additions & 25 deletions gui/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,40 @@ import (

// Our actual application config
type AlpacaScopeConfig struct {
TelescopeProtocol string `json:"TelescopeProtocol"`
TelescopeMount string `json:"TelescopeMount"`
AutoTracking bool `json:"AutoTracking"`
ListenIp string `json:"ListenIp"`
ListenPort string `json:"ListenPort"`
AscomAuto bool `json:"AscomAuto"`
AscomIp string `json:"AscomIp"`
AscomPort string `json:"AscomPort"`
AscomTelescope string `json:"AscomTelescope"`
isRunning bool
Quit chan bool `json:"-"` // have to hide since public
EnableButtons chan bool `json:"-"`
store *SettingsStore // platform specific
TelescopeProtocol string `json:"TelescopeProtocol"`
TelescopeMount string `json:"TelescopeMount"`
AutoTracking bool `json:"AutoTracking"`
ListenIp string `json:"ListenIp"`
ListenPort string `json:"ListenPort"`
AscomAuto bool `json:"AscomAuto"`
AscomIp string `json:"AscomIp"`
AscomPort string `json:"AscomPort"`
AscomTelescope string `json:"AscomTelescope"`
HighPrecisionLX200 bool `json:"HighPrecisionLX200"`
isRunning bool
Quit chan bool `json:"-"` // have to hide since public
EnableButtons chan bool `json:"-"`
store *SettingsStore // platform specific
}

// Loads the config from our SettingsStore (if it exists),
// otherwise will return our defaults. Errors are informational
// so you know why loading settings failed.
func NewAlpacaScopeConfig() *AlpacaScopeConfig {
config := &AlpacaScopeConfig{
TelescopeProtocol: "NexStar",
TelescopeMount: "Alt-Az",
AutoTracking: true,
AscomAuto: true,
ListenIp: "All-Interfaces/0.0.0.0",
ListenPort: "4030",
AscomIp: "127.0.0.1",
AscomPort: alpaca.DEFAULT_PORT_STR,
AscomTelescope: "0",
Quit: make(chan bool),
EnableButtons: make(chan bool),
store: NewSettingsStore(),
TelescopeProtocol: "NexStar",
TelescopeMount: "Alt-Az",
HighPrecisionLX200: false,
AutoTracking: true,
AscomAuto: true,
ListenIp: "All-Interfaces/0.0.0.0",
ListenPort: "4030",
AscomIp: "127.0.0.1",
AscomPort: alpaca.DEFAULT_PORT_STR,
AscomTelescope: "0",
Quit: make(chan bool),
EnableButtons: make(chan bool),
store: NewSettingsStore(),
}

return config
Expand Down
58 changes: 37 additions & 21 deletions gui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,20 @@ const (
var sbox *StatusBox

type Widgets struct {
TelescopeProtocol *widget.Select
TelescopeMount *widget.Select
AutoTracking *widget.Check
ListenIp *widget.Select
ListenPort *widget.Entry
AscomAuto *widget.Check
AscomIp *widget.Entry
AscomPort *widget.Entry
AscomTelescope *widget.Select
Status *widget.TextGrid
Save *widget.Button
Delete *widget.Button
form *widget.Form
TelescopeProtocol *widget.Select
TelescopeMount *widget.Select
AutoTracking *widget.Check
HighPrecisionLX200 *widget.Check
ListenIp *widget.Select
ListenPort *widget.Entry
AscomAuto *widget.Check
AscomIp *widget.Entry
AscomPort *widget.Entry
AscomTelescope *widget.Select
Status *widget.TextGrid
Save *widget.Button
Delete *widget.Button
}

func main() {
Expand All @@ -79,7 +81,8 @@ func main() {

top := widget.NewForm(
widget.NewFormItem("Telescope Protocol", ourWidgets.TelescopeProtocol),
widget.NewFormItem("Mount Type", ourWidgets.TelescopeMount),
widget.NewFormItem("NexStar Mount Type", ourWidgets.TelescopeMount),
widget.NewFormItem("LX200 default to High Precision", ourWidgets.HighPrecisionLX200),
widget.NewFormItem("Auto Tracking", ourWidgets.AutoTracking),
widget.NewFormItem("Listen IP", ourWidgets.ListenIp),
widget.NewFormItem("Listen Port", ourWidgets.ListenPort),
Expand All @@ -88,6 +91,7 @@ func main() {
widget.NewFormItem("ASCOM Remote Port", ourWidgets.AscomPort),
widget.NewFormItem("ASCOM Telescope ID", ourWidgets.AscomTelescope),
)
ourWidgets.form = top

ourWidgets.Save = widget.NewButton("Save Settings", func() {
err := config.Save()
Expand Down Expand Up @@ -393,10 +397,14 @@ func NewWidgets(config *AlpacaScopeConfig) *Widgets {
config.TelescopeProtocol = proto
if proto == "NexStar" {
w.TelescopeMount.Enable()
w.HighPrecisionLX200.Disable()
} else {
// only NexStar supports the mountType
w.TelescopeMount.Disable()
// only LX200 supports high precision
w.HighPrecisionLX200.Enable()
}
w.form.Refresh()
},
)
w.TelescopeProtocol.Selected = config.TelescopeProtocol
Expand All @@ -406,16 +414,23 @@ func NewWidgets(config *AlpacaScopeConfig) *Widgets {

// AutoTracking
w.AutoTracking = widget.NewCheck("", func(enabled bool) {
switch enabled {
case true:
config.AutoTracking = true
case false:
config.AutoTracking = false
}

config.AutoTracking = enabled
w.form.Refresh()
})
w.AutoTracking.Checked = config.AutoTracking

// HighPrecisionLX200
w.HighPrecisionLX200 = widget.NewCheck("", func(enabled bool) {
config.HighPrecisionLX200 = enabled
w.form.Refresh()
})
w.HighPrecisionLX200.Checked = config.HighPrecisionLX200
if config.TelescopeProtocol == "LX200" {
w.HighPrecisionLX200.Enable()
} else {
w.HighPrecisionLX200.Disable()
}

// ListenIp
ips, err := utils.GetLocalIPs()
if err != nil {
Expand Down Expand Up @@ -466,7 +481,7 @@ func NewWidgets(config *AlpacaScopeConfig) *Widgets {
w.AscomIp.Enable()
w.AscomPort.Enable()
}

w.form.Refresh()
})
w.AscomAuto.Checked = config.AscomAuto
if config.AscomAuto {
Expand All @@ -491,6 +506,7 @@ func NewWidgets(config *AlpacaScopeConfig) *Widgets {

func (w *Widgets) Set(config *AlpacaScopeConfig) {
w.TelescopeProtocol.SetSelected(config.TelescopeProtocol)
w.HighPrecisionLX200.SetChecked(config.HighPrecisionLX200)
w.TelescopeMount.SetSelected(config.TelescopeMount)
w.AutoTracking.SetChecked(config.AutoTracking)
w.ListenIp.SetSelected(config.ListenIp)
Expand Down
Loading

0 comments on commit 73f8754

Please sign in to comment.