Disable dangerous motor reset command after causing telescope reboot
The motor reset command (cmd 14003, inferred from a gap in the WsCmd enum)
caused the telescope to immediately reboot during live testing. The Android
app never uses ReqMotorReset — it only uses joystick (14006-14009), run
(14000) and stop (14002). Motor homing is handled internally by the firmware
during astro calibration or panorama operations.
Changes:
- MotorReset() now returns an error instead of sending the command
- CLI "motor reset" shows the disabled message
- Documented the incident and lessons in TEST_RESULTS.md
- Confirmed motor position query (cmd 14001) works but returns NEED_RESET
- Confirmed slew movements (all directions/speeds) work safely after reboot
💘 Generated with Crush
Assisted-by: Crush:glm-5.2
This commit is contained in:
@ -197,14 +197,10 @@ func (t *Telescope) MotorRunTo(id int32, endPos, speed float64) error {
|
||||
})
|
||||
}
|
||||
|
||||
// MotorReset resets a motor (finds home via limit switch).
|
||||
// cmd 14003 is inferred (not in WsCmd enum). direction: false=back, true=forward.
|
||||
func (t *Telescope) MotorReset(id int32, direction bool) error {
|
||||
return t.sendNotify(CmdMotorReset, &pb.ReqMotorReset{Id: id, Direction: direction})
|
||||
}
|
||||
|
||||
// MotorGetPosition queries a motor's current position.
|
||||
// cmd 14001 is inferred. May timeout if firmware doesn't support it.
|
||||
// MotorGetPosition queries a motor's current position (cmd 14001).
|
||||
// Returns code=-14520 (NEED_RESET) if motors haven't been homed.
|
||||
// Note: this command ID is inferred, not in the APK's WsCmd enum, but
|
||||
// confirmed working via live testing.
|
||||
func (t *Telescope) MotorGetPosition(id int32) (*pb.ResMotorPosition, error) {
|
||||
pkt, err := t.send(CmdMotorGetPosition, &pb.ReqMotorGetPosition{Id: id})
|
||||
if err != nil {
|
||||
@ -214,6 +210,13 @@ func (t *Telescope) MotorGetPosition(id int32) (*pb.ResMotorPosition, error) {
|
||||
return resp, decodeResponse(pkt, resp)
|
||||
}
|
||||
|
||||
// WARNING: MotorReset (cmd 14003) is inferred and NOT used by the Android app.
|
||||
// Live testing showed it causes the telescope to reboot. Use with extreme caution.
|
||||
// Disabled until properly reverse-engineered from the native .so libraries.
|
||||
func (t *Telescope) MotorReset(id int32, direction bool) error {
|
||||
return fmt.Errorf("motor reset (cmd 14003) is disabled: causes telescope reboot, not safe")
|
||||
}
|
||||
|
||||
// GetFocusInfinityPos retrieves the user-defined infinity focus position.
|
||||
func (t *Telescope) GetFocusInfinityPos() (int32, error) {
|
||||
pkt, err := t.sendEmpty(CmdFocusGetUserInfinity)
|
||||
|
||||
Reference in New Issue
Block a user