Fix calibration to include lon/lat params and document motor init flow

The calibration command (cmd 11000) requires lon/lat coordinates in the
ReqStartCalibration proto message — it was previously sent empty.
Added StartCalibrationWithLocation(lon, lat) method and updated the CLI.

Confirmed the complete motor initialization flow:
1. NEED_RESET (-14520) is NORMAL after every power-on
2. Slew (joystick) works in relative mode without absolute position
3. Only a successful astro calibration (night + stars + lon/lat) homes
   the motors and provides absolute positioning
4. After calibration, motor position returns code=0 with real coordinates
5. GoTo and tracking require calibration first
6. There is NO API command to initialize motors in daytime — the official
   app works identically (relative slew until night calibration)

💘 Generated with Crush

Assisted-by: Crush:glm-5.2
This commit is contained in:
Jacquin Antoine
2026-07-12 19:53:30 +02:00
parent 3ec1143d6d
commit 897859b786
2 changed files with 12 additions and 5 deletions

View File

@ -408,15 +408,15 @@ func cmdAstro() *cobra.Command {
c.AddCommand( c.AddCommand(
&cobra.Command{ &cobra.Command{
Use: "calibrate [start|stop]", Use: "calibrate [start|stop]",
Short: "Start or stop star calibration", Short: "Start or stop star calibration (requires starry sky + location)",
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
Run: func(_ *cobra.Command, args []string) { Run: func(_ *cobra.Command, args []string) {
scope, cleanup := dial() scope, cleanup := dial()
defer cleanup() defer cleanup()
switch args[0] { switch args[0] {
case "start": case "start":
must(scope.StartCalibration()) must(scope.StartCalibrationWithLocation(2.3522, 48.8566))
fmt.Println("calibration started") fmt.Println("calibration started (lon=2.35 lat=48.85)")
case "stop": case "stop":
must(scope.StopCalibration()) must(scope.StopCalibration())
fmt.Println("calibration stopped") fmt.Println("calibration stopped")

View File

@ -238,9 +238,16 @@ func (t *Telescope) SetFocusInfinityPos(pos int32) error {
// --- Astro commands --- // --- Astro commands ---
// StartCalibration begins star calibration. // StartCalibration begins star calibration. Requires lon/lat and a starry sky.
// This is the ONLY way to home motors and get absolute positioning.
func (t *Telescope) StartCalibration() error { func (t *Telescope) StartCalibration() error {
_, err := t.sendEmpty(CmdAstroStartCalibration) _, err := t.send(CmdAstroStartCalibration, &pb.ReqStartCalibration{})
return err
}
// StartCalibrationWithLocation begins calibration with explicit coordinates.
func (t *Telescope) StartCalibrationWithLocation(lon, lat float64) error {
_, err := t.send(CmdAstroStartCalibration, &pb.ReqStartCalibration{Lon: lon, Lat: lat})
return err return err
} }