summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@lxd650.localnet>2023-01-26 01:45:11 +0000
committerroot <root@lxd650.localnet>2023-01-26 01:45:11 +0000
commit8e32f5d0a57e982f67e685ba7ec4101d26728350 (patch)
treea17a946d496f77a8ae362d19d268adb2c5021bab
parent73cc1cedfcc30f61a2c52e92d0033e94591a8227 (diff)
downloadindi_mount_driver-8e32f5d0a57e982f67e685ba7ec4101d26728350.tar.gz
indi_mount_driver-8e32f5d0a57e982f67e685ba7ec4101d26728350.tar.bz2
indi_mount_driver-8e32f5d0a57e982f67e685ba7ec4101d26728350.zip
working alignment, and update telescope time and location from indi
-rw-r--r--Makefile2
-rw-r--r--indi-lxd650/Makefile67
-rw-r--r--indi-lxd650/lxd650.cpp141
-rw-r--r--indi-lxd650/lxd650.h9
4 files changed, 167 insertions, 52 deletions
diff --git a/Makefile b/Makefile
index 01caa72..ac9f08d 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ default: indi-celestronaux/make indi-lxd650/make
install: indi-celestronaux/install indi-lxd650/install
%/install:%/make
- (cd ${@:%/install=%} && install)
+ (cd ${@:%/install=%} && make install)
%/make:%/Makefile
(cd ${@:%/make=%} && make)
diff --git a/indi-lxd650/Makefile b/indi-lxd650/Makefile
index 881c4be..01ba528 100644
--- a/indi-lxd650/Makefile
+++ b/indi-lxd650/Makefile
@@ -1,5 +1,5 @@
# CMAKE generated file: DO NOT EDIT!
-# Generated by "Unix Makefiles" Generator, CMake Version 3.17
+# Generated by "Unix Makefiles" Generator, CMake Version 3.18
# Default target executed when no arguments are given to make.
default_target: all
@@ -43,10 +43,9 @@ default_target: all
# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s
-# Suppress display of executed commands.
+#Suppress display of executed commands.
$(VERBOSE).SILENT:
-
# A target that is always out of date.
cmake_force:
@@ -68,10 +67,10 @@ RM = /usr/bin/cmake -E rm -f
EQUALS = =
# The top-level source directory on which CMake was run.
-CMAKE_SOURCE_DIR = /root/projects/telescope/indi_mount_driver/indi-lxd650
+CMAKE_SOURCE_DIR = /root/projects/indi/indi_mount_driver/indi-lxd650
# The top-level build directory on which CMake was run.
-CMAKE_BINARY_DIR = /root/projects/telescope/indi_mount_driver/indi-lxd650
+CMAKE_BINARY_DIR = /root/projects/indi/indi_mount_driver/indi-lxd650
#=============================================================================
# Targets provided globally by CMake.
@@ -100,16 +99,27 @@ install/local/fast: preinstall/fast
/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local/fast
-# Special rule for the target edit_cache
-edit_cache:
- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
- /usr/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
-.PHONY : edit_cache
+# Special rule for the target install
+install: preinstall
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
+ /usr/bin/cmake -P cmake_install.cmake
+.PHONY : install
-# Special rule for the target edit_cache
-edit_cache/fast: edit_cache
+# Special rule for the target install
+install/fast: preinstall/fast
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
+ /usr/bin/cmake -P cmake_install.cmake
+.PHONY : install/fast
-.PHONY : edit_cache/fast
+# Special rule for the target list_install_components
+list_install_components:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
+.PHONY : list_install_components
+
+# Special rule for the target list_install_components
+list_install_components/fast: list_install_components
+
+.PHONY : list_install_components/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@@ -122,33 +132,22 @@ rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
-# Special rule for the target list_install_components
-list_install_components:
- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
-.PHONY : list_install_components
-
-# Special rule for the target list_install_components
-list_install_components/fast: list_install_components
-
-.PHONY : list_install_components/fast
+# Special rule for the target edit_cache
+edit_cache:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
+ /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
+.PHONY : edit_cache
-# Special rule for the target install
-install: preinstall
- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
- /usr/bin/cmake -P cmake_install.cmake
-.PHONY : install
+# Special rule for the target edit_cache
+edit_cache/fast: edit_cache
-# Special rule for the target install
-install/fast: preinstall/fast
- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
- /usr/bin/cmake -P cmake_install.cmake
-.PHONY : install/fast
+.PHONY : edit_cache/fast
# The main all target
all: cmake_check_build_system
- $(CMAKE_COMMAND) -E cmake_progress_start /root/projects/telescope/indi_mount_driver/indi-lxd650/CMakeFiles /root/projects/telescope/indi_mount_driver/indi-lxd650/CMakeFiles/progress.marks
+ $(CMAKE_COMMAND) -E cmake_progress_start /root/projects/indi/indi_mount_driver/indi-lxd650/CMakeFiles /root/projects/indi/indi_mount_driver/indi-lxd650//CMakeFiles/progress.marks
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
- $(CMAKE_COMMAND) -E cmake_progress_start /root/projects/telescope/indi_mount_driver/indi-lxd650/CMakeFiles 0
+ $(CMAKE_COMMAND) -E cmake_progress_start /root/projects/indi/indi_mount_driver/indi-lxd650/CMakeFiles 0
.PHONY : all
# The main clean target
diff --git a/indi-lxd650/lxd650.cpp b/indi-lxd650/lxd650.cpp
index 87dd65d..995145d 100644
--- a/indi-lxd650/lxd650.cpp
+++ b/indi-lxd650/lxd650.cpp
@@ -54,7 +54,8 @@ LXD650::LXD650()
DBG_SCOPE = INDI::Logger::getInstance().addDebugLevel("Scope Verbose", "SCOPE");
- SetTelescopeCapability(TELESCOPE_CAN_SYNC | TELESCOPE_CAN_GOTO | TELESCOPE_CAN_ABORT, 4);
+ SetTelescopeCapability(TELESCOPE_CAN_SYNC | TELESCOPE_CAN_GOTO | TELESCOPE_CAN_ABORT | TELESCOPE_HAS_LOCATION | TELESCOPE_HAS_TIME, 4);
+
LOG_DEBUG("Initializing from LX200 Basic device...");
}
@@ -73,7 +74,7 @@ void LXD650::debugTriggered(bool enable)
***************************************************************************************/
const char *LXD650::getDefaultName()
{
- return "LX200 Basic";
+ return "LXD-650 1697";
}
/**************************************************************************************
@@ -178,7 +179,7 @@ void LXD650::show_alignment (const char *wot, double ra1, double dec1, double ra
fs_sexa (dec2_str, dec2, 2, 3600);
- LOGF_DEBUG ("Mapping: %s RA %s DE %s => RA %s DE %s", wot, ra1_str, dec1_str, ra2_str, dec2_str);
+ LOGF_INFO ("Mapping: %s RA %s DE %s => RA %s DE %s", wot, ra1_str, dec1_str, ra2_str, dec2_str);
}
@@ -214,16 +215,14 @@ bool LXD650::ReadScopeStatus()
}
}
- INDI::IEquatorialCoordinates MountRADE { currentRA, currentDEC };
- TelescopeDirectionVector TDV = TelescopeDirectionVectorFromEquatorialCoordinates(MountRADE);
-
#if 0
NewRaDec(currentRA, currentDEC);
#else
double sky_RA, sky_DEC;
- if (!TransformTelescopeToCelestial(TDV, sky_RA, sky_DEC)) {
- sky_RA=currentRA;
- sky_DEC=currentDEC;
+
+ if (!TelescopeEquatorialToSky(currentRA, currentDEC, sky_RA, sky_DEC)) {
+ sky_RA = currentRA;
+ sky_DEC = currentDEC;
}
NewRaDec(sky_RA, sky_DEC);
@@ -241,17 +240,17 @@ bool LXD650::Goto(double r, double d)
{
#if 1
- TelescopeDirectionVector TDV;
- INDI::IEquatorialCoordinates MountRADE { r, d };
+ double mount_r, mount_d;
- if (TransformCelestialToTelescope(r, d, 0.0, TDV)) {
- EquatorialCoordinatesFromTelescopeDirectionVector(TDV, MountRADE);
- } // Conversion failed, use values as is
+ if (!SkyToTelescopeEquatorial(r, d, mount_r, mount_d)) {
+ mount_r = r;
+ mount_d = d;
+ }
- show_alignment("Sky->Mount", r, d, MountRADE.rightascension, MountRADE.declination);
+ show_alignment("Sky->Mount", r, d, mount_r, mount_d);
- r=MountRADE.rightascension;
- d=MountRADE.declination;
+ r = mount_r;
+ d = mount_d;
#endif
@@ -361,8 +360,15 @@ bool LXD650::Sync (double ra, double dec)
NewEntry.ObservationJulianDate, NewEntry.RightAscension, NewEntry.Declination, NewEntry.TelescopeDirection.x,
NewEntry.TelescopeDirection.y, NewEntry.TelescopeDirection.z);
+ show_alignment ("Sync Sky:Mount",ra,dec,currentRA, currentDEC);
+
+ LOGF_INFO ("New sync point Date %lf RA %lf DEC %lf TDV(x %lf y %lf z %lf)",
+ NewEntry.ObservationJulianDate, NewEntry.RightAscension, NewEntry.Declination, NewEntry.TelescopeDirection.x,
+ NewEntry.TelescopeDirection.y, NewEntry.TelescopeDirection.z);
+
if (!CheckForDuplicateSyncPoint (NewEntry)) {
GetAlignmentDatabase().push_back (NewEntry);
+// bool AddAlignmentEntryEquatorial(double actualRA, double actualDec, double mountRA, double mountDec);
// Tell the client about size change
UpdateSize();
@@ -391,6 +397,106 @@ bool LXD650::Sync (double ra, double dec)
#endif
+/////////////////////////////////////////////////////////////////////////////////////
+///
+/////////////////////////////////////////////////////////////////////////////////////
+
+bool LXD650::setLocalDate(uint8_t days, uint8_t months, uint16_t years)
+{
+ return (setCalenderDate(PortFD, days, months, years) == 0);
+}
+
+bool LXD650::setLocalTime24(uint8_t hour, uint8_t minute, uint8_t second)
+{
+ return (setLocalTime(PortFD, hour, minute, second) == 0);
+}
+
+bool LXD650::setUTCOffset(double offset)
+{
+ return (::setUTCOffset(PortFD, (offset * -1.0)) == 0);
+}
+
+bool LXD650::updateTime(ln_date *utc, double utc_offset)
+{
+ struct ln_zonedate ltm;
+ double JD;
+
+ if (isSimulation())
+ return true;
+
+ ln_date_to_zonedate(utc, &ltm, utc_offset * 3600.0);
+
+ JD = ln_get_julian_day(utc);
+
+ LOGF_DEBUG("New JD is %.2f", JD);
+
+ // Meade defines UTC Offset as the offset ADDED to local time to yield UTC, which
+ // is the opposite of the standard definition of UTC offset!
+ if (setUTCOffset(utc_offset) == false)
+ {
+ LOG_ERROR("Error setting UTC Offset.");
+ return false;
+ }
+
+ // Set Local Time
+ if (setLocalTime24(ltm.hours, ltm.minutes, ltm.seconds) == false)
+ {
+ LOG_ERROR("Error setting local time.");
+ return false;
+ }
+
+ if (setLocalDate(ltm.days, ltm.months, ltm.years) == false)
+ {
+ LOG_ERROR("Error setting local date.");
+ return false;
+ }
+
+ LOG_INFO("Time updated, updating planetary data...");
+ return true;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+///
+/////////////////////////////////////////////////////////////////////////////////////
+bool LXD650::updateLocation(double latitude, double longitude, double elevation)
+{
+ // Update INDI Alignment Subsystem Location
+ UpdateLocation(latitude, longitude, elevation);
+ LOGF_INFO("Location %.1f %.1f %.1f",latitude,longitude,elevation);
+
+ SetApproximateMountAlignment(latitude >= 0 ? NORTH_CELESTIAL_POLE : SOUTH_CELESTIAL_POLE);
+
+ Initialise(this);
+
+#if 0
+ // update cordwrap position at each init of the alignment subsystem
+ syncCoordWrapPosition();
+#endif
+
+ // JM 2021-04-10: MUST convert from INDI longitude to standard longitude.
+ // DO NOT REMOVE
+ if (longitude > 180)
+ longitude = longitude - 360;
+
+ if (!isSimulation())
+ {
+ if (setSiteLongitude(PortFD, longitude) < 0)
+ {
+ LOG_ERROR("Error setting site longitude coordinates");
+ return false;
+ }
+
+ if (setSiteLatitude(PortFD, latitude) < 0)
+ {
+ LOG_ERROR("Error setting site latitude coordinates");
+ return false;
+ }
+ }
+
+ return true;
+}
+
/////////////////////////////////////////////////////////////////////////////////////
@@ -772,6 +878,7 @@ void LXD650::slewError(int slewCode)
bool LXD650::saveConfigItems(FILE *fp)
{
INDI::Telescope::saveConfigItems(fp);
+ SaveAlignmentConfigProperties(fp);
IUSaveConfigNumber(fp, &SlewAccuracyNP);
return true;
}
diff --git a/indi-lxd650/lxd650.h b/indi-lxd650/lxd650.h
index 0c912c1..7a6fc96 100644
--- a/indi-lxd650/lxd650.h
+++ b/indi-lxd650/lxd650.h
@@ -68,6 +68,10 @@ class LXD650 : public INDI::Telescope,
virtual IPState GuideEast(uint32_t ms) override;
virtual IPState GuideWest(uint32_t ms) override;
+ virtual bool updateTime(ln_date *utc, double utc_offset) override;
+ virtual bool updateLocation(double latitude, double longitude, double elevation) override;
+
+
protected:
bool isSlewComplete();
void slewError(int slewCode);
@@ -95,4 +99,9 @@ class LXD650 : public INDI::Telescope,
void GuideWestCB(void);
void GuideEastCB(void);
+ virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years);
+ virtual bool setLocalTime24(uint8_t hour, uint8_t minute, uint8_t second);
+ virtual bool setUTCOffset(double offset);
+
+
};