Skip to content

Commit

Permalink
Add updateLocation methods
Browse files Browse the repository at this point in the history
  • Loading branch information
not7cd committed Mar 25, 2019
1 parent 41d34ed commit 4ac7a4f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions 3rdparty/indi-starbook/config.h.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
#ifndef CONFIG_H
#define CONFIG_H

Expand Down
30 changes: 28 additions & 2 deletions 3rdparty/indi-starbook/indi_starbook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,39 @@ bool StarbookDriver::MoveWE(INDI_DIR_WE dir, INDI::Telescope::TelescopeMotionCom

bool StarbookDriver::updateTime(ln_date *utc, double utc_offset) {
INDI_UNUSED(utc_offset);

starbook::ResponseCode rc = cmd_interface->SetTime(*utc);
starbook::PlaceResponse res{{0, 0}, 0};
starbook::ResponseCode rc;
rc = cmd_interface->SetTime(*utc);
if (!rc) {
LogResponse("updateTime", rc);
return false;
}
rc = cmd_interface->GetPlace(res);
if (!rc) {
LogResponse("updateTime", rc);
return false;
}
rc = cmd_interface->SetPlace(res.posn, floor(utc_offset));
LogResponse("updateTime", rc);
return rc == starbook::OK;

}

bool StarbookDriver::updateLocation(double latitude, double longitude, double elevation) {
INDI_UNUSED(elevation);
starbook::LnLat posn(latitude, longitude);
starbook::ResponseCode rc;
starbook::PlaceResponse res{{0, 0}, 0};
rc = cmd_interface->GetPlace(res);
if (!rc) {
LogResponse("updatePlace", rc);
return false;
}
rc = cmd_interface->SetPlace(posn, res.tz);
LogResponse("updatePlace", rc);
return rc == starbook::OK;
}

bool StarbookDriver::getFirmwareVersion() {
starbook::VersionResponse res;
starbook::ResponseCode rc = cmd_interface->Version(res);
Expand Down
2 changes: 2 additions & 0 deletions 3rdparty/indi-starbook/indi_starbook.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class StarbookDriver : public INDI::Telescope

ITextVectorProperty StateTP;

bool updateLocation(double latitude, double longitude, double elevation) override;

ISwitch StartS[1];

ISwitchVectorProperty StartSP;
Expand Down

0 comments on commit 4ac7a4f

Please sign in to comment.