indi-eqmod-1.0+20220129131520/ 0000755 0001751 0001751 00000000000 14175242255 014210 5 ustar debian debian indi-eqmod-1.0+20220129131520/indi_eqmod_sk.xml 0000644 0001751 0001751 00000030272 14174600255 017540 0 ustar debian debian
0.0
0.0
0.5
0.5
10
100
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
Alert
Idle
Idle
Idle
Idle
Alert
Idle
Idle
Idle
Idle
0.0
12.0
64.0
64.0
256.0
256.0
On
Off
On
Off
Off
Off
Off
On
On
Off
Off
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
Off
10.0
10.0
Off
Off
Off
On
Off
On
Off
1.0
1.0
Off
Off
On
Off
Off
Off
On
Off
On
Off
On
Off
255
On
Off
On
Off
indi-eqmod-1.0+20220129131520/README 0000644 0001751 0001751 00000002217 14174600255 015067 0 ustar debian debian SkyWatcher Protocol INDI Driver
==================
This package provides the INDI driver for mounts compliant to the SkyWatcher Protocol as described in
http://code.google.com/p/skywatcher/wiki/SkyWatcherProtocol
Requirements
============
+ libindi0 >= v0.9 (http://indi.sf.net)
You need to install both libindi0 and libindi-dev to build this package.
+ libnova
You need to install both libnova and libnova-devel to build this package.
Installation
============
See INSTALL
How to Use
==========
You can use the SkyWatcher Protocol INDI Driver in any INDI-compatible client such as KStars or Xephem.
To run the driver from the command line:
$ indiserver indi_eqmod_telescope
You can then connect to the driver from any client, the default port is 7624.
If you're using KStars, the driver will be automatically listed in KStars' Device Manager,
no further configuration is necessary.
To connect your mount, first specify the serial port in the options Tab (default is /dev/ttyUSB0).
The mount is supposed to be parked in the home position (pointing to the celestial pole)
at the first connection, or after each reset of the mount.
indi-eqmod-1.0+20220129131520/staradventurer2i.h 0000644 0001751 0001751 00000002142 14174600255 017661 0 ustar debian debian /*******************************************************************************
Copyright(c) 2020 Jasem Mutlaq. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*******************************************************************************/
#pragma once
#include "eqmodbase.h"
class StarAdventurer2i : public EQMod
{
public:
StarAdventurer2i();
protected:
virtual const char *getDefaultName();
virtual bool initProperties();
};
indi-eqmod-1.0+20220129131520/indi_eqmod.xml.cmake 0000644 0001751 0001751 00000002123 14174600255 020114 0 ustar debian debian
indi_eqmod_telescope
@EQMOD_VERSION_MAJOR@.@EQMOD_VERSION_MINOR@
indi_azgti_telescope
@EQMOD_VERSION_MAJOR@.@EQMOD_VERSION_MINOR@
indi_staradventurer2i_telescope
@EQMOD_VERSION_MAJOR@.@EQMOD_VERSION_MINOR@
indi_staradventurer2i_telescope
@EQMOD_VERSION_MAJOR@.@EQMOD_VERSION_MINOR@
indi-eqmod-1.0+20220129131520/azgti.cpp 0000644 0001751 0001751 00000001542 14174600255 016031 0 ustar debian debian /*
Copyright(c) 2020 Jasem Mutlaq. All rights reserved.
AZ-GTi based on azgti
INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#include "azgtibase.h"
#include
static std::unique_ptr azgti(new AZGTIBase());
indi-eqmod-1.0+20220129131520/azgtibase.h 0000644 0001751 0001751 00000002124 14174600255 016326 0 ustar debian debian /*******************************************************************************
Copyright(c) 2020 Jasem Mutlaq. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*******************************************************************************/
#pragma once
#include "eqmodbase.h"
class AZGTIBase : public EQMod
{
public:
AZGTIBase();
protected:
virtual const char *getDefaultName();
virtual bool initProperties();
};
indi-eqmod-1.0+20220129131520/simulator/ 0000755 0001751 0001751 00000000000 14174600255 016224 5 ustar debian debian indi-eqmod-1.0+20220129131520/simulator/indi_eqmod_simulator_sk.xml 0000644 0001751 0001751 00000005172 14174600255 023657 0 ustar debian debian
180.0
180.0
47.0
12.0
47.0
12.0
200.0
64.0
200.0
64.0
On
Off
Off
Off
Off
Off
Off
On
020300
indi-eqmod-1.0+20220129131520/simulator/skywatcher-simulator.h 0000644 0001751 0001751 00000007727 14174600255 022613 0 ustar debian debian
#pragma once
#include
/* Microstepping */
/* 8 microsteps */
#define MICROSTEP_MASK 0x07
// PWM_MASK = 0x1 << LN(MICROSTEPS)
#define PWM_MASK 0x08
// WINDINGB_MASK = 0x2 << LN(MICROSTEPS)
#define WINDINGB_MASK 0x10
// WINDINGA_MASK = 0x3 << LN(MICROSTEPS)
#define WINDINGA_MASK 0x18
#define SETRAPHIA(microstep) \
RAPHIA = ((((microstep & WINDINGA_MASK) == 0) || ((microstep & WINDINGA_MASK) == WINDINGA_MASK)) ? 1 : 0)
#define SETRAPHIB(microstep) RAPHIB = ((microstep & WINDINGB_MASK) ? 1 : 0)
#define SETDEPHIA(microstep) \
DEPHIA = (((microstep & WINDINGA_MASK) == 0) || ((microstep & WINDINGA_MASK) == WINDINGA_MASK)) ? 1 : 0
#define SETDEPHIB(microstep) DEPHIB = (microstep & WINDINGB_MASK) ? 1 : 0
/* Timer period */
#define MICROSECONDS 1000000
#define MUL_RA (MICROSECONDS / ra_steps_worm)
#define REM_RA (MICROSECONDS % ra_steps_worm)
#define MUL_DE (MICROSECONDS / de_steps_worm)
#define REM_DE (MICROSECONDS % de_steps_worm)
#define SETMOTORPROPERTY(motorstatus, property) motorstatus |= property
#define UNSETMOTORPROPERTY(motorstatus, property) motorstatus &= ~property
#define GETMOTORPROPERTY(motorstatus, property) (motorstatus & property)
#define HEX(c) (((c) < 'A') ? ((c) - '0') : ((c) - 'A') + 10)
class SkywatcherSimulator
{
public:
void setupVersion(const char *mcversion);
void setupRA(unsigned int nb_teeth, unsigned int gear_ratio_num, unsigned int gear_ratio_den, unsigned int nb_steps,
unsigned int nb_microsteps, unsigned int highspeed);
void setupDE(unsigned int nb_teeth, unsigned int gear_ratio_num, unsigned int gear_ratio_den, unsigned int nb_steps,
unsigned int nb_microsteps, unsigned int highspeed);
void process_command(const char *cmd, int *received);
void get_reply(char *buf, int *len);
protected:
private:
enum motorstatus
{
INITIALIZED = 0x0100,
RUNNING = 0x0001,
SLEWMODE = 0X0010,
BACKWARD = 0x0020,
HIGHSPEED = 0x0040
};
/* Gears/Worms/Steppers */
const char *version;
unsigned int ra_nb_teeth;
unsigned int de_nb_teeth;
unsigned int ra_gear_ratio_num;
unsigned int ra_gear_ratio_den;
unsigned int de_gear_ratio_num;
unsigned int de_gear_ratio_den;
unsigned int ra_nb_steps;
unsigned int de_nb_steps;
unsigned int ra_microsteps;
unsigned int de_microsteps;
unsigned int ra_highspeed_ratio;
unsigned int de_highspeed_ratio;
unsigned int ra_steps_360;
unsigned int de_steps_360;
unsigned int ra_steps_worm;
unsigned int de_steps_worm;
unsigned int ra_position;
unsigned char ra_microstep;
unsigned char ra_pwmindex;
unsigned int ra_wormperiod;
unsigned int ra_target;
unsigned int ra_target_current;
unsigned int ra_target_slow;
unsigned int ra_breaks;
unsigned int de_position;
unsigned char de_microstep;
unsigned char de_pwmindex;
unsigned int de_wormperiod;
unsigned int de_target;
unsigned int de_target_current;
unsigned int de_target_slow;
unsigned int de_breaks;
// Motor periods in ns
unsigned int ra_period;
unsigned int de_period;
// Motor status (Skywatcher protocol)
unsigned int ra_status;
unsigned int de_status;
// USART
char reply[32];
unsigned char replyindex;
static char hexa[16];
void send_byte(unsigned char c);
void send_string(const char *s);
void send_u24(unsigned int);
void send_u12(unsigned int);
void send_u8(unsigned char);
unsigned char read;
unsigned int get_u8(const char *cmd);
unsigned int get_u24(const char *cmd);
void compute_timer_ra(unsigned int wormperiod);
void compute_timer_de(unsigned int wormperiod);
void compute_ra_position();
void compute_de_position();
void ra_resume();
void de_resume();
void ra_pause();
void ra_stop();
void de_pause();
void de_stop();
struct timeval lastraTime;
struct timeval lastdeTime;
};
indi-eqmod-1.0+20220129131520/simulator/skywatcher-simulator.cpp 0000644 0001751 0001751 00000045151 14174600255 023137 0 ustar debian debian
#include "skywatcher-simulator.h"
#include
#include
#include
void SkywatcherSimulator::send_byte(unsigned char c)
{
reply[replyindex++] = c;
}
void SkywatcherSimulator::send_string(const char *s)
{
while (*s)
{
send_byte(*s++);
}
}
char SkywatcherSimulator::hexa[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
void SkywatcherSimulator::send_u24(unsigned int n)
{
send_byte(hexa[(n & 0xF0) >> 4]);
send_byte(hexa[(n & 0x0F)]);
send_byte(hexa[(n & 0xF000) >> 12]);
send_byte(hexa[(n & 0x0F00) >> 8]);
send_byte(hexa[(n & 0xF00000) >> 20]);
send_byte(hexa[(n & 0x0F0000) >> 16]);
}
void SkywatcherSimulator::send_u12(unsigned int n)
{
send_byte(hexa[(n & 0xF0) >> 4]);
send_byte(hexa[(n & 0x0F)]);
send_byte(hexa[(n & 0xF00) >> 8]);
}
void SkywatcherSimulator::send_u8(unsigned char n)
{
send_byte(hexa[(n & 0xF0) >> 4]);
send_byte(hexa[(n & 0x0F)]);
}
unsigned int SkywatcherSimulator::get_u8(const char *cmd)
{
unsigned int res = 0;
res |= HEX(cmd[3]);
res <<= 4;
res |= HEX(cmd[4]);
read += 2;
return res;
}
unsigned int SkywatcherSimulator::get_u24(const char *cmd)
{
unsigned int res = 0;
res = HEX(cmd[7]);
res <<= 4;
res |= HEX(cmd[8]);
res <<= 4;
res |= HEX(cmd[5]);
res <<= 4;
res |= HEX(cmd[6]);
res <<= 4;
res |= HEX(cmd[3]);
res <<= 4;
res |= HEX(cmd[4]);
read += 6;
return res;
}
void SkywatcherSimulator::setupVersion(const char *mcversion)
{
version = mcversion;
}
void SkywatcherSimulator::setupRA(unsigned int nb_teeth, unsigned int gear_ratio_num, unsigned int gear_ratio_den,
unsigned int nb_steps, unsigned int nb_microsteps, unsigned int highspeed)
{
ra_nb_teeth = nb_teeth;
ra_gear_ratio_num = gear_ratio_num;
ra_gear_ratio_den = gear_ratio_den;
ra_nb_steps = nb_steps;
ra_microsteps = nb_microsteps;
ra_highspeed_ratio = ra_microsteps / highspeed;
ra_steps_360 = (ra_nb_teeth * ra_gear_ratio_num * ra_nb_steps * ra_microsteps) / ra_gear_ratio_den;
ra_steps_worm = (ra_gear_ratio_num * ra_nb_steps * ra_microsteps) / ra_gear_ratio_den;
ra_position = 0x800000;
ra_microstep = 0x00;
ra_pwmindex = ra_microsteps - 1;
ra_wormperiod = 0x256;
ra_target = 0x000001;
ra_target_current = 0x000000;
ra_target_slow = 400;
ra_breaks = 400;
ra_status = 0X0010; // lowspeed, forward, slew mode, stopped
gettimeofday(&lastraTime, nullptr);
//IDLog("Simulator setupRA %d %d\n", ra_steps_360, ra_steps_worm);
}
void SkywatcherSimulator::setupDE(unsigned int nb_teeth, unsigned int gear_ratio_num, unsigned int gear_ratio_den,
unsigned int nb_steps, unsigned int nb_microsteps, unsigned int highspeed)
{
de_nb_teeth = nb_teeth;
de_gear_ratio_num = gear_ratio_num;
de_gear_ratio_den = gear_ratio_den;
de_nb_steps = nb_steps;
de_microsteps = nb_microsteps;
de_highspeed_ratio = de_microsteps / highspeed;
de_steps_360 = (de_nb_teeth * de_gear_ratio_num * de_nb_steps * de_microsteps) / de_gear_ratio_den;
de_steps_worm = (de_gear_ratio_num * de_nb_steps * de_microsteps) / de_gear_ratio_den;
de_position = 0x800000;
de_microstep = 0x00;
de_pwmindex = de_microsteps - 1;
de_wormperiod = 0x256;
de_target = 0x000001;
de_target_current = 0x000000;
de_target_slow = 400;
de_breaks = 400;
de_status = 0X0010; // lowspeed, forward, slew mode, stopped
//IDLog("Simulator setupDE %d %d\n", de_steps_360, de_steps_worm);
}
void SkywatcherSimulator::compute_timer_ra(unsigned int wormperiod)
{
uint32_t n = (wormperiod * MUL_RA);
n += ((wormperiod * REM_RA) / ra_steps_worm);
ra_period = n;
//IDLog("Simulator RA Worm period = %d, Microstep timer period = %d µs\n", wormperiod, ra_period);
}
void SkywatcherSimulator::compute_timer_de(unsigned int wormperiod)
{
uint32_t n = (wormperiod * MUL_DE);
n += ((wormperiod * REM_DE) / de_steps_worm);
de_period = n;
//IDLog("Simulator DE Worm period = %d, Microstep timer period = %d µs\n", wormperiod, de_period);
}
void SkywatcherSimulator::compute_ra_position()
{
struct timeval raTime, resTime;
gettimeofday(&raTime, nullptr);
timersub(&raTime, &lastraTime, &resTime);
if (GETMOTORPROPERTY(ra_status, RUNNING))
{
unsigned int stepmul = (GETMOTORPROPERTY(ra_status, HIGHSPEED)) ? ra_highspeed_ratio : 1;
unsigned int deltastep;
deltastep = ((((resTime.tv_sec * MICROSECONDS) + resTime.tv_usec) * stepmul) / ra_period);
if (!(GETMOTORPROPERTY(ra_status, SLEWMODE)))
{
// GOTO
if ((GETMOTORPROPERTY(ra_status, HIGHSPEED)) &&
(ra_target_current + deltastep >= ra_target - ra_target_slow))
{
struct timeval hstime, lstime;
//hstime: time moving @ highspeed
hstime.tv_sec =
((ra_target - ra_target_slow - ra_target_current) * ra_period) / (MICROSECONDS * stepmul);
hstime.tv_usec =
(((ra_target - ra_target_slow - ra_target_current) * ra_period) / stepmul) % MICROSECONDS;
timersub(&resTime, &hstime, &lstime);
UNSETMOTORPROPERTY(ra_status, HIGHSPEED); //switch to low speed
deltastep = (ra_target - ra_target_slow - ra_target_current) +
((((lstime.tv_sec * MICROSECONDS) + lstime.tv_usec)) / ra_period);
}
if (ra_target_current + deltastep >= ra_target)
{
deltastep = ra_target - ra_target_current;
SETMOTORPROPERTY(ra_status, SLEWMODE);
ra_pause();
}
else
ra_target_current += deltastep;
}
if (GETMOTORPROPERTY(ra_status, BACKWARD)) //BACKWARD
ra_position = ra_position - deltastep;
else
ra_position = ra_position + deltastep;
}
lastraTime = raTime;
}
void SkywatcherSimulator::compute_de_position()
{
struct timeval deTime, resTime;
gettimeofday(&deTime, nullptr);
timersub(&deTime, &lastdeTime, &resTime);
if (GETMOTORPROPERTY(de_status, RUNNING))
{
unsigned int stepmul = (GETMOTORPROPERTY(de_status, HIGHSPEED)) ? de_highspeed_ratio : 1;
unsigned int deltastep;
deltastep = ((((resTime.tv_sec * MICROSECONDS) + resTime.tv_usec) * stepmul) / de_period);
if (!(GETMOTORPROPERTY(de_status, SLEWMODE)))
{
// GOTO
if ((GETMOTORPROPERTY(de_status, HIGHSPEED)) &&
(de_target_current + deltastep >= de_target - de_target_slow))
{
struct timeval hstime, lstime;
//hstime: time moving @ highspeed
hstime.tv_sec =
((de_target - de_target_slow - de_target_current) * de_period) / (MICROSECONDS * stepmul);
hstime.tv_usec =
(((de_target - de_target_slow - de_target_current) * de_period) / stepmul) % MICROSECONDS;
timersub(&resTime, &hstime, &lstime);
UNSETMOTORPROPERTY(de_status, HIGHSPEED); //switch to low speed
deltastep = (de_target - de_target_slow - de_target_current) +
((((lstime.tv_sec * MICROSECONDS) + lstime.tv_usec)) / de_period);
}
if (de_target_current + deltastep >= de_target)
{
deltastep = de_target - de_target_current;
SETMOTORPROPERTY(de_status, SLEWMODE);
de_pause();
}
else
de_target_current += deltastep;
}
if (GETMOTORPROPERTY(de_status, BACKWARD)) //BACKWARD
de_position = de_position - deltastep;
else
de_position = de_position + deltastep;
}
lastdeTime = deTime;
}
void SkywatcherSimulator::ra_resume()
{
gettimeofday(&lastraTime, nullptr);
compute_timer_ra(ra_wormperiod);
//GOTO
if (!(GETMOTORPROPERTY(ra_status, SLEWMODE)))
ra_target_current = 0;
SETMOTORPROPERTY(ra_status, RUNNING);
}
void SkywatcherSimulator::de_resume()
{
gettimeofday(&lastdeTime, nullptr);
compute_timer_de(de_wormperiod);
//GOTO
if (!(GETMOTORPROPERTY(de_status, SLEWMODE)))
de_target_current = 0;
SETMOTORPROPERTY(de_status, RUNNING);
}
void SkywatcherSimulator::ra_pause()
{
UNSETMOTORPROPERTY(ra_status, RUNNING);
}
void SkywatcherSimulator::ra_stop()
{
UNSETMOTORPROPERTY(ra_status, RUNNING);
}
void SkywatcherSimulator::de_pause()
{
UNSETMOTORPROPERTY(de_status, RUNNING);
}
void SkywatcherSimulator::de_stop()
{
UNSETMOTORPROPERTY(de_status, RUNNING);
}
void SkywatcherSimulator::process_command(const char *cmd, int *received)
{
replyindex = 0;
read = 1;
if (cmd[0] != ':')
{
send_byte('!');
goto next_cmd;
}
switch (cmd[1])
{
/** Syntrek Protocol **/
case 'e': // Get firmware version
if (cmd[2] != '1')
{
goto cant_do;
}
else
{
send_byte('=');
send_string(version);
}
break;
case 'a': // Get number of microsteps per revolution
if (cmd[2] == '1')
{
send_byte('=');
send_u24(ra_steps_360);
}
else if (cmd[2] == '2')
{
send_byte('=');
send_u24(de_steps_360);
}
else
goto cant_do;
break;
case 'b': // Get number of microsteps per revolution
if (cmd[2] == '1')
{
send_byte('=');
send_u24(ra_steps_worm);
}
else if (cmd[2] == '2')
{
send_byte('=');
send_u24(de_steps_worm);
}
else
goto cant_do;
break;
case 'D': // Get Worm period
if (cmd[2] == '1')
{
send_byte('=');
send_u24(ra_wormperiod);
}
else if (cmd[2] == '2')
{
send_byte('=');
send_u24(de_wormperiod);
}
else
goto cant_do;
break;
case 'f': // Get motor status
if (cmd[2] == '1')
{
send_byte('=');
send_u12(ra_status);
}
else if (cmd[2] == '2')
{
send_byte('=');
send_u12(de_status);
}
else
goto cant_do;
break;
case 'j': // Get encoder values
if (cmd[2] == '1')
{
compute_ra_position();
send_byte('=');
send_u24(ra_position);
}
else if (cmd[2] == '2')
{
compute_de_position();
send_byte('=');
send_u24(de_position);
}
else
goto cant_do;
break;
case 'g': // get high speed ratio
if (cmd[2] == '1')
{
send_byte('=');
send_u24(ra_highspeed_ratio);
}
else if (cmd[2] == '2')
{
send_byte('=');
send_u24(de_highspeed_ratio);
}
else
goto cant_do;
break;
case 'E': // Set encoder values
if (cmd[2] == '1')
{
ra_position = get_u24(cmd);
send_byte('=');
}
else if (cmd[2] == '2')
{
de_position = get_u24(cmd);
send_byte('=');
}
else
goto cant_do;
break;
case 'F': // Initialize & activate motors
if ((cmd[2] != '1') && (cmd[2] != '2') && (cmd[2] != '3'))
goto cant_do;
//init_pwm();
//init_timers();
if ((cmd[2] == '1') || (cmd[2] == '3'))
{
//SETRAPWMA(pwm_table[ra_pwmindex]); SETRAPWMB(pwm_table[MICROSTEPS - 1 - ra_pwmindex]);
//SETRAPHIA(ra_microstep); SETRAPHIB(ra_microstep);
SETMOTORPROPERTY(ra_status, INITIALIZED);
//RAENABLE = 1;
}
if ((cmd[2] == '2') || (cmd[2] == '3'))
{
//SETDEPWMA(pwm_table[de_pwmindex]); SETDEPWMB(pwm_table[MICROSTEPS - 1 - de_pwmindex]);
//SETDEPHIA(de_microstep); SETDEPHIB(de_microstep);
SETMOTORPROPERTY(de_status, INITIALIZED);
//DEENABLE = 1;
}
send_byte('=');
break;
case 'J': // Start motor
if (cmd[2] == '1')
{
ra_resume();
send_byte('=');
}
else if (cmd[2] == '2')
{
de_resume();
send_byte('=');
}
else
goto cant_do;
break;
case 'K': // Stop motor
if (cmd[2] == '1')
{
ra_pause();
send_byte('=');
}
else if (cmd[2] == '2')
{
de_pause();
send_byte('=');
}
else
goto cant_do;
break;
case 'L': // Instant Stop motor
if (cmd[2] == '1')
{
ra_stop();
send_byte('=');
}
else if (cmd[2] == '2')
{
de_stop();
send_byte('=');
}
else
goto cant_do;
break;
case 'I': // Set Speed
if (cmd[2] == '1')
{
ra_wormperiod = get_u24(cmd);
if (GETMOTORPROPERTY(ra_status, RUNNING))
compute_timer_ra(ra_wormperiod);
send_byte('=');
}
else if (cmd[2] == '2')
{
de_wormperiod = get_u24(cmd);
if (GETMOTORPROPERTY(de_status, RUNNING))
compute_timer_de(de_wormperiod);
send_byte('=');
}
else
goto cant_do;
break;
case 'G': // Set Mode/Direction
if ((cmd[2] != '1') && (cmd[2] != '2'))
goto cant_do;
if (cmd[2] == '1')
{
unsigned char modedir = get_u8(cmd);
if (modedir & 0x0F)
SETMOTORPROPERTY(ra_status, BACKWARD);
else
UNSETMOTORPROPERTY(ra_status, BACKWARD);
modedir = (modedir >> 4);
if (modedir == 0)
{
UNSETMOTORPROPERTY(ra_status, SLEWMODE);
SETMOTORPROPERTY(ra_status, HIGHSPEED);
}
else if (modedir == 1)
{
SETMOTORPROPERTY(ra_status, SLEWMODE);
UNSETMOTORPROPERTY(ra_status, HIGHSPEED);
}
else if (modedir == 2)
{
UNSETMOTORPROPERTY(ra_status, SLEWMODE);
UNSETMOTORPROPERTY(ra_status, HIGHSPEED);
}
else if (modedir == 3)
{
SETMOTORPROPERTY(ra_status, SLEWMODE);
SETMOTORPROPERTY(ra_status, HIGHSPEED);
}
}
if (cmd[2] == '2')
{
unsigned char modedir = get_u8(cmd);
if (modedir & 0x0F)
SETMOTORPROPERTY(de_status, BACKWARD);
else
UNSETMOTORPROPERTY(de_status, BACKWARD);
modedir = (modedir >> 4);
if (modedir == 0)
{
UNSETMOTORPROPERTY(de_status, SLEWMODE);
SETMOTORPROPERTY(de_status, HIGHSPEED);
}
else if (modedir == 1)
{
SETMOTORPROPERTY(de_status, SLEWMODE);
UNSETMOTORPROPERTY(de_status, HIGHSPEED);
}
else if (modedir == 2)
{
UNSETMOTORPROPERTY(de_status, SLEWMODE);
UNSETMOTORPROPERTY(de_status, HIGHSPEED);
}
else if (modedir == 3)
{
SETMOTORPROPERTY(de_status, SLEWMODE);
SETMOTORPROPERTY(de_status, HIGHSPEED);
}
}
send_byte('=');
break;
case 'H': // Set Goto Target
if (cmd[2] == '1')
{
ra_target = get_u24(cmd);
send_byte('=');
}
else if (cmd[2] == '2')
{
de_target = get_u24(cmd);
send_byte('=');
}
else
goto cant_do;
break;
case 'M': // Set Goto BreakSteps
if (cmd[2] == '1')
{
ra_target_slow = get_u24(cmd);
send_byte('=');
}
else if (cmd[2] == '2')
{
de_target_slow = get_u24(cmd);
send_byte('=');
}
else
goto cant_do;
break;
case 'U': // Set BreakSteps
if (cmd[2] == '1')
{
ra_breaks = get_u24(cmd);
send_byte('=');
}
else if (cmd[2] == '2')
{
de_breaks = get_u24(cmd);
send_byte('=');
}
else
goto cant_do;
break;
case 'P': // Set ST4 guide Rate
send_byte('=');
break;
case 'V': // Set Led Brightness
send_byte('=');
break;
case 'O': // Snap ports
send_byte('=');
break;
default:
goto cant_do;
}
read += 3; // 2 + '\r'
goto next_cmd;
cant_do:
send_byte('!'); // Can't execute command
next_cmd:
send_byte('\x0d');
reply[replyindex] = '\0';
*received = read;
}
void SkywatcherSimulator::get_reply(char *buf, int *len)
{
strncpy(buf, reply, replyindex + 1);
*len = replyindex;
}
indi-eqmod-1.0+20220129131520/simulator/simulator.h 0000644 0001751 0001751 00000003572 14174600255 020423 0 ustar debian debian /* Copyright 2012 Geehalel (geehalel AT gmail DOT com) */
/* This file is part of the Skywatcher Protocol INDI driver.
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#pragma once
#include "config.h"
#include "skywatcher-simulator.h"
#include
class EQModSimulator
{
protected:
private:
INDI::Telescope *telescope = NULL;
SkywatcherSimulator *sksim = NULL;
INumberVectorProperty *SimWormNP = NULL;
INumberVectorProperty *SimRatioNP = NULL;
INumberVectorProperty *SimMotorNP = NULL;
ISwitchVectorProperty *SimModeSP = NULL;
ISwitchVectorProperty *SimHighSpeedSP = NULL;
ITextVectorProperty *SimMCVersionTP = NULL;
bool defined=false;
public:
EQModSimulator(INDI::Telescope *);
void Connect();
void receive_cmd(const char *cmd, int *received);
void send_reply(char *buf, int *sent);
bool initProperties();
bool updateProperties(bool enable);
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n);
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n);
bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n);
};
indi-eqmod-1.0+20220129131520/simulator/simulator.cpp 0000644 0001751 0001751 00000016327 14174600255 020760 0 ustar debian debian
#include "simulator.h"
#include
EQModSimulator::EQModSimulator(INDI::Telescope *t)
{
telescope = t;
}
void EQModSimulator::Connect()
{
ISwitch *sw = IUFindOnSwitch(SimModeSP);
sksim = new SkywatcherSimulator();
if (!strcmp(sw->name, "SIM_EQ6"))
{
sksim->setupVersion("020300");
sksim->setupRA(180, 47, 12, 200, 64, 2);
sksim->setupDE(180, 47, 12, 200, 64, 2);
}
else
{
if (!strcmp(sw->name, "SIM_HEQ5"))
{
sksim->setupVersion("020301");
sksim->setupRA(135, 47, 9, 200, 64, 2);
sksim->setupDE(135, 47, 9, 200, 64, 2);
}
else
{
if (!strcmp(sw->name, "SIM_NEQ5"))
{
sksim->setupVersion("020302");
sksim->setupRA(144, 44, 9, 200, 32, 2);
sksim->setupDE(144, 44, 9, 200, 32, 2);
}
else
{
if (!strcmp(sw->name, "SIM_NEQ3"))
{
sksim->setupVersion("020303");
sksim->setupRA(130, 55, 10, 200, 32, 2);
sksim->setupDE(130, 55, 10, 200, 32, 2);
}
else
{
if (!strcmp(sw->name, "SIM_GEEHALEL"))
{
sksim->setupVersion("0203F0");
sksim->setupRA(144, 60, 15, 400, 8, 1);
sksim->setupDE(144, 60, 10, 400, 8, 1);
}
else
{
if (!strcmp(sw->name, "SIM_CUSTOM"))
{
double teeth, num, den, steps, microsteps, highspeed;
ISwitch *hssw = IUFindOnSwitch(SimHighSpeedSP);
sksim->setupVersion(IUFindText(SimMCVersionTP, "SIM_MCPHRASE")->text);
teeth = IUFindNumber(SimWormNP, "RA_TEETH")->value;
num = IUFindNumber(SimRatioNP, "RA_RATIO_NUM")->value;
den = IUFindNumber(SimRatioNP, "RA_RATIO_DEN")->value;
steps = IUFindNumber(SimMotorNP, "RA_MOTOR_STEPS")->value;
microsteps = IUFindNumber(SimMotorNP, "RA_MOTOR_USTEPS")->value;
highspeed = 1;
if (!strcmp(hssw->name, "SIM_HALFSTEP"))
highspeed = 2;
sksim->setupRA(teeth, num, den, steps, microsteps, highspeed);
teeth = IUFindNumber(SimWormNP, "DE_TEETH")->value;
num = IUFindNumber(SimRatioNP, "DE_RATIO_NUM")->value;
den = IUFindNumber(SimRatioNP, "DE_RATIO_DEN")->value;
steps = IUFindNumber(SimMotorNP, "DE_MOTOR_STEPS")->value;
microsteps = IUFindNumber(SimMotorNP, "DE_MOTOR_USTEPS")->value;
sksim->setupDE(teeth, num, den, steps, microsteps, highspeed);
}
}
}
}
}
}
}
void EQModSimulator::receive_cmd(const char *cmd, int *received)
{
// *received=0;
if (sksim)
sksim->process_command(cmd, received);
}
void EQModSimulator::send_reply(char *buf, int *sent)
{
if (sksim)
sksim->get_reply(buf, sent);
//strncpy(buf,"=\r", 2);
//*sent=2;
}
bool EQModSimulator::initProperties()
{
telescope->buildSkeleton("indi_eqmod_simulator_sk.xml");
SimWormNP = telescope->getNumber("SIMULATORWORM");
SimRatioNP = telescope->getNumber("SIMULATORRATIO");
SimMotorNP = telescope->getNumber("SIMULATORMOTOR");
SimModeSP = telescope->getSwitch("SIMULATORMODE");
SimHighSpeedSP = telescope->getSwitch("SIMULATORHIGHSPEED");
SimMCVersionTP = telescope->getText("SIMULATORMCVERSION");
return true;
}
bool EQModSimulator::updateProperties(bool enable)
{
if (enable)
{
telescope->defineProperty(SimModeSP);
telescope->defineProperty(SimWormNP);
telescope->defineProperty(SimRatioNP);
telescope->defineProperty(SimMotorNP);
telescope->defineProperty(SimHighSpeedSP);
telescope->defineProperty(SimMCVersionTP);
defined = true;
/*
AlignDataFileTP=telescope->getText("ALIGNDATAFILE");
AlignDataBP=telescope->getBLOB("ALIGNDATA");
*/
}
else if (defined)
{
telescope->deleteProperty(SimModeSP->name);
telescope->deleteProperty(SimWormNP->name);
telescope->deleteProperty(SimRatioNP->name);
telescope->deleteProperty(SimMotorNP->name);
telescope->deleteProperty(SimHighSpeedSP->name);
telescope->deleteProperty(SimMCVersionTP->name);
}
return true;
}
bool EQModSimulator::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
{
// first check if it's for our device
if (strcmp(dev, telescope->getDeviceName()) == 0)
{
INumberVectorProperty *nvp = telescope->getNumber(name);
if ((nvp != SimWormNP) && (nvp != SimRatioNP) & (nvp != SimMotorNP))
return false;
if (telescope->isConnected())
{
DEBUGDEVICE(telescope->getDeviceName(), INDI::Logger::DBG_WARNING,
"Can not change simulation settings when mount is already connected");
return false;
}
nvp->s = IPS_OK;
IUUpdateNumber(nvp, values, names, n);
IDSetNumber(nvp, nullptr);
return true;
}
return false;
}
bool EQModSimulator::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
{
// first check if it's for our device
if (strcmp(dev, telescope->getDeviceName()) == 0)
{
ISwitchVectorProperty *svp = telescope->getSwitch(name);
if ((svp != SimModeSP) && (svp != SimHighSpeedSP))
return false;
if (telescope->isConnected())
{
DEBUGDEVICE(telescope->getDeviceName(), INDI::Logger::DBG_WARNING,
"Can not change simulation settings when mount is already connected");
return false;
}
svp->s = IPS_OK;
IUUpdateSwitch(svp, states, names, n);
IDSetSwitch(svp, nullptr);
return true;
}
return false;
}
bool EQModSimulator::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
{
// first check if it's for our device
if (strcmp(dev, telescope->getDeviceName()) == 0)
{
ITextVectorProperty *tvp = telescope->getText(name);
if (tvp)
{
if ((tvp != SimMCVersionTP))
return false;
if (telescope->isConnected())
{
DEBUGDEVICE(telescope->getDeviceName(), INDI::Logger::DBG_WARNING,
"Can not change simulation settings when mount is already connected");
return false;
}
tvp->s = IPS_OK;
IUUpdateText(tvp, texts, names, n);
IDSetText(tvp, nullptr);
return true;
}
}
return false;
}
indi-eqmod-1.0+20220129131520/eqmodbase.cpp 0000644 0001751 0001751 00000402270 14174600255 016656 0 ustar debian debian /* Copyright 2012 Geehalel (geehalel AT gmail DOT com) */
/* This file is part of the Skywatcher Protocol INDI driver.
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
2013-10-20: Fixed a few bugs and init/update properties issue (Jasem Mutlaq)
2013-10-24: Use updateTime from new INDI framework (Jasem Mutlaq)
2013-10-31: Added support for joysticks (Jasem Mutlaq)
2013-11-01: Fixed issues with logger and Skywatcher's readout for InquireHighSpeedRatio.
2018-04-27: Added abnormalDisconnect to properly disconnect the driver in case of unrecoverable errors (Jasem Mutlaq)
2018-04-27: Since all dispatch_command are always followed by read_eqmod, we decided to include it inside
and on failure, we retries up to the EQMOD_MAX_RETRY before giving up in case of occasional traient errors. (Jasem Mutlaq)
*/
/* TODO */
/* HORIZONTAL_COORDS -> HORIZONTAL_COORD - OK */
/* DATE -> TIME_LST/LST and TIME_UTC/UTC - OK */
/* Problem in time initialization using gettimeofday/gmtime: 1h after UTC on summer, because of DST ?? */
/* TELESCOPE_MOTION_RATE in arcmin/s */
/* use/snoop a GPS ??*/
#include "eqmodbase.h"
#include "mach_gettime.h"
#include
#include
#include
#include
#include
#include
#include
#ifdef WITH_ALIGN
#include // For DBG_ALIGNMENT
using namespace INDI::AlignmentSubsystem;
#endif
#include
#include
#include
#define GOTO_RATE 2 /* slew rate, degrees/s */
#define SLEW_RATE 0.5 /* slew rate, degrees/s */
#define FINE_SLEW_RATE 0.1 /* slew rate, degrees/s */
#define SID_RATE 0.004178 /* sidereal rate, degrees/s */
#define GOTO_LIMIT 5 /* Move at GOTO_RATE until distance from target is GOTO_LIMIT degrees */
#define SLEW_LIMIT 2 /* Move at SLEW_LIMIT until distance from target is SLEW_LIMIT degrees */
#define FINE_SLEW_LIMIT 0.5 /* Move at FINE_SLEW_RATE until distance from target is FINE_SLEW_LIMIT degrees */
#define GOTO_ITERATIVE_LIMIT 5 /* Max GOTO Iterations */
#define RAGOTORESOLUTION 5 /* GOTO Resolution in arcsecs */
#define DEGOTORESOLUTION 5 /* GOTO Resolution in arcsecs */
/* Preset Slew Speeds */
#define SLEWMODES 11
double slewspeeds[SLEWMODES - 1] = { 1.0, 2.0, 4.0, 8.0, 32.0, 64.0, 128.0, 600.0, 700.0, 800.0 };
#define RA_AXIS 0
#define DEC_AXIS 1
#define GUIDE_NORTH 0
#define GUIDE_SOUTH 1
#define GUIDE_WEST 0
#define GUIDE_EAST 1
#if 0
int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y)
{
/* Perform the carry for the later subtraction by updating y. */
if (x->tv_usec < y->tv_usec)
{
int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
y->tv_usec -= 1000000 * nsec;
y->tv_sec += nsec;
}
if (x->tv_usec - y->tv_usec > 1000000)
{
int nsec = (x->tv_usec - y->tv_usec) / 1000000;
y->tv_usec += 1000000 * nsec;
y->tv_sec -= nsec;
}
/* Compute the time remaining to wait.
tv_usec is certainly positive. */
result->tv_sec = x->tv_sec - y->tv_sec;
result->tv_usec = x->tv_usec - y->tv_usec;
/* Return 1 if result is negative. */
return x->tv_sec < y->tv_sec;
}
#endif
EQMod::EQMod()
{
//ctor
setVersion(EQMOD_VERSION_MAJOR, EQMOD_VERSION_MINOR);
// Do not define dynamic properties on startup, and do not delete them from memory
setDynamicPropertiesBehavior(false, false);
currentRA = 0;
currentDEC = 90;
gotoparams.completed = true;
last_motion_ns = -1;
last_motion_ew = -1;
pulseInProgress = 0;
DBG_SCOPE_STATUS = INDI::Logger::getInstance().addDebugLevel("Scope Status", "SCOPE");
DBG_COMM = INDI::Logger::getInstance().addDebugLevel("Serial Port", "COMM");
DBG_MOUNT = INDI::Logger::getInstance().addDebugLevel("Verbose Mount", "MOUNT");
mount = new Skywatcher(this);
SetTelescopeCapability(TELESCOPE_CAN_PARK | TELESCOPE_CAN_SYNC | TELESCOPE_CAN_GOTO | TELESCOPE_CAN_ABORT |
TELESCOPE_HAS_TIME | TELESCOPE_HAS_LOCATION
| TELESCOPE_HAS_PIER_SIDE | TELESCOPE_HAS_TRACK_RATE | TELESCOPE_HAS_TRACK_MODE | TELESCOPE_CAN_CONTROL_TRACK,
SLEWMODES);
RAInverted = DEInverted = false;
bzero(&syncdata, sizeof(syncdata));
bzero(&syncdata2, sizeof(syncdata2));
#ifdef WITH_ALIGN_GEEHALEL
align = new Align(this);
#endif
simulator = new EQModSimulator(this);
#ifdef WITH_SCOPE_LIMITS
horizon = new HorizonLimits(this);
#endif
/* initialize time */
tzset();
gettimeofday(&lasttimeupdate, nullptr); // takes care of DST
gmtime_r(&lasttimeupdate.tv_sec, &utc);
lndate.seconds = utc.tm_sec + ((double)lasttimeupdate.tv_usec / 1000000);
lndate.minutes = utc.tm_min;
lndate.hours = utc.tm_hour;
lndate.days = utc.tm_mday;
lndate.months = utc.tm_mon + 1;
lndate.years = utc.tm_year + 1900;
get_utc_time(&lastclockupdate);
/* initialize random seed: */
srand(time(nullptr));
// Others
AutohomeState = AUTO_HOME_IDLE;
restartguidePPEC = false;
}
EQMod::~EQMod()
{
//dtor
delete mount;
mount = nullptr;
}
#if defined WITH_ALIGN || defined WITH_ALIGN_GEEHALEL
bool EQMod::isStandardSync()
{
return (strcmp(IUFindOnSwitch(AlignSyncModeSP)->name, "ALIGNSTANDARDSYNC") == 0);
}
#endif
void EQMod::setStepperSimulation(bool enable)
{
if ((enable && !isSimulation()) || (!enable && isSimulation()))
{
mount->setSimulation(enable);
if (not simulator->updateProperties(enable))
LOG_WARN("setStepperSimulator: Disable/Enable error");
}
INDI::Telescope::setSimulation(enable);
}
const char *EQMod::getDefaultName()
{
return "EQMod Mount";
}
double EQMod::getLongitude()
{
return (IUFindNumber(&LocationNP, "LONG")->value);
}
double EQMod::getLatitude()
{
return (IUFindNumber(&LocationNP, "LAT")->value);
}
double EQMod::getJulianDate()
{
/*
struct timeval currenttime, difftime;
double usecs;
gettimeofday(¤ttime, nullptr);
if (timeval_subtract(&difftime, ¤ttime, &lasttimeupdate) == -1)
return juliandate;
*/
struct timespec currentclock, diffclock;
double nsecs;
get_utc_time(¤tclock);
diffclock.tv_sec = currentclock.tv_sec - lastclockupdate.tv_sec;
diffclock.tv_nsec = currentclock.tv_nsec - lastclockupdate.tv_nsec;
while (diffclock.tv_nsec > 1000000000)
{
diffclock.tv_sec++;
diffclock.tv_nsec -= 1000000000;
}
while (diffclock.tv_nsec < 0)
{
diffclock.tv_sec--;
diffclock.tv_nsec += 1000000000;
}
//IDLog("Get Julian; ln_date was %02d:%02d:%.9f\n", lndate.hours, lndate.minutes, lndate.seconds);
//IDLog("Clocks last: %d secs %d nsecs current: %d secs %d nsecs\n", lastclockupdate.tv_sec, lastclockupdate.tv_nsec, currentclock.tv_sec, currentclock.tv_nsec);
//IDLog("Diff %d secs %d nsecs\n", diffclock.tv_sec, diffclock.tv_nsec);
//IDLog("Diff %d %d\n", difftime.tv_sec, difftime.tv_usec);
//lndate.seconds += (difftime.tv_sec + (difftime.tv_usec / 1000000));
//usecs=lndate.seconds - floor(lndate.seconds);
lndate.seconds += (diffclock.tv_sec + ((double)diffclock.tv_nsec / 1000000000.0));
nsecs = lndate.seconds - floor(lndate.seconds);
utc.tm_sec = lndate.seconds;
utc.tm_isdst = -1; // let mktime find if DST already in effect in utc
//IDLog("Get julian: setting UTC secs to %f", utc.tm_sec);
mktime(&utc); // normalize time
//IDLog("Get Julian; UTC is now %s", asctime(&utc));
ln_get_date_from_tm(&utc, &lndate);
//IDLog("Get Julian; ln_date is now %02d:%02d:%.9f\n", lndate.hours, lndate.minutes, lndate.seconds);
//lndate.seconds+=usecs;
//lasttimeupdate = currenttime;
lndate.seconds += nsecs;
//IDLog(" ln_date with nsecs %02d:%02d:%.9f\n", lndate.hours, lndate.minutes, lndate.seconds);
lastclockupdate = currentclock;
juliandate = ln_get_julian_day(&lndate);
//IDLog("julian diff: %g\n", juliandate - ln_get_julian_from_sys());
return juliandate;
//return ln_get_julian_from_sys();
}
double EQMod::getLst(double jd, double lng)
{
double lst;
//lst=ln_get_mean_sidereal_time(jd);
lst = ln_get_apparent_sidereal_time(jd);
lst += (lng / 15.0);
lst = range24(lst);
return lst;
}
bool EQMod::initProperties()
{
/* Make sure to init parent properties first */
INDI::Telescope::initProperties();
loadProperties();
for (int i = 0; i < SlewRateSP.nsp - 1; i++)
{
SlewRateSP.sp[i].s = ISS_OFF;
sprintf(SlewRateSP.sp[i].label, "%.fx", slewspeeds[i]);
SlewRateSP.sp[i].aux = (void *)&slewspeeds[i];
}
// Since last item is NOT maximum (but custom), let's set item before custom to SLEWMAX
SlewRateSP.sp[SlewRateSP.nsp - 2].s = ISS_ON;
strncpy(SlewRateSP.sp[SlewRateSP.nsp - 2].name, "SLEW_MAX", MAXINDINAME);
// Last is custom
strncpy(SlewRateSP.sp[SlewRateSP.nsp - 1].name, "SLEWCUSTOM", MAXINDINAME);
strncpy(SlewRateSP.sp[SlewRateSP.nsp - 1].label, "Custom", MAXINDILABEL);
AddTrackMode("TRACK_SIDEREAL", "Sidereal", true);
AddTrackMode("TRACK_SOLAR", "Solar");
AddTrackMode("TRACK_LUNAR", "Lunar");
AddTrackMode("TRACK_CUSTOM", "Custom");
SetParkDataType(PARK_RA_DEC_ENCODER);
setDriverInterface(getDriverInterface() | GUIDER_INTERFACE);
#ifdef WITH_ALIGN
InitAlignmentProperties(this);
// Force the alignment system to always be on
getSwitch("ALIGNMENT_SUBSYSTEM_ACTIVE")->sp[0].s = ISS_ON;
#endif
addAuxControls();
return true;
}
void EQMod::ISGetProperties(const char *dev)
{
INDI::Telescope::ISGetProperties(dev);
if (isConnected())
{
defineProperty(&GuideNSNP);
defineProperty(&GuideWENP);
defineProperty(SlewSpeedsNP);
defineProperty(GuideRateNP);
defineProperty(PulseLimitsNP);
defineProperty(MountInformationTP);
defineProperty(SteppersNP);
defineProperty(CurrentSteppersNP);
defineProperty(PeriodsNP);
defineProperty(JulianNP);
defineProperty(TimeLSTNP);
defineProperty(RAStatusLP);
defineProperty(DEStatusLP);
defineProperty(HemisphereSP);
defineProperty(HorizontalCoordNP);
defineProperty(ReverseDECSP);
defineProperty(TargetPierSideSP);
defineProperty(StandardSyncNP);
defineProperty(StandardSyncPointNP);
defineProperty(SyncPolarAlignNP);
defineProperty(SyncManageSP);
defineProperty(BacklashNP);
defineProperty(UseBacklashSP);
defineProperty(TrackDefaultSP);
defineProperty(ST4GuideRateNSSP);
defineProperty(ST4GuideRateWESP);
#if defined WITH_ALIGN && defined WITH_ALIGN_GEEHALEL
defineProperty(&AlignMethodSP);
#endif
#if defined WITH_ALIGN || defined WITH_ALIGN_GEEHALEL
defineProperty(AlignSyncModeSP);
#endif
if (mount->HasHomeIndexers())
{
defineProperty(AutoHomeSP);
}
if (mount->HasAuxEncoders())
{
defineProperty(AuxEncoderSP);
defineProperty(AuxEncoderNP);
}
if (mount->HasPPEC())
{
defineProperty(PPECTrainingSP);
defineProperty(PPECSP);
}
if (mount->HasSnapPort1())
{
defineProperty(SNAPPORT1SP);
}
if (mount->HasSnapPort2())
{
defineProperty(SNAPPORT2SP);
}
if (mount->HasPolarLed())
{
defineProperty(LEDBrightnessNP);
}
#ifdef WITH_ALIGN_GEEHALEL
if (align)
{
align->ISGetProperties();
}
#endif
#ifdef WITH_SCOPE_LIMITS
if (horizon)
{
horizon->ISGetProperties();
}
#endif
simulator->updateProperties(isSimulation());
}
}
bool EQMod::loadProperties()
{
buildSkeleton("indi_eqmod_sk.xml");
GuideRateNP = getNumber("GUIDE_RATE");
GuideRateN = GuideRateNP->np;
PulseLimitsNP = getNumber("PULSE_LIMITS");
MinPulseN = IUFindNumber(PulseLimitsNP, "MIN_PULSE");
MinPulseTimerN = IUFindNumber(PulseLimitsNP, "MIN_PULSE_TIMER");
MountInformationTP = getText("MOUNTINFORMATION");
SteppersNP = getNumber("STEPPERS");
CurrentSteppersNP = getNumber("CURRENTSTEPPERS");
PeriodsNP = getNumber("PERIODS");
JulianNP = getNumber("JULIAN");
TimeLSTNP = getNumber("TIME_LST");
RAStatusLP = getLight("RASTATUS");
DEStatusLP = getLight("DESTATUS");
SlewSpeedsNP = getNumber("SLEWSPEEDS");
HemisphereSP = getSwitch("HEMISPHERE");
TrackDefaultSP = getSwitch("TELESCOPE_TRACK_DEFAULT");
ReverseDECSP = getSwitch("REVERSEDEC");
TargetPierSideSP = getSwitch("TARGETPIERSIDE");
HorizontalCoordNP = getNumber("HORIZONTAL_COORD");
StandardSyncNP = getNumber("STANDARDSYNC");
StandardSyncPointNP = getNumber("STANDARDSYNCPOINT");
SyncPolarAlignNP = getNumber("SYNCPOLARALIGN");
SyncManageSP = getSwitch("SYNCMANAGE");
BacklashNP = getNumber("BACKLASH");
UseBacklashSP = getSwitch("USEBACKLASH");
AutoHomeSP = getSwitch("AUTOHOME");
AuxEncoderSP = getSwitch("AUXENCODER");
AuxEncoderNP = getNumber("AUXENCODERVALUES");
ST4GuideRateNSSP = getSwitch("ST4_GUIDE_RATE_NS");
ST4GuideRateWESP = getSwitch("ST4_GUIDE_RATE_WE");
PPECTrainingSP = getSwitch("PPEC_TRAINING");
PPECSP = getSwitch("PPEC");
LEDBrightnessNP = getNumber("LED_BRIGHTNESS");
SNAPPORT1SP = getSwitch("SNAPPORT1");
SNAPPORT2SP = getSwitch("SNAPPORT2");
#ifdef WITH_ALIGN_GEEHALEL
align->initProperties();
#endif
#if defined WITH_ALIGN && defined WITH_ALIGN_GEEHALEL
IUFillSwitch(&AlignMethodS[0], "ALIGN_METHOD_EQMOD", "EQMod Align", ISS_ON);
IUFillSwitch(&AlignMethodS[1], "ALIGN_METHOD_SUBSYSTEM", "Alignment Subsystem", ISS_OFF);
IUFillSwitchVector(&AlignMethodSP, AlignMethodS, NARRAY(AlignMethodS), getDeviceName(), "ALIGN_METHOD",
"Align Method", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);
#endif
#if defined WITH_ALIGN || defined WITH_ALIGN_GEEHALEL
AlignSyncModeSP = getSwitch("ALIGNSYNCMODE");
#endif
simulator->initProperties();
INDI::GuiderInterface::initGuiderProperties(this->getDeviceName(), MOTION_TAB);
#ifdef WITH_SCOPE_LIMITS
if (horizon)
{
if (!horizon->initProperties())
return false;
}
#endif
return true;
}
bool EQMod::updateProperties()
{
INDI::Telescope::updateProperties();
if (isConnected())
{
defineProperty(&GuideNSNP);
defineProperty(&GuideWENP);
defineProperty(SlewSpeedsNP);
defineProperty(GuideRateNP);
defineProperty(PulseLimitsNP);
defineProperty(MountInformationTP);
defineProperty(SteppersNP);
defineProperty(CurrentSteppersNP);
defineProperty(PeriodsNP);
defineProperty(JulianNP);
defineProperty(TimeLSTNP);
defineProperty(RAStatusLP);
defineProperty(DEStatusLP);
defineProperty(HemisphereSP);
defineProperty(HorizontalCoordNP);
defineProperty(ReverseDECSP);
defineProperty(TargetPierSideSP);
defineProperty(StandardSyncNP);
defineProperty(StandardSyncPointNP);
defineProperty(SyncPolarAlignNP);
defineProperty(SyncManageSP);
defineProperty(BacklashNP);
defineProperty(UseBacklashSP);
defineProperty(TrackDefaultSP);
defineProperty(ST4GuideRateNSSP);
defineProperty(ST4GuideRateWESP);
#if defined WITH_ALIGN && defined WITH_ALIGN_GEEHALEL
defineProperty(&AlignMethodSP);
#endif
#if defined WITH_ALIGN || defined WITH_ALIGN_GEEHALEL
defineProperty(AlignSyncModeSP);
#endif
try
{
mount->InquireBoardVersion(MountInformationTP);
for (int i = 0; i < MountInformationTP->ntp; i++)
LOGF_DEBUG("Got Board Property %s: %s", MountInformationTP->tp[i].name,
MountInformationTP->tp[i].text);
mount->InquireRAEncoderInfo(SteppersNP);
mount->InquireDEEncoderInfo(SteppersNP);
for (int i = 0; i < SteppersNP->nnp; i++)
LOGF_DEBUG("Got Encoder Property %s: %.0f", SteppersNP->np[i].label,
SteppersNP->np[i].value);
mount->InquireFeatures();
if (mount->HasHomeIndexers())
{
LOG_INFO("Mount has home indexers. Enabling Autohome.");
defineProperty(AutoHomeSP);
}
if (mount->HasAuxEncoders())
{
defineProperty(AuxEncoderSP);
defineProperty(AuxEncoderNP);
LOG_INFO("Mount has auxiliary encoders. Turning them off.");
mount->TurnRAEncoder(false);
mount->TurnDEEncoder(false);
}
if (mount->HasPPEC())
{
bool intraining, inppec;
defineProperty(PPECTrainingSP);
defineProperty(PPECSP);
LOG_INFO("Mount has PPEC.");
mount->GetPPECStatus(&intraining, &inppec);
if (intraining)
{
PPECTrainingSP->sp[0].s = ISS_OFF;
PPECTrainingSP->sp[1].s = ISS_ON;
PPECTrainingSP->s = IPS_BUSY;
IDSetSwitch(PPECTrainingSP, nullptr);
}
if (inppec)
{
PPECSP->sp[0].s = ISS_OFF;
PPECSP->sp[1].s = ISS_ON;
PPECSP->s = IPS_BUSY;
IDSetSwitch(PPECSP, nullptr);
}
}
if (mount->HasPolarLed())
{
defineProperty(LEDBrightnessNP);
}
LOG_DEBUG("Init backlash.");
mount->SetBacklashUseRA((IUFindSwitch(UseBacklashSP, "USEBACKLASHRA")->s == ISS_ON ? true : false));
mount->SetBacklashUseDE((IUFindSwitch(UseBacklashSP, "USEBACKLASHDE")->s == ISS_ON ? true : false));
mount->SetBacklashRA((uint32_t)(IUFindNumber(BacklashNP, "BACKLASHRA")->value));
mount->SetBacklashDE((uint32_t)(IUFindNumber(BacklashNP, "BACKLASHDE")->value));
if (mount->HasSnapPort1())
{
defineProperty(SNAPPORT1SP);
}
if (mount->HasSnapPort2())
{
defineProperty(SNAPPORT2SP);
}
mount->Init();
zeroRAEncoder = mount->GetRAEncoderZero();
totalRAEncoder = mount->GetRAEncoderTotal();
homeRAEncoder = mount->GetRAEncoderHome();
zeroDEEncoder = mount->GetDEEncoderZero();
totalDEEncoder = mount->GetDEEncoderTotal();
homeDEEncoder = mount->GetDEEncoderHome();
parkRAEncoder = GetAxis1Park();
parkDEEncoder = GetAxis2Park();
INumber *latitude = IUFindNumber(&LocationNP, "LAT");
INumber *longitude = IUFindNumber(&LocationNP, "LONG");
INumber *elevation = IUFindNumber(&LocationNP, "ELEV");
if (latitude && longitude && elevation)
updateLocation(latitude->value, longitude->value, elevation->value);
// else
// updateLocation(0.0, 0.0, 0.0);
// if ((latitude) && (latitude->value < 0.0))
// SetSouthernHemisphere(true);
// else
// SetSouthernHemisphere(false);
sendTimeFromSystem();
}
catch (EQModError &e)
{
return (e.DefaultHandleException(this));
}
}
else
{
deleteProperty(GuideNSNP.name);
deleteProperty(GuideWENP.name);
deleteProperty(GuideRateNP->name);
deleteProperty(PulseLimitsNP->name);
deleteProperty(MountInformationTP->name);
deleteProperty(SteppersNP->name);
deleteProperty(CurrentSteppersNP->name);
deleteProperty(PeriodsNP->name);
deleteProperty(JulianNP->name);
deleteProperty(TimeLSTNP->name);
deleteProperty(RAStatusLP->name);
deleteProperty(DEStatusLP->name);
deleteProperty(SlewSpeedsNP->name);
deleteProperty(HemisphereSP->name);
deleteProperty(HorizontalCoordNP->name);
deleteProperty(ReverseDECSP->name);
deleteProperty(TargetPierSideSP->name);
deleteProperty(StandardSyncNP->name);
deleteProperty(StandardSyncPointNP->name);
deleteProperty(SyncPolarAlignNP->name);
deleteProperty(SyncManageSP->name);
deleteProperty(TrackDefaultSP->name);
deleteProperty(BacklashNP->name);
deleteProperty(UseBacklashSP->name);
deleteProperty(ST4GuideRateNSSP->name);
deleteProperty(ST4GuideRateWESP->name);
deleteProperty(LEDBrightnessNP->name);
if (mount->HasHomeIndexers())
deleteProperty(AutoHomeSP->name);
if (mount->HasAuxEncoders())
{
deleteProperty(AuxEncoderSP->name);
deleteProperty(AuxEncoderNP->name);
}
if (mount->HasPPEC())
{
deleteProperty(PPECTrainingSP->name);
deleteProperty(PPECSP->name);
}
if (mount->HasSnapPort1())
{
deleteProperty(SNAPPORT1SP->name);
}
if (mount->HasSnapPort2())
{
deleteProperty(SNAPPORT2SP->name);
}
if (mount->HasPolarLed())
{
deleteProperty(LEDBrightnessNP->name);
}
#if defined WITH_ALIGN && defined WITH_ALIGN_GEEHALEL
deleteProperty(AlignMethodSP.name);
#endif
#if defined WITH_ALIGN || defined WITH_ALIGN_GEEHALEL
deleteProperty(AlignSyncModeSP->name);
#endif
//MountInformationTP=nullptr;
//}
}
#ifdef WITH_ALIGN_GEEHALEL
if (align)
{
if (!align->updateProperties())
return false;
}
#endif
#ifdef WITH_SCOPE_LIMITS
if (horizon)
{
if (!horizon->updateProperties())
return false;
}
#endif
simulator->updateProperties(isSimulation());
return true;
}
bool EQMod::Handshake()
{
try
{
if (!getActiveConnection()->name().compare("CONNECTION_TCP")
&& tcpConnection->connectionType() == Connection::TCP::TYPE_UDP)
{
tty_set_generic_udp_format(1);
}
mount->setPortFD(PortFD);
mount->Handshake();
// Mount initialisation is in updateProperties as it sets directly Indi properties which should be defined
}
catch (EQModError &e)
{
return (e.DefaultHandleException(this));
}
#ifdef WITH_ALIGN
// Set this according to mount type
SetApproximateMountAlignmentFromMountType(EQUATORIAL);
#endif
LOG_INFO("Successfully connected to EQMod Mount.");
return true;
}
void EQMod::abnormalDisconnectCallback(void *userpointer)
{
EQMod *p = static_cast(userpointer);
if (p->Connect())
{
p->setConnected(true, IPS_OK);
p->updateProperties();
}
}
void EQMod::abnormalDisconnect()
{
// Ignore disconnect errors
INDI::Telescope::Disconnect();
// Set Disconnected
setConnected(false, IPS_IDLE);
// Update properties
updateProperties();
// Reconnect in 2 seconds
IEAddTimer(2000, (IE_TCF *)abnormalDisconnectCallback, this);
}
bool EQMod::Disconnect()
{
if (isConnected())
{
try
{
mount->Disconnect();
}
catch (EQModError &e)
{
LOGF_ERROR("Error when disconnecting mount -> %s", e.message);
return (false);
}
return INDI::Telescope::Disconnect();
}
else
return false;
}
void EQMod::TimerHit()
{
if (isConnected())
{
bool rc;
// Skip reading scope status if we are in a middle of a pulse
// to avoid delaying it
if (pulseInProgress != 0)
{
rc = true;
}
else
{
rc = ReadScopeStatus();
}
if (rc == false)
{
// read was not good
EqNP.s = IPS_ALERT;
IDSetNumber(&EqNP, nullptr);
}
SetTimer(getCurrentPollingPeriod());
}
}
bool EQMod::ReadScopeStatus()
{
// Time
double juliandate = 0;
double lst = 0;
char hrlst[12] = {0};
const char *datenames[] = { "LST", "JULIANDATE", "UTC" };
double periods[2];
const char *periodsnames[] = { "RAPERIOD", "DEPERIOD" };
double horizvalues[2];
const char *horiznames[2] = { "AZ", "ALT" };
double steppervalues[2];
const char *steppernames[] = { "RAStepsCurrent", "DEStepsCurrent" };
juliandate = getJulianDate();
lst = getLst(juliandate, getLongitude());
fs_sexa(hrlst, lst, 2, 360000);
hrlst[11] = '\0';
DEBUGF(DBG_SCOPE_STATUS, "Compute local time: lst=%2.8f (%s) - julian date=%8.8f", lst, hrlst, juliandate);
IUUpdateNumber(TimeLSTNP, &lst, (char **)(datenames), 1);
TimeLSTNP->s = IPS_OK;
IDSetNumber(TimeLSTNP, nullptr);
IUUpdateNumber(JulianNP, &juliandate, (char **)(datenames + 1), 1);
JulianNP->s = IPS_OK;
IDSetNumber(JulianNP, nullptr);
try
{
TelescopePierSide pierSide;
currentRAEncoder = mount->GetRAEncoder();
currentDEEncoder = mount->GetDEEncoder();
DEBUGF(DBG_SCOPE_STATUS, "Current encoders RA=%ld DE=%ld", static_cast(currentRAEncoder),
static_cast(currentDEEncoder));
EncodersToRADec(currentRAEncoder, currentDEEncoder, lst, ¤tRA, ¤tDEC, ¤tHA, &pierSide);
setPierSide(pierSide);
alignedRA = currentRA;
alignedDEC = currentDEC;
ghalignedRA = currentRA;
ghalignedDEC = currentDEC;
bool aligned = false;
#ifdef WITH_ALIGN_GEEHALEL
if (align)
{
align->GetAlignedCoords(syncdata, juliandate, &m_Location, currentRA, currentDEC, &ghalignedRA,
&ghalignedDEC);
aligned = true;
}
// else
#endif
#ifdef WITH_ALIGN
// Only use INDI Alignment Subsystem if it is active.
if (AlignMethodSP.sp[1].s == ISS_ON)
{
const char *maligns[3] = { "ZENITH", "NORTH", "SOUTH" };
INDI::IEquatorialCoordinates RaDec;
// Use HA/Dec as telescope coordinate system
RaDec.rightascension = currentRA;
RaDec.declination = currentDEC;
TelescopeDirectionVector TDV = TelescopeDirectionVectorFromEquatorialCoordinates(RaDec);
DEBUGF(INDI::AlignmentSubsystem::DBG_ALIGNMENT,
"Status: Mnt. Algnt. %s Date %lf encoders RA=%ld DE=%ld Telescope RA %lf DEC %lf",
maligns[GetApproximateMountAlignment()], juliandate,
static_cast(currentRAEncoder), static_cast(currentDEEncoder),
currentRA, currentDEC);
DEBUGF(INDI::AlignmentSubsystem::DBG_ALIGNMENT, " Direction RA(deg.) %lf DEC %lf TDV(x %lf y %lf z %lf)",
RaDec.rightascension, RaDec.declination, TDV.x, TDV.y, TDV.z);
aligned = true;
if (!TransformTelescopeToCelestial(TDV, alignedRA, alignedDEC))
{
aligned = false;
DEBUGF(INDI::AlignmentSubsystem::DBG_ALIGNMENT,
"Failed TransformTelescopeToCelestial: Scope RA=%g Scope DE=%f, Aligned RA=%f DE=%f", currentRA,
currentDEC, alignedRA, alignedDEC);
}
else
{
DEBUGF(INDI::AlignmentSubsystem::DBG_ALIGNMENT,
"TransformTelescopeToCelestial: Scope RA=%f Scope DE=%f, Aligned RA=%f DE=%f", currentRA, currentDEC,
alignedRA, alignedDEC);
}
}
#endif
if (!aligned && (syncdata.lst != 0.0))
{
DEBUGF(DBG_SCOPE_STATUS, "Aligning with last sync delta RA %g DE %g", syncdata.deltaRA, syncdata.deltaDEC);
// should check values are in range!
alignedRA += syncdata.deltaRA;
alignedDEC += syncdata.deltaDEC;
if (alignedDEC > 90.0 || alignedDEC < -90.0)
{
alignedRA += 12.00;
if (alignedDEC > 0.0)
alignedDEC = 180.0 - alignedDEC;
else
alignedDEC = -180.0 - alignedDEC;
}
alignedRA = range24(alignedRA);
}
#if defined WITH_ALIGN_GEEHALEL && !defined WITH_ALIGN
alignedRA = ghalignedRA;
alignedDEC = ghalignedDEC;
#endif
#if defined WITH_ALIGN_GEEHALEL && defined WITH_ALIGN
if (AlignMethodSP.sp[0].s == ISS_ON)
{
alignedRA = ghalignedRA;
alignedDEC = ghalignedDEC;
}
#endif
lnradec.rightascension = alignedRA;
lnradec.declination = alignedDEC;
// Only update Alt/Az if the scope is not idle.
if (TrackState != SCOPE_IDLE && TrackState != SCOPE_PARKED)
{
/* uses sidereal time, not local sidereal time */
INDI::EquatorialToHorizontal(&lnradec, &m_Location, juliandate, &lnaltaz);
horizvalues[0] = lnaltaz.azimuth;
horizvalues[1] = lnaltaz.altitude;
IUUpdateNumber(HorizontalCoordNP, horizvalues, (char **)horiznames, 2);
IDSetNumber(HorizontalCoordNP, nullptr);
}
steppervalues[0] = currentRAEncoder;
steppervalues[1] = currentDEEncoder;
IUUpdateNumber(CurrentSteppersNP, steppervalues, (char **)steppernames, 2);
IDSetNumber(CurrentSteppersNP, nullptr);
mount->GetRAMotorStatus(RAStatusLP);
mount->GetDEMotorStatus(DEStatusLP);
IDSetLight(RAStatusLP, nullptr);
IDSetLight(DEStatusLP, nullptr);
periods[0] = mount->GetRAPeriod();
periods[1] = mount->GetDEPeriod();
IUUpdateNumber(PeriodsNP, periods, (char **)periodsnames, 2);
IDSetNumber(PeriodsNP, nullptr);
// Log all coords
{
char CurrentRAString[64] = {0}, CurrentDEString[64] = {0},
AlignedRAString[64] = {0}, AlignedDEString[64] = {0},
AZString[64] = {0}, ALString[64] = {0};
fs_sexa(CurrentRAString, currentRA, 2, 3600);
fs_sexa(CurrentDEString, currentDEC, 2, 3600);
fs_sexa(AlignedRAString, alignedRA, 2, 3600);
fs_sexa(AlignedDEString, alignedDEC, 2, 3600);
fs_sexa(AZString, horizvalues[0], 2, 3600);
fs_sexa(ALString, horizvalues[1], 2, 3600);
LOGF_DEBUG("Scope RA (%s) DE (%s) Aligned RA (%s) DE (%s) AZ (%s) ALT (%s), PierSide (%s)",
CurrentRAString,
CurrentDEString,
AlignedRAString,
AlignedDEString,
AZString,
ALString,
pierSide == PIER_EAST ? "East" : (pierSide == PIER_WEST ? "West" : "Unknown"));
}
if (mount->HasAuxEncoders())
{
double auxencodervalues[2];
const char *auxencodernames[] = { "AUXENCRASteps", "AUXENCDESteps" };
auxencodervalues[0] = mount->GetRAAuxEncoder();
auxencodervalues[1] = mount->GetDEAuxEncoder();
IUUpdateNumber(AuxEncoderNP, auxencodervalues, (char **)auxencodernames, 2);
IDSetNumber(AuxEncoderNP, nullptr);
}
if (gotoInProgress())
{
if (!(mount->IsRARunning()) && !(mount->IsDERunning()))
{
// Goto iteration
gotoparams.iterative_count += 1;
LOGF_INFO(
"Iterative Goto (%d): RA diff = %4.2f arcsecs DE diff = %4.2f arcsecs",
gotoparams.iterative_count, 3600 * fabs(gotoparams.ratarget - currentRA),
3600 * fabs(gotoparams.detarget - currentDEC));
if ((gotoparams.iterative_count <= GOTO_ITERATIVE_LIMIT) &&
(((3600 * fabs(gotoparams.ratarget - currentRA)) > RAGOTORESOLUTION) ||
((3600 * fabs(gotoparams.detarget - currentDEC)) > DEGOTORESOLUTION)))
{
gotoparams.racurrent = currentRA;
gotoparams.decurrent = currentDEC;
gotoparams.racurrentencoder = currentRAEncoder;
gotoparams.decurrentencoder = currentDEEncoder;
EncoderTarget(&gotoparams);
// Start iterative slewing
LOGF_INFO(
"Iterative goto (%d): slew mount to RA increment = %d, DE increment = %d",
gotoparams.iterative_count, static_cast(gotoparams.ratargetencoder - gotoparams.racurrentencoder),
static_cast(gotoparams.detargetencoder - gotoparams.decurrentencoder));
mount->SlewTo(static_cast(gotoparams.ratargetencoder - gotoparams.racurrentencoder),
static_cast(gotoparams.detargetencoder - gotoparams.decurrentencoder));
}
else
{
ISwitch *sw;
sw = IUFindSwitch(&CoordSP, "TRACK");
if ((gotoparams.iterative_count > GOTO_ITERATIVE_LIMIT) &&
(((3600 * fabs(gotoparams.ratarget - currentRA)) > RAGOTORESOLUTION) ||
((3600 * fabs(gotoparams.detarget - currentDEC)) > DEGOTORESOLUTION)))
{
LOGF_INFO(
"Iterative Goto Limit reached (%d iterations): RA diff = %4.2f arcsecs DE diff = %4.2f "
"arcsecs",
gotoparams.iterative_count, 3600 * fabs(gotoparams.ratarget - currentRA),
3600 * fabs(gotoparams.detarget - currentDEC));
}
// For AstroEQ (needs an explicit :G command at the end of gotos)
mount->ResetMotions();
if ((RememberTrackState == SCOPE_TRACKING) || ((sw != nullptr) && (sw->s == ISS_ON)))
{
char *name;
if (RememberTrackState == SCOPE_TRACKING)
{
sw = IUFindOnSwitch(&TrackModeSP);
name = sw->name;
mount->StartRATracking(GetRATrackRate());
mount->StartDETracking(GetDETrackRate());
}
else
{
ISState state;
sw = IUFindOnSwitch(TrackDefaultSP);
name = sw->name;
state = ISS_ON;
mount->StartRATracking(GetDefaultRATrackRate());
mount->StartDETracking(GetDefaultDETrackRate());
#if 0
IUResetSwitch(TrackModeSP);
IUUpdateSwitch(TrackModeSP, &state, &name, 1);
TrackModeSP->s = IPS_BUSY;
IDSetSwitch(TrackModeSP, nullptr);
#endif
}
TrackState = SCOPE_TRACKING;
RememberTrackState = TrackState;
#if 0
TrackModeSP->s = IPS_BUSY;
IDSetSwitch(TrackModeSP, nullptr);
#endif
LOGF_INFO("Telescope slew is complete. Tracking %s...", name);
}
else
{
TrackState = SCOPE_IDLE;
RememberTrackState = TrackState;
LOG_INFO("Telescope slew is complete. Stopping...");
}
gotoparams.completed = true;
//EqNP.s = IPS_OK;
}
}
}
#ifdef WITH_SCOPE_LIMITS
if (horizon)
{
if (horizon->checkLimits(horizvalues[0], horizvalues[1], TrackState, gotoInProgress()))
Abort();
}
#endif
if (TrackState == SCOPE_PARKING)
{
if (!(mount->IsRARunning()) && !(mount->IsDERunning()))
{
SetParked(true);
}
}
if (mount->HasPPEC())
{
if (PPECTrainingSP->s == IPS_BUSY)
{
bool intraining, inppec;
mount->GetPPECStatus(&intraining, &inppec);
if (!(intraining))
{
LOG_INFO("PPEC Training completed.");
PPECTrainingSP->sp[0].s = ISS_ON;
PPECTrainingSP->sp[1].s = ISS_OFF;
PPECTrainingSP->s = IPS_IDLE;
IDSetSwitch(PPECTrainingSP, nullptr);
}
}
}
if (AutohomeState == AUTO_HOME_CONFIRM)
{
if (ah_confirm_timeout > 0)
ah_confirm_timeout -= 1;
if (ah_confirm_timeout == 0)
{
AutohomeState = AUTO_HOME_IDLE;
LOG_INFO("Autohome confirm timeout.");
}
}
if (TrackState == SCOPE_AUTOHOMING)
{
uint32_t indexRA = 0, indexDE = 0;
LOGF_DEBUG("Autohoming status: %d", AutohomeState);
switch (AutohomeState)
{
case AUTO_HOME_IDLE:
case AUTO_HOME_CONFIRM:
AutohomeState = AUTO_HOME_IDLE;
TrackState = SCOPE_IDLE;
RememberTrackState = TrackState;
LOG_INFO("Invalid status while Autohoming. Aborting");
break;
case AUTO_HOME_WAIT_PHASE1:
if (!(mount->IsRARunning()) && !(mount->IsDERunning()))
{
LOG_INFO("Autohome phase 1: end");
LOG_INFO(
"AutoHome phase 2: reading home position indexes for extra moves");
mount->GetRAIndexer();
mount->GetDEIndexer();
uint32_t raindex = mount->GetlastreadRAIndexer();
uint32_t deindex = mount->GetlastreadDEIndexer();
LOGF_INFO(
"AutoHome phase 2: read home position indexes: RA=0x%x DE=0x%x", raindex, deindex);
if (raindex == 0 || raindex == 0xFFFFFF)
ah_bIndexChanged_RA = false;
else
ah_bIndexChanged_RA = true;
if (deindex == 0 || deindex == 0xFFFFFF)
ah_bIndexChanged_DE = false;
else
ah_bIndexChanged_DE = true;
if (ah_bIndexChanged_RA)
{
LOGF_INFO(
"AutoHome phase 2: RA home index changed RA=0x%x, slewing again", raindex);
ah_iPosition_RA = mount->GetRAEncoder();
ah_iChanges = (5 * mount->GetRAEncoderTotal()) / 360;
if (ah_bSlewingUp_RA)
ah_iPosition_RA = ah_iPosition_RA - ah_iChanges;
else
ah_iPosition_RA = ah_iPosition_RA + ah_iChanges;
}
if (ah_bIndexChanged_DE)
{
LOGF_INFO(
"AutoHome phase 2: DE home index changed DE=0x%x, slewing again", deindex);
ah_iPosition_DE = mount->GetDEEncoder();
ah_iChanges = (5 * mount->GetDEEncoderTotal()) / 360;
if (ah_bSlewingUp_DE)
ah_iPosition_DE = ah_iPosition_DE - ah_iChanges;
else
ah_iPosition_DE = ah_iPosition_DE + ah_iChanges;
}
if ((ah_bIndexChanged_RA) || (ah_bIndexChanged_DE))
{
LOGF_INFO(
"AutoHome phase 2: slewing to RA=0x%x (up=%c) DE=0x%x (up=%c)", ah_iPosition_RA,
(ah_bSlewingUp_RA ? '1' : '0'), ah_iPosition_DE, (ah_bSlewingUp_DE ? '1' : '0'));
mount->AbsSlewTo(ah_iPosition_RA, ah_iPosition_DE, ah_bSlewingUp_RA, ah_bSlewingUp_DE);
LOG_INFO(
"Autohome phase 2: start slewing, waiting for motors to stop");
}
else
{
LOG_INFO("Autohome phase 2: nothing to do");
}
AutohomeState = AUTO_HOME_WAIT_PHASE2;
}
else
{
LOG_DEBUG("Autohome phase 1: Waiting for motors to stop");
}
break;
case AUTO_HOME_WAIT_PHASE2:
if (!(mount->IsRARunning()) && !(mount->IsDERunning()))
{
LOG_INFO("Autohome phase 2: end");
LOG_INFO("AutoHome phase 3: resetting home position indexes");
if (ah_bIndexChanged_RA)
{
uint32_t raindex = mount->GetlastreadRAIndexer();
mount->ResetRAIndexer();
mount->GetRAIndexer();
LOGF_INFO(
"AutoHome phase 3: resetting RA home index: 0x%x (was 0x%x)",
mount->GetlastreadRAIndexer(), raindex);
}
if (ah_bIndexChanged_DE)
{
uint32_t deindex = mount->GetlastreadDEIndexer();
mount->ResetDEIndexer();
mount->GetDEIndexer();
LOGF_INFO(
"AutoHome phase 3: resetting DE home index: 0x%x (was 0x%x)",
mount->GetlastreadDEIndexer(), deindex);
}
LOG_INFO(
"AutoHome phase 3: reading home position indexes to update directions");
if (ah_bIndexChanged_RA)
{
mount->GetRAIndexer();
if (mount->GetlastreadRAIndexer() == 0)
ah_bSlewingUp_RA = false;
else
ah_bSlewingUp_RA = true;
LOGF_INFO(
"AutoHome phase 3: reading RA home position index: RA=0x%x up=%c",
mount->GetlastreadRAIndexer(), (ah_bSlewingUp_RA ? '1' : '0'));
}
if (ah_bIndexChanged_DE)
{
mount->GetDEIndexer();
if (mount->GetlastreadDEIndexer() == 0)
ah_bSlewingUp_DE = false;
else
ah_bSlewingUp_DE = true;
LOGF_INFO(
"AutoHome phase 3: reading DE home position index: DE=0x%x up=%c",
mount->GetlastreadDEIndexer(), (ah_bSlewingUp_DE ? '1' : '0'));
}
if (!ah_bSlewingUp_RA)
{
LOG_INFO(
"AutoHome phase 3: starting RA negative slewing, waiting RA home indexer");
ah_waitRA = -1;
mount->SlewRA(-800.0);
}
if (!ah_bSlewingUp_DE)
{
LOG_INFO(
"AutoHome phase 3: starting DE negative slewing, waiting DE home indexer");
ah_waitDE = -1;
mount->SlewDE(-800.0);
}
AutohomeState = AUTO_HOME_WAIT_PHASE3;
}
else
{
LOG_DEBUG("Autohome phase 2: Waiting for motors to stop");
}
break;
case AUTO_HOME_WAIT_PHASE3:
if (mount->IsRARunning())
{
if (ah_waitRA < 0)
{
mount->GetRAIndexer();
if ((indexRA = mount->GetlastreadRAIndexer()) != 0xFFFFFF)
{
ah_waitRA = 3000 / getCurrentPollingPeriod();
LOGF_INFO(
"Autohome phase 3: detected RA Index changed, waiting %d poll periods",
ah_waitRA);
}
}
else
ah_waitRA -= 1;
if (ah_waitRA == 0)
{
LOG_INFO("Autohome phase 3: stopping RA");
mount->StopRA();
}
}
if (mount->IsDERunning())
{
if (ah_waitDE < 0)
{
mount->GetDEIndexer();
if ((indexDE = mount->GetlastreadDEIndexer()) != 0xFFFFFF)
{
ah_waitDE = 3000 / getCurrentPollingPeriod();
LOGF_INFO(
"Autohome phase 3: detected DE Index changed, waiting %d poll periods",
ah_waitDE);
}
}
else
ah_waitDE -= 1;
if (ah_waitDE == 0)
{
LOG_INFO("Autohome phase 3: stopping DE");
mount->StopDE();
}
}
if (!(mount->IsRARunning()) && !(mount->IsDERunning()))
{
if (!ah_bSlewingUp_RA)
{
mount->ResetRAIndexer();
mount->GetRAIndexer();
LOGF_INFO(
"AutoHome phase 3: resetting RA home index: 0x%x (was 0x%x)",
mount->GetlastreadRAIndexer(), indexRA);
ah_bSlewingUp_RA = true;
}
if (!ah_bSlewingUp_DE)
{
mount->ResetDEIndexer();
mount->GetDEIndexer();
LOGF_INFO(
"AutoHome phase 3: resetting DE home index: 0x%x (was 0x%x)",
mount->GetlastreadDEIndexer(), indexDE);
ah_bSlewingUp_DE = true;
}
LOG_INFO("Autohome phase 3: end");
LOG_INFO("Autohome phase 4: *** find the home position index ***");
LOG_INFO(
"AutoHome phase 4: starting RA positive slewing, waiting RA home indexer");
ah_waitRA = -1;
ah_bIndexChanged_RA = false;
mount->SlewRA(400.0);
LOG_INFO(
"AutoHome phase 4: starting DE positive slewing, waiting DE home indexer");
ah_waitDE = -1;
mount->SlewDE(400.0);
ah_bIndexChanged_DE = false;
AutohomeState = AUTO_HOME_WAIT_PHASE4;
}
break;
case AUTO_HOME_WAIT_PHASE4:
if (!ah_bIndexChanged_RA)
{
mount->GetRAIndexer();
ah_iPosition_RA = mount->GetlastreadRAIndexer();
if (ah_iPosition_RA != 0)
{
ah_bIndexChanged_RA = true;
ah_sHomeIndexPosition_RA = ah_iPosition_RA;
LOGF_INFO(
"Autohome phase 4: detected RA Home index: 0x%x, stopping motor", ah_iPosition_RA);
mount->StopRA();
}
}
if (!ah_bIndexChanged_DE)
{
mount->GetDEIndexer();
ah_iPosition_DE = mount->GetlastreadDEIndexer();
if (ah_iPosition_DE != 0)
{
ah_bIndexChanged_DE = true;
ah_sHomeIndexPosition_DE = ah_iPosition_DE;
LOGF_INFO(
"Autohome phase 4: detected DE Home index: 0x%x, stopping motor", ah_iPosition_DE);
mount->StopDE();
}
}
if (!(mount->IsRARunning()) && !(mount->IsDERunning()))
{
LOG_INFO("Autohome phase 4: end");
LOG_INFO("Autohome phase 5: Moving back 10 deg.");
ah_iChanges = (10 * mount->GetRAEncoderTotal()) / 360;
ah_iPosition_RA = ah_iPosition_RA - ah_iChanges;
ah_iChanges = (10 * mount->GetDEEncoderTotal()) / 360;
ah_iPosition_DE = ah_iPosition_DE - ah_iChanges;
LOGF_INFO(
"AutoHome phase 5: slewing to RA=0x%x (up=%c) DE=0x%x (up=%c)", ah_iPosition_RA, '0',
ah_iPosition_DE, '0');
mount->AbsSlewTo(ah_iPosition_RA, ah_iPosition_DE, false, false);
AutohomeState = AUTO_HOME_WAIT_PHASE5;
}
break;
case AUTO_HOME_WAIT_PHASE5:
if (!(mount->IsRARunning()) && !(mount->IsDERunning()))
{
LOG_INFO("Autohome phase 5: end");
LOG_INFO("Autohome phase 6: Goto Home Position");
LOGF_INFO(
"AutoHome phase 6: slewing to RA=0x%x (up=%c) DE=0x%x (up=%c)", ah_sHomeIndexPosition_RA,
'1', ah_sHomeIndexPosition_DE, '1');
mount->AbsSlewTo(ah_sHomeIndexPosition_RA, ah_sHomeIndexPosition_DE, true, true);
AutohomeState = AUTO_HOME_WAIT_PHASE6;
}
else
{
LOG_DEBUG("Autohome phase 5: Waiting for motors to stop");
}
break;
case AUTO_HOME_WAIT_PHASE6:
if (!(mount->IsRARunning()) && !(mount->IsDERunning()))
{
LOG_INFO("Autohome phase 6: end");
LOGF_INFO("AutoHome phase 6: Mount at RA=0x%x DE=0x%x",
mount->GetRAEncoder(), mount->GetDEEncoder());
LOGF_INFO(
"Autohome: Mount at Home Position, setting encoders RA=0x%x DE=0X%x",
mount->GetRAEncoderHome(), mount->GetDEEncoderHome());
mount->SetRAAxisPosition(mount->GetRAEncoderHome());
mount->SetDEAxisPosition(mount->GetDEEncoderHome());
TrackState = SCOPE_IDLE;
RememberTrackState = TrackState;
AutohomeState = AUTO_HOME_IDLE;
AutoHomeSP->s = IPS_IDLE;
IUResetSwitch(AutoHomeSP);
IDSetSwitch(AutoHomeSP, nullptr);
LOG_INFO("Autohome: end");
}
else
{
LOG_DEBUG("Autohome phase 6: Waiting for motors to stop");
}
break;
default:
LOGF_WARN("Unknown Autohome status %d: aborting", AutohomeState);
Abort();
break;
}
}
}
catch (EQModError &e)
{
return (e.DefaultHandleException(this));
}
// This should be kept last so that any TRACK_STATE
// change are reflected in EQNP property in INDI::Telescope
NewRaDec(alignedRA, alignedDEC);
return true;
}
void EQMod::EncodersToRADec(uint32_t rastep, uint32_t destep, double lst, double *ra, double *de, double *ha,
TelescopePierSide *pierSide)
{
double RACurrent = 0.0, DECurrent = 0.0, HACurrent = 0.0;
TelescopePierSide p;
HACurrent = EncoderToHours(rastep, zeroRAEncoder, totalRAEncoder, Hemisphere);
RACurrent = HACurrent + lst;
DECurrent = EncoderToDegrees(destep, zeroDEEncoder, totalDEEncoder, Hemisphere);
//IDLog("EncodersToRADec: destep=%6X zeroDEncoder=%6X totalDEEncoder=%6x DECurrent=%f\n", destep, zeroDEEncoder , totalDEEncoder, DECurrent);
if (Hemisphere == NORTH)
{
if ((DECurrent > 90.0) && (DECurrent <= 270.0))
{
RACurrent = RACurrent - 12.0;
p = PIER_EAST;
}
else
p = PIER_WEST;
}
else if ((DECurrent <= 90.0) || (DECurrent > 270.0))
{
RACurrent = RACurrent + 12.0;
//currentPierSide = EAST;
p = PIER_EAST;
}
else
p = PIER_WEST;
//currentPierSide = WEST;
HACurrent = rangeHA(HACurrent);
RACurrent = range24(RACurrent);
DECurrent = rangeDec(DECurrent);
*ra = RACurrent;
*de = DECurrent;
if (ha)
*ha = HACurrent;
if (pierSide)
*pierSide = p;
}
double EQMod::EncoderToHours(uint32_t step, uint32_t initstep, uint32_t totalstep, enum Hemisphere h)
{
double result = 0.0;
if (step > initstep)
{
result = (static_cast(step - initstep) / totalstep) * 24.0;
result = 24.0 - result;
}
else
{
result = (static_cast(initstep - step) / totalstep) * 24.0;
}
if (h == NORTH)
result = range24(result + 6.0);
else
result = range24((24 - result) + 6.0);
return result;
}
double EQMod::EncoderToDegrees(uint32_t step, uint32_t initstep, uint32_t totalstep, enum Hemisphere h)
{
double result = 0.0;
if (step > initstep)
{
result = (static_cast(step - initstep) / totalstep) * 360.0;
}
else
{
result = (static_cast(initstep - step) / totalstep) * 360.0;
result = 360.0 - result;
}
//IDLog("EncodersToDegrees: step=%6X initstep=%6x result=%f hemisphere %s \n", step, initstep, result, (h==NORTH?"North":"South"));
if (h == NORTH)
result = range360(result);
else
result = range360(360.0 - result);
//IDLog("EncodersToDegrees: returning result=%f\n", result);
return result;
}
double EQMod::EncoderFromHour(double hour, uint32_t initstep, uint32_t totalstep, enum Hemisphere h)
{
double shifthour = 0.0;
shifthour = range24(hour - 6);
if (h == NORTH)
if (shifthour < 12.0)
return round(initstep - ((shifthour / 24.0) * totalstep));
else
return round(initstep + (((24.0 - shifthour) / 24.0) * totalstep));
else if (shifthour < 12.0)
return round(initstep + ((shifthour / 24.0) * totalstep));
else
return round(initstep - (((24.0 - shifthour) / 24.0) * totalstep));
}
double EQMod::EncoderFromRA(double ratarget, TelescopePierSide p, double lst, uint32_t initstep,
uint32_t totalstep, enum Hemisphere h)
{
double ha = 0.0;
ha = ratarget - lst;
// if ((h == NORTH && p == PIER_EAST) || (h == SOUTH && p == PIER_WEST))
if (p == PIER_EAST)
ha = ha + 12.0;
ha = range24(ha);
return EncoderFromHour(ha, initstep, totalstep, h);
}
double EQMod::EncoderFromDegree(double degree, uint32_t initstep, uint32_t totalstep, enum Hemisphere h)
{
double target = 0.0;
target = range360(degree);
if (h == SOUTH)
target = 360.0 - target;
if (target > 270.0)
target -= 360.0;
return round(initstep + ((target / 360.0) * totalstep));
}
double EQMod::EncoderFromDec(double detarget, TelescopePierSide p, uint32_t initstep, uint32_t totalstep,
enum Hemisphere h)
{
if ((h == NORTH && p == PIER_EAST) || (h == SOUTH && p == PIER_WEST))
detarget = 180.0 - detarget;
return EncoderFromDegree(detarget, initstep, totalstep, h);
}
void EQMod::SetSouthernHemisphere(bool southern)
{
const char *hemispherenames[] = { "NORTH", "SOUTH" };
ISState hemispherevalues[2];
LOGF_DEBUG("Set southern %s", (southern ? "true" : "false"));
if (southern)
Hemisphere = SOUTH;
else
Hemisphere = NORTH;
RAInverted = (Hemisphere == SOUTH);
UpdateDEInverted();
if (Hemisphere == NORTH)
{
hemispherevalues[0] = ISS_ON;
hemispherevalues[1] = ISS_OFF;
IUUpdateSwitch(HemisphereSP, hemispherevalues, (char **)hemispherenames, 2);
}
else
{
hemispherevalues[0] = ISS_OFF;
hemispherevalues[1] = ISS_ON;
IUUpdateSwitch(HemisphereSP, hemispherevalues, (char **)hemispherenames, 2);
}
HemisphereSP->s = IPS_IDLE;
IDSetSwitch(HemisphereSP, nullptr);
}
void EQMod::UpdateDEInverted()
{
bool prev = DEInverted;
DEInverted = (Hemisphere == SOUTH) ^ (ReverseDECSP->sp[0].s == ISS_ON);
if (DEInverted != prev)
LOGF_DEBUG("Set DEInverted %s", DEInverted ? "true" : "false");
}
void EQMod::EncoderTarget(GotoParams *g)
{
double r, d;
double ha = 0.0;
double juliandate;
double lst;
uint32_t targetraencoder = 0, targetdecencoder = 0;
bool outsidelimits = false;
r = g->ratarget;
d = g->detarget;
juliandate = getJulianDate();
lst = getLst(juliandate, getLongitude());
if (g->pier_side == PIER_UNKNOWN)
{
// decide pier side and keep it consistent in iterative calls
ha = rangeHA(r - lst);
if (ha < 0.0)
{
// target WEST
g->pier_side = PIER_EAST;
}
else
{
g->pier_side = PIER_WEST;
}
}
targetraencoder = EncoderFromRA(r, g->pier_side, lst, zeroRAEncoder, totalRAEncoder, Hemisphere);
targetdecencoder = EncoderFromDec(d, g->pier_side, zeroDEEncoder, totalDEEncoder, Hemisphere);
if (g->checklimits)
{
if (Hemisphere == NORTH)
{
assert(g->limiteast <= g->limitwest);
if ((targetraencoder < g->limiteast) || (targetraencoder > g->limitwest))
outsidelimits = true;
}
else
{
assert(g->limiteast >= g->limitwest);
if ((targetraencoder > g->limiteast) || (targetraencoder < g->limitwest))
outsidelimits = true;
}
}
g->outsidelimits = outsidelimits;
g->ratargetencoder = targetraencoder;
g->detargetencoder = targetdecencoder;
}
double EQMod::GetRATrackRate()
{
double rate = 0.0;
ISwitch *sw;
sw = IUFindOnSwitch(&TrackModeSP);
if (!sw)
return 0.0;
if (!strcmp(sw->name, "TRACK_SIDEREAL"))
{
rate = TRACKRATE_SIDEREAL;
}
else if (!strcmp(sw->name, "TRACK_LUNAR"))
{
rate = TRACKRATE_LUNAR;
}
else if (!strcmp(sw->name, "TRACK_SOLAR"))
{
rate = TRACKRATE_SOLAR;
}
else if (!strcmp(sw->name, "TRACK_CUSTOM"))
{
rate = IUFindNumber(&TrackRateNP, "TRACK_RATE_RA")->value;
}
else
return 0.0;
if (RAInverted)
rate = -rate;
return rate;
}
double EQMod::GetDETrackRate()
{
double rate = 0.0;
ISwitch *sw;
sw = IUFindOnSwitch(&TrackModeSP);
if (!sw)
return 0.0;
if (!strcmp(sw->name, "TRACK_SIDEREAL"))
{
rate = 0.0;
}
else if (!strcmp(sw->name, "TRACK_LUNAR"))
{
rate = 0.0;
}
else if (!strcmp(sw->name, "TRACK_SOLAR"))
{
rate = 0.0;
}
else if (!strcmp(sw->name, "TRACK_CUSTOM"))
{
rate = IUFindNumber(&TrackRateNP, "TRACK_RATE_DE")->value;
}
else
return 0.0;
if (DEInverted)
rate = -rate;
return rate;
}
double EQMod::GetDefaultRATrackRate()
{
double rate = 0.0;
ISwitch *sw;
sw = IUFindOnSwitch(TrackDefaultSP);
if (!sw)
return 0.0;
if (!strcmp(sw->name, "TRACK_SIDEREAL"))
{
rate = TRACKRATE_SIDEREAL;
}
else if (!strcmp(sw->name, "TRACK_LUNAR"))
{
rate = TRACKRATE_LUNAR;
}
else if (!strcmp(sw->name, "TRACK_SOLAR"))
{
rate = TRACKRATE_SOLAR;
}
else if (!strcmp(sw->name, "TRACK_CUSTOM"))
{
rate = IUFindNumber(&TrackRateNP, "TRACK_RATE_RA")->value;
}
else
return 0.0;
if (RAInverted)
rate = -rate;
return rate;
}
double EQMod::GetDefaultDETrackRate()
{
double rate = 0.0;
ISwitch *sw;
sw = IUFindOnSwitch(TrackDefaultSP);
if (!sw)
return 0.0;
if (!strcmp(sw->name, "TRACK_SIDEREAL"))
{
rate = 0.0;
}
else if (!strcmp(sw->name, "TRACK_LUNAR"))
{
rate = 0.0;
}
else if (!strcmp(sw->name, "TRACK_SOLAR"))
{
rate = 0.0;
}
else if (!strcmp(sw->name, "TRACK_CUSTOM"))
{
rate = IUFindNumber(&TrackRateNP, "TRACK_RATE_DE")->value;
}
else
return 0.0;
if (DEInverted)
rate = -rate;
return rate;
}
bool EQMod::gotoInProgress()
{
return (!gotoparams.completed);
}
bool EQMod::Goto(double r, double d)
{
double juliandate;
double lst;
#ifdef WITH_SCOPE_LIMITS
INDI::IEquatorialCoordinates gotoradec;
INDI::IHorizontalCoordinates gotoaltaz;
double gotoaz;
double gotoalt;
#endif
if ((TrackState == SCOPE_SLEWING) || (TrackState == SCOPE_PARKING) || (TrackState == SCOPE_PARKED))
{
LOG_WARN("Can not perform goto while goto/park in progress, or scope parked.");
// EqNP.s = IPS_IDLE;
// IDSetNumber(&EqNP, nullptr);
// return true;
return false;
}
juliandate = getJulianDate();
lst = getLst(juliandate, getLongitude());
#ifdef WITH_SCOPE_LIMITS
gotoradec.rightascension = r;
gotoradec.declination = d;
INDI::EquatorialToHorizontal(&gotoradec, &m_Location, juliandate, &gotoaltaz);
gotoaz = gotoaltaz.azimuth;
gotoalt = gotoaltaz.altitude;
if (horizon)
{
if (!horizon->inGotoLimits(gotoaz, gotoalt))
{
LOG_WARN("Goto outside Horizon Limits.");
// EqNP.s = IPS_IDLE;
// IDSetNumber(&EqNP, nullptr);
// return true;
return false;
}
}
#endif
LOGF_INFO("Starting Goto RA=%g DE=%g (current RA=%g DE=%g)", r, d, currentRA, currentDEC);
targetRA = r;
targetDEC = d;
char RAStr[64], DecStr[64];
// Compute encoder targets and check RA limits if forced
bzero(&gotoparams, sizeof(gotoparams));
gotoparams.ratarget = r;
gotoparams.detarget = d;
gotoparams.racurrent = currentRA;
gotoparams.decurrent = currentDEC;
bool aligned = false;
#ifdef WITH_ALIGN_GEEHALEL
double ghratarget = r, ghdetarget = d;
if (AlignMethodSP.sp[0].s == ISS_ON)
{
aligned = true;
if (align)
{
align->AlignGoto(syncdata, juliandate, &m_Location, &ghratarget, &ghdetarget);
LOGF_INFO("Aligned Eqmod Goto RA=%g DE=%g (target RA=%g DE=%g)", ghratarget, ghdetarget,
r, d);
}
else
{
if (syncdata.lst != 0.0)
{
ghratarget = gotoparams.ratarget - syncdata.deltaRA;
ghdetarget = gotoparams.detarget - syncdata.deltaDEC;
LOGF_INFO("Failed Eqmod Goto RA=%g DE=%g (target RA=%g DE=%g)", ghratarget,
ghdetarget, r, d);
}
}
}
#endif
#ifdef WITH_ALIGN
if (AlignMethodSP.sp[1].s == ISS_ON)
{
TelescopeDirectionVector TDV;
aligned = true;
if (!TransformCelestialToTelescope(r, d, 0.0, TDV))
{
DEBUGF(INDI::AlignmentSubsystem::DBG_ALIGNMENT,
"Failed TransformCelestialToTelescope: RA=%lf DE=%lf, Goto RA=%lf DE=%lf", r, d, gotoparams.ratarget,
gotoparams.detarget);
if (syncdata.lst != 0.0)
{
gotoparams.ratarget -= syncdata.deltaRA;
gotoparams.detarget -= syncdata.deltaDEC;
}
}
else
{
INDI::IEquatorialCoordinates RaDec;
EquatorialCoordinatesFromTelescopeDirectionVector(TDV, RaDec);
DEBUGF(INDI::AlignmentSubsystem::DBG_ALIGNMENT,
"TransformCelestialToTelescope: RA=%lf DE=%lf, TDV (x :%lf, y: %lf, z: %lf), local hour RA %lf DEC %lf",
r, d, TDV.x, TDV.y, TDV.z, RaDec.rightascension, RaDec.declination);
gotoparams.ratarget = RaDec.rightascension;
gotoparams.detarget = RaDec.declination;
DEBUGF(INDI::AlignmentSubsystem::DBG_ALIGNMENT,
"TransformCelestialToTelescope: RA=%lf DE=%lf, Goto RA=%lf DE=%lf", r, d, gotoparams.ratarget,
gotoparams.detarget);
}
}
#endif
if (!aligned && (syncdata.lst != 0.0))
{
gotoparams.ratarget -= syncdata.deltaRA;
gotoparams.detarget -= syncdata.deltaDEC;
}
#if defined WITH_ALIGN_GEEHALEL && !defined WITH_ALIGN
if (aligned)
{
gotoparams.ratarget = ghratarget;
gotoparams.detarget = ghdetarget;
}
#endif
#if defined WITH_ALIGN_GEEHALEL && defined WITH_ALIGN
if (aligned && (AlignMethodSP.sp[0].s == ISS_ON))
{
LOGF_INFO("Setting Eqmod Goto RA=%g DE=%g (target RA=%g DE=%g)", ghratarget, ghdetarget,
r, d);
gotoparams.ratarget = ghratarget;
gotoparams.detarget = ghdetarget;
}
#endif
gotoparams.racurrentencoder = currentRAEncoder;
gotoparams.decurrentencoder = currentDEEncoder;
gotoparams.completed = false;
gotoparams.checklimits = true;
gotoparams.pier_side = TargetPier;
gotoparams.outsidelimits = false;
if (Hemisphere == NORTH)
{
gotoparams.limiteast = zeroRAEncoder - (totalRAEncoder / 4) - (totalRAEncoder / 24); // 13h
gotoparams.limitwest = zeroRAEncoder + (totalRAEncoder / 4) + (totalRAEncoder / 24); // 23h
}
else
{
gotoparams.limiteast = zeroRAEncoder + (totalRAEncoder / 4) + (totalRAEncoder / 24); // ??
gotoparams.limitwest = zeroRAEncoder - (totalRAEncoder / 4) - (totalRAEncoder / 24); // ??
}
if (gotoparams.pier_side != PIER_UNKNOWN)
{
LOG_WARN("Enforcing the pier side prevents a meridian flip and may lead to collisions of the telescope with obstacles.");
}
EncoderTarget(&gotoparams);
if (gotoparams.outsidelimits)
{
LOGF_INFO("Target is unreachable, aborting (target encoders %u %u)", gotoparams.ratargetencoder,
gotoparams.detargetencoder);
Abort();
return false;
}
try
{
// stop motor
mount->StopRA();
mount->StopDE();
// Start slewing
LOGF_INFO("Slewing mount: RA increment = %d, DE increment = %d",
static_cast(gotoparams.ratargetencoder - gotoparams.racurrentencoder),
static_cast(gotoparams.detargetencoder - gotoparams.decurrentencoder));
mount->SlewTo(static_cast(gotoparams.ratargetencoder - gotoparams.racurrentencoder),
static_cast(gotoparams.detargetencoder - gotoparams.decurrentencoder));
}
catch (EQModError &e)
{
return (e.DefaultHandleException(this));
}
fs_sexa(RAStr, targetRA, 2, 3600);
fs_sexa(DecStr, targetDEC, 2, 3600);
// This is already set before Goto in INDI::Telescope
//RememberTrackState = TrackState;
TrackState = SCOPE_SLEWING;
//EqREqNP.s = IPS_BUSY;
//EqNP.s = IPS_BUSY;
#if 0
// 2017-08-01 Jasem: We should set TrackState to IPS_IDLE instead here?
TrackModeSP->s = IPS_IDLE;
IDSetSwitch(TrackModeSP, nullptr);
#endif
LOGF_INFO("Slewing to RA: %s - DEC: %s", RAStr, DecStr);
return true;
}
bool EQMod::Park()
{
if (!isParked())
{
if (TrackState == SCOPE_SLEWING)
{
LOG_INFO("Can not park while slewing...");
ParkSP.s = IPS_ALERT;
IDSetSwitch(&ParkSP, nullptr);
return false;
}
try
{
// stop motor
mount->StopRA();
mount->StopDE();
currentRAEncoder = mount->GetRAEncoder();
currentDEEncoder = mount->GetDEEncoder();
parkRAEncoder = GetAxis1Park();
parkDEEncoder = GetAxis2Park();
// Start slewing
LOGF_INFO("Parking mount: RA increment = %d, DE increment = %d",
static_cast(parkRAEncoder - currentRAEncoder), static_cast(parkDEEncoder - currentDEEncoder));
mount->SlewTo(static_cast(parkRAEncoder - currentRAEncoder),
static_cast(parkDEEncoder - currentDEEncoder));
}
catch (EQModError e)
{
return (e.DefaultHandleException(this));
}
//TrackModeSP->s = IPS_IDLE;
//IDSetSwitch(TrackModeSP, nullptr);
TrackState = SCOPE_PARKING;
// ParkSP.s = IPS_BUSY;
// IDSetSwitch(&ParkSP, nullptr);
LOG_INFO("Mount park in progress...");
return true;
}
return false;
}
bool EQMod::UnPark()
{
SetParked(false);
return true;
}
bool EQMod::Sync(double ra, double dec)
{
double juliandate;
double lst;
SyncData tmpsyncdata;
double ha;
TelescopePierSide pier_side;
// get current mount position asap
tmpsyncdata.telescopeRAEncoder = mount->GetRAEncoder();
tmpsyncdata.telescopeDECEncoder = mount->GetDEEncoder();
juliandate = getJulianDate();
lst = getLst(juliandate, getLongitude());
if (TrackState != SCOPE_TRACKING)
{
// EqNP.s = IPS_ALERT;
// IDSetNumber(&EqNP, nullptr);
LOG_WARN("Syncs are allowed only when Tracking");
return false;
}
/* remember the two last syncs to compute Polar alignment */
tmpsyncdata.lst = lst;
tmpsyncdata.jd = juliandate;
tmpsyncdata.targetRA = ra;
tmpsyncdata.targetDEC = dec;
if (TargetPier == PIER_UNKNOWN)
{
ha = rangeHA(ra - lst);
if (ha < 0.0)
{
// target WEST
pier_side = PIER_EAST;
}
else
{
pier_side = PIER_WEST;
}
}
else
{
pier_side = TargetPier;
}
tmpsyncdata.targetRAEncoder = EncoderFromRA(ra, pier_side, lst, zeroRAEncoder, totalRAEncoder, Hemisphere);
tmpsyncdata.targetDECEncoder = EncoderFromDec(dec, pier_side, zeroDEEncoder, totalDEEncoder, Hemisphere);
try
{
EncodersToRADec(tmpsyncdata.telescopeRAEncoder, tmpsyncdata.telescopeDECEncoder, lst, &tmpsyncdata.telescopeRA,
&tmpsyncdata.telescopeDEC, nullptr, nullptr);
}
catch (EQModError e)
{
return (e.DefaultHandleException(this));
}
tmpsyncdata.deltaRA = tmpsyncdata.targetRA - tmpsyncdata.telescopeRA;
tmpsyncdata.deltaDEC = tmpsyncdata.targetDEC - tmpsyncdata.telescopeDEC;
tmpsyncdata.deltaRAEncoder = static_cast(tmpsyncdata.targetRAEncoder - tmpsyncdata.telescopeRAEncoder);
tmpsyncdata.deltaDECEncoder = static_cast(tmpsyncdata.targetDECEncoder - tmpsyncdata.telescopeDECEncoder);
#ifdef WITH_ALIGN_GEEHALEL
if (align && !isStandardSync())
{
align->AlignSync(syncdata, tmpsyncdata);
//return true;
}
#endif
#ifdef WITH_ALIGN
if (!isStandardSync())
{
AlignmentDatabaseEntry NewEntry;
INDI::IEquatorialCoordinates RaDec;
RaDec.rightascension = tmpsyncdata.telescopeRA;
RaDec.declination = tmpsyncdata.telescopeDEC;
//NewEntry.ObservationJulianDate = ln_get_julian_from_sys();
NewEntry.ObservationJulianDate = juliandate;
NewEntry.RightAscension = ra;
NewEntry.Declination = dec;
NewEntry.TelescopeDirection = TelescopeDirectionVectorFromEquatorialCoordinates(RaDec);
NewEntry.PrivateDataSize = 0;
DEBUGF(INDI::AlignmentSubsystem::DBG_ALIGNMENT, "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, 0.01))
{
GetAlignmentDatabase().push_back(NewEntry);
// Tell the client about size change
UpdateSize();
// Tell the math plugin to reinitialise
Initialise(this);
}
}
#endif
#if defined WITH_ALIGN_GEEHALEL || defined WITH_ALIGN
if (isStandardSync())
#endif
{
#ifdef WITH_ALIGN_GEEHALEL
if (align && isStandardSync())
align->AlignStandardSync(syncdata, &tmpsyncdata, &m_Location);
#endif
syncdata2 = syncdata;
syncdata = tmpsyncdata;
IUFindNumber(StandardSyncNP, "STANDARDSYNC_RA")->value = syncdata.deltaRA;
IUFindNumber(StandardSyncNP, "STANDARDSYNC_DE")->value = syncdata.deltaDEC;
IDSetNumber(StandardSyncNP, nullptr);
IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_JD")->value = juliandate;
IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_SYNCTIME")->value = lst;
IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_CELESTIAL_RA")->value = syncdata.targetRA;
IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_CELESTIAL_DE")->value = syncdata.targetDEC;
IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_TELESCOPE_RA")->value = syncdata.telescopeRA;
IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_TELESCOPE_DE")->value = syncdata.telescopeDEC;
IDSetNumber(StandardSyncPointNP, nullptr);
LOGF_INFO("Mount Synced (deltaRA = %.6f deltaDEC = %.6f)", syncdata.deltaRA, syncdata.deltaDEC);
if (syncdata2.lst != 0.0)
{
computePolarAlign(syncdata2, syncdata, getLatitude(), &tpa_alt, &tpa_az);
IUFindNumber(SyncPolarAlignNP, "SYNCPOLARALIGN_ALT")->value = tpa_alt;
IUFindNumber(SyncPolarAlignNP, "SYNCPOLARALIGN_AZ")->value = tpa_az;
IDSetNumber(SyncPolarAlignNP, nullptr);
IDLog("computePolarAlign: Telescope Polar Axis: alt = %g, az = %g\n", tpa_alt, tpa_az);
}
}
return true;
}
IPState EQMod::GuideNorth(uint32_t ms)
{
if (ms < MinPulseN->value)
{
return IPS_IDLE;
}
double rateshift = TRACKRATE_SIDEREAL * IUFindNumber(GuideRateNP, "GUIDE_RATE_NS")->value;
LOGF_DEBUG("Timed guide North %d ms at rate %g %s", ms, rateshift, DEInverted ? "(Inverted)" : "");
IPState pulseState = IPS_BUSY;
if (DEInverted)
rateshift = -rateshift;
try
{
if (ms >= MinPulseTimerN->value)
{
pulseInProgress |= 1;
GuideTimerNS = IEAddTimer(ms, (IE_TCF *)timedguideNSCallback, this);
mount->StartDETracking(GetDETrackRate() + rateshift);
}
else
{
// We should be done once the synchronous guide is complete
pulseState = IPS_IDLE;
struct timespec starttime, endtime;
clock_gettime(CLOCK_MONOTONIC, &starttime);
mount->StartDETracking(GetDETrackRate() + rateshift);
clock_gettime(CLOCK_MONOTONIC, &endtime);
double elapsed =
(endtime.tv_sec - starttime.tv_sec) * 1000.0 + ((endtime.tv_nsec - starttime.tv_nsec) / 1000000.0);
if (elapsed < ms)
{
uint32_t left = ms - elapsed;
usleep(left * 1000);
}
try
{
mount->StartDETracking(GetDETrackRate());
}
catch (EQModError e)
{
if (!(e.DefaultHandleException(this)))
{
DEBUGDEVICE(getDeviceName(), INDI::Logger::DBG_WARNING,
"Timed guide North/South Error: can not restart tracking");
}
}
GuideComplete(AXIS_DE);
DEBUGDEVICE(getDeviceName(), INDI::Logger::DBG_DEBUG, "End Timed guide North/South");
}
}
catch (EQModError e)
{
e.DefaultHandleException(this);
return IPS_ALERT;
}
return pulseState;
}
IPState EQMod::GuideSouth(uint32_t ms)
{
if (ms < MinPulseN->value)
{
return IPS_IDLE;
}
double rateshift = 0.0;
rateshift = TRACKRATE_SIDEREAL * IUFindNumber(GuideRateNP, "GUIDE_RATE_NS")->value;
LOGF_DEBUG("Timed guide South %d ms at rate %g %s", ms, rateshift, DEInverted ? "(Inverted)" : "");
IPState pulseState = IPS_BUSY;
if (DEInverted)
rateshift = -rateshift;
try
{
if (ms >= MinPulseTimerN->value)
{
pulseInProgress |= 1;
GuideTimerNS = IEAddTimer(ms, (IE_TCF *)timedguideNSCallback, this);
mount->StartDETracking(GetDETrackRate() - rateshift);
}
else
{
// We should be done once the synchronous guide is complete
pulseState = IPS_IDLE;
struct timespec starttime, endtime;
clock_gettime(CLOCK_MONOTONIC, &starttime);
mount->StartDETracking(GetDETrackRate() - rateshift);
clock_gettime(CLOCK_MONOTONIC, &endtime);
double elapsed =
(endtime.tv_sec - starttime.tv_sec) * 1000.0 + ((endtime.tv_nsec - starttime.tv_nsec) / 1000000.0);
if (elapsed < ms)
{
uint32_t left = ms - elapsed;
usleep(left * 1000);
}
try
{
mount->StartDETracking(GetDETrackRate());
}
catch (EQModError e)
{
if (!(e.DefaultHandleException(this)))
{
DEBUGDEVICE(getDeviceName(), INDI::Logger::DBG_WARNING,
"Timed guide North/South Error: can not restart tracking");
}
}
GuideComplete(AXIS_DE);
DEBUGDEVICE(getDeviceName(), INDI::Logger::DBG_DEBUG, "End Timed guide North/South");
}
}
catch (EQModError e)
{
e.DefaultHandleException(this);
return IPS_ALERT;
}
return pulseState;
}
IPState EQMod::GuideEast(uint32_t ms)
{
if (ms < MinPulseN->value)
{
return IPS_IDLE;
}
double rateshift = 0.0;
rateshift = TRACKRATE_SIDEREAL * IUFindNumber(GuideRateNP, "GUIDE_RATE_WE")->value;
LOGF_DEBUG("Timed guide East %d ms at rate %g %s", ms, rateshift, RAInverted ? "(Inverted)" : "");
IPState pulseState = IPS_BUSY;
if (RAInverted)
rateshift = -rateshift;
try
{
if (mount->HasPPEC())
{
restartguidePPEC = false;
if (PPECSP->s == IPS_BUSY)
{
restartguidePPEC = true;
LOG_INFO("Turning PPEC off while guiding.");
mount->TurnPPEC(false);
}
}
if (ms >= MinPulseTimerN->value)
{
pulseInProgress |= 2;
GuideTimerWE = IEAddTimer(ms, (IE_TCF *)timedguideWECallback, this);
mount->StartRATracking(GetRATrackRate() - rateshift);
}
else
{
// We should be done once the synchronous guide is complete
pulseState = IPS_IDLE;
struct timespec starttime, endtime;
clock_gettime(CLOCK_MONOTONIC, &starttime);
mount->StartRATracking(GetRATrackRate() - rateshift);
clock_gettime(CLOCK_MONOTONIC, &endtime);
double elapsed =
(endtime.tv_sec - starttime.tv_sec) * 1000.0 + ((endtime.tv_nsec - starttime.tv_nsec) / 1000000.0);
if (elapsed < ms)
{
uint32_t left = ms - elapsed;
usleep(left * 1000);
}
try
{
if (mount->HasPPEC())
{
if (restartguidePPEC)
{
restartguidePPEC = false;
DEBUGDEVICE(getDeviceName(), INDI::Logger::DBG_SESSION, "Turning PPEC on after guiding.");
mount->TurnPPEC(true);
}
}
mount->StartRATracking(GetRATrackRate());
}
catch (EQModError e)
{
if (!(e.DefaultHandleException(this)))
{
DEBUGDEVICE(getDeviceName(), INDI::Logger::DBG_WARNING,
"Timed guide West/East Error: can not restart tracking");
}
}
GuideComplete(AXIS_RA);
DEBUGDEVICE(getDeviceName(), INDI::Logger::DBG_DEBUG, "End Timed guide West/East");
}
}
catch (EQModError e)
{
e.DefaultHandleException(this);
return IPS_ALERT;
}
return pulseState;
}
IPState EQMod::GuideWest(uint32_t ms)
{
if (ms < MinPulseN->value)
{
return IPS_IDLE;
}
double rateshift = 0.0;
rateshift = TRACKRATE_SIDEREAL * IUFindNumber(GuideRateNP, "GUIDE_RATE_WE")->value;
LOGF_DEBUG("Timed guide West %d ms at rate %g %s", ms, rateshift, RAInverted ? "(Inverted)" : "");
IPState pulseState = IPS_BUSY;
if (RAInverted)
rateshift = -rateshift;
try
{
if (mount->HasPPEC())
{
restartguidePPEC = false;
if (PPECSP->s == IPS_BUSY)
{
restartguidePPEC = true;
LOG_INFO("Turning PPEC off while guiding.");
mount->TurnPPEC(false);
}
}
if (ms >= MinPulseTimerN->value)
{
pulseInProgress |= 2;
GuideTimerWE = IEAddTimer(ms, (IE_TCF *)timedguideWECallback, this);
mount->StartRATracking(GetRATrackRate() + rateshift);
}
else
{
// We should be done once the synchronous guide is complete
pulseState = IPS_IDLE;
struct timespec starttime, endtime;
clock_gettime(CLOCK_MONOTONIC, &starttime);
mount->StartRATracking(GetRATrackRate() + rateshift);
clock_gettime(CLOCK_MONOTONIC, &endtime);
double elapsed =
(endtime.tv_sec - starttime.tv_sec) * 1000.0 + ((endtime.tv_nsec - starttime.tv_nsec) / 1000000.0);
if (elapsed < ms)
{
uint32_t left = ms - elapsed;
usleep(left * 1000);
}
try
{
if (mount->HasPPEC())
{
if (restartguidePPEC)
{
restartguidePPEC = false;
DEBUGDEVICE(getDeviceName(), INDI::Logger::DBG_SESSION, "Turning PPEC on after guiding.");
mount->TurnPPEC(true);
}
}
mount->StartRATracking(GetRATrackRate());
}
catch (EQModError e)
{
if (!(e.DefaultHandleException(this)))
{
DEBUGDEVICE(getDeviceName(), INDI::Logger::DBG_WARNING,
"Timed guide West/East Error: can not restart tracking");
}
}
GuideComplete(AXIS_RA);
DEBUGDEVICE(getDeviceName(), INDI::Logger::DBG_DEBUG, "End Timed guide West/East");
}
}
catch (EQModError e)
{
e.DefaultHandleException(this);
return IPS_ALERT;
}
return pulseState;
}
bool EQMod::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
{
bool compose = true;
// first check if it's for our device
if (strcmp(dev, getDeviceName()) == 0)
{
// This is for our device
// Now lets see if it's something we process here
if (strcmp(name, "SLEWSPEEDS") == 0)
{
/* TODO: don't change speed in gotos gotoparams.inprogress... */
if (TrackState != SCOPE_TRACKING)
{
try
{
for (int i = 0; i < n; i++)
{
if (strcmp(names[i], "RASLEW") == 0)
mount->SetRARate(values[i]);
else if (strcmp(names[i], "DESLEW") == 0)
mount->SetDERate(values[i]);
}
}
catch (EQModError e)
{
return (e.DefaultHandleException(this));
}
}
IUUpdateNumber(SlewSpeedsNP, values, names, n);
SlewSpeedsNP->s = IPS_OK;
IDSetNumber(SlewSpeedsNP, nullptr);
LOGF_INFO("Setting Slew rates - RA=%.2fx DE=%.2fx",
IUFindNumber(SlewSpeedsNP, "RASLEW")->value, IUFindNumber(SlewSpeedsNP, "DESLEW")->value);
return true;
}
// Guider interface
if (!strcmp(name, GuideNSNP.name) || !strcmp(name, GuideWENP.name))
{
// Unless we're in track mode, we don't obey guide commands.
if (TrackState != SCOPE_TRACKING)
{
GuideNSNP.s = IPS_IDLE;
IDSetNumber(&GuideNSNP, nullptr);
GuideWENP.s = IPS_IDLE;
IDSetNumber(&GuideWENP, nullptr);
LOG_WARN("Can not guide if not tracking.");
return true;
}
processGuiderProperties(name, values, names, n);
return true;
}
if (strcmp(name, GuideRateNP->name) == 0)
{
IUUpdateNumber(GuideRateNP, values, names, n);
GuideRateNP->s = IPS_OK;
IDSetNumber(GuideRateNP, nullptr);
LOGF_INFO("Setting Custom Tracking Rates - RA=%1.1f arcsec/s DE=%1.1f arcsec/s",
IUFindNumber(GuideRateNP, "GUIDE_RATE_WE")->value,
IUFindNumber(GuideRateNP, "GUIDE_RATE_NS")->value);
return true;
}
if (strcmp(name, PulseLimitsNP->name) == 0)
{
IUUpdateNumber(PulseLimitsNP, values, names, n);
PulseLimitsNP->s = IPS_OK;
IDSetNumber(PulseLimitsNP, nullptr);
LOGF_INFO("Setting pulse limits: minimum pulse %3.0f ms, minimum timer pulse %4.0f ms", MinPulseN->value,
MinPulseTimerN->value);
return true;
}
if (strcmp(name, "BACKLASH") == 0)
{
IUUpdateNumber(BacklashNP, values, names, n);
BacklashNP->s = IPS_OK;
IDSetNumber(BacklashNP, nullptr);
mount->SetBacklashRA((uint32_t)(IUFindNumber(BacklashNP, "BACKLASHRA")->value));
mount->SetBacklashDE((uint32_t)(IUFindNumber(BacklashNP, "BACKLASHDE")->value));
LOGF_INFO("Setting Backlash compensation - RA=%.0f microsteps DE=%.0f microsteps",
IUFindNumber(BacklashNP, "BACKLASHRA")->value, IUFindNumber(BacklashNP, "BACKLASHDE")->value);
return true;
}
if (mount->HasPolarLed())
{
if (strcmp(name, "LED_BRIGHTNESS") == 0)
{
IUUpdateNumber(LEDBrightnessNP, values, names, n);
LEDBrightnessNP->s = IPS_OK;
IDSetNumber(LEDBrightnessNP, nullptr);
mount->SetLEDBrightness(static_cast(values[0]));
LOGF_INFO("Setting LED brightness to %.f", values[0]);
return true;
}
}
if (strcmp(name, "STANDARDSYNCPOINT") == 0)
{
syncdata2 = syncdata;
bzero(&syncdata, sizeof(syncdata));
IUUpdateNumber(StandardSyncPointNP, values, names, n);
StandardSyncPointNP->s = IPS_OK;
syncdata.jd = IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_JD")->value;
syncdata.lst = IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_SYNCTIME")->value;
syncdata.targetRA = IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_CELESTIAL_RA")->value;
syncdata.targetDEC = IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_CELESTIAL_DE")->value;
syncdata.telescopeRA = IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_TELESCOPE_RA")->value;
syncdata.telescopeDEC = IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_TELESCOPE_DE")->value;
syncdata.deltaRA = syncdata.targetRA - syncdata.telescopeRA;
syncdata.deltaDEC = syncdata.targetDEC - syncdata.telescopeDEC;
IDSetNumber(StandardSyncPointNP, nullptr);
IUFindNumber(StandardSyncNP, "STANDARDSYNC_RA")->value = syncdata.deltaRA;
IUFindNumber(StandardSyncNP, "STANDARDSYNC_DE")->value = syncdata.deltaDEC;
IDSetNumber(StandardSyncNP, nullptr);
LOGF_INFO("Mount manually Synced (deltaRA = %.6f deltaDEC = %.6f)",
syncdata.deltaRA, syncdata.deltaDEC);
//IDLog("Mount Synced (deltaRA = %.6f deltaDEC = %.6f)\n", syncdata.deltaRA, syncdata.deltaDEC);
if (syncdata2.lst != 0.0)
{
computePolarAlign(syncdata2, syncdata, getLatitude(), &tpa_alt, &tpa_az);
IUFindNumber(SyncPolarAlignNP, "SYNCPOLARALIGN_ALT")->value = tpa_alt;
IUFindNumber(SyncPolarAlignNP, "SYNCPOLARALIGN_AZ")->value = tpa_az;
IDSetNumber(SyncPolarAlignNP, nullptr);
IDLog("computePolarAlign: Telescope Polar Axis: alt = %g, az = %g\n", tpa_alt, tpa_az);
}
return true;
}
}
#ifdef WITH_ALIGN_GEEHALEL
if (align)
{
compose = align->ISNewNumber(dev, name, values, names, n);
if (compose)
return true;
}
#endif
if (simulator)
{
compose = simulator->ISNewNumber(dev, name, values, names, n);
if (compose)
return true;
}
#ifdef WITH_SCOPE_LIMITS
if (horizon)
{
compose = horizon->ISNewNumber(dev, name, values, names, n);
if (compose)
return true;
}
#endif
#ifdef WITH_ALIGN
ProcessAlignmentNumberProperties(this, name, values, names, n);
#endif
// if we didn't process it, continue up the chain, let somebody else
// give it a shot
return INDI::Telescope::ISNewNumber(dev, name, values, names, n);
}
bool EQMod::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
{
bool compose = true;
if (strcmp(dev, getDeviceName()) == 0)
{
if (!strcmp(name, "SIMULATION"))
{
ISwitchVectorProperty *svp = getSwitch(name);
IUUpdateSwitch(svp, states, names, n);
ISwitch *sp = IUFindOnSwitch(svp);
if (!sp)
return false;
if (isConnected())
{
DEBUG(INDI::Logger::DBG_WARNING,
"Mount must be disconnected before you can change simulation settings.");
svp->s = IPS_ALERT;
IDSetSwitch(svp, nullptr);
return false;
}
if (!strcmp(sp->name, "ENABLE"))
setStepperSimulation(true);
else
setStepperSimulation(false);
return true;
}
if (strcmp(name, "USEBACKLASH") == 0)
{
IUUpdateSwitch(UseBacklashSP, states, names, n);
mount->SetBacklashUseRA((IUFindSwitch(UseBacklashSP, "USEBACKLASHRA")->s == ISS_ON ? true : false));
mount->SetBacklashUseDE((IUFindSwitch(UseBacklashSP, "USEBACKLASHDE")->s == ISS_ON ? true : false));
LOGF_INFO("Use Backlash : RA: %s, DE: %s",
IUFindSwitch(UseBacklashSP, "USEBACKLASHRA")->s == ISS_ON ? "True" : "False",
IUFindSwitch(UseBacklashSP, "USEBACKLASHDE")->s == ISS_ON ? "True" : "False");
UseBacklashSP->s = IPS_IDLE;
IDSetSwitch(UseBacklashSP, nullptr);
return true;
}
if (strcmp(name, "TRACKDEFAULT") == 0)
{
ISwitch *swbefore, *swafter;
swbefore = IUFindOnSwitch(TrackDefaultSP);
IUUpdateSwitch(TrackDefaultSP, states, names, n);
swafter = IUFindOnSwitch(TrackDefaultSP);
if (swbefore != swafter)
{
TrackDefaultSP->s = IPS_IDLE;
IDSetSwitch(TrackDefaultSP, nullptr);
LOGF_INFO("Changed Track Default (from %s to %s).", swbefore->name,
swafter->name);
}
return true;
}
if (strcmp(name, "ST4_GUIDE_RATE_WE") == 0)
{
ISwitch *swbefore, *swafter;
swbefore = IUFindOnSwitch(ST4GuideRateWESP);
IUUpdateSwitch(ST4GuideRateWESP, states, names, n);
swafter = IUFindOnSwitch(ST4GuideRateWESP);
if (swbefore != swafter)
{
unsigned char rate = '0' + (unsigned char)IUFindOnSwitchIndex(ST4GuideRateWESP);
mount->SetST4RAGuideRate(rate);
ST4GuideRateWESP->s = IPS_IDLE;
IDSetSwitch(ST4GuideRateWESP, nullptr);
LOGF_INFO("Changed ST4 Guide rate WE (from %s to %s).", swbefore->label,
swafter->label);
}
return true;
}
if (strcmp(name, "ST4_GUIDE_RATE_NS") == 0)
{
ISwitch *swbefore, *swafter;
swbefore = IUFindOnSwitch(ST4GuideRateNSSP);
IUUpdateSwitch(ST4GuideRateNSSP, states, names, n);
swafter = IUFindOnSwitch(ST4GuideRateNSSP);
if (swbefore != swafter)
{
unsigned char rate = '0' + (unsigned char)IUFindOnSwitchIndex(ST4GuideRateNSSP);
mount->SetST4DEGuideRate(rate);
ST4GuideRateNSSP->s = IPS_IDLE;
IDSetSwitch(ST4GuideRateNSSP, nullptr);
LOGF_INFO("Changed ST4 Guide rate NS (from %s to %s).", swbefore->label,
swafter->label);
}
return true;
}
if (!strcmp(name, "SYNCMANAGE"))
{
ISwitchVectorProperty *svp = getSwitch(name);
IUUpdateSwitch(svp, states, names, n);
ISwitch *sp = IUFindOnSwitch(svp);
if (!sp)
return false;
IDSetSwitch(svp, nullptr);
if (!strcmp(sp->name, "SYNCCLEARDELTA"))
{
bzero(&syncdata, sizeof(syncdata));
bzero(&syncdata2, sizeof(syncdata2));
IUFindNumber(StandardSyncNP, "STANDARDSYNC_RA")->value = syncdata.deltaRA;
IUFindNumber(StandardSyncNP, "STANDARDSYNC_DE")->value = syncdata.deltaDEC;
IDSetNumber(StandardSyncNP, nullptr);
IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_JD")->value = syncdata.jd;
IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_SYNCTIME")->value = syncdata.lst;
IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_CELESTIAL_RA")->value = syncdata.targetRA;
;
IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_CELESTIAL_DE")->value = syncdata.targetDEC;
;
IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_TELESCOPE_RA")->value = syncdata.telescopeRA;
;
IUFindNumber(StandardSyncPointNP, "STANDARDSYNCPOINT_TELESCOPE_DE")->value = syncdata.telescopeDEC;
;
IDSetNumber(StandardSyncPointNP, nullptr);
LOG_INFO("Cleared current Sync Data");
tpa_alt = 0.0;
tpa_az = 0.0;
IUFindNumber(SyncPolarAlignNP, "SYNCPOLARALIGN_ALT")->value = tpa_alt;
IUFindNumber(SyncPolarAlignNP, "SYNCPOLARALIGN_AZ")->value = tpa_az;
IDSetNumber(SyncPolarAlignNP, nullptr);
return true;
}
}
if (!strcmp(name, "REVERSEDEC"))
{
IUUpdateSwitch(ReverseDECSP, states, names, n);
ReverseDECSP->s = IPS_OK;
UpdateDEInverted();
LOG_INFO("Inverting Declination Axis.");
IDSetSwitch(ReverseDECSP, nullptr);
}
if (!strcmp(name, "TARGETPIERSIDE"))
{
IUUpdateSwitch(TargetPierSideSP, states, names, n);
TargetPierSideSP->s = IPS_OK;
TargetPier = PIER_UNKNOWN;
if (IUFindSwitch(TargetPierSideSP, "PIER_EAST")->s == ISS_ON)
{
TargetPier = PIER_EAST;
LOG_INFO("Target pier side set to EAST");
}
else if (IUFindSwitch(TargetPierSideSP, "PIER_WEST")->s == ISS_ON)
{
TargetPier = PIER_WEST;
LOG_INFO("Target pier side set to WEST");
}
IDSetSwitch(TargetPierSideSP, nullptr);
}
//if (MountInformationTP && MountInformationTP->tp && (!strcmp(MountInformationTP->tp[0].text, "EQ8") || !strcmp(MountInformationTP->tp[0].text, "AZEQ6"))) {
if (mount->HasHomeIndexers())
{
if (AutoHomeSP && strcmp(name, AutoHomeSP->name) == 0)
{
if ((TrackState != SCOPE_IDLE) && (TrackState != SCOPE_AUTOHOMING))
{
if (TrackState != SCOPE_AUTOHOMING)
{
AutoHomeSP->s = IPS_IDLE;
IUResetSwitch(AutoHomeSP);
IDSetSwitch(AutoHomeSP, nullptr);
}
LOG_WARN("Can not start AutoHome. Scope not idle");
return true;
}
if (TrackState == SCOPE_AUTOHOMING)
{
AutoHomeSP->s = IPS_IDLE;
IUResetSwitch(AutoHomeSP);
IDSetSwitch(AutoHomeSP, nullptr);
LOG_WARN("Aborting AutoHome.");
Abort();
return true;
}
if (AutohomeState == AUTO_HOME_IDLE)
{
AutoHomeSP->s = IPS_OK;
IUResetSwitch(AutoHomeSP);
IDSetSwitch(AutoHomeSP, nullptr);
LOG_WARN("*** AutoHome NOT TESTED. Press PERFORM AGAIN TO CONFIRM. ***");
AutohomeState = AUTO_HOME_CONFIRM;
ah_confirm_timeout = 10;
return true;
}
if (AutohomeState == AUTO_HOME_CONFIRM)
{
IUUpdateSwitch(AutoHomeSP, states, names, n);
AutoHomeSP->s = IPS_BUSY;
LOG_INFO("Starting Autohome.");
IDSetSwitch(AutoHomeSP, nullptr);
TrackState = SCOPE_AUTOHOMING;
try
{
LOG_INFO("AutoHome phase 1: turning off aux encoders");
mount->TurnRAEncoder(false);
mount->TurnDEEncoder(false);
LOG_INFO("AutoHome phase 1: resetting home position indexes");
mount->ResetRAIndexer();
mount->ResetDEIndexer();
LOG_INFO(
"AutoHome phase 1: reading home position indexes to set directions");
mount->GetRAIndexer();
mount->GetDEIndexer();
LOGF_INFO(
"AutoHome phase 1: read home position indexes: RA=0x%x DE=0x%x",
mount->GetlastreadRAIndexer(), mount->GetlastreadDEIndexer());
if (mount->GetlastreadRAIndexer() == 0)
ah_bSlewingUp_RA = true;
else
ah_bSlewingUp_RA = false;
if (mount->GetlastreadDEIndexer() == 0)
ah_bSlewingUp_DE = true;
else
ah_bSlewingUp_DE = false;
ah_iPosition_RA = mount->GetRAEncoder();
ah_iPosition_DE = mount->GetDEEncoder();
ah_iChanges = (5 * mount->GetRAEncoderTotal()) / 360;
if (ah_bSlewingUp_RA)
ah_iPosition_RA = ah_iPosition_RA - ah_iChanges;
else
ah_iPosition_RA = ah_iPosition_RA + ah_iChanges;
ah_iChanges = (5 * mount->GetDEEncoderTotal()) / 360;
if (ah_bSlewingUp_DE)
ah_iPosition_DE = ah_iPosition_DE - ah_iChanges;
else
ah_iPosition_DE = ah_iPosition_DE + ah_iChanges;
LOG_INFO(
"AutoHome phase 1: trying to move further away from home position");
LOGF_INFO(
"AutoHome phase 1: slewing to RA=0x%x (up=%c) DE=0x%x (up=%c)", ah_iPosition_RA,
(ah_bSlewingUp_RA ? '1' : '0'), ah_iPosition_DE, (ah_bSlewingUp_DE ? '1' : '0'));
mount->AbsSlewTo(ah_iPosition_RA, ah_iPosition_DE, ah_bSlewingUp_RA, ah_bSlewingUp_DE);
AutohomeState = AUTO_HOME_WAIT_PHASE1;
}
catch (EQModError e)
{
AutoHomeSP->s = IPS_ALERT;
IUResetSwitch(AutoHomeSP);
IDSetSwitch(AutoHomeSP, nullptr);
AutohomeState = AUTO_HOME_IDLE;
TrackState = SCOPE_IDLE;
RememberTrackState = TrackState;
return (e.DefaultHandleException(this));
}
}
}
}
if (mount->HasAuxEncoders())
{
if (AuxEncoderSP && strcmp(name, AuxEncoderSP->name) == 0)
{
IUUpdateSwitch(AuxEncoderSP, states, names, n);
if (AuxEncoderSP->sp[1].s == ISS_ON)
{
AuxEncoderSP->s = IPS_OK;
LOG_DEBUG("Turning auxiliary encoders on.");
mount->TurnRAEncoder(true);
mount->TurnDEEncoder(true);
}
else
{
AuxEncoderSP->s = IPS_IDLE;
LOG_DEBUG("Turning auxiliary encoders off.");
mount->TurnRAEncoder(false);
mount->TurnDEEncoder(false);
}
IDSetSwitch(AuxEncoderSP, nullptr);
}
}
if (mount->HasPPEC())
{
if (PPECTrainingSP && strcmp(name, PPECTrainingSP->name) == 0)
{
IUUpdateSwitch(PPECTrainingSP, states, names, n);
if (PPECTrainingSP->sp[1].s == ISS_ON)
{
if (TrackState != SCOPE_TRACKING)
{
PPECTrainingSP->s = IPS_IDLE;
LOG_WARN("Can not start PPEC Training. Scope not tracking");
IUResetSwitch(PPECTrainingSP);
PPECTrainingSP->sp[0].s = ISS_ON;
PPECTrainingSP->sp[1].s = ISS_OFF;
}
else
{
PPECTrainingSP->s = IPS_BUSY;
LOG_INFO("Turning PPEC Training on.");
try
{
mount->TurnPPECTraining(true);
}
catch (EQModError e)
{
LOG_WARN("Unable to start PPEC Training.");
PPECTrainingSP->s = IPS_ALERT;
PPECTrainingSP->sp[0].s = ISS_ON;
PPECTrainingSP->sp[1].s = ISS_OFF;
}
}
}
else
{
PPECTrainingSP->s = IPS_IDLE;
LOG_INFO("Turning PPEC Training off.");
mount->TurnPPECTraining(false);
}
IDSetSwitch(PPECTrainingSP, nullptr);
return true;
}
if (PPECSP && strcmp(name, PPECSP->name) == 0)
{
IUUpdateSwitch(PPECSP, states, names, n);
if (PPECSP->sp[1].s == ISS_ON)
{
PPECSP->s = IPS_BUSY;
LOG_INFO("Turning PPEC on.");
mount->TurnPPEC(true);
}
else
{
PPECSP->s = IPS_IDLE;
LOG_INFO("Turning PPEC off.");
mount->TurnPPEC(false);
}
IDSetSwitch(PPECSP, nullptr);
return true;
}
}
if (mount->HasSnapPort1())
{
if (SNAPPORT1SP && strcmp(name, SNAPPORT1SP->name) == 0)
{
IUUpdateSwitch(SNAPPORT1SP, states, names, n);
if (SNAPPORT1SP->sp[1].s == ISS_ON)
{
SNAPPORT1SP->s = IPS_OK;
DEBUG(INDI::Logger::DBG_DEBUG, "Turning snap port 1 on.");
mount->TurnSnapPort1(true);
}
else
{
SNAPPORT1SP->s = IPS_IDLE;
DEBUG(INDI::Logger::DBG_DEBUG, "Turning snap port 1 off.");
mount->TurnSnapPort1(false);
}
IDSetSwitch(SNAPPORT1SP, nullptr);
return true;
}
}
if (mount->HasSnapPort2())
{
if (SNAPPORT2SP && strcmp(name, SNAPPORT2SP->name) == 0)
{
IUUpdateSwitch(SNAPPORT2SP, states, names, n);
if (SNAPPORT2SP->sp[1].s == ISS_ON)
{
SNAPPORT2SP->s = IPS_OK;
DEBUG(INDI::Logger::DBG_DEBUG, "Turning snap port 2 on.");
mount->TurnSnapPort2(true);
}
else
{
SNAPPORT2SP->s = IPS_IDLE;
DEBUG(INDI::Logger::DBG_DEBUG, "Turning snap port 2 off.");
mount->TurnSnapPort2(false);
}
IDSetSwitch(SNAPPORT2SP, nullptr);
return true;
}
}
#if defined WITH_ALIGN || defined WITH_ALIGN_GEEHALEL
if (AlignSyncModeSP && strcmp(name, AlignSyncModeSP->name) == 0)
{
ISwitch *sw;
AlignSyncModeSP->s = IPS_OK;
IUUpdateSwitch(AlignSyncModeSP, states, names, n);
//for (int i=0; i < n; i++)
// IDLog("AlignSyncMode Switch %s %d\n", names[i], states[i]);
sw = IUFindOnSwitch(AlignSyncModeSP);
IDSetSwitch(AlignSyncModeSP, "Sync mode set to %s", sw->label);
return true;
}
#endif
#if defined WITH_ALIGN_GEEHALEL && defined WITH_ALIGN
if (strcmp(name, AlignMethodSP.name) == 0)
{
ISwitch *sw;
AlignMethodSP.s = IPS_OK;
IUUpdateSwitch(&AlignMethodSP, states, names, n);
//for (int i=0; i < n; i++)
// IDLog("AlignSyncMode Switch %s %d\n", names[i], states[i]);
sw = IUFindOnSwitch(&AlignMethodSP);
IDSetSwitch(&AlignMethodSP, "Align method set to %s", sw->label);
return true;
}
#endif
}
#ifdef WITH_ALIGN_GEEHALEL
if (align)
{
compose = align->ISNewSwitch(dev, name, states, names, n);
if (compose)
return true;
}
#endif
if (simulator)
{
compose = simulator->ISNewSwitch(dev, name, states, names, n);
if (compose)
return true;
}
#ifdef WITH_SCOPE_LIMITS
if (horizon)
{
compose = horizon->ISNewSwitch(dev, name, states, names, n);
if (compose)
return true;
}
#endif
#ifdef WITH_ALIGN
ProcessAlignmentSwitchProperties(this, name, states, names, n);
#endif
INDI::Logger::ISNewSwitch(dev, name, states, names, n);
// Nobody has claimed this, so, ignore it
return INDI::Telescope::ISNewSwitch(dev, name, states, names, n);
}
bool EQMod::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
{
bool compose;
#ifdef WITH_ALIGN_GEEHALEL
if (align)
{
compose = align->ISNewText(dev, name, texts, names, n);
if (compose)
return true;
}
#endif
if (simulator)
{
compose = simulator->ISNewText(dev, name, texts, names, n);
if (compose)
return true;
}
#ifdef WITH_SCOPE_LIMITS
if (horizon)
{
compose = horizon->ISNewText(dev, name, texts, names, n);
if (compose)
return true;
}
#endif
#ifdef WITH_ALIGN
ProcessAlignmentTextProperties(this, name, texts, names, n);
#endif
// Nobody has claimed this, so, ignore it
return INDI::Telescope::ISNewText(dev, name, texts, names, n);
}
#ifdef WITH_ALIGN
bool EQMod::ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[],
char *names[], int n)
{
if (strcmp(dev, getDeviceName()) == 0)
{
// Process alignment properties
ProcessAlignmentBLOBProperties(this, name, sizes, blobsizes, blobs, formats, names, n);
}
// Pass it up the chain
return INDI::Telescope::ISNewBLOB(dev, name, sizes, blobsizes, blobs, formats, names, n);
}
#endif
bool EQMod::updateTime(ln_date *lndate_utc, double utc_offset)
{
char utc_time[32];
lndate.seconds = lndate_utc->seconds;
lndate.minutes = lndate_utc->minutes;
lndate.hours = lndate_utc->hours;
lndate.days = lndate_utc->days;
lndate.months = lndate_utc->months;
lndate.years = lndate_utc->years;
utc.tm_sec = lndate.seconds;
utc.tm_min = lndate.minutes;
utc.tm_hour = lndate.hours;
utc.tm_mday = lndate.days;
utc.tm_mon = lndate.months - 1;
utc.tm_year = lndate.years - 1900;
gettimeofday(&lasttimeupdate, nullptr);
get_utc_time(&lastclockupdate);
strftime(utc_time, 32, "%Y-%m-%dT%H:%M:%S", &utc);
LOGF_INFO("Setting UTC Time to %s, Offset %g", utc_time, utc_offset);
return true;
}
double EQMod::GetRASlew()
{
ISwitch *sw;
double rate = 1.0;
sw = IUFindOnSwitch(&SlewRateSP);
if (!strcmp(sw->name, "SLEWCUSTOM"))
rate = IUFindNumber(SlewSpeedsNP, "RASLEW")->value;
else
rate = *((double *)sw->aux);
return rate;
}
double EQMod::GetDESlew()
{
ISwitch *sw;
double rate = 1.0;
sw = IUFindOnSwitch(&SlewRateSP);
if (!strcmp(sw->name, "SLEWCUSTOM"))
rate = IUFindNumber(SlewSpeedsNP, "DESLEW")->value;
else
rate = *((double *)sw->aux);
return rate;
}
bool EQMod::MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command)
{
const char *dirStr = (dir == DIRECTION_NORTH) ? "North" : "South";
double rate = (dir == DIRECTION_NORTH) ? GetDESlew() : GetDESlew() * -1;
try
{
switch (command)
{
case MOTION_START:
if (gotoInProgress() || (TrackState == SCOPE_PARKING) || (TrackState == SCOPE_PARKED))
{
LOG_WARN("Can not slew while goto/park in progress, or scope parked.");
return false;
}
LOGF_INFO("Starting %s slew.", dirStr);
if (DEInverted)
rate = -rate;
mount->SlewDE(rate);
//TrackState = SCOPE_SLEWING;
break;
case MOTION_STOP:
LOGF_INFO("%s Slew stopped", dirStr);
mount->StopDE();
//if (TrackModeSP->s == IPS_BUSY)
if (RememberTrackState == SCOPE_TRACKING)
{
LOG_INFO("Restarting DE Tracking...");
TrackState = SCOPE_TRACKING;
mount->StartDETracking(GetDETrackRate());
}
else
TrackState = SCOPE_IDLE;
RememberTrackState = TrackState;
break;
}
}
catch (EQModError e)
{
return e.DefaultHandleException(this);
}
return true;
}
bool EQMod::MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command)
{
const char *dirStr = (dir == DIRECTION_WEST) ? "West" : "East";
double rate = (dir == DIRECTION_WEST) ? GetRASlew() : GetRASlew() * -1;
try
{
switch (command)
{
case MOTION_START:
if (gotoInProgress() || (TrackState == SCOPE_PARKING) || (TrackState == SCOPE_PARKED))
{
LOG_WARN("Can not slew while goto/park in progress, or scope parked.");
return false;
}
LOGF_INFO("Starting %s slew.", dirStr);
if (RAInverted)
rate = -rate;
mount->SlewRA(rate);
//TrackState = SCOPE_SLEWING;
break;
case MOTION_STOP:
LOGF_INFO("%s Slew stopped", dirStr);
mount->StopRA();
//if (TrackModeSP->s == IPS_BUSY)
if (RememberTrackState == SCOPE_TRACKING)
{
LOG_INFO("Restarting RA Tracking...");
TrackState = SCOPE_TRACKING;
mount->StartRATracking(GetRATrackRate());
}
else
TrackState = SCOPE_IDLE;
RememberTrackState = TrackState;
break;
}
}
catch (EQModError e)
{
return e.DefaultHandleException(this);
}
return true;
}
bool EQMod::Abort()
{
try
{
mount->StopRA();
}
catch (EQModError e)
{
if (!(e.DefaultHandleException(this)))
{
LOG_WARN("Abort: error while stopping RA motor");
}
}
try
{
mount->StopDE();
}
catch (EQModError e)
{
if (!(e.DefaultHandleException(this)))
{
LOG_WARN("Abort: error while stopping DE motor");
}
}
GuideNSNP.s = IPS_IDLE;
IDSetNumber(&GuideNSNP, nullptr);
GuideWENP.s = IPS_IDLE;
IDSetNumber(&GuideWENP, nullptr);
#if 0
TrackModeSP->s = IPS_IDLE;
IUResetSwitch(TrackModeSP);
IDSetSwitch(TrackModeSP, nullptr);
#endif
AutohomeState = AUTO_HOME_IDLE;
AutoHomeSP->s = IPS_IDLE;
IUResetSwitch(AutoHomeSP);
IDSetSwitch(AutoHomeSP, nullptr);
TrackState = SCOPE_IDLE;
RememberTrackState = TrackState;
if (gotoparams.completed == false)
gotoparams.completed = true;
return true;
}
void EQMod::timedguideNSCallback(void *userpointer)
{
EQMod *p = ((EQMod *)userpointer);
p->pulseInProgress &= ~1;
try
{
p->mount->StartDETracking(p->GetDETrackRate());
}
catch (EQModError e)
{
if (!(e.DefaultHandleException(p)))
{
DEBUGDEVICE(p->getDeviceName(), INDI::Logger::DBG_WARNING,
"Timed guide North/South Error: can not restart tracking");
}
}
p->GuideComplete(AXIS_DE);
DEBUGDEVICE(p->getDeviceName(), INDI::Logger::DBG_DEBUG, "End Timed guide North/South");
IERmTimer(p->GuideTimerNS);
}
void EQMod::timedguideWECallback(void *userpointer)
{
EQMod *p = ((EQMod *)userpointer);
p->pulseInProgress &= ~2;
try
{
if (p->mount->HasPPEC())
{
if (p->restartguidePPEC)
{
p->restartguidePPEC = false;
DEBUGDEVICE(p->getDeviceName(), INDI::Logger::DBG_SESSION, "Turning PPEC on after guiding.");
p->mount->TurnPPEC(true);
}
}
p->mount->StartRATracking(p->GetRATrackRate());
}
catch (EQModError e)
{
if (!(e.DefaultHandleException(p)))
{
DEBUGDEVICE(p->getDeviceName(), INDI::Logger::DBG_WARNING,
"Timed guide West/East Error: can not restart tracking");
}
}
p->GuideComplete(AXIS_RA);
DEBUGDEVICE(p->getDeviceName(), INDI::Logger::DBG_DEBUG, "End Timed guide West/East");
IERmTimer(p->GuideTimerWE);
}
void EQMod::computePolarAlign(SyncData s1, SyncData s2, double lat, double *tpaalt, double *tpaaz)
/*
From // // http://www.whim.org/nebula/math/pdf/twostar.pdf
*/
{
double delta1 = 0, alpha1 = 0, delta2 = 0, alpha2 = 0;
double d1 = 0, d2 = 0; /* corrected delta1/delta2 */
double cdelta1 = 0, calpha1 = 0, cdelta2 = 0, calpha2 = 0;
double Delta = 0;
double cosDelta1 = 0, cosDelta2 = 0;
double cosd2pd1 = 0, d2pd1 = 0;
double tpadelta = 0, tpaalpha = 0;
double sintpadelta = 0, costpaalpha = 0, sintpaalpha = 0;
double cosama1 = 0, cosama2 = 0;
double cosaz = 0, sinaz = 0;
double beta = 0;
// Star s2 polar align
double s2tra = 0, s2tdec = 0;
char s2trasexa[13], s2tdecsexa[13];
char s2rasexa[13], s2decsexa[13];
alpha1 = DEG_TO_RAD((s1.telescopeRA - s1.lst) * 360.0 / 24.0);
delta1 = DEG_TO_RAD(s1.telescopeDEC);
alpha2 = DEG_TO_RAD((s2.telescopeRA - s2.lst) * 360.0 / 24.0);
delta2 = DEG_TO_RAD(s2.telescopeDEC);
calpha1 = DEG_TO_RAD((s1.targetRA - s1.lst) * 360.0 / 24.0);
cdelta1 = DEG_TO_RAD(s1.targetDEC);
calpha2 = DEG_TO_RAD((s2.targetRA - s2.lst) * 360.0 / 24.0);
cdelta2 = DEG_TO_RAD(s2.targetDEC);
if ((calpha2 == calpha1) || (alpha1 == alpha2))
return;
cosDelta1 = sin(cdelta1) * sin(cdelta2) + (cos(cdelta1) * cos(cdelta2) * cos(calpha2 - calpha1));
cosDelta2 = sin(delta1) * sin(delta2) + (cos(delta1) * cos(delta2) * cos(alpha2 - alpha1));
if (cosDelta1 != cosDelta2)
LOGF_DEBUG(
"PolarAlign -- Telescope axes are not perpendicular. Angular distances are:celestial=%g telescope=%g",
acos(cosDelta1), acos(cosDelta2));
Delta = acos(cosDelta1);
LOGF_DEBUG("Angular distance of the two stars is %g", Delta);
//cosd2md1 = sin(delta1) * sin(delta2) + cos(delta1) * cos(delta2);
cosd2pd1 = ((cos(delta2 - delta1) * (1 + cos(alpha2 - alpha1))) - (2.0 * cosDelta2)) / (1 - cos(alpha2 - alpha1));
d2pd1 = acos(cosd2pd1);
if (delta2 * delta1 > 0.0)
{
/* same sign */
if (delta1 < 0.0)
d2pd1 = -d2pd1;
}
else
{
if (fabs(delta1) > fabs(delta2))
{
if (delta1 < 0.0)
d2pd1 = -d2pd1;
}
else
{
if (delta2 < 0.0)
d2pd1 = -d2pd1;
}
}
d2 = (d2pd1 + delta2 - delta1) / 2.0;
d1 = d2pd1 - d2;
LOGF_DEBUG("Computed delta1 = %g (%g) delta2 = %g (%g)", d1, delta1, d2, delta2);
delta1 = d1;
delta2 = d2;
sintpadelta =
(sin(delta1) * sin(cdelta1)) + (sin(delta2) * sin(cdelta2)) -
cosDelta1 * ((sin(delta1) * sin(cdelta2)) + (sin(cdelta1) * sin(delta2))) +
(cos(delta1) * cos(delta2) * sin(alpha2 - alpha1) * cos(cdelta1) * cos(cdelta2) * sin(calpha2 - calpha1));
sintpadelta = sintpadelta / (sin(Delta) * sin(Delta));
tpadelta = asin(sintpadelta);
cosama1 = (sin(delta1) - (sin(cdelta1) * sintpadelta)) / (cos(cdelta1) * cos(tpadelta));
cosama2 = (sin(delta2) - (sin(cdelta2) * sintpadelta)) / (cos(cdelta2) * cos(tpadelta));
costpaalpha = (sin(calpha2) * cosama1 - sin(calpha1) * cosama2) / sin(calpha2 - calpha1);
sintpaalpha = (cos(calpha1) * cosama2 - cos(calpha2) * cosama1) / sin(calpha2 - calpha1);
//tpaalpha = acos(costpaalpha);
//if (sintpaalpha < 0) tpaalpha = 2 * M_PI - tpaalpha;
// tpadelta and tpaaplha are very near M_PI / 2 d: DON'T USE atan2
//tpaalpha=atan2(sintpaalpha, costpaalpha);
tpaalpha = 2 * atan2(sintpaalpha, (1.0 + costpaalpha));
LOGF_DEBUG("Computed Telescope polar alignment (rad): delta(dec) = %g alpha(ha) = %g",
tpadelta, tpaalpha);
beta = DEG_TO_RAD(lat);
*tpaalt = asin(sin(tpadelta) * sin(beta) + (cos(tpadelta) * cos(beta) * cos(tpaalpha)));
cosaz = (sin(tpadelta) - (sin(*tpaalt) * sin(beta))) / (cos(*tpaalt) * cos(beta));
sinaz = (cos(tpadelta) * sin(tpaalpha)) / cos(*tpaalt);
//*tpaaz = acos(cosaz);
//if (sinaz < 0) *tpaaz = 2 * M_PI - *tpaaz;
*tpaaz = atan2(sinaz, cosaz);
*tpaalt = RAD_TO_DEG(*tpaalt);
*tpaaz = RAD_TO_DEG(*tpaaz);
LOGF_DEBUG("Computed Telescope polar alignment (deg): alt = %g az = %g", *tpaalt, *tpaaz);
starPolarAlign(s2.lst, s2.targetRA, s2.targetDEC, (M_PI / 2) - tpaalpha, (M_PI / 2) - tpadelta, &s2tra, &s2tdec);
fs_sexa(s2trasexa, s2tra, 2, 3600);
fs_sexa(s2tdecsexa, s2tdec, 3, 3600);
fs_sexa(s2rasexa, s2.targetRA, 2, 3600);
fs_sexa(s2decsexa, s2.targetDEC, 3, 3600);
LOGF_INFO("Star (RA=%s DEC=%s) Polar Align Coords: RA=%s DEC=%s", s2rasexa, s2decsexa,
s2trasexa, s2tdecsexa);
s2tra = s2.targetRA + (s2.targetRA - s2tra);
s2tdec = s2.targetDEC + (s2.targetDEC - s2tdec);
fs_sexa(s2trasexa, s2tra, 2, 3600);
fs_sexa(s2tdecsexa, s2tdec, 3, 3600);
fs_sexa(s2rasexa, s2.targetRA, 2, 3600);
fs_sexa(s2decsexa, s2.targetDEC, 3, 3600);
LOGF_INFO("Star (RA=%s DEC=%s) Polar Align Goto: RA=%s DEC=%s", s2rasexa, s2decsexa,
s2trasexa, s2tdecsexa);
}
void EQMod::starPolarAlign(double lst, double ra, double dec, double theta, double gamma, double *tra, double *tdec)
{
double rotz[3][3];
double rotx[3][3];
double mat[3][3];
double H;
double Lc, Mc, Nc;
double mra, mdec;
double L, M, N;
int i, j, k;
H = (lst - ra) * M_PI / 12.0;
dec = dec * M_PI / 180.0;
rotz[0][0] = cos(theta);
rotz[0][1] = -sin(theta);
rotz[0][2] = 0.0;
rotz[1][0] = sin(theta);
rotz[1][1] = cos(theta);
rotz[1][2] = 0.0;
rotz[2][0] = 0.0;
rotz[2][1] = 0.0;
rotz[2][2] = 1.0;
rotx[0][0] = 1.0;
rotx[0][1] = 0.0;
rotx[0][2] = 0.0;
rotx[1][0] = 0.0;
rotx[1][1] = cos(gamma);
rotx[1][2] = -sin(gamma);
rotx[2][0] = 0.0;
rotx[2][1] = sin(gamma);
rotx[2][2] = cos(gamma);
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
mat[i][j] = 0.0;
for (k = 0; k < 3; k++)
mat[i][j] += rotx[i][k] * rotz[k][j];
}
}
Lc = cos(dec) * cos(-H);
Mc = cos(dec) * sin(-H);
Nc = sin(dec);
L = mat[0][0] * Lc + mat[0][1] * Mc + mat[0][2] * Nc;
M = mat[1][0] * Lc + mat[1][1] * Mc + mat[1][2] * Nc;
N = mat[2][0] * Lc + mat[2][1] * Mc + mat[2][2] * Nc;
mra = atan2(M, L) * 12.0 / M_PI;
//mra=atan(M/L) * 12.0 / M_PI;
//printf("atan(M/L) %g L=%g M=%g N=%g\n", mra, L, M, N);
//if (L < 0.0) mra = 12.0 + mra;
mra += lst;
while (mra < 0.0)
mra += 24.0;
while (mra > 24.0)
mra -= 24.0;
mdec = asin(N) * 180.0 / M_PI;
*tra = mra;
*tdec = mdec;
}
bool EQMod::updateLocation(double latitude, double longitude, double elevation)
{
m_Location.longitude = longitude;
m_Location.latitude = latitude;
m_Location.elevation = elevation;
if (latitude < 0.0)
SetSouthernHemisphere(true);
else
SetSouthernHemisphere(false);
#ifdef WITH_ALIGN
INDI::AlignmentSubsystem::AlignmentSubsystemForDrivers::UpdateLocation(latitude, longitude, elevation);
// Set this according to mount type
SetApproximateMountAlignmentFromMountType(EQUATORIAL);
#endif
// Make display longitude to be in the standard 0 to +180 East, and 0 to -180 West.
// No need to confuse new users with INDI format.
char lat_str[MAXINDIFORMAT] = {0}, lng_str[MAXINDIFORMAT] = {0};
double display_longitude = longitude > 180 ? longitude - 360 : longitude;
fs_sexa(lat_str, m_Location.latitude, 2, 36000);
fs_sexa(lng_str, display_longitude, 2, 36000);
// Choose WGS 84, also known as EPSG:4326 for latitude/longitude ordering
LOGF_INFO("Observer location updated: Latitude %.12s (%.2f) Longitude %.12s (%.2f)", lat_str, m_Location.latitude, lng_str,
display_longitude);
return true;
}
void EQMod::saveInitialParkPosition()
{
// If there is no initial park data. We assume the default parking position
// Looking at celestial pole with weights down
SetDefaultPark();
WriteParkData();
}
bool EQMod::SetCurrentPark()
{
parkRAEncoder = currentRAEncoder;
parkDEEncoder = currentDEEncoder;
SetAxis1Park(parkRAEncoder);
SetAxis2Park(parkDEEncoder);
LOGF_INFO("Setting Park Position to current RA Encoder=%ld DE Encoder=%ld",
static_cast(parkRAEncoder), static_cast(parkDEEncoder));
return true;
}
bool EQMod::SetDefaultPark()
{
parkRAEncoder = GetAxis1ParkDefault();
parkDEEncoder = GetAxis2ParkDefault();
SetAxis1Park(parkRAEncoder);
SetAxis2Park(parkDEEncoder);
LOGF_INFO("Setting Park Position to default RA Encoder=%ld DE Encoder=%ld",
static_cast(parkRAEncoder), static_cast(parkDEEncoder));
return true;
}
bool EQMod::saveConfigItems(FILE *fp)
{
INDI::Telescope::saveConfigItems(fp);
if (BacklashNP)
IUSaveConfigNumber(fp, BacklashNP);
if (UseBacklashSP)
IUSaveConfigSwitch(fp, UseBacklashSP);
if (GuideRateNP)
IUSaveConfigNumber(fp, GuideRateNP);
if (PulseLimitsNP)
IUSaveConfigNumber(fp, PulseLimitsNP);
if (SlewSpeedsNP)
IUSaveConfigNumber(fp, SlewSpeedsNP);
if (ReverseDECSP)
IUSaveConfigSwitch(fp, ReverseDECSP);
if (LEDBrightnessNP)
IUSaveConfigNumber(fp, LEDBrightnessNP);
if (HasPECState())
IUSaveConfigSwitch(fp, PPECSP);
#ifdef WITH_ALIGN_GEEHALEL
if (align)
align->saveConfigItems(fp);
#endif
#ifdef WITH_SCOPE_LIMITS
if (horizon)
horizon->saveConfigItems(fp);
#endif
return true;
}
bool EQMod::SetTrackRate(double raRate, double deRate)
{
try
{
mount->SetRARate(raRate / SKYWATCHER_STELLAR_SPEED);
mount->SetDERate(deRate / SKYWATCHER_STELLAR_SPEED);
}
catch (EQModError e)
{
return (e.DefaultHandleException(this));
}
LOGF_INFO("Setting Custom Tracking Rates - RA=%.6f DE=%.6f arcsec/s", raRate, deRate);
return true;
}
bool EQMod::SetTrackMode(uint8_t mode)
{
// GetRATrackRate..etc al already check TrackModeSP to obtain the appropiate tracking rate, so no need for mode here.
INDI_UNUSED(mode);
try
{
mount->StartRATracking(GetRATrackRate());
mount->StartDETracking(GetDETrackRate());
}
catch (EQModError e)
{
return (e.DefaultHandleException(this));
}
return true;
}
bool EQMod::SetTrackEnabled(bool enabled)
{
try
{
if (enabled)
{
LOGF_INFO("Start Tracking (%s).", IUFindOnSwitch(&TrackModeSP)->label);
TrackState = SCOPE_TRACKING;
RememberTrackState = TrackState;
mount->StartRATracking(GetRATrackRate());
mount->StartDETracking(GetDETrackRate());
}
else if (enabled == false)
{
LOGF_WARN("Stopping Tracking (%s).", IUFindOnSwitch(&TrackModeSP)->label);
TrackState = SCOPE_IDLE;
RememberTrackState = TrackState;
mount->StopRA();
mount->StopDE();
}
}
catch (EQModError e)
{
return (e.DefaultHandleException(this));
}
return true;
}
indi-eqmod-1.0+20220129131520/indi-eqmod.spec 0000644 0001751 0001751 00000004162 14174600255 017112 0 ustar debian debian %define __cmake_in_source_build %{_vpath_builddir}
Name: indi-eqmod
Version:1.9.5.git
Release: %(date -u +%%Y%%m%%d%%H%%M%%S)%{?dist}
Summary: Instrument Neutral Distributed Interface 3rd party drivers
License: LGPLv2
# See COPYRIGHT file for a description of the licenses and files covered
URL: https://indilib.org
Source0: https://github.com/indilib/indi-3rdparty/archive/master.tar.gz
BuildRequires: cmake
BuildRequires: libfli-devel
BuildRequires: libnova-devel
BuildRequires: qt5-qtbase-devel
BuildRequires: systemd
BuildRequires: gphoto2-devel
BuildRequires: LibRaw-devel
BuildRequires: indi-libs
BuildRequires: indi-devel
BuildRequires: libtiff-devel
BuildRequires: cfitsio-devel
BuildRequires: zlib-devel
BuildRequires: gsl-devel
BuildRequires: libcurl-devel
BuildRequires: libjpeg-turbo-devel
BuildRequires: fftw-devel
BuildRequires: libftdi-devel
BuildRequires: gpsd-devel
BuildRequires: libdc1394-devel
BuildRequires: boost-devel
BuildRequires: boost-regex
BuildRequires: gmock
BuildRequires: pkgconfig(fftw3)
BuildRequires: pkgconfig(cfitsio)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(gsl)
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libusb-1.0)
BuildRequires: pkgconfig(zlib)
%description
INDI is a distributed control protocol designed to operate
astronomical instrumentation. INDI is small, flexible, easy to parse,
and scalable. It supports common DCS functions such as remote control,
data acquisition, monitoring, and a lot more. This is a 3rd party driver.
%prep -v
%autosetup -v -p1 -n indi-3rdparty-master
%build
# This package tries to mix and match PIE and PIC which is wrong and will
# trigger link errors when LTO is enabled.
# Disable LTO
%define _lto_cflags %{nil}
cd indi-eqmod
%cmake .
make VERBOSE=1 %{?_smp_mflags} -j4
%install
cd indi-eqmod
make DESTDIR=%{buildroot} install
%files
%license indi-eqmod/COPYING LICENSE
%doc indi-eqmod/AUTHORS indi-eqmod/README
%{_bindir}/*
%{_datadir}/indi
%changelog
* Sun Jul 19 2020 Jim Howard 1.8.7.git-1
- update to build from git for copr, credit to Sergio Pascual and Christian Dersch for prior work on spec files
indi-eqmod-1.0+20220129131520/mach_gettime.cpp 0000644 0001751 0001751 00000000771 14174600255 017344 0 ustar debian debian /* complete rewrite May 2017, Rumen G.Bogdanovski */
#include
#ifdef __MACH__ /* Mac OSX prior Sierra is missing clock_gettime() */
#include
#include
void get_utc_time(struct timespec *ts)
{
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
ts->tv_sec = mts.tv_sec;
ts->tv_nsec = mts.tv_nsec;
}
#endif
indi-eqmod-1.0+20220129131520/scope-limits/ 0000755 0001751 0001751 00000000000 14174600255 016615 5 ustar debian debian indi-eqmod-1.0+20220129131520/scope-limits/scope-limits.h 0000644 0001751 0001751 00000005333 14174600255 021402 0 ustar debian debian /* Copyright 2014 Geehalel (geehalel AT gmail DOT com) */
/* This file is part of the Skywatcher Protocol INDI driver.
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#pragma once
#include
#include
class HorizonLimits
{
protected:
private:
INDI::Telescope *telescope;
ITextVectorProperty *HorizonLimitsDataFileTP;
IBLOBVectorProperty *HorizonLimitsDataFitsBP;
INumberVectorProperty *HorizonLimitsPointNP;
ISwitchVectorProperty *HorizonLimitsTraverseSP;
ISwitchVectorProperty *HorizonLimitsManageSP;
ISwitchVectorProperty *HorizonLimitsFileOperationSP;
ISwitchVectorProperty *HorizonLimitsOnLimitSP;
ISwitchVectorProperty *HorizonLimitsLimitGotoSP;
std::vector *horizon;
int horizonindex;
char *WriteDataFile(const char *filename);
char *LoadDataFile(const char *filename);
char errorline[128];
char *sline;
bool HorizonInitialized;
public:
HorizonLimits(INDI::Telescope *);
virtual ~HorizonLimits();
const char *getDeviceName(); // used for logger
virtual bool initProperties();
virtual void ISGetProperties();
virtual bool updateProperties();
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n);
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n);
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n);
virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
char *formats[], char *names[], int n);
virtual void Init();
virtual void Reset();
virtual bool inLimits(double az, double alt);
virtual bool inGotoLimits(double az, double alt);
virtual bool checkLimits(double az, double alt, INDI::Telescope::TelescopeStatus status, bool ingoto);
virtual bool saveConfigItems(FILE *fp);
static bool cmp(INDI::IHorizontalCoordinates const &h1, INDI::IHorizontalCoordinates const &h2);
};
indi-eqmod-1.0+20220129131520/scope-limits/indi_eqmod_scope_limits_sk.xml 0000644 0001751 0001751 00000005325 14174600255 024723 0 ustar debian debian
~/.indi/HorizonData.txt
0.0
0.0
Off
Off
Off
Off
Off
Off
Off
Off
Off
On
Off
Off
Off
On
indi-eqmod-1.0+20220129131520/scope-limits/scope-limits.cpp 0000644 0001751 0001751 00000060011 14174600255 021727 0 ustar debian debian /* Copyright 2012 Geehalel (geehalel AT gmail DOT com) */
/* This file is part of the Skywatcher Protocol INDI driver.
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#include "scope-limits.h"
#include "../eqmodbase.h"
#include
#include
#include // std::sort
#include
// Predicate ordering horizon points per increasing azimuth
bool HorizonLimits::cmp(INDI::IHorizontalCoordinates const &h1, INDI::IHorizontalCoordinates const &h2)
{
return (h1.azimuth < h2.azimuth);
}
HorizonLimits::HorizonLimits(INDI::Telescope *t)
{
telescope = t;
horizon = new std::vector;
horizonindex = -1;
strcpy(errorline, "Bad number format line ");
sline = errorline + 23;
HorizonInitialized = false;
}
HorizonLimits::~HorizonLimits()
{
delete (horizon);
horizon = nullptr;
horizonindex = -1;
}
const char *HorizonLimits::getDeviceName()
{
return telescope->getDeviceName();
}
void HorizonLimits::Reset()
{
if (horizon)
horizon->erase(horizon->begin(), horizon->end());
}
void HorizonLimits::Init()
{
if (!HorizonInitialized)
{
char *res = LoadDataFile(IUFindText(HorizonLimitsDataFileTP, "HORIZONLIMITSFILENAME")->text);
if (res)
{
LOGF_WARN("Can not load HorizonLimits Data File %s: %s",
IUFindText(HorizonLimitsDataFileTP, "HORIZONLIMITSFILENAME")->text, res);
}
else
{
LOGF_INFO("HorizonLimits: Data loaded from file %s",
IUFindText(HorizonLimitsDataFileTP, "HORIZONLIMITSFILENAME")->text);
}
}
HorizonInitialized = true;
}
bool HorizonLimits::initProperties()
{
/* Load properties from the skeleton file */
telescope->buildSkeleton("indi_eqmod_scope_limits_sk.xml");
HorizonLimitsDataFileTP = telescope->getText("HORIZONLIMITSDATAFILE");
HorizonLimitsDataFitsBP = telescope->getBLOB("HORIZONLIMITSDATAFITS");
HorizonLimitsPointNP = telescope->getNumber("HORIZONLIMITSPOINT");
HorizonLimitsTraverseSP = telescope->getSwitch("HORIZONLIMITSTRAVERSE");
HorizonLimitsManageSP = telescope->getSwitch("HORIZONLIMITSMANAGE");
HorizonLimitsFileOperationSP = telescope->getSwitch("HORIZONLIMITSFILEOPERATION");
HorizonLimitsOnLimitSP = telescope->getSwitch("HORIZONLIMITSONLIMIT");
HorizonLimitsLimitGotoSP = telescope->getSwitch("HORIZONLIMITSLIMITGOTO");
return true;
}
void HorizonLimits::ISGetProperties()
{
if (telescope->isConnected())
{
telescope->defineProperty(HorizonLimitsDataFileTP);
telescope->defineProperty(HorizonLimitsDataFitsBP);
telescope->defineProperty(HorizonLimitsPointNP);
telescope->defineProperty(HorizonLimitsTraverseSP);
telescope->defineProperty(HorizonLimitsManageSP);
telescope->defineProperty(HorizonLimitsFileOperationSP);
telescope->defineProperty(HorizonLimitsOnLimitSP);
telescope->defineProperty(HorizonLimitsLimitGotoSP);
}
}
bool HorizonLimits::updateProperties()
{
//IDLog("HorizonLimits update properties connected = %d.\n",(telescope->isConnected()?1:0) );
if (telescope->isConnected())
{
telescope->defineProperty(HorizonLimitsDataFileTP);
telescope->defineProperty(HorizonLimitsDataFitsBP);
telescope->defineProperty(HorizonLimitsPointNP);
telescope->defineProperty(HorizonLimitsTraverseSP);
telescope->defineProperty(HorizonLimitsManageSP);
telescope->defineProperty(HorizonLimitsFileOperationSP);
telescope->defineProperty(HorizonLimitsOnLimitSP);
telescope->defineProperty(HorizonLimitsLimitGotoSP);
Init();
}
else if (HorizonLimitsDataFileTP)
{
telescope->deleteProperty(HorizonLimitsDataFileTP->name);
telescope->deleteProperty(HorizonLimitsDataFitsBP->name);
telescope->deleteProperty(HorizonLimitsPointNP->name);
telescope->deleteProperty(HorizonLimitsTraverseSP->name);
telescope->deleteProperty(HorizonLimitsManageSP->name);
telescope->deleteProperty(HorizonLimitsFileOperationSP->name);
telescope->deleteProperty(HorizonLimitsOnLimitSP->name);
telescope->deleteProperty(HorizonLimitsLimitGotoSP->name);
}
return true;
}
bool HorizonLimits::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
{
// first check if it's for our device
if (strcmp(dev, telescope->getDeviceName()) == 0)
{
if (HorizonLimitsPointNP && strcmp(name, HorizonLimitsPointNP->name) == 0)
{
std::vector::iterator low;
HorizonLimitsPointNP->s = IPS_OK;
if (IUUpdateNumber(HorizonLimitsPointNP, values, names, n) != 0)
{
HorizonLimitsPointNP->s = IPS_ALERT;
IDSetNumber(HorizonLimitsPointNP, nullptr);
return false;
}
INDI::IHorizontalCoordinates hp{values[0], values[1]};
if (binary_search(horizon->begin(), horizon->end(), hp, HorizonLimits::cmp))
{
DEBUGF(INDI::Logger::DBG_WARNING,
"Horizon Limits: point with Az = %f already present. Delete it first.", hp.azimuth);
HorizonLimitsPointNP->s = IPS_ALERT;
IDSetNumber(HorizonLimitsPointNP, nullptr);
return false;
}
horizon->push_back(hp);
std::sort(horizon->begin(), horizon->end(), HorizonLimits::cmp);
low = std::lower_bound(horizon->begin(), horizon->end(), hp, HorizonLimits::cmp);
horizonindex = std::distance(horizon->begin(), low);
DEBUGF(INDI::Logger::DBG_SESSION,
"Horizon Limits: Added point Az = %lf, Alt = %lf, Rank=%d (Total %d points)", hp.azimuth, hp.altitude,
horizonindex, horizon->size());
IDSetNumber(HorizonLimitsPointNP, nullptr);
return true;
}
}
return false;
}
bool HorizonLimits::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
{
if (strcmp(dev, telescope->getDeviceName()) == 0)
{
if (HorizonLimitsTraverseSP && strcmp(name, HorizonLimitsTraverseSP->name) == 0)
{
if (!horizon || horizon->size() == 0)
{
LOG_WARN("Horizon Limits: Can not traverse empty list");
HorizonLimitsTraverseSP->s = IPS_ALERT;
IDSetSwitch(HorizonLimitsTraverseSP, nullptr);
return true;
}
ISwitch *sw;
INumber *az = IUFindNumber(HorizonLimitsPointNP, "HORIZONLIMITS_POINT_AZ");
INumber *alt = IUFindNumber(HorizonLimitsPointNP, "HORIZONLIMITS_POINT_ALT");
IUUpdateSwitch(HorizonLimitsTraverseSP, states, names, n);
sw = IUFindOnSwitch(HorizonLimitsTraverseSP);
if (!strcmp(sw->name, "HORIZONLIMITSLISTFIRST"))
{
horizonindex = 0;
}
if (!strcmp(sw->name, "HORIZONLIMITSLISTPREV"))
{
if (horizonindex > 0)
horizonindex = horizonindex - 1;
else if (horizonindex == -1)
horizonindex = horizon->size() - 1;
}
if (!strcmp(sw->name, "HORIZONLIMITSLISTNEXT"))
{
if (horizonindex < (int)(horizon->size() - 1))
horizonindex = horizonindex + 1;
}
if (!strcmp(sw->name, "HORIZONLIMITSLISTLAST"))
{
horizonindex = horizon->size() - 1;
}
az->value = horizon->at(horizonindex).azimuth;
alt->value = horizon->at(horizonindex).altitude;
HorizonLimitsPointNP->s = IPS_OK;
IDSetNumber(HorizonLimitsPointNP, nullptr);
HorizonLimitsTraverseSP->s = IPS_OK;
IDSetSwitch(HorizonLimitsTraverseSP, nullptr);
return true;
}
if (HorizonLimitsManageSP && strcmp(name, HorizonLimitsManageSP->name) == 0)
{
ISwitch *sw;
IUUpdateSwitch(HorizonLimitsManageSP, states, names, n);
sw = IUFindOnSwitch(HorizonLimitsManageSP);
INumber *az = IUFindNumber(HorizonLimitsPointNP, "HORIZONLIMITS_POINT_AZ");
INumber *alt = IUFindNumber(HorizonLimitsPointNP, "HORIZONLIMITS_POINT_ALT");
if (!strcmp(sw->name, "HORIZONLIMITSLISTADDCURRENT"))
{
std::vector::iterator low;
double values[2];
const char *names[] = { "HORIZONLIMITS_POINT_AZ", "HORIZONLIMITS_POINT_ALT" };
INumberVectorProperty *horizontalcoords = telescope->getNumber("HORIZONTAL_COORD");
if (!horizontalcoords)
{
LOG_WARN("Horizon Limits: Scope does not support horizontal coordinates.");
HorizonLimitsManageSP->s = IPS_ALERT;
IDSetSwitch(HorizonLimitsManageSP, nullptr);
return false;
}
values[0] = IUFindNumber(horizontalcoords, "AZ")->value;
values[1] = IUFindNumber(horizontalcoords, "ALT")->value;
if (IUUpdateNumber(HorizonLimitsPointNP, values, (char **)names, 2) != 0)
{
HorizonLimitsPointNP->s = IPS_ALERT;
IDSetNumber(HorizonLimitsPointNP, nullptr);
HorizonLimitsManageSP->s = IPS_ALERT;
IDSetSwitch(HorizonLimitsManageSP, nullptr);
return false;
}
INDI::IHorizontalCoordinates hp{values[0], values[1]};
if (binary_search(horizon->begin(), horizon->end(), hp, HorizonLimits::cmp))
{
DEBUGF(INDI::Logger::DBG_WARNING,
"Horizon Limits: point with Az = %f already present. Delete it first.", hp.azimuth);
HorizonLimitsManageSP->s = IPS_ALERT;
IDSetSwitch(HorizonLimitsManageSP, nullptr);
return false;
}
horizon->push_back(hp);
std::sort(horizon->begin(), horizon->end(), HorizonLimits::cmp);
low = std::lower_bound(horizon->begin(), horizon->end(), hp, HorizonLimits::cmp);
horizonindex = std::distance(horizon->begin(), low);
DEBUGF(INDI::Logger::DBG_SESSION,
"Horizon Limits: Added point Az = %f, Alt = %f, Rank=%d (Total %d points)", hp.azimuth, hp.altitude,
horizonindex, horizon->size());
HorizonLimitsPointNP->s = IPS_OK;
IDSetNumber(HorizonLimitsPointNP, nullptr);
HorizonLimitsManageSP->s = IPS_OK;
IDSetSwitch(HorizonLimitsManageSP, nullptr);
return true;
}
else if (!strcmp(sw->name, "HORIZONLIMITSLISTDELETE"))
{
if (!horizon || (horizonindex >= (int)horizon->size()))
{
LOG_WARN("Horizon Limits: Can not delete point");
HorizonLimitsManageSP->s = IPS_ALERT;
IDSetSwitch(HorizonLimitsManageSP, nullptr);
return true;
}
LOGF_INFO("Horizon Limits: Deleted point Az = %f, Alt = %f, Rank=%d",
horizon->at(horizonindex).azimuth, horizon->at(horizonindex).altitude, horizonindex);
horizon->erase(horizon->begin() + horizonindex);
if (horizonindex >= (int)horizon->size())
horizonindex = horizon->size() - 1;
az->value = horizon->at(horizonindex).azimuth;
alt->value = horizon->at(horizonindex).altitude;
HorizonLimitsPointNP->s = IPS_OK;
IDSetNumber(HorizonLimitsPointNP, nullptr);
HorizonLimitsManageSP->s = IPS_OK;
IDSetSwitch(HorizonLimitsManageSP, nullptr);
return true;
}
else if (!strcmp(sw->name, "HORIZONLIMITSLISTCLEAR"))
{
LOG_INFO("Horizon Limits: List cleared");
if (horizon)
horizon->erase(horizon->begin(), horizon->end());
horizonindex = -1;
az->value = 0.0;
alt->value = 0.0;
HorizonLimitsPointNP->s = IPS_OK;
IDSetNumber(HorizonLimitsPointNP, nullptr);
HorizonLimitsManageSP->s = IPS_OK;
IDSetSwitch(HorizonLimitsManageSP, nullptr);
return true;
}
}
if (HorizonLimitsFileOperationSP && strcmp(name, HorizonLimitsFileOperationSP->name) == 0)
{
ISwitch *sw;
IUUpdateSwitch(HorizonLimitsFileOperationSP, states, names, n);
sw = IUFindOnSwitch(HorizonLimitsFileOperationSP);
if (!strcmp(sw->name, "HORIZONLIMITSWRITEFILE"))
{
char *res;
res = WriteDataFile(IUFindText(HorizonLimitsDataFileTP, "HORIZONLIMITSFILENAME")->text);
if (res)
{
LOGF_WARN("Can not save HorizonLimits Data to file %s: %s",
IUFindText(HorizonLimitsDataFileTP, "HORIZONLIMITSFILENAME")->text, res);
HorizonLimitsFileOperationSP->s = IPS_ALERT;
}
else
{
LOGF_INFO("HorizonLimits: Data saved in file %s",
IUFindText(HorizonLimitsDataFileTP, "HORIZONLIMITSFILENAME")->text);
HorizonLimitsFileOperationSP->s = IPS_OK;
}
}
else if (!strcmp(sw->name, "HORIZONLIMITSLOADFILE"))
{
char *res;
//Reset();
res = LoadDataFile(IUFindText(HorizonLimitsDataFileTP, "HORIZONLIMITSFILENAME")->text);
if (res)
{
LOGF_WARN("Can not load HorizonLimits Data File %s: %s",
IUFindText(HorizonLimitsDataFileTP, "HORIZONLIMITSFILENAME")->text, res);
HorizonLimitsFileOperationSP->s = IPS_ALERT;
}
else
{
LOGF_INFO("HorizonLimits: Data loaded from file %s",
IUFindText(HorizonLimitsDataFileTP, "HORIZONLIMITSFILENAME")->text);
HorizonLimitsFileOperationSP->s = IPS_OK;
}
}
IDSetSwitch(HorizonLimitsFileOperationSP, nullptr);
return true;
}
if (HorizonLimitsOnLimitSP && strcmp(name, HorizonLimitsOnLimitSP->name) == 0)
{
HorizonLimitsOnLimitSP->s = IPS_OK;
IUUpdateSwitch(HorizonLimitsOnLimitSP, states, names, n);
IDSetSwitch(HorizonLimitsOnLimitSP, nullptr);
return true;
}
if (HorizonLimitsLimitGotoSP && strcmp(name, HorizonLimitsLimitGotoSP->name) == 0)
{
HorizonLimitsLimitGotoSP->s = IPS_OK;
IUUpdateSwitch(HorizonLimitsLimitGotoSP, states, names, n);
IDSetSwitch(HorizonLimitsLimitGotoSP, nullptr);
return true;
}
}
return false;
}
bool HorizonLimits::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
{
if (strcmp(dev, telescope->getDeviceName()) == 0)
{
if (HorizonLimitsDataFileTP && (strcmp(name, HorizonLimitsDataFileTP->name) == 0))
{
IUUpdateText(HorizonLimitsDataFileTP, texts, names, n);
IDSetText(HorizonLimitsDataFileTP, nullptr);
return true;
}
}
return false;
}
bool HorizonLimits::ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
char *formats[], char *names[], int num)
{
INDI_UNUSED(dev);
INDI_UNUSED(name);
INDI_UNUSED(sizes);
INDI_UNUSED(blobsizes);
INDI_UNUSED(blobs);
INDI_UNUSED(formats);
INDI_UNUSED(names);
INDI_UNUSED(num);
return false;
}
char *HorizonLimits::WriteDataFile(const char *filename)
{
wordexp_t wexp;
FILE *fp;
char lon[10], lat[10];
INumberVectorProperty *geo = telescope->getNumber("GEOGRAPHIC_COORD");
INumber *nlon = IUFindNumber(geo, "LONG");
INumber *nlat = IUFindNumber(geo, "LAT");
if (wordexp(filename, &wexp, 0))
{
wordfree(&wexp);
return (char *)("Badly formed filename");
}
if (!horizon)
{
return (char *)"No Horizon data";
}
if (!(fp = fopen(wexp.we_wordv[0], "w")))
{
wordfree(&wexp);
return strerror(errno);
}
setlocale(LC_NUMERIC, "C");
numberFormat(lon, "%10.6m", nlon->value);
numberFormat(lat, "%10.6m", nlat->value);
fprintf(fp, "# Horizon Data for device %s\n", getDeviceName());
fprintf(fp, "# Location: longitude=%s latitude=%s\n", lon, lat);
fprintf(fp, "# Created on %s by %s\n", timestamp(), telescope->getDriverName());
for (std::vector::iterator it = horizon->begin(); it != horizon->end(); ++it)
fprintf(fp, "%g %g\n", it->azimuth, it->altitude);
fclose(fp);
setlocale(LC_NUMERIC, "");
return nullptr;
}
char *HorizonLimits::LoadDataFile(const char *filename)
{
wordexp_t wexp;
FILE *fp;
char *line = nullptr;
size_t len = 0;
ssize_t read;
int nline = 0, pos = 0;
INumber *az = IUFindNumber(HorizonLimitsPointNP, "HORIZONLIMITS_POINT_AZ");
INumber *alt = IUFindNumber(HorizonLimitsPointNP, "HORIZONLIMITS_POINT_ALT");
if (wordexp(filename, &wexp, 0))
{
wordfree(&wexp);
return (char *)("Badly formed filename");
}
if (!(fp = fopen(wexp.we_wordv[0], "r")))
{
wordfree(&wexp);
return strerror(errno);
}
wordfree(&wexp);
Reset();
setlocale(LC_NUMERIC, "C");
while ((read = getline(&line, &len, fp)) != -1)
{
char *s = line;
while ((*s == ' ') || (*s == '\t'))
s++;
if (*s == '#')
continue;
double az, alt;
if (sscanf(s, "%lg%n", &az, &pos) != 1)
{
fclose(fp);
snprintf((char *)sline, 4, "%d", nline);
setlocale(LC_NUMERIC, "");
return (char *)errorline;
}
s += pos;
while ((*s == ' ') || (*s == '\t'))
s++;
if (sscanf(s, "%lg%n", &alt, &pos) != 1)
{
fclose(fp);
snprintf((char *)sline, 4, "%d", nline);
setlocale(LC_NUMERIC, "");
return (char *)errorline;
}
INDI::IHorizontalCoordinates one{az, alt};
horizon->push_back(one);
nline++;
pos = 0;
}
horizonindex = -1;
az->value = 0.0;
alt->value = 0.0;
HorizonLimitsPointNP->s = IPS_OK;
IDSetNumber(HorizonLimitsPointNP, nullptr);
if (line)
free(line);
fclose(fp);
setlocale(LC_NUMERIC, "");
return nullptr;
}
bool HorizonLimits::inLimits(double raw_az, double raw_alt)
{
INDI::IHorizontalCoordinates const scope{raw_az, raw_alt};
// Minimal altitude is zero if there is no horizon - arguable
if (horizon == nullptr || horizon->size() == 0)
return scope.altitude >= 0.0;
// If there is a single horizon point, test altitude directly
if (horizon->size() == 1)
return scope.altitude >= horizon->begin()->altitude;
// Search for the horizon point just after which the tested point may be inserted - see std::lower_bound documentation
std::vector::iterator next = std::lower_bound(horizon->begin(), horizon->end(), scope,
HorizonLimits::cmp);
// If the tested point would be inserted at the end of the horizon list, loop next point back to first
if (next == horizon->end())
next = horizon->begin();
// If the tested azimuth is identical to the next point, test altitude directly
if (next->azimuth == scope.azimuth)
return (scope.altitude >= next->altitude);
// Grab the previous horizon point - the one after which inserting the tested point does not alter horizon ordering
std::vector::iterator const prev = ((next == horizon->begin()) ? horizon->end() : next) - 1;
// If the altitude is identical between the two horizon siblings, test altitude directly
if (prev->altitude == next->altitude)
return (scope.altitude >= next->altitude);
// Compute azimuth distances for horizon point and scope point from reference point
double const delta_horizon_az = (next->azimuth - prev->azimuth) + ((next->azimuth >= prev->azimuth) ? 0.0 : 360.0);
double const delta_scope_az = (scope.azimuth - prev->azimuth) + ((scope.azimuth >= prev->azimuth) ? 0.0 : 360.0);
// Compute a linear interpolation coefficient between the two horizontal points and test against interpolated altitude
double const delta_horizon_alt = next->altitude - prev->altitude;
double const h = prev->altitude + delta_horizon_alt * delta_scope_az / delta_horizon_az;
return (scope.altitude >= h);
}
bool HorizonLimits::inGotoLimits(double az, double alt)
{
ISwitch *swlimitgotodisable = IUFindSwitch(HorizonLimitsLimitGotoSP, "HORIZONLIMITSLIMITGOTODISABLE");
return (inLimits(az, alt) || (swlimitgotodisable->s == ISS_ON));
}
bool HorizonLimits::checkLimits(double az, double alt, INDI::Telescope::TelescopeStatus status, bool ingoto)
{
static bool warningMessageDispatched = false;
bool abortscope = false;
ISwitch *swaborttrack = IUFindSwitch(HorizonLimitsOnLimitSP, "HORIZONLIMITSONLIMITTRACK");
ISwitch *swabortslew = IUFindSwitch(HorizonLimitsOnLimitSP, "HORIZONLIMITSONLIMITSLEW");
ISwitch *swabortgoto = IUFindSwitch(HorizonLimitsOnLimitSP, "HORIZONLIMITSONLIMITGOTO");
if (!(inLimits(az, alt)))
{
if ((status == INDI::Telescope::SCOPE_TRACKING) && (swaborttrack->s == ISS_ON))
{
abortscope = true;
LOGF_WARN("Horizon Limits: Scope at AZ=%3.3lf ALT=%3.3lf is outside limits. Abort Tracking.", az, alt);
}
else if ((status == INDI::Telescope::SCOPE_SLEWING) && (swabortslew->s == ISS_ON) && !ingoto)
{
abortscope = true;
LOGF_WARN("Horizon Limits: Scope at AZ=%3.3lf ALT=%3.3lf is outside limits. Abort Slewing.", az, alt);
}
else if ((status == INDI::Telescope::SCOPE_SLEWING) && (swabortgoto->s == ISS_ON) && ingoto)
{
abortscope = true;
LOGF_WARN("Horizon Limits: Scope at AZ=%3.3lf ALT=%3.3lf is outside limits. Abort Goto.", az, alt);
}
else if (!warningMessageDispatched)
{
warningMessageDispatched = true;
LOGF_WARN("Horizon Limits: Scope at AZ=%3.3lf ALT=%3.3lf is outside limits. Nothing to abort.", az, alt);
}
}
else
warningMessageDispatched = false;
return (abortscope);
}
bool HorizonLimits::saveConfigItems(FILE *fp)
{
if (HorizonLimitsOnLimitSP)
IUSaveConfigSwitch(fp, HorizonLimitsOnLimitSP);
if (HorizonLimitsLimitGotoSP)
IUSaveConfigSwitch(fp, HorizonLimitsLimitGotoSP);
return true;
}
indi-eqmod-1.0+20220129131520/cmake_modules/ 0000755 0001751 0001751 00000000000 14174600255 017015 5 ustar debian debian indi-eqmod-1.0+20220129131520/cmake_modules/FindGPSD.cmake 0000644 0001751 0001751 00000001036 14174600255 021355 0 ustar debian debian # - Find GPSD
# Find the native GPSD includes and library
FIND_PATH(GPSD_INCLUDE_DIR libgpsmm.h gps.h)
SET(GPSD_NAMES ${GPSD_NAMES} gps)
FIND_LIBRARY(GPSD_LIBRARY NAMES ${GPSD_NAMES} )
# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GPSD DEFAULT_MSG GPSD_LIBRARY GPSD_INCLUDE_DIR)
IF(GPSD_FOUND)
SET(GPSD_LIBRARIES ${GPSD_LIBRARY})
message(STATUS "Found libgps: ${GPSD_LIBRARIES}")
ENDIF(GPSD_FOUND)
indi-eqmod-1.0+20220129131520/cmake_modules/FindFTDI1.cmake 0000644 0001751 0001751 00000002672 14174600255 021436 0 ustar debian debian # - Try to find FTDI1
# Once done this will define
#
# FTDI1_FOUND - system has FTDI
# FTDI1_INCLUDE_DIR - the FTDI include directory
# FTDI1_LIBRARIES - Link these to use FTDI
#
# N.B. You must include the file as following:
#
#include
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES)
# in cache already
set(FTDI1_FOUND TRUE)
message(STATUS "Found libftdi1: ${FTDI1_LIBRARIES}")
else (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES)
find_path(FTDI1_INCLUDE_DIR ftdi.h
PATH_SUFFIXES libftdi1
${_obIncDir}
${GNUWIN32_DIR}/include
/usr/local/include
)
find_library(FTDI1_LIBRARIES NAMES ftdi1
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
/usr/local/lib
)
if(FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES)
set(FTDI1_FOUND TRUE)
else (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES)
set(FTDI1_FOUND FALSE)
endif(FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES)
if (FTDI1_FOUND)
if (NOT FTDI1_FIND_QUIETLY)
message(STATUS "Found FTDI1: ${FTDI1_LIBRARIES}")
endif (NOT FTDI1_FIND_QUIETLY)
else (FTDI1_FOUND)
if (FTDI1_FIND_REQUIRED)
message(FATAL_ERROR "FTDI not found. Please install libftdi1-dev")
endif (FTDI1_FIND_REQUIRED)
endif (FTDI1_FOUND)
mark_as_advanced(FTDI1_INCLUDE_DIR FTDI1_LIBRARIES)
endif (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindOpenAL.cmake 0000644 0001751 0001751 00000006604 14174600255 021744 0 ustar debian debian # Locate OpenAL
# This module defines
# OPENAL_LIBRARY
# OPENAL_FOUND, if false, do not try to link to OpenAL
# OPENAL_INCLUDE_DIR, where to find the headers
#
# $OPENALDIR is an environment variable that would
# correspond to the ./configure --prefix=$OPENALDIR
# used in building OpenAL.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake module.
# This makes the presumption that you are include al.h like
# #include "al.h"
# and not
# #include
# The reason for this is that the latter is not entirely portable.
# Windows/Creative Labs does not by default put their headers in AL/ and
# OS X uses the convention .
#
# For Windows, Creative Labs seems to have added a registry key for their
# OpenAL 1.1 installer. I have added that key to the list of search paths,
# however, the key looks like it could be a little fragile depending on
# if they decide to change the 1.00.0000 number for bug fix releases.
# Also, they seem to have laid down groundwork for multiple library platforms
# which puts the library in an extra subdirectory. Currently there is only
# Win32 and I have hardcoded that here. This may need to be adjusted as
# platforms are introduced.
# The OpenAL 1.0 installer doesn't seem to have a useful key I can use.
# I do not know if the Nvidia OpenAL SDK has a registry key.
#
# For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger).
# To support the framework, I originally wrote special framework detection
# code in this module which I have now removed with CMake's introduction
# of native support for frameworks.
# In addition, OpenAL is open source, and it is possible to compile on Panther.
# Furthermore, due to bugs in the initial OpenAL release, and the
# transition to OpenAL 1.1, it is common to need to override the built-in
# framework.
# Per my request, CMake should search for frameworks first in
# the following order:
# ~/Library/Frameworks/OpenAL.framework/Headers
# /Library/Frameworks/OpenAL.framework/Headers
# /System/Library/Frameworks/OpenAL.framework/Headers
#
# On OS X, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# OPENAL_LIBRARY to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
FIND_PATH(OPENAL_INCLUDE_DIR al.h
PATHS
$ENV{OPENALDIR}
NO_DEFAULT_PATH
PATH_SUFFIXES include/AL include/OpenAL include
)
FIND_PATH(OPENAL_INCLUDE_DIR al.h
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
PATH_SUFFIXES include/AL include/OpenAL include
)
FIND_LIBRARY(OPENAL_LIBRARY
NAMES OpenAL al openal OpenAL32
PATHS
$ENV{OPENALDIR}
NO_DEFAULT_PATH
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
)
FIND_LIBRARY(OPENAL_LIBRARY
NAMES OpenAL al openal OpenAL32
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
)
SET(OPENAL_FOUND "NO")
IF(OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
SET(OPENAL_FOUND "YES")
ENDIF(OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
indi-eqmod-1.0+20220129131520/cmake_modules/FindFFTW3.cmake 0000644 0001751 0001751 00000002573 14174600255 021460 0 ustar debian debian # - Try to find FFTW3
# Once done this will define
#
# FFTW3_FOUND - system has FFTW3
# FFTW3_INCLUDE_DIR - the FFTW3 include directory
# FFTW3_LIBRARIES - Link these to use FFTW3
# FFTW3_VERSION_STRING - Human readable version number of fftw3
# FFTW3_VERSION_MAJOR - Major version number of fftw3
# FFTW3_VERSION_MINOR - Minor version number of fftw3
# Copyright (c) 2017, Ilia Platone,
# Based on FindLibfacile by Carsten Niehaus,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (FFTW3_LIBRARIES)
# in cache already
set(FFTW3_FOUND TRUE)
message(STATUS "Found FFTW3: ${FFTW3_LIBRARIES}")
else (FFTW3_LIBRARIES)
find_library(FFTW3_LIBRARIES NAMES fftw3
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
/usr/local/lib
)
if(FFTW3_LIBRARIES)
set(FFTW3_FOUND TRUE)
else (FFTW3_LIBRARIES)
set(FFTW3_FOUND FALSE)
endif(FFTW3_LIBRARIES)
if (FFTW3_FOUND)
if (NOT FFTW3_FIND_QUIETLY)
message(STATUS "Found FFTW3: ${FFTW3_LIBRARIES}")
endif (NOT FFTW3_FIND_QUIETLY)
else (FFTW3_FOUND)
if (FFTW3_FIND_REQUIRED)
message(FATAL_ERROR "FFTW3 not found. Please install libfftw3-dev")
endif (FFTW3_FIND_REQUIRED)
endif (FFTW3_FOUND)
mark_as_advanced(FFTW3_LIBRARIES)
endif (FFTW3_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindMALLINCAM.cmake 0000644 0001751 0001751 00000003013 14174600255 022112 0 ustar debian debian # - Try to find MALLINCAM Camera Library
# Once done this will define
#
# MALLINCAM_FOUND - system has Levenhuk
# MALLINCAM_INCLUDE_DIR - the Levenhuk include directory
# MALLINCAM_LIBRARIES - Link these to use Levenhuk
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES)
# in cache already
set(MALLINCAM_FOUND TRUE)
message(STATUS "Found libnncam: ${MALLINCAM_LIBRARIES}")
else (MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES)
find_path(MALLINCAM_INCLUDE_DIR mallincam.h
PATH_SUFFIXES libmallincam
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(MALLINCAM_LIBRARIES NAMES mallincam
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES)
set(MALLINCAM_FOUND TRUE)
else (MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES)
set(MALLINCAM_FOUND FALSE)
endif(MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES)
if (MALLINCAM_FOUND)
if (NOT MALLINCAM_FIND_QUIETLY)
message(STATUS "Found MALLINCAM: ${MALLINCAM_LIBRARIES}")
endif (NOT MALLINCAM_FIND_QUIETLY)
else (MALLINCAM_FOUND)
if (MALLINCAM_FIND_REQUIRED)
message(FATAL_ERROR "MALLINCAM not found. Please install MALLINCAM Library http://www.indilib.org")
endif (MALLINCAM_FIND_REQUIRED)
endif (MALLINCAM_FOUND)
mark_as_advanced(MALLINCAM_INCLUDE_DIR MALLINCAM_LIBRARIES)
endif (MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindNova.cmake 0000644 0001751 0001751 00000003046 14174600255 021526 0 ustar debian debian # - Try to find NOVA
# Once done this will define
#
# NOVA_FOUND - system has NOVA
# NOVA_INCLUDE_DIR - the NOVA include directory
# NOVA_LIBRARIES - Link these to use NOVA
# Copyright (c) 2006, Jasem Mutlaq
# Based on FindLibfacile by Carsten Niehaus,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES)
# in cache already
set(NOVA_FOUND TRUE)
message(STATUS "Found libnova: ${NOVA_LIBRARIES}")
else (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES)
find_path(NOVA_INCLUDE_DIR libnova.h
PATH_SUFFIXES libnova
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(NOVA_LIBRARIES NAMES nova libnova libnovad
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
set(CMAKE_REQUIRED_INCLUDES ${NOVA_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${NOVA_LIBRARIES})
if(NOVA_INCLUDE_DIR AND NOVA_LIBRARIES)
set(NOVA_FOUND TRUE)
else (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES)
set(NOVA_FOUND FALSE)
endif(NOVA_INCLUDE_DIR AND NOVA_LIBRARIES)
if (NOVA_FOUND)
if (NOT Nova_FIND_QUIETLY)
message(STATUS "Found NOVA: ${NOVA_LIBRARIES}")
endif (NOT Nova_FIND_QUIETLY)
else (NOVA_FOUND)
if (Nova_FIND_REQUIRED)
message(FATAL_ERROR "libnova not found. Please install libnova development package.")
endif (Nova_FIND_REQUIRED)
endif (NOVA_FOUND)
mark_as_advanced(NOVA_INCLUDE_DIR NOVA_LIBRARIES)
endif (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindVorbis.cmake 0000644 0001751 0001751 00000002044 14174600255 022064 0 ustar debian debian # - Find vorbis
# Find the native vorbis includes and libraries
#
# VORBIS_INCLUDE_DIR - where to find vorbis.h, etc.
# VORBIS_LIBRARIES - List of libraries when using vorbis(file).
# VORBIS_FOUND - True if vorbis found.
if(VORBIS_INCLUDE_DIR)
# Already in cache, be silent
set(VORBIS_FIND_QUIETLY TRUE)
endif(VORBIS_INCLUDE_DIR)
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
find_library(OGG_LIBRARY NAMES ogg)
find_library(VORBIS_LIBRARY NAMES vorbis)
find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
# Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VORBIS DEFAULT_MSG
VORBIS_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBIS_LIBRARY)
if(VORBIS_FOUND)
set(VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
else(VORBIS_FOUND)
set(VORBIS_LIBRARIES)
endif(VORBIS_FOUND)
mark_as_advanced(VORBIS_INCLUDE_DIR)
mark_as_advanced(OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
indi-eqmod-1.0+20220129131520/cmake_modules/FindJPEG.cmake 0000644 0001751 0001751 00000001663 14174600255 021353 0 ustar debian debian # - Find JPEG
# Find the native JPEG includes and library
# This module defines
# JPEG_INCLUDE_DIR, where to find jpeglib.h, etc.
# JPEG_LIBRARIES, the libraries needed to use JPEG.
# JPEG_FOUND, If false, do not try to use JPEG.
# also defined, but not for general use are
# JPEG_LIBRARY, where to find the JPEG library.
FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h)
SET(JPEG_NAMES ${JPEG_NAMES} jpeg)
FIND_LIBRARY(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR)
IF(JPEG_FOUND)
SET(JPEG_LIBRARIES ${JPEG_LIBRARY})
ENDIF(JPEG_FOUND)
# Deprecated declarations.
SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} )
GET_FILENAME_COMPONENT (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH)
MARK_AS_ADVANCED(JPEG_LIBRARY JPEG_INCLUDE_DIR )
indi-eqmod-1.0+20220129131520/cmake_modules/FindCFITSIO.cmake 0000644 0001751 0001751 00000004346 14174600255 021727 0 ustar debian debian # - Try to find CFITSIO
# Once done this will define
#
# CFITSIO_FOUND - system has CFITSIO
# CFITSIO_INCLUDE_DIR - the CFITSIO include directory
# CFITSIO_LIBRARIES - Link these to use CFITSIO
# CFITSIO_VERSION_STRING - Human readable version number of cfitsio
# CFITSIO_VERSION_MAJOR - Major version number of cfitsio
# CFITSIO_VERSION_MINOR - Minor version number of cfitsio
# Copyright (c) 2006, Jasem Mutlaq
# Based on FindLibfacile by Carsten Niehaus,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
# in cache already
set(CFITSIO_FOUND TRUE)
message(STATUS "Found CFITSIO: ${CFITSIO_LIBRARIES}")
else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
# JM: Packages from different distributions have different suffixes
find_path(CFITSIO_INCLUDE_DIR fitsio.h
PATH_SUFFIXES libcfitsio3 libcfitsio0 cfitsio
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(CFITSIO_LIBRARIES NAMES cfitsio
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
set(CFITSIO_FOUND TRUE)
else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
set(CFITSIO_FOUND FALSE)
endif(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
if (CFITSIO_FOUND)
# Find the version of the cfitsio header
file(STRINGS ${CFITSIO_INCLUDE_DIR}/fitsio.h CFITSIO_VERSION_STRING LIMIT_COUNT 1 REGEX "CFITSIO_VERSION")
STRING(REGEX REPLACE "[^0-9.]" "" CFITSIO_VERSION_STRING ${CFITSIO_VERSION_STRING})
STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\1" CFITSIO_VERSION_MAJOR ${CFITSIO_VERSION_STRING})
STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\2" CFITSIO_VERSION_MINOR ${CFITSIO_VERSION_STRING})
if (NOT CFITSIO_FIND_QUIETLY)
message(STATUS "Found CFITSIO ${CFITSIO_VERSION_STRING}: ${CFITSIO_LIBRARIES}")
endif (NOT CFITSIO_FIND_QUIETLY)
else (CFITSIO_FOUND)
if (CFITSIO_FIND_REQUIRED)
message(STATUS "CFITSIO not found.")
endif (CFITSIO_FIND_REQUIRED)
endif (CFITSIO_FOUND)
mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARIES)
endif (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindUSB1.cmake 0000644 0001751 0001751 00000005623 14174600255 021340 0 ustar debian debian # - Try to find libusb-1.0
# Once done this will define
#
# USB1_FOUND - system has libusb-1.0
# USB1_INCLUDE_DIRS - the libusb-1.0 include directories
# USB1_LIBRARIES - Link these to use libusb-1.0
# USB1_DEFINITIONS - Compiler switches required for using libusb-1.0
#
# USB1_HAS_LIBUSB_ERROR_NAME - defined when libusb-1.0 has libusb_error_name()
#=============================================================================
# Copyright (c) 2017 Pino Toscano
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
find_package(PkgConfig)
pkg_check_modules(PC_LIBUSB1 QUIET libusb-1.0)
find_path(USB1_INCLUDE_DIR
NAMES
libusb.h
HINTS
${PC_LIBUSB1_INCLUDE_DIRS}
PATH_SUFFIXES
libusb-1.0
)
find_library(USB1_LIBRARY
NAMES
${PC_LIBUSB1_LIBRARIES}
usb-1.0
HINTS
${PC_LIBUSB1_LIBRARY_DIRS}
)
set(USB1_INCLUDE_DIRS ${USB1_INCLUDE_DIR})
set(USB1_LIBRARIES ${USB1_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(USB1
FOUND_VAR
USB1_FOUND
REQUIRED_VARS
USB1_LIBRARY
USB1_INCLUDE_DIR
VERSION_VAR
PC_LIBUSB1_VERSION
)
mark_as_advanced(USB1_INCLUDE_DIRS USB1_LIBRARIES)
if(USB1_FOUND)
include(CheckCXXSourceCompiles)
include(CMakePushCheckState)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_INCLUDES ${USB1_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${USB1_LIBRARIES})
check_cxx_source_compiles("#include
int main() { libusb_error_name(0); return 0; }" USB1_HAS_LIBUSB_ERROR_NAME)
cmake_pop_check_state()
endif()
indi-eqmod-1.0+20220129131520/cmake_modules/FindGMock.cmake 0000644 0001751 0001751 00000011623 14174600255 021623 0 ustar debian debian #.rst:
# FindGMock
# ---------
#
# Locate the Google C++ Mocking Framework.
#
# Defines the following variables:
#
# ::
#
# GMOCK_FOUND - Found the Google Mocking framework
# GMOCK_INCLUDE_DIRS - Include directories
#
#
#
# Also defines the library variables below as normal variables. These
# contain debug/optimized keywords when a debugging library is found.
#
# ::
#
# GMOCK_LIBRARIES - libgmock
#
#
#
# Accepts the following variables as input:
#
# ::
#
# GMOCK_ROOT - (as a CMake or environment variable)
# The root directory of the gmock install prefix
#
#
#
# ::
#
# GMOCK_MSVC_SEARCH - If compiling with MSVC, this variable can be set to
# "MD" or "MT" to enable searching a GMock build tree
# (defaults: "MD")
#
#
#
# Example Usage:
#
# ::
#
# find_package(GMock REQUIRED)
# include_directories(${GMOCK_INCLUDE_DIRS})
#
#
#
# ::
#
# add_executable(foo foo.cc)
# target_link_libraries(foo ${GMOCK_LIBRARIES})
#
#
#
# ::
#
# add_test(AllMocksInFoo foo)
#
#
#
#
#
# If you would like each Google test to show up in CMock as a test you
# may use the following macro. NOTE: It will slow down your tests by
# running an executable for each test and test fixture. You will also
# have to rerun CMake after adding or removing tests or test fixtures.
#
# GMOCK_ADD_MOCKS(executable extra_args ARGN)
#
# ::
#
# executable = The path to the test executable
# extra_args = Pass a list of extra arguments to be passed to
# executable enclosed in quotes (or "" for none)
# ARGN = A list of source files to search for tests & test
# fixtures.
#
#
#
# ::
#
# Example:
# set(FooMockArgs --foo 1 --bar 2)
# add_executable(FooMock FooUnitMock.cc)
# GMOCK_ADD_MOCKS(FooMock "${FooMockArgs}" FooUnitMock.cc)
#=============================================================================
# Copyright 2009 Kitware, Inc.
# Copyright 2009 Philip Lowman
# Copyright 2009 Daniel Blezek
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
#
# Thanks to Daniel Blezek for the GMOCK_ADD_MOCKS code
function(GMOCK_ADD_MOCKS executable extra_args)
if(NOT ARGN)
message(FATAL_ERROR "Missing ARGN: Read the documentation for GMOCK_ADD_MOCKS")
endif()
foreach(source ${ARGN})
file(READ "${source}" contents)
string(REGEX MATCHALL "MOCK_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
foreach(hit ${found_tests})
string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit})
add_test(${test_name} ${executable} --gmock_filter=${test_name} ${extra_args})
endforeach()
endforeach()
endfunction()
function(_gmock_append_debugs _endvar _library)
if(${_library} AND ${_library}_DEBUG)
set(_output optimized ${${_library}} debug ${${_library}_DEBUG})
else()
set(_output ${${_library}})
endif()
set(${_endvar} ${_output} PARENT_SCOPE)
endfunction()
function(_gmock_find_library _name)
find_library(${_name}
NAMES ${ARGN}
HINTS
ENV GMOCK_ROOT
${GMOCK_ROOT}
PATH_SUFFIXES ${_gmock_libpath_suffixes}
)
mark_as_advanced(${_name})
endfunction()
#
if(NOT DEFINED GMOCK_MSVC_SEARCH)
set(GMOCK_MSVC_SEARCH MD)
endif()
set(_gmock_libpath_suffixes lib)
if(MSVC)
if(GMOCK_MSVC_SEARCH STREQUAL "MD")
list(APPEND _gmock_libpath_suffixes
msvc/gmock-md/Debug
msvc/gmock-md/Release)
elseif(GMOCK_MSVC_SEARCH STREQUAL "MT")
list(APPEND _gmock_libpath_suffixes
msvc/gmock/Debug
msvc/gmock/Release)
endif()
endif()
find_path(GMOCK_INCLUDE_DIR gmock/gmock.h
HINTS
$ENV{GMOCK_ROOT}/include
${GMOCK_ROOT}/include
)
mark_as_advanced(GMOCK_INCLUDE_DIR)
if(MSVC AND GMOCK_MSVC_SEARCH STREQUAL "MD")
# The provided /MD project files for Google Mock add -md suffixes to the
# library names.
_gmock_find_library(GMOCK_LIBRARY gmock-md gmock)
_gmock_find_library(GMOCK_LIBRARY_DEBUG gmock-mdd gmockd)
else()
_gmock_find_library(GMOCK_LIBRARY gmock)
_gmock_find_library(GMOCK_LIBRARY_DEBUG gmockd)
endif()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMock DEFAULT_MSG GMOCK_LIBRARY GMOCK_INCLUDE_DIR)
if(GMOCK_FOUND)
set(GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIR})
_gmock_append_debugs(GMOCK_LIBRARIES GMOCK_LIBRARY)
endif()
indi-eqmod-1.0+20220129131520/cmake_modules/FindPackageMessage.cmake 0000644 0001751 0001751 00000003755 14174600255 023472 0 ustar debian debian #.rst:
# FindPackageMessage
# ------------------
#
#
#
# FIND_PACKAGE_MESSAGE( "message for user" "find result details")
#
# This macro is intended to be used in FindXXX.cmake modules files. It
# will print a message once for each unique find result. This is useful
# for telling the user where a package was found. The first argument
# specifies the name (XXX) of the package. The second argument
# specifies the message to display. The third argument lists details
# about the find result so that if they change the message will be
# displayed again. The macro also obeys the QUIET argument to the
# find_package command.
#
# Example:
#
# ::
#
# if(X11_FOUND)
# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
# else()
# ...
# endif()
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
function(FIND_PACKAGE_MESSAGE pkg msg details)
# Avoid printing a message repeatedly for the same find result.
if(NOT ${pkg}_FIND_QUIETLY)
string(REPLACE "\n" "" details "${details}")
set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
# The message has not yet been printed.
message(STATUS "${msg}")
# Save the find details in the cache to avoid printing the same
# message again.
set("${DETAILS_VAR}" "${details}"
CACHE INTERNAL "Details about finding ${pkg}")
endif()
endif()
endfunction()
indi-eqmod-1.0+20220129131520/cmake_modules/FindFTDI.cmake 0000644 0001751 0001751 00000002671 14174600255 021354 0 ustar debian debian # - Try to find FTDI
# This finds libFTDI that is compatible with old libusb v 0.1
# For newer libusb > 1.0, use FindFTDI1.cmake
# Once done this will define
#
# FTDI_FOUND - system has FTDI
# FTDI_INCLUDE_DIR - the FTDI include directory
# FTDI_LIBRARIES - Link these to use FTDI
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (FTDI_INCLUDE_DIR AND FTDI_LIBRARIES)
# in cache already
set(FTDI_FOUND TRUE)
message(STATUS "Found libftdi: ${FTDI_LIBRARIES}")
else (FTDI_INCLUDE_DIR AND FTDI_LIBRARIES)
find_path(FTDI_INCLUDE_DIR ftdi.h
PATH_SUFFIXES libftdi1
${_obIncDir}
${GNUWIN32_DIR}/include
/usr/local/include
)
find_library(FTDI_LIBRARIES NAMES ftdi ftdi1
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
/usr/local/lib
)
if(FTDI_INCLUDE_DIR AND FTDI_LIBRARIES)
set(FTDI_FOUND TRUE)
else (FTDI_INCLUDE_DIR AND FTDI_LIBRARIES)
set(FTDI_FOUND FALSE)
endif(FTDI_INCLUDE_DIR AND FTDI_LIBRARIES)
if (FTDI_FOUND)
if (NOT FTDI_FIND_QUIETLY)
message(STATUS "Found FTDI: ${FTDI_LIBRARIES}")
endif (NOT FTDI_FIND_QUIETLY)
else (FTDI_FOUND)
if (FTDI_FIND_REQUIRED)
message(FATAL_ERROR "FTDI not found. Please install libftdi-dev")
endif (FTDI_FIND_REQUIRED)
endif (FTDI_FOUND)
mark_as_advanced(FTDI_INCLUDE_DIR FTDI_LIBRARIES)
endif (FTDI_INCLUDE_DIR AND FTDI_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindMODBUS.cmake 0000644 0001751 0001751 00000003201 14174600255 021605 0 ustar debian debian # - Try to find libmodbus
# Once done this will define
#
# MODBUS_FOUND - system has MODBUS
# MODBUS_INCLUDE_DIR - the MODBUS include directory
# MODBUS_LIBRARIES - Link these to use MODBUS
# Copyright (c) 2006, Jasem Mutlaq
# Based on FindLibfacile by Carsten Niehaus,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES)
# in cache already
set(MODBUS_FOUND TRUE)
message(STATUS "Found libmodbus: ${MODBUS_LIBRARIES}")
else (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES)
find_path(MODBUS_INCLUDE_DIR modbus.h
PATH_SUFFIXES modbus
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(MODBUS_LIBRARIES NAMES modbus
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
set(CMAKE_REQUIRED_INCLUDES ${MODBUS_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MODBUS_LIBRARIES})
if(MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES)
set(MODBUS_FOUND TRUE)
else (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES)
set(MODBUS_FOUND FALSE)
endif(MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES)
if (MODBUS_FOUND)
if (NOT MODBUS_FIND_QUIETLY)
message(STATUS "Found libmodbus: ${MODBUS_LIBRARIES}")
endif (NOT MODBUS_FIND_QUIETLY)
else (MODBUS_FOUND)
if (MODBUS_FIND_REQUIRED)
message(FATAL_ERROR "libmodbus not found. Please install libmodbus-devel. https://launchpad.net/libmodbus/")
endif (MODBUS_FIND_REQUIRED)
endif (MODBUS_FOUND)
mark_as_advanced(MODBUS_INCLUDE_DIR MODBUS_LIBRARIES)
endif (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindSTARSHOOTG.cmake 0000644 0001751 0001751 00000003070 14174600255 022315 0 ustar debian debian # - Try to find Starshoot Camera Library
# Once done this will define
#
# STARSHOOTG_FOUND - system has Starshoot
# STARSHOOTG_INCLUDE_DIR - the Starshoot include directory
# STARSHOOTG_LIBRARIES - Link these to use Starshoot
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES)
# in cache already
set(STARSHOOTG_FOUND TRUE)
message(STATUS "Found libstarshootg: ${STARSHOOTG_LIBRARIES}")
else (STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES)
find_path(STARSHOOTG_INCLUDE_DIR starshootg.h
PATH_SUFFIXES libstarshootg
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(STARSHOOTG_LIBRARIES NAMES starshootg
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES)
set(STARSHOOTG_FOUND TRUE)
else (STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES)
set(STARSHOOTG_FOUND FALSE)
endif(STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES)
if (STARSHOOTG_FOUND)
if (NOT STARSHOOTG_FIND_QUIETLY)
message(STATUS "Found StarshootG: ${STARSHOOTG_LIBRARIES}")
endif (NOT STARSHOOTG_FIND_QUIETLY)
else (STARSHOOTG_FOUND)
if (STARSHOOTG_FIND_REQUIRED)
message(FATAL_ERROR "StarshootG not found. Please install StarshootG Library http://www.indilib.org")
endif (STARSHOOTG_FIND_REQUIRED)
endif (STARSHOOTG_FOUND)
mark_as_advanced(STARSHOOTG_INCLUDE_DIR STARSHOOTG_LIBRARIES)
endif (STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/InstallImported.cmake 0000644 0001751 0001751 00000006611 14174600255 023135 0 ustar debian debian
function (install_imported)
cmake_parse_arguments (ARG "" "DESTINATION" "TARGETS" ${ARGN})
if (NOT DEFINED ARG_DESTINATION)
message (FATAL_ERROR "DESTINATION not defined")
endif ()
foreach (target ${ARG_TARGETS})
get_target_property (location ${target} LOCATION)
get_target_property (version ${target} VERSION)
get_target_property (soversion ${target} SOVERSION)
get_target_property (output_name ${target} OUTPUT_NAME)
get_target_property (suffix ${target} SUFFIX)
get_target_property (type ${target} TYPE)
if (NOT ${type} STREQUAL "SHARED_LIBRARY")
message (FATAL_ERROR "install_imported: ${type} not supported")
endif ()
if (${location} STREQUAL "${target}-NOTFOUND")
return ()
endif ()
if (NOT ${version} STREQUAL "version-NOTFOUND")
set (version ".${version}")
else ()
set (version "")
endif ()
if (NOT ${soversion} STREQUAL "soversion-NOTFOUND")
set (soversion ".${soversion}")
else ()
set (soversion "")
endif ()
if (${output_name} STREQUAL "output_name-NOTFOUND")
set (output_name ${target})
endif ()
set (name_noversion "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${CMAKE_SHARED_LIBRARY_SUFFIX}")
if (APPLE)
set (name_version "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${version}${CMAKE_SHARED_LIBRARY_SUFFIX}")
set (name_soversion "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${soversion}${CMAKE_SHARED_LIBRARY_SUFFIX}")
else ()
set (name_version "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${CMAKE_SHARED_LIBRARY_SUFFIX}${version}")
set (name_soversion "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${CMAKE_SHARED_LIBRARY_SUFFIX}${soversion}")
endif ()
if (NOT IS_ABSOLUTE ${location})
set (location ${CMAKE_CURRENT_SOURCE_DIR}/${location})
endif ()
if (NOT ${name_noversion} STREQUAL ${name_soversion})
add_custom_command (
OUTPUT ${name_noversion}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${name_soversion} ${name_noversion} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
MAIN_DEPENDENCY ${name_soversion}
)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${name_noversion} DESTINATION ${ARG_DESTINATION})
endif ()
if (NOT ${name_soversion} STREQUAL ${name_version})
add_custom_command (
OUTPUT ${name_soversion}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${name_version} ${name_soversion} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
MAIN_DEPENDENCY ${name_version}
)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${name_soversion} DESTINATION ${ARG_DESTINATION})
endif ()
add_custom_command (
OUTPUT ${name_version}
COMMAND ${CMAKE_COMMAND} -E copy "${location}" "${CMAKE_CURRENT_BINARY_DIR}/${name_version}"
MAIN_DEPENDENCY ${location}
)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${name_version} DESTINATION ${ARG_DESTINATION})
add_custom_target(
imported_${output_name} ALL
DEPENDS ${name_version} ${name_noversion} ${name_soversion}
)
endforeach ()
endfunction ()
indi-eqmod-1.0+20220129131520/cmake_modules/FindAHPXC.cmake 0000644 0001751 0001751 00000002732 14174600255 021467 0 ustar debian debian # - Try to find AHPXC Universal Library
# Once done this will define
#
# AHPXC_FOUND - system has AHPXC
# AHPXC_INCLUDE_DIR - the AHPXC include directory
# AHPXC_LIBRARIES - Link these to use AHPXC
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES)
# in cache already
set(AHPXC_FOUND TRUE)
message(STATUS "Found libahp_xc: ${AHPXC_LIBRARIES}")
else (AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES)
find_path(AHPXC_INCLUDE_DIR ahp_xc.h
PATH_SUFFIXES ahp
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(AHPXC_LIBRARIES NAMES ahp_xc
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES)
set(AHPXC_FOUND TRUE)
else (AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES)
set(AHPXC_FOUND FALSE)
endif(AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES)
if (AHPXC_FOUND)
if (NOT AHPXC_FIND_QUIETLY)
message(STATUS "Found AHP XC: ${AHPXC_LIBRARIES}")
endif (NOT AHPXC_FIND_QUIETLY)
else (AHPXC_FOUND)
if (AHPXC_FIND_REQUIRED)
message(FATAL_ERROR "AHP XC not found. Please install libahp_xc http://www.indilib.org")
endif (AHPXC_FIND_REQUIRED)
endif (AHPXC_FOUND)
mark_as_advanced(AHPXC_INCLUDE_DIR AHPXC_LIBRARIES)
endif (AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindFLI.cmake 0000644 0001751 0001751 00000002645 14174600255 021241 0 ustar debian debian # - Try to find Finger Lakes Instruments Library
# Once done this will define
#
# FLI_FOUND - system has FLI
# FLI_INCLUDE_DIR - the FLI include directory
# FLI_LIBRARIES - Link these to use FLI
# Copyright (c) 2008, Jasem Mutlaq
# Based on FindLibfacile by Carsten Niehaus,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (FLI_INCLUDE_DIR AND FLI_LIBRARIES)
# in cache already
set(FLI_FOUND TRUE)
message(STATUS "Found libfli: ${FLI_LIBRARIES}")
else (FLI_INCLUDE_DIR AND FLI_LIBRARIES)
find_path(FLI_INCLUDE_DIR libfli.h
PATH_SUFFIXES fli
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(FLI_LIBRARIES NAMES fli
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(FLI_INCLUDE_DIR AND FLI_LIBRARIES)
set(FLI_FOUND TRUE)
else (FLI_INCLUDE_DIR AND FLI_LIBRARIES)
set(FLI_FOUND FALSE)
endif(FLI_INCLUDE_DIR AND FLI_LIBRARIES)
if (FLI_FOUND)
if (NOT FLI_FIND_QUIETLY)
message(STATUS "Found FLI: ${FLI_LIBRARIES}")
endif (NOT FLI_FIND_QUIETLY)
else (FLI_FOUND)
if (FLI_FIND_REQUIRED)
message(FATAL_ERROR "FLI not found. Please install libfli-dev. http://www.indilib.org")
endif (FLI_FIND_REQUIRED)
endif (FLI_FOUND)
mark_as_advanced(FLI_INCLUDE_DIR FLI_LIBRARIES)
endif (FLI_INCLUDE_DIR AND FLI_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindASI.cmake 0000644 0001751 0001751 00000003565 14174600255 021245 0 ustar debian debian # - Try to find ASI Library
# Once done this will define
#
# ASI_FOUND - system has ASI
# ASI_INCLUDE_DIR - the ASI include directory
# ASI_LIBRARIES - Link these to use ASI
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (ASI_INCLUDE_DIR AND ASI_LIBRARIES)
# in cache already
set(ASI_FOUND TRUE)
message(STATUS "Found libasi: ${ASI_LIBRARIES}")
else (ASI_INCLUDE_DIR AND ASI_LIBRARIES)
find_path(ASI_INCLUDE_DIR ASICamera2.h
PATH_SUFFIXES libasi
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(ASICAM_LIBRARIES NAMES ASICamera2
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
find_library(ASIEFW_LIBRARIES NAMES EFWFilter
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
find_library(ASIST4_LIBRARIES NAMES USB2ST4Conv
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
find_library(ASIEAF_LIBRARIES NAMES EAFFocuser
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if (ASICAM_LIBRARIES AND ASIEFW_LIBRARIES AND ASIST4_LIBRARIES AND ASIEAF_LIBRARIES)
set(ASI_LIBRARIES ${ASICAM_LIBRARIES} ${ASIEFW_LIBRARIES} ${ASIST4_LIBRARIES} ${ASIEAF_LIBRARIES})
endif (ASICAM_LIBRARIES AND ASIEFW_LIBRARIES AND ASIST4_LIBRARIES AND ASIEAF_LIBRARIES)
if(ASI_INCLUDE_DIR AND ASI_LIBRARIES)
set(ASI_FOUND TRUE)
else (ASI_INCLUDE_DIR AND ASI_LIBRARIES)
set(ASI_FOUND FALSE)
endif(ASI_INCLUDE_DIR AND ASI_LIBRARIES)
if (ASI_FOUND)
if (NOT ASI_FIND_QUIETLY)
message(STATUS "Found ASI: ${ASI_LIBRARIES}")
endif (NOT ASI_FIND_QUIETLY)
else (ASI_FOUND)
if (ASI_FIND_REQUIRED)
message(FATAL_ERROR "ASI not found. Please install libasi http://www.indilib.org")
endif (ASI_FIND_REQUIRED)
endif (ASI_FOUND)
mark_as_advanced(ASI_INCLUDE_DIR ASI_LIBRARIES)
endif (ASI_INCLUDE_DIR AND ASI_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindINDI.cmake 0000644 0001751 0001751 00000034574 14174600255 021360 0 ustar debian debian # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This module can find INDI Library
#
# Requirements:
# - CMake >= 2.8.3 (for new version of find_package_handle_standard_args)
#
# The following variables will be defined for your use:
# - INDI_FOUND : were all of your specified components found (include dependencies)?
# - INDI_WEBSOCKET : was INDI compiled with websocket support?
# - INDI_INCLUDE_DIR : INDI include directory
# - INDI_DATA_DIR : INDI include directory
# - INDI_LIBRARIES : INDI libraries
# - INDI_DRIVER_LIBRARIES : Same as above maintained for backward compatibility
# - INDI_VERSION : complete version of INDI (x.y.z)
# - INDI_MAJOR_VERSION : major version of INDI
# - INDI_MINOR_VERSION : minor version of INDI
# - INDI_RELEASE_VERSION : release version of INDI
# - INDI__FOUND : were found? (FALSE for non specified component if it is not a dependency)
#
# For windows or non standard installation, define INDI_ROOT variable to point to the root installation of INDI. Two ways:
# - run cmake with -DINDI_ROOT=
# - define an environment variable with the same name before running cmake
# With cmake-gui, before pressing "Configure":
# 1) Press "Add Entry" button
# 2) Add a new entry defined as:
# - Name: INDI_ROOT
# - Type: choose PATH in the selection list
# - Press "..." button and select the root installation of INDI
#
# Example Usage:
#
# 1. Copy this file in the root of your project source directory
# 2. Then, tell CMake to search this non-standard module in your project directory by adding to your CMakeLists.txt:
# set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
# 3. Finally call find_package() once, here are some examples to pick from
#
# Require INDI 1.4 or later
# find_package(INDI 1.4 REQUIRED)
#
# if(INDI_FOUND)
# include_directories(${INDI_INCLUDE_DIR})
# add_executable(myapp myapp.cpp)
# target_link_libraries(myapp ${INDI_LIBRARIES})
# endif(INDI_FOUND)
#
#
# Using Components:
#
# You can search for specific components. Currently, the following components are available
# * driver: to build INDI hardware drivers.
# * align: to build drivers that use INDI Alignment Subsystem.
# * client: to build pure C++ INDI clients.
# * clientqt5: to build Qt5-based INDI clients.
# * lx200: To build LX200-based 3rd party drivers (you must link with driver above as well).
#
# By default, if you do not specify any components, driver and align components are searched.
#
# Example:
#
# To use INDI Qt5 Client library only in your application:
#
# find_package(INDI COMPONENTS clientqt5 REQUIRED)
#
# if(INDI_FOUND)
# include_directories(${INDI_INCLUDE_DIR})
# add_executable(myapp myapp.cpp)
# target_link_libraries(myapp ${INDI_LIBRARIES})
# endif(INDI_FOUND)
#
# To use INDI driver + lx200 component in your application:
#
# find_package(INDI COMPONENTS driver lx200 REQUIRED)
#
# if(INDI_FOUND)
# include_directories(${INDI_INCLUDE_DIR})
# add_executable(myapp myapp.cpp)
# target_link_libraries(myapp ${INDI_LIBRARIES})
# endif(INDI_FOUND)
#
# Notice we still use ${INDI_LIBRARIES} which now should contain both driver & lx200 libraries.
#==============================================================================================
# Copyright (c) 2011-2013, julp
# Copyright (c) 2017-2019 Jasem Mutlaq
#
# Distributed under the OSI-approved BSD License
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTINDILAR PURPOSE.
#=============================================================================
find_package(PkgConfig QUIET)
########## Private ##########
if(NOT DEFINED INDI_PUBLIC_VAR_NS)
set(INDI_PUBLIC_VAR_NS "INDI") # Prefix for all INDI relative public variables
endif(NOT DEFINED INDI_PUBLIC_VAR_NS)
if(NOT DEFINED INDI_PRIVATE_VAR_NS)
set(INDI_PRIVATE_VAR_NS "_${INDI_PUBLIC_VAR_NS}") # Prefix for all INDI relative internal variables
endif(NOT DEFINED INDI_PRIVATE_VAR_NS)
if(NOT DEFINED PC_INDI_PRIVATE_VAR_NS)
set(PC_INDI_PRIVATE_VAR_NS "_PC${INDI_PRIVATE_VAR_NS}") # Prefix for all pkg-config relative internal variables
endif(NOT DEFINED PC_INDI_PRIVATE_VAR_NS)
function(indidebug _VARNAME)
if(${INDI_PUBLIC_VAR_NS}_DEBUG)
if(DEFINED ${INDI_PUBLIC_VAR_NS}_${_VARNAME})
message("${INDI_PUBLIC_VAR_NS}_${_VARNAME} = ${${INDI_PUBLIC_VAR_NS}_${_VARNAME}}")
else(DEFINED ${INDI_PUBLIC_VAR_NS}_${_VARNAME})
message("${INDI_PUBLIC_VAR_NS}_${_VARNAME} = ")
endif(DEFINED ${INDI_PUBLIC_VAR_NS}_${_VARNAME})
endif(${INDI_PUBLIC_VAR_NS}_DEBUG)
endfunction(indidebug)
set(${INDI_PRIVATE_VAR_NS}_ROOT "")
if(DEFINED ENV{INDI_ROOT})
set(${INDI_PRIVATE_VAR_NS}_ROOT "$ENV{INDI_ROOT}")
endif(DEFINED ENV{INDI_ROOT})
if (DEFINED INDI_ROOT)
set(${INDI_PRIVATE_VAR_NS}_ROOT "${INDI_ROOT}")
endif(DEFINED INDI_ROOT)
set(${INDI_PRIVATE_VAR_NS}_BIN_SUFFIXES )
set(${INDI_PRIVATE_VAR_NS}_LIB_SUFFIXES )
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND ${INDI_PRIVATE_VAR_NS}_BIN_SUFFIXES "bin64")
list(APPEND ${INDI_PRIVATE_VAR_NS}_LIB_SUFFIXES "lib64")
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND ${INDI_PRIVATE_VAR_NS}_BIN_SUFFIXES "bin")
list(APPEND ${INDI_PRIVATE_VAR_NS}_LIB_SUFFIXES "lib")
set(${INDI_PRIVATE_VAR_NS}_COMPONENTS )
# ...
macro(INDI_declare_component _NAME)
list(APPEND ${INDI_PRIVATE_VAR_NS}_COMPONENTS ${_NAME})
set("${INDI_PRIVATE_VAR_NS}_COMPONENTS_${_NAME}" ${ARGN})
endmacro(INDI_declare_component)
INDI_declare_component(driver indidriver)
INDI_declare_component(align indiAlignmentDriver)
INDI_declare_component(client indiclient)
INDI_declare_component(clientqt5 indiclientqt5)
INDI_declare_component(lx200 indilx200)
########## Public ##########
set(${INDI_PUBLIC_VAR_NS}_FOUND TRUE)
set(${INDI_PUBLIC_VAR_NS}_LIBRARIES )
set(${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR )
foreach(${INDI_PRIVATE_VAR_NS}_COMPONENT ${${INDI_PRIVATE_VAR_NS}_COMPONENTS})
string(TOUPPER "${${INDI_PRIVATE_VAR_NS}_COMPONENT}" ${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT)
set("${INDI_PUBLIC_VAR_NS}_${${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" FALSE) # may be done in the INDI_declare_component macro
endforeach(${INDI_PRIVATE_VAR_NS}_COMPONENT)
# Check components
if(NOT ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS) # driver and posix client by default
set(${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS driver align)
else(NOT ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS)
#list(APPEND ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS uc)
list(REMOVE_DUPLICATES ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS)
foreach(${INDI_PRIVATE_VAR_NS}_COMPONENT ${${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS})
if(NOT DEFINED ${INDI_PRIVATE_VAR_NS}_COMPONENTS_${${INDI_PRIVATE_VAR_NS}_COMPONENT})
message(FATAL_ERROR "Unknown INDI component: ${${INDI_PRIVATE_VAR_NS}_COMPONENT}")
endif(NOT DEFINED ${INDI_PRIVATE_VAR_NS}_COMPONENTS_${${INDI_PRIVATE_VAR_NS}_COMPONENT})
endforeach(${INDI_PRIVATE_VAR_NS}_COMPONENT)
endif(NOT ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS)
# Includes
find_path(
${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR
indidevapi.h
PATH_SUFFIXES libindi include/libindi
${PC_INDI_INCLUDE_DIR}
${_obIncDir}
${GNUWIN32_DIR}/include
HINTS ${${INDI_PRIVATE_VAR_NS}_ROOT}
DOC "Include directory for INDI"
)
find_path(
WEBSOCKET_HEADER
indiwsserver.h
PATH_SUFFIXES libindi
${PC_INDI_INCLUDE_DIR}
${_obIncDir}
${GNUWIN32_DIR}/include
)
if (WEBSOCKET_HEADER)
SET(INDI_WEBSOCKET TRUE)
else()
SET(INDI_WEBSOCKET FALSE)
endif()
find_path(${INDI_PUBLIC_VAR_NS}_DATA_DIR
drivers.xml
PATH_SUFFIXES share/indi
DOC "Data directory for INDI"
)
if(${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR)
if(EXISTS "${${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR}/indiversion.h") # INDI >= 1.4
file(READ "${${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR}/indiversion.h" ${INDI_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS)
else()
message(FATAL_ERROR "INDI version header not found")
endif()
if(${INDI_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS MATCHES ".*INDI_VERSION ([0-9]+).([0-9]+).([0-9]+)")
set(${INDI_PUBLIC_VAR_NS}_MAJOR_VERSION "${CMAKE_MATCH_1}")
set(${INDI_PUBLIC_VAR_NS}_MINOR_VERSION "${CMAKE_MATCH_2}")
set(${INDI_PUBLIC_VAR_NS}_RELEASE_VERSION "${CMAKE_MATCH_3}")
else()
message(FATAL_ERROR "failed to detect INDI version")
endif()
set(${INDI_PUBLIC_VAR_NS}_VERSION "${${INDI_PUBLIC_VAR_NS}_MAJOR_VERSION}.${${INDI_PUBLIC_VAR_NS}_MINOR_VERSION}.${${INDI_PUBLIC_VAR_NS}_RELEASE_VERSION}")
# Check libraries
foreach(${INDI_PRIVATE_VAR_NS}_COMPONENT ${${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS})
set(${INDI_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES )
set(${INDI_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES )
foreach(${INDI_PRIVATE_VAR_NS}_BASE_NAME ${${INDI_PRIVATE_VAR_NS}_COMPONENTS_${${INDI_PRIVATE_VAR_NS}_COMPONENT}})
list(APPEND ${INDI_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES "${${INDI_PRIVATE_VAR_NS}_BASE_NAME}")
list(APPEND ${INDI_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES "${${INDI_PRIVATE_VAR_NS}_BASE_NAME}d")
list(APPEND ${INDI_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES "${${INDI_PRIVATE_VAR_NS}_BASE_NAME}${INDI_MAJOR_VERSION}${INDI_MINOR_VERSION}")
list(APPEND ${INDI_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES "${${INDI_PRIVATE_VAR_NS}_BASE_NAME}${INDI_MAJOR_VERSION}${INDI_MINOR_VERSION}d")
endforeach(${INDI_PRIVATE_VAR_NS}_BASE_NAME)
find_library(
${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT}
NAMES ${${INDI_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES}
HINTS ${${INDI_PRIVATE_VAR_NS}_ROOT}
PATH_SUFFIXES ${_INDI_LIB_SUFFIXES}
DOC "Release libraries for INDI"
)
find_library(
${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}
NAMES ${${INDI_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES}
HINTS ${${INDI_PRIVATE_VAR_NS}_ROOT}
PATH_SUFFIXES ${_INDI_LIB_SUFFIXES}
DOC "Debug libraries for INDI"
)
string(TOUPPER "${${INDI_PRIVATE_VAR_NS}_COMPONENT}" ${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT)
if(NOT ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) # both not found
set("${INDI_PUBLIC_VAR_NS}_${${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" FALSE)
set("${INDI_PUBLIC_VAR_NS}_FOUND" FALSE)
else(NOT ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) # one or both found
set("${INDI_PUBLIC_VAR_NS}_${${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" TRUE)
if(NOT ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) # release not found => we are in debug
set(${INDI_PRIVATE_VAR_NS}_LIB_${${INDI_PRIVATE_VAR_NS}_COMPONENT} "${${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}}")
elseif(NOT ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) # debug not found => we are in release
set(${INDI_PRIVATE_VAR_NS}_LIB_${${INDI_PRIVATE_VAR_NS}_COMPONENT} "${${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT}}")
else() # both found
set(
${INDI_PRIVATE_VAR_NS}_LIB_${${INDI_PRIVATE_VAR_NS}_COMPONENT}
optimized ${${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT}}
debug ${${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}}
)
endif()
list(APPEND ${INDI_PUBLIC_VAR_NS}_LIBRARIES ${${INDI_PRIVATE_VAR_NS}_LIB_${${INDI_PRIVATE_VAR_NS}_COMPONENT}})
endif(NOT ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT})
endforeach(${INDI_PRIVATE_VAR_NS}_COMPONENT)
# Check find_package arguments
include(FindPackageHandleStandardArgs)
if(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY)
find_package_handle_standard_args(
${INDI_PUBLIC_VAR_NS}
REQUIRED_VARS ${INDI_PUBLIC_VAR_NS}_LIBRARIES ${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR
VERSION_VAR ${INDI_PUBLIC_VAR_NS}_VERSION
)
else(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY)
find_package_handle_standard_args(${INDI_PUBLIC_VAR_NS} "INDI not found" ${INDI_PUBLIC_VAR_NS}_LIBRARIES ${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR)
endif(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY)
else(${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR)
set("${INDI_PUBLIC_VAR_NS}_FOUND" FALSE)
if(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY)
message(FATAL_ERROR "Could not find INDI include directory")
endif(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY)
endif(${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR)
mark_as_advanced(
${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR
${INDI_PUBLIC_VAR_NS}_LIBRARIES
INDI_WEBSOCKET
)
# IN (args)
indidebug("FIND_COMPONENTS")
indidebug("FIND_REQUIRED")
indidebug("FIND_QUIETLY")
indidebug("FIND_VERSION")
# OUT
# Found
indidebug("FOUND")
indidebug("SERVER_FOUND")
indidebug("DRIVERS_FOUND")
indidebug("CLIENT_FOUND")
indidebug("QT5CLIENT_FOUND")
indidebug("LX200_FOUND")
# Linking
indidebug("INCLUDE_DIR")
indidebug("DATA_DIR")
indidebug("LIBRARIES")
# Backward compatibility
set(${INDI_PUBLIC_VAR_NS}_DRIVER_LIBRARIES ${${INDI_PUBLIC_VAR_NS}_LIBRARIES})
indidebug("DRIVER_LIBRARIES")
# Version
indidebug("MAJOR_VERSION")
indidebug("MINOR_VERSION")
indidebug("RELEASE_VERSION")
indidebug("VERSION")
indi-eqmod-1.0+20220129131520/cmake_modules/CMakeCommon.cmake 0000644 0001751 0001751 00000013667 14174600255 022165 0 ustar debian debian
include(CheckCCompilerFlag)
#IF (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#ENDIF ()
# C++14 Support
if (NOT ANDROID)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif(NOT ANDROID)
# Position Independent Code
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Ccache support
IF (ANDROID OR UNIX OR APPLE)
FIND_PROGRAM(CCACHE_FOUND ccache)
SET(CCACHE_SUPPORT OFF CACHE BOOL "Enable ccache support")
IF ((CCACHE_FOUND OR ANDROID) AND CCACHE_SUPPORT MATCHES ON)
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
ENDIF ()
ENDIF ()
# Add security (hardening flags)
IF (UNIX OR APPLE OR ANDROID)
# Older compilers are predefining _FORTIFY_SOURCE, so defining it causes a
# warning, which is then considered an error. Second issue is that for
# these compilers, _FORTIFY_SOURCE must be used while optimizing, else
# causes a warning, which also results in an error. And finally, CMake is
# not using optimization when testing for libraries, hence breaking the build.
CHECK_C_COMPILER_FLAG("-Werror -D_FORTIFY_SOURCE=2" COMPATIBLE_FORTIFY_SOURCE)
IF (${COMPATIBLE_FORTIFY_SOURCE})
SET(SEC_COMP_FLAGS "-D_FORTIFY_SOURCE=2")
ENDIF ()
SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -fstack-protector-all -fPIE")
# Make sure to add optimization flag. Some systems require this for _FORTIFY_SOURCE.
IF (NOT CMAKE_BUILD_TYPE MATCHES "MinSizeRel" AND NOT CMAKE_BUILD_TYPE MATCHES "Release" AND NOT CMAKE_BUILD_TYPE MATCHES "Debug")
SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -O1")
ENDIF ()
IF (NOT ANDROID AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT APPLE AND NOT CYGWIN)
SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -Wa,--noexecstack")
ENDIF ()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SEC_COMP_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SEC_COMP_FLAGS}")
SET(SEC_LINK_FLAGS "")
IF (NOT APPLE AND NOT CYGWIN)
SET(SEC_LINK_FLAGS "${SEC_LINK_FLAGS} -Wl,-z,nodump -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now")
ENDIF ()
IF (NOT ANDROID AND NOT APPLE)
SET(SEC_LINK_FLAGS "${SEC_LINK_FLAGS} -pie")
ENDIF ()
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SEC_LINK_FLAGS}")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SEC_LINK_FLAGS}")
ENDIF ()
# Warning, debug and linker flags
SET(FIX_WARNINGS OFF CACHE BOOL "Enable strict compilation mode to turn compiler warnings to errors")
IF (UNIX OR APPLE)
SET(COMP_FLAGS "")
SET(LINKER_FLAGS "")
# Verbose warnings and turns all to errors
SET(COMP_FLAGS "${COMP_FLAGS} -Wall -Wextra")
IF (FIX_WARNINGS)
SET(COMP_FLAGS "${COMP_FLAGS} -Werror")
ENDIF ()
# Omit problematic warnings
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET(COMP_FLAGS "${COMP_FLAGS} -Wno-unused-but-set-variable")
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.9.9)
SET(COMP_FLAGS "${COMP_FLAGS} -Wno-format-truncation")
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
SET(COMP_FLAGS "${COMP_FLAGS} -Wno-nonnull -Wno-deprecated-declarations")
ENDIF ()
# Minimal debug info with Clang
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET(COMP_FLAGS "${COMP_FLAGS} -gline-tables-only")
ELSE ()
SET(COMP_FLAGS "${COMP_FLAGS} -g")
ENDIF ()
# Note: The following flags are problematic on older systems with gcc 4.8
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9.9))
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
SET(COMP_FLAGS "${COMP_FLAGS} -Wno-unused-command-line-argument")
ENDIF ()
FIND_PROGRAM(LDGOLD_FOUND ld.gold)
SET(LDGOLD_SUPPORT OFF CACHE BOOL "Enable ld.gold support")
# Optional ld.gold is 2x faster than normal ld
IF (LDGOLD_FOUND AND LDGOLD_SUPPORT MATCHES ON AND NOT APPLE AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES arm)
SET(LINKER_FLAGS "${LINKER_FLAGS} -fuse-ld=gold")
# Use Identical Code Folding
SET(COMP_FLAGS "${COMP_FLAGS} -ffunction-sections")
SET(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--icf=safe")
# Compress the debug sections
# Note: Before valgrind 3.12.0, patch should be applied for valgrind (https://bugs.kde.org/show_bug.cgi?id=303877)
IF (NOT APPLE AND NOT ANDROID AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES arm AND NOT CMAKE_CXX_CLANG_TIDY)
SET(COMP_FLAGS "${COMP_FLAGS} -Wa,--compress-debug-sections")
SET(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--compress-debug-sections=zlib")
ENDIF ()
ENDIF ()
ENDIF ()
# Apply the flags
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMP_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMP_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}")
ENDIF ()
# Sanitizer support
SET(CLANG_SANITIZERS OFF CACHE BOOL "Clang's sanitizer support")
IF (CLANG_SANITIZERS AND
((UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR (APPLE AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")))
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer")
ENDIF ()
# Unity Build support
include(UnityBuild)
indi-eqmod-1.0+20220129131520/cmake_modules/FindINOVASDK.cmake 0000644 0001751 0001751 00000002753 14174600255 022045 0 ustar debian debian # - Try to find INOVASDK Universal Library
# Once done this will define
#
# INOVASDK_FOUND - system has INOVASDK
# INOVASDK_INCLUDE_DIR - the INOVASDK include directory
# INOVASDK_LIBRARIES - Link these to use INOVASDK
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES)
# in cache already
set(INOVASDK_FOUND TRUE)
message(STATUS "Found libinovasdk: ${INOVASDK_LIBRARIES}")
else (INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES)
find_path(INOVASDK_INCLUDE_DIR inovasdk.h
PATH_SUFFIXES inovasdk
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(INOVASDK_LIBRARIES NAMES inovasdk
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES)
set(INOVASDK_FOUND TRUE)
else (INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES)
set(INOVASDK_FOUND FALSE)
endif(INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES)
if (INOVASDK_FOUND)
if (NOT INOVASDK_FIND_QUIETLY)
message(STATUS "Found INOVASDK: ${INOVASDK_LIBRARIES}")
endif (NOT INOVASDK_FIND_QUIETLY)
else (INOVASDK_FOUND)
if (INOVASDK_FIND_REQUIRED)
message(FATAL_ERROR "INOVASDK not found. Please install INOVASDK Library http://www.indilib.org")
endif (INOVASDK_FIND_REQUIRED)
endif (INOVASDK_FOUND)
mark_as_advanced(INOVASDK_INCLUDE_DIR INOVASDK_LIBRARIES)
endif (INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindQHY.cmake 0000644 0001751 0001751 00000002426 14174600255 021265 0 ustar debian debian # - Try to find QHY Library
# Once done this will define
#
# QHY_FOUND - system has QHY
# QHY_INCLUDE_DIR - the QHY include directory
# QHY_LIBRARIES - Link these to use QHY
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (QHY_INCLUDE_DIR AND QHY_LIBRARIES)
# in cache already
set(QHY_FOUND TRUE)
message(STATUS "Found libqhyccd: ${QHY_LIBRARIES}")
else (QHY_INCLUDE_DIR AND QHY_LIBRARIES)
find_path(QHY_INCLUDE_DIR qhyccd.h
PATH_SUFFIXES libqhy
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(QHY_LIBRARIES NAMES qhyccd
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(QHY_INCLUDE_DIR AND QHY_LIBRARIES)
set(QHY_FOUND TRUE)
else (QHY_INCLUDE_DIR AND QHY_LIBRARIES)
set(QHY_FOUND FALSE)
endif(QHY_INCLUDE_DIR AND QHY_LIBRARIES)
if (QHY_FOUND)
if (NOT QHY_FIND_QUIETLY)
message(STATUS "Found QHY: ${QHY_LIBRARIES}")
endif (NOT QHY_FIND_QUIETLY)
else (QHY_FOUND)
if (QHY_FIND_REQUIRED)
message(FATAL_ERROR "QHY not found. Please install libqhy http://www.indilib.org")
endif (QHY_FIND_REQUIRED)
endif (QHY_FOUND)
mark_as_advanced(QHY_INCLUDE_DIR QHY_LIBRARIES)
endif (QHY_INCLUDE_DIR AND QHY_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindPENTAX.cmake 0000644 0001751 0001751 00000005530 14174600255 021622 0 ustar debian debian # - Try to find PENTAX Universal Libraries
# Once done this will define
#
# PENTAX_FOUND - system has PENTAX
# PENTAX_INCLUDE_DIR - the PENTAX include directory
# PENTAX_LIBRARIES - Link these to use PENTAX
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES)
# in cache already
set(PENTAX_FOUND TRUE)
message(STATUS "Found PENTAX libraries: ${PENTAX_LIBRARIES}")
else (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES)
find_path(PKTRIGGERCORD_INCLUDE_DIR libpktriggercord.h
PATH_SUFFIXES libpktriggercord
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(PKTRIGGERCORD_LIBRARIES NAMES pktriggercord
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
PATH_SUFFIXES indipentax
)
#if not armv8, then look for ricoh library; otherwise only use pktriggercord library
if(NOT (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^aarch64"))
find_path(RICOH_INCLUDE_DIR ricoh_camera_sdk.hpp
PATH_SUFFIXES libpentax libricohcamerasdk
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(RICOH_LIBRARIES NAMES RicohCameraSDKCpp
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
find_library(RICOHMTP_LIBRARIES NAMES libmtpricoh.so.9.3.0
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if (RICOH_INCLUDE_DIR AND PKTRIGGERCORD_INCLUDE_DIR)
set(PENTAX_INCLUDE_DIR ${RICOH_INCLUDE_DIR} ${PKTRIGGERCORD_INCLUDE_DIR})
endif (RICOH_INCLUDE_DIR AND PKTRIGGERCORD_INCLUDE_DIR)
if (RICOH_LIBRARIES AND RICOHMTP_LIBRARIES AND PKTRIGGERCORD_LIBRARIES)
set(PENTAX_LIBRARIES ${RICOH_LIBRARIES} ${RICOHMTP_LIBRARIES} ${PKTRIGGERCORD_LIBRARIES})
endif (RICOH_LIBRARIES AND RICOHMTP_LIBRARIES AND PKTRIGGERCORD_LIBRARIES)
else()
if (PKTRIGGERCORD_INCLUDE_DIR)
set(PENTAX_INCLUDE_DIR ${PKTRIGGERCORD_INCLUDE_DIR})
endif (PKTRIGGERCORD_INCLUDE_DIR)
if (PKTRIGGERCORD_LIBRARIES)
set(PENTAX_LIBRARIES ${PKTRIGGERCORD_LIBRARIES})
endif (PKTRIGGERCORD_LIBRARIES)
endif()
if(PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES)
set(PENTAX_FOUND TRUE)
else (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES)
set(PENTAX_FOUND FALSE)
endif(PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES)
if (PENTAX_FOUND)
if (NOT PENTAX_FIND_QUIETLY)
message(STATUS "Found PENTAX libraries: ${PENTAX_LIBRARIES}")
endif (NOT PENTAX_FIND_QUIETLY)
else (PENTAX_FOUND)
if (PENTAX_FIND_REQUIRED)
message(FATAL_ERROR "One or both of libricohcamersdk and libpktriggercord are not found. Please install them. See http://www.indilib.org.")
endif (PENTAX_FIND_REQUIRED)
endif (PENTAX_FOUND)
mark_as_advanced(PENTAX_INCLUDE_DIR PENTAX_LIBRARIES)
endif (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindGLIB2.cmake 0000644 0001751 0001751 00000013271 14174600255 021423 0 ustar debian debian # - Try to find GLib2
# Once done this will define
#
# GLIB2_FOUND - system has GLib2
# GLIB2_INCLUDE_DIRS - the GLib2 include directory
# GLIB2_LIBRARIES - Link these to use GLib2
#
# HAVE_GLIB_GREGEX_H glib has gregex.h header and
# supports g_regex_match_simple
#
# Copyright (c) 2006 Andreas Schneider
# Copyright (c) 2006 Philippe Bernery
# Copyright (c) 2007 Daniel Gollub
# Copyright (c) 2007 Alban Browaeys
# Copyright (c) 2008 Michael Bell
# Copyright (c) 2008 Bjoern Ricks
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
IF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS )
# in cache already
SET(GLIB2_FOUND TRUE)
ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS )
INCLUDE(FindPkgConfig)
## Glib
IF ( GLIB2_FIND_REQUIRED )
SET( _pkgconfig_REQUIRED "REQUIRED" )
ELSE ( GLIB2_FIND_REQUIRED )
SET( _pkgconfig_REQUIRED "" )
ENDIF ( GLIB2_FIND_REQUIRED )
IF ( GLIB2_MIN_VERSION )
PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0>=${GLIB2_MIN_VERSION} )
ELSE ( GLIB2_MIN_VERSION )
PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0 )
ENDIF ( GLIB2_MIN_VERSION )
IF ( PKG_CONFIG_FOUND )
IF ( GLIB2_FOUND )
SET ( GLIB2_CORE_FOUND TRUE )
ELSE ( GLIB2_FOUND )
SET ( GLIB2_CORE_FOUND FALSE )
ENDIF ( GLIB2_FOUND )
ENDIF ( PKG_CONFIG_FOUND )
# Look for glib2 include dir and libraries w/o pkgconfig
IF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND )
FIND_PATH(
_glibconfig_include_DIR
NAMES
glibconfig.h
PATHS
/opt/gnome/lib64
/opt/gnome/lib
/opt/lib/
/opt/local/lib
/sw/lib/
/usr/lib64
/usr/lib
/usr/local/include
${CMAKE_LIBRARY_PATH}
PATH_SUFFIXES
glib-2.0/include
)
FIND_PATH(
_glib2_include_DIR
NAMES
glib.h
PATHS
/opt/gnome/include
/opt/local/include
/sw/include
/usr/include
/usr/local/include
PATH_SUFFIXES
glib-2.0
)
#MESSAGE(STATUS "Glib headers: ${_glib2_include_DIR}")
FIND_LIBRARY(
_glib2_link_DIR
NAMES
glib-2.0
glib
PATHS
/opt/gnome/lib
/opt/local/lib
/sw/lib
/usr/lib
/usr/local/lib
)
IF ( _glib2_include_DIR AND _glib2_link_DIR )
SET ( _glib2_FOUND TRUE )
ENDIF ( _glib2_include_DIR AND _glib2_link_DIR )
IF ( _glib2_FOUND )
SET ( GLIB2_INCLUDE_DIRS ${_glib2_include_DIR} ${_glibconfig_include_DIR} )
SET ( GLIB2_LIBRARIES ${_glib2_link_DIR} )
SET ( GLIB2_CORE_FOUND TRUE )
ELSE ( _glib2_FOUND )
SET ( GLIB2_CORE_FOUND FALSE )
ENDIF ( _glib2_FOUND )
# Handle dependencies
# libintl
IF ( NOT LIBINTL_FOUND )
FIND_PATH(LIBINTL_INCLUDE_DIR
NAMES
libintl.h
PATHS
/opt/gnome/include
/opt/local/include
/sw/include
/usr/include
/usr/local/include
)
FIND_LIBRARY(LIBINTL_LIBRARY
NAMES
intl
PATHS
/opt/gnome/lib
/opt/local/lib
/sw/lib
/usr/local/lib
/usr/lib
)
IF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR)
SET (LIBINTL_FOUND TRUE)
ENDIF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR)
ENDIF ( NOT LIBINTL_FOUND )
# libiconv
IF ( NOT LIBICONV_FOUND )
FIND_PATH(LIBICONV_INCLUDE_DIR
NAMES
iconv.h
PATHS
/opt/gnome/include
/opt/local/include
/opt/local/include
/sw/include
/sw/include
/usr/local/include
/usr/include
PATH_SUFFIXES
glib-2.0
)
FIND_LIBRARY(LIBICONV_LIBRARY
NAMES
iconv
PATHS
/opt/gnome/lib
/opt/local/lib
/sw/lib
/usr/lib
/usr/local/lib
)
IF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR)
SET (LIBICONV_FOUND TRUE)
ENDIF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR)
ENDIF ( NOT LIBICONV_FOUND )
IF (LIBINTL_FOUND)
SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBINTL_LIBRARY})
SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBINTL_INCLUDE_DIR})
ENDIF (LIBINTL_FOUND)
IF (LIBICONV_FOUND)
SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY})
SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR})
ENDIF (LIBICONV_FOUND)
ENDIF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND )
##
IF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES)
SET (GLIB2_FOUND TRUE)
ENDIF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES)
IF (GLIB2_FOUND)
IF (NOT GLIB2_FIND_QUIETLY)
MESSAGE (STATUS "Found GLib2: ${GLIB2_LIBRARIES} ${GLIB2_INCLUDE_DIRS}")
ENDIF (NOT GLIB2_FIND_QUIETLY)
ELSE (GLIB2_FOUND)
IF (GLIB2_FIND_REQUIRED)
MESSAGE (SEND_ERROR "Could not find GLib2")
ENDIF (GLIB2_FIND_REQUIRED)
ENDIF (GLIB2_FOUND)
# show the GLIB2_INCLUDE_DIRS and GLIB2_LIBRARIES variables only in the advanced view
MARK_AS_ADVANCED(GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES)
MARK_AS_ADVANCED(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARY)
MARK_AS_ADVANCED(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY)
ENDIF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS)
IF ( GLIB2_FOUND )
# Check if system has a newer version of glib
# which supports g_regex_match_simple
INCLUDE( CheckIncludeFiles )
SET( CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS} )
CHECK_INCLUDE_FILES ( glib/gregex.h HAVE_GLIB_GREGEX_H )
# Reset CMAKE_REQUIRED_INCLUDES
SET( CMAKE_REQUIRED_INCLUDES "" )
ENDIF( GLIB2_FOUND )
indi-eqmod-1.0+20220129131520/cmake_modules/FindATIK.cmake 0000644 0001751 0001751 00000002540 14174600255 021351 0 ustar debian debian # - Try to find Atik Camera Library
# Once done this will define
#
# ATIK_FOUND - system has ATIK
# ATIK_INCLUDE_DIR - the ATIK include directory
# ATIK_LIBRARIES - Link these to use ATIK
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (ATIK_INCLUDE_DIR AND ATIK_LIBRARIES)
# in cache already
set(ATIK_FOUND TRUE)
message(STATUS "Found libatik: ${ATIK_LIBRARIES}")
else (ATIK_INCLUDE_DIR AND ATIK_LIBRARIES)
find_path(ATIK_INCLUDE_DIR AtikCameras.h
PATH_SUFFIXES libatik
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(ATIK_LIBRARIES NAMES atikcameras
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(ATIK_INCLUDE_DIR AND ATIK_LIBRARIES)
set(ATIK_FOUND TRUE)
else (ATIK_INCLUDE_DIR AND ATIK_LIBRARIES)
set(ATIK_FOUND FALSE)
endif(ATIK_INCLUDE_DIR AND ATIK_LIBRARIES)
if (ATIK_FOUND)
if (NOT ATIK_FIND_QUIETLY)
message(STATUS "Found Atik Library: ${ATIK_LIBRARIES}")
endif (NOT ATIK_FIND_QUIETLY)
else (ATIK_FOUND)
if (ATIK_FIND_REQUIRED)
message(FATAL_ERROR "Atik Library not found. Please install Atik Library http://www.indilib.org")
endif (ATIK_FIND_REQUIRED)
endif (ATIK_FOUND)
mark_as_advanced(ATIK_INCLUDE_DIR ATIK_LIBRARIES)
endif (ATIK_INCLUDE_DIR AND ATIK_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindALUT.cmake 0000644 0001751 0001751 00000005042 14174600255 021366 0 ustar debian debian # - Locate ALUT
# This module defines
# ALUT_LIBRARY
# ALUT_FOUND, if false, do not try to link to OpenAL
# ALUT_INCLUDE_DIR, where to find the headers
#
# $OPENALDIR is an environment variable that would
# correspond to the ./configure --prefix=$OPENALDIR
# used in building OpenAL.
#
# Created by Bryan Donlan, based on the FindOpenAL.cmake module by Eric Wang.
FIND_PATH(ALUT_INCLUDE_DIR alut.h
$ENV{OPENALDIR}/include
~/Library/Frameworks/OpenAL.framework/Headers
/Library/Frameworks/OpenAL.framework/Headers
/System/Library/Frameworks/OpenAL.framework/Headers # Tiger
/usr/local/include/AL
/usr/local/include/OpenAL
/usr/local/include
/usr/include/AL
/usr/include/OpenAL
/usr/include
/sw/include/AL # Fink
/sw/include/OpenAL
/sw/include
/opt/local/include/AL # DarwinPorts
/opt/local/include/OpenAL
/opt/local/include
/opt/csw/include/AL # Blastwave
/opt/csw/include/OpenAL
/opt/csw/include
/opt/include/AL
/opt/include/OpenAL
/opt/include
)
# I'm not sure if I should do a special casing for Apple. It is
# unlikely that other Unix systems will find the framework path.
# But if they do ([Next|Open|GNU]Step?),
# do they want the -framework option also?
IF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR})
IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
)
# String is in default search path, don't need to use -F
SET (ALUT_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
ELSE("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
)
# String is not /Library/Frameworks, need to use -F
SET(ALUT_LIBRARY "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
ENDIF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
)
# Clear the temp variable so nobody can see it
SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
ELSE(${ALUT_INCLUDE_DIR} MATCHES ".framework")
FIND_LIBRARY(ALUT_LIBRARY
NAMES alut
PATHS
$ENV{OPENALDIR}/lib
$ENV{OPENALDIR}/libs
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
)
ENDIF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
SET(ALUT_FOUND "NO")
IF(ALUT_LIBRARY)
SET(ALUT_FOUND "YES")
ENDIF(ALUT_LIBRARY)
indi-eqmod-1.0+20220129131520/cmake_modules/FindD2XX.cmake 0000644 0001751 0001751 00000002620 14174600255 021345 0 ustar debian debian # - Try to find D2XX
# Once done this will define
#
# D2XX_FOUND - system has FTDI
# D2XX_INCLUDE_DIR - the FTDI include directory
# D2XX_LIBRARIES - Link these to use FTDI
#
# N.B. You must include the file as following:
#
#include
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (D2XX_INCLUDE_DIR AND D2XX_LIBRARIES)
# in cache already
set(D2XX_FOUND TRUE)
message(STATUS "Found libfd2xx: ${D2XX_LIBRARIES}")
else (D2XX_INCLUDE_DIR AND D2XX_LIBRARIES)
find_path(D2XX_INCLUDE_DIR ftd2xx.h
#PATH_SUFFIXES libD2XX
${_obIncDir}
${GNUWIN32_DIR}/include
/usr/local/include
)
find_library(D2XX_LIBRARIES NAMES ftd2xx
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
/usr/local/lib
)
if(D2XX_INCLUDE_DIR AND D2XX_LIBRARIES)
set(D2XX_FOUND TRUE)
else (D2XX_INCLUDE_DIR AND D2XX_LIBRARIES)
set(D2XX_FOUND FALSE)
endif(D2XX_INCLUDE_DIR AND D2XX_LIBRARIES)
if (D2XX_FOUND)
if (NOT D2XX_FIND_QUIETLY)
message(STATUS "Found D2XX: ${D2XX_LIBRARIES}")
endif (NOT D2XX_FIND_QUIETLY)
else (D2XX_FOUND)
if (D2XX_FIND_REQUIRED)
message(FATAL_ERROR "D2XX not found. Please install libd2xx")
endif (D2XX_FIND_REQUIRED)
endif (D2XX_FOUND)
mark_as_advanced(D2XX_INCLUDE_DIR D2XX_LIBRARIES)
endif (D2XX_INCLUDE_DIR AND D2XX_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindARAVIS.cmake 0000644 0001751 0001751 00000002723 14174600255 021611 0 ustar debian debian # - Find the native sqlite3 includes and library
#
# This module defines
# ARV_INCLUDE_DIR, where to find libgphoto2 header files
# ARV_LIBRARIES, the libraries to link against to use libgphoto2
# ARV_FOUND, If false, do not try to use libgphoto2.
# ARV_VERSION_STRING, e.g. 2.4.14
# ARV_VERSION_MAJOR, e.g. 2
# ARV_VERSION_MINOR, e.g. 4
# ARV_VERSION_PATCH, e.g. 14
#
# also defined, but not for general use are
# ARV_LIBRARY, where to find the sqlite3 library.
#=============================================================================
# Copyright 2010 henrik andersson
#=============================================================================
SET(ARV_FIND_REQUIRED ${Arv_FIND_REQUIRED})
find_path(ARV_INCLUDE_DIR aravis-0.8/arv.h)
mark_as_advanced(ARV_INCLUDE_DIR)
set(ARV_NAMES ${ARV_NAMES} aravis-0.8)
find_library(ARV_LIBRARY NAMES ${ARV_NAMES} )
mark_as_advanced(ARV_LIBRARY)
set(ARV_VERSION_MAJOR "0")
set(ARV_VERSION_MINOR "8")
set(ARV_VERSION_STRING "${ARV_VERSION_MAJOR}.${ARV_VERSION_MINOR}")
# handle the QUIETLY and REQUIRED arguments and set ARV_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ARV DEFAULT_MSG ARV_LIBRARY ARV_INCLUDE_DIR)
IF(ARV_FOUND)
#SET(Arv_LIBRARIES ${ARV_LIBRARY})
SET(Arv_LIBRARIES "aravis-0.8")
SET(Arv_INCLUDE_DIRS "${ARV_INCLUDE_DIR}/aravis-0.8")
MESSAGE (STATUS "Found aravis: ${Arv_LIBRARIES} ${Arv_INCLUDE_DIRS}")
ENDIF(ARV_FOUND)
indi-eqmod-1.0+20220129131520/cmake_modules/FindFISHCAMP.cmake 0000644 0001751 0001751 00000003225 14174600255 022014 0 ustar debian debian # - Try to find FISHCAMP CCD
# Once done this will define
#
# FISHCAMP_FOUND - system has FISHCAMP
# FISHCAMP_LIBRARIES - Link these to use FISHCAMP
# FISHCAMP_INCLUDE_DIR - Fishcamp include directory
# Copyright (c) 2006, Jasem Mutlaq
# Based on FindLibfacile by Carsten Niehaus,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR)
# in cache already
set(FISHCAMP_FOUND TRUE)
message(STATUS "Found FISHCAMP: ${FISHCAMP_LIBRARIES}")
else (FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR)
find_library(FISHCAMP_LIBRARIES NAMES fishcamp
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
find_path(FISHCAMP_INCLUDE_DIR fishcamp.h
PATH_SUFFIXES libfishcamp
${_obIncDir}
${GNUWIN32_DIR}/include
)
set(CMAKE_REQUIRED_LIBRARIES ${FISHCAMP_LIBRARIES})
if(FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR)
set(FISHCAMP_FOUND TRUE)
else (FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR)
set(FISHCAMP_FOUND FALSE)
endif(FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR)
if (FISHCAMP_FOUND)
if (NOT FISHCAMP_FIND_QUIETLY)
message(STATUS "Found FISHCAMP: ${FISHCAMP_LIBRARIES}")
endif (NOT FISHCAMP_FIND_QUIETLY)
else (FISHCAMP_FOUND)
if (FISHCAMP_FIND_REQUIRED)
message(FATAL_ERROR "FISHCAMP not found. Please install FISHCAMP library. http://www.indilib.org")
endif (FISHCAMP_FIND_REQUIRED)
endif (FISHCAMP_FOUND)
mark_as_advanced(FISHCAMP_LIBRARIES FISHCAMP_INCLUDE_DIR)
endif (FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR)
indi-eqmod-1.0+20220129131520/cmake_modules/FindDC1394.cmake 0000644 0001751 0001751 00000002643 14174600255 021434 0 ustar debian debian # - Try to find dc1394 library (version 2) and include files
# Once done this will define
#
# DC1394_FOUND - system has DC1394
# DC1394_INCLUDE_DIR - the DC1394 include directory
# DC1394_LIBRARIES - Link these to use DC1394
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (DC1394_INCLUDE_DIR AND DC1394_LIBRARIES)
# in cache already
set(DC1394_FOUND TRUE)
message(STATUS "Found libdc1394: ${DC1394_LIBRARIES}")
else (DC1394_INCLUDE_DIR AND DC1394_LIBRARIES)
find_path(DC1394_INCLUDE_DIR control.h
PATH_SUFFIXES dc1394
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(DC1394_LIBRARIES NAMES dc1394
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(DC1394_INCLUDE_DIR AND DC1394_LIBRARIES)
set(DC1394_FOUND TRUE)
else (DC1394_INCLUDE_DIR AND DC1394_LIBRARIES)
set(DC1394_FOUND FALSE)
endif(DC1394_INCLUDE_DIR AND DC1394_LIBRARIES)
if (DC1394_FOUND)
if (NOT DC1394_FIND_QUIETLY)
message(STATUS "Found DC1394: ${DC1394_LIBRARIES}")
endif (NOT DC1394_FIND_QUIETLY)
else (DC1394_FOUND)
if (DC1394_FIND_REQUIRED)
message(FATAL_ERROR "DC1394 not found. Please install libdc1394 development package.")
endif (DC1394_FIND_REQUIRED)
endif (DC1394_FOUND)
mark_as_advanced(DC1394_INCLUDE_DIR DC1394_LIBRARIES)
endif (DC1394_INCLUDE_DIR AND DC1394_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindTIFFXX.cmake 0000644 0001751 0001751 00000001763 14174600255 021637 0 ustar debian debian # - Try to find TIFFXX Library
# Once done this will define
#
# TIFXX_LIBRARY - Link these to use TIFFXX
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (TIFFXX_LIBRARY)
# in cache already
set(TIFFXX_FOUND TRUE)
message(STATUS "Found libtiffxx: ${TIFFXX_LIBRARY}")
else (TIFFXX_LIBRARY)
find_library(TIFFXX_LIBRARY NAMES tiffxx
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(TIFFXX_LIBRARY)
set(TIFFXX_FOUND TRUE)
else (TIFFXX_LIBRARY)
set(TIFFXX_FOUND FALSE)
endif(TIFFXX_LIBRARY)
if (TIFFXX_FOUND)
if (NOT TIFFXX_FIND_QUIETLY)
message(STATUS "Found tiffxx: ${TIFFXX_LIBRARY}")
endif (NOT TIFFXX_FIND_QUIETLY)
else (TIFFXX_FOUND)
if (TIFFXX_FIND_REQUIRED)
message(FATAL_ERROR "tiffxx is not found. Please install it first.")
endif (TIFFXX_FIND_REQUIRED)
endif (TIFFXX_FOUND)
mark_as_advanced(TIFFXX_LIBRARY)
endif (TIFFXX_LIBRARY)
indi-eqmod-1.0+20220129131520/cmake_modules/FindGSL.cmake 0000644 0001751 0001751 00000022241 14174600255 021246 0 ustar debian debian #.rst:
# FindGSL
# --------
#
# Find the native GSL includes and libraries.
#
# The GNU Scientific Library (GSL) is a numerical library for C and C++
# programmers. It is free software under the GNU General Public
# License.
#
# Imported Targets
# ^^^^^^^^^^^^^^^^
#
# If GSL is found, this module defines the following :prop_tgt:`IMPORTED`
# targets::
#
# GSL::gsl - The main GSL library.
# GSL::gslcblas - The CBLAS support library used by GSL.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module will set the following variables in your project::
#
# GSL_FOUND - True if GSL found on the local system
# GSL_INCLUDE_DIRS - Location of GSL header files.
# GSL_LIBRARIES - The GSL libraries.
# GSL_VERSION - The version of the discovered GSL install.
#
# Hints
# ^^^^^
#
# Set ``GSL_ROOT_DIR`` to a directory that contains a GSL installation.
#
# This script expects to find libraries at ``$GSL_ROOT_DIR/lib`` and the GSL
# headers at ``$GSL_ROOT_DIR/include/gsl``. The library directory may
# optionally provide Release and Debug folders. For Unix-like systems, this
# script will use ``$GSL_ROOT_DIR/bin/gsl-config`` (if found) to aid in the
# discovery GSL.
#
# Cache Variables
# ^^^^^^^^^^^^^^^
#
# This module may set the following variables depending on platform and type
# of GSL installation discovered. These variables may optionally be set to
# help this module find the correct files::
#
# GSL_CLBAS_LIBRARY - Location of the GSL CBLAS library.
# GSL_CBLAS_LIBRARY_DEBUG - Location of the debug GSL CBLAS library (if any).
# GSL_CONFIG_EXECUTABLE - Location of the ``gsl-config`` script (if any).
# GSL_LIBRARY - Location of the GSL library.
# GSL_LIBRARY_DEBUG - Location of the debug GSL library (if any).
#
#=============================================================================
# Copyright 2014 Kelly Thompson
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Include these modules to handle the QUIETLY and REQUIRED arguments.
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
#=============================================================================
# If the user has provided ``GSL_ROOT_DIR``, use it! Choose items found
# at this location over system locations.
if( EXISTS "$ENV{GSL_ROOT_DIR}" )
file( TO_CMAKE_PATH "$ENV{GSL_ROOT_DIR}" GSL_ROOT_DIR )
set( GSL_ROOT_DIR "${GSL_ROOT_DIR}" CACHE PATH "Prefix for GSL installation." )
endif()
if( NOT EXISTS "${GSL_ROOT_DIR}" )
set( GSL_USE_PKGCONFIG ON )
endif()
#=============================================================================
# As a first try, use the PkgConfig module. This will work on many
# *NIX systems. See :module:`findpkgconfig`
# This will return ``GSL_INCLUDEDIR`` and ``GSL_LIBDIR`` used below.
if( GSL_USE_PKGCONFIG )
find_package(PkgConfig)
pkg_check_modules( GSL QUIET gsl )
if( EXISTS "${GSL_INCLUDEDIR}" )
get_filename_component( GSL_ROOT_DIR "${GSL_INCLUDEDIR}" DIRECTORY CACHE)
endif()
endif()
#=============================================================================
# Set GSL_INCLUDE_DIRS and GSL_LIBRARIES. If we skipped the PkgConfig step, try
# to find the libraries at $GSL_ROOT_DIR (if provided) or in standard system
# locations. These find_library and find_path calls will prefer custom
# locations over standard locations (HINTS). If the requested file is not found
# at the HINTS location, standard system locations will be still be searched
# (/usr/lib64 (Redhat), lib/i386-linux-gnu (Debian)).
find_path( GSL_INCLUDE_DIR
NAMES gsl/gsl_sf.h
HINTS ${GSL_ROOT_DIR}/include ${GSL_INCLUDEDIR}
)
find_library( GSL_LIBRARY
NAMES gsl
HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR}
PATH_SUFFIXES Release Debug
)
find_library( GSL_CBLAS_LIBRARY
NAMES gslcblas cblas
HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR}
PATH_SUFFIXES Release Debug
)
# Do we also have debug versions?
find_library( GSL_LIBRARY_DEBUG
NAMES gsl
HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR}
PATH_SUFFIXES Debug
)
find_library( GSL_CBLAS_LIBRARY_DEBUG
NAMES gslcblas cblas
HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR}
PATH_SUFFIXES Debug
)
set( GSL_INCLUDE_DIRS ${GSL_INCLUDE_DIR} )
set( GSL_LIBRARIES ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY} )
# If we didn't use PkgConfig, try to find the version via gsl-config or by
# reading gsl_version.h.
if( NOT GSL_VERSION )
# 1. If gsl-config exists, query for the version.
find_program( GSL_CONFIG_EXECUTABLE
NAMES gsl-config
HINTS "${GSL_ROOT_DIR}/bin"
)
if( EXISTS "${GSL_CONFIG_EXECUTABLE}" )
execute_process(
COMMAND "${GSL_CONFIG_EXECUTABLE}" --version
OUTPUT_VARIABLE GSL_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE )
endif()
# 2. If gsl-config is not available, try looking in gsl/gsl_version.h
if( NOT GSL_VERSION AND EXISTS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" )
file( STRINGS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" gsl_version_h_contents REGEX "define GSL_VERSION" )
string( REGEX REPLACE ".*([0-9].[0-9][0-9]).*" "\\1" GSL_VERSION ${gsl_version_h_contents} )
endif()
# might also try scraping the directory name for a regex match "gsl-X.X"
endif()
#=============================================================================
# handle the QUIETLY and REQUIRED arguments and set GSL_FOUND to TRUE if all
# listed variables are TRUE
find_package_handle_standard_args( GSL
FOUND_VAR
GSL_FOUND
REQUIRED_VARS
GSL_INCLUDE_DIR
GSL_LIBRARY
GSL_CBLAS_LIBRARY
VERSION_VAR
GSL_VERSION
)
mark_as_advanced( GSL_ROOT_DIR GSL_VERSION GSL_LIBRARY GSL_INCLUDE_DIR
GSL_CBLAS_LIBRARY GSL_LIBRARY_DEBUG GSL_CBLAS_LIBRARY_DEBUG
GSL_USE_PKGCONFIG GSL_CONFIG )
#=============================================================================
# Register imported libraries:
# 1. If we can find a Windows .dll file (or if we can find both Debug and
# Release libraries), we will set appropriate target properties for these.
# 2. However, for most systems, we will only register the import location and
# include directory.
# Look for dlls, or Release and Debug libraries.
if(WIN32)
string( REPLACE ".lib" ".dll" GSL_LIBRARY_DLL "${GSL_LIBRARY}" )
string( REPLACE ".lib" ".dll" GSL_CBLAS_LIBRARY_DLL "${GSL_CBLAS_LIBRARY}" )
string( REPLACE ".lib" ".dll" GSL_LIBRARY_DEBUG_DLL "${GSL_LIBRARY_DEBUG}" )
string( REPLACE ".lib" ".dll" GSL_CBLAS_LIBRARY_DEBUG_DLL "${GSL_CBLAS_LIBRARY_DEBUG}" )
endif()
if( GSL_FOUND AND NOT TARGET GSL::gsl )
if( EXISTS "${GSL_LIBRARY_DLL}" AND EXISTS "${GSL_CBLAS_LIBRARY_DLL}")
# Windows systems with dll libraries.
add_library( GSL::gsl SHARED IMPORTED )
add_library( GSL::gslcblas SHARED IMPORTED )
# Windows with dlls, but only Release libraries.
set_target_properties( GSL::gslcblas PROPERTIES
IMPORTED_LOCATION_RELEASE "${GSL_CBLAS_LIBRARY_DLL}"
IMPORTED_IMPLIB "${GSL_CBLAS_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}"
IMPORTED_CONFIGURATIONS Release
IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
set_target_properties( GSL::gsl PROPERTIES
IMPORTED_LOCATION_RELEASE "${GSL_LIBRARY_DLL}"
IMPORTED_IMPLIB "${GSL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}"
IMPORTED_CONFIGURATIONS Release
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
INTERFACE_LINK_LIBRARIES GSL::gslcblas )
# If we have both Debug and Release libraries
if( EXISTS "${GSL_LIBRARY_DEBUG_DLL}" AND EXISTS "${GSL_CBLAS_LIBRARY_DEBUG_DLL}")
set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties( GSL::gslcblas PROPERTIES
IMPORTED_LOCATION_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG_DLL}"
IMPORTED_IMPLIB_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG}" )
set_property( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties( GSL::gsl PROPERTIES
IMPORTED_LOCATION_DEBUG "${GSL_LIBRARY_DEBUG_DLL}"
IMPORTED_IMPLIB_DEBUG "${GSL_LIBRARY_DEBUG}" )
endif()
else()
# For all other environments (ones without dll libraries), create
# the imported library targets.
add_library( GSL::gsl UNKNOWN IMPORTED )
add_library( GSL::gslcblas UNKNOWN IMPORTED )
set_target_properties( GSL::gslcblas PROPERTIES
IMPORTED_LOCATION "${GSL_CBLAS_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
set_target_properties( GSL::gsl PROPERTIES
IMPORTED_LOCATION "${GSL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
INTERFACE_LINK_LIBRARIES GSL::gslcblas )
endif()
endif()
indi-eqmod-1.0+20220129131520/cmake_modules/FindMICAM.cmake 0000644 0001751 0001751 00000002567 14174600255 021460 0 ustar debian debian # - Try to find Moravian Instruments Camera Library
# Once done this will define
#
# MICAM_FOUND - system has MI
# MICAM_INCLUDE_DIR - the MI include directory
# MICAM_LIBRARIES - Link these to use MI
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (MICAM_INCLUDE_DIR AND MICAM_LIBRARIES)
# in cache already
set(MICAM_FOUND TRUE)
message(STATUS "Found libmicam: ${MICAM_LIBRARIES}")
else (MICAM_INCLUDE_DIR AND MICAM_LIBRARIES)
find_path(MICAM_INCLUDE_DIR gxccd.h
PATH_SUFFIXES libmicam
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(MICAM_LIBRARIES NAMES gxccd
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(MICAM_INCLUDE_DIR AND MICAM_LIBRARIES)
set(MICAM_FOUND TRUE)
else (MICAM_INCLUDE_DIR AND MICAM_LIBRARIES)
set(MICAM_FOUND FALSE)
endif(MICAM_INCLUDE_DIR AND MICAM_LIBRARIES)
if (MICAM_FOUND)
if (NOT MICAM_FIND_QUIETLY)
message(STATUS "Found MI Library: ${MICAM_LIBRARIES}")
endif (NOT MICAM_FIND_QUIETLY)
else (MICAM_FOUND)
if (MICAM_FIND_REQUIRED)
message(FATAL_ERROR "MI Library not found. Please install MI Library http://www.indilib.org")
endif (MICAM_FIND_REQUIRED)
endif (MICAM_FOUND)
mark_as_advanced(MICAM_INCLUDE_DIR MICAM_LIBRARIES)
endif (MICAM_INCLUDE_DIR AND MICAM_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindPackageHandleStandardArgs.cmake 0000644 0001751 0001751 00000035657 14174600255 025605 0 ustar debian debian #[=======================================================================[.rst:
FindPackageHandleStandardArgs
-----------------------------
This module provides a function intended to be used in :ref:`Find Modules`
implementing :command:`find_package()` calls. It handles the
``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``.
It also sets the ``_FOUND`` variable. The package is
considered found if all variables listed contain valid results, e.g.
valid filepaths.
.. command:: find_package_handle_standard_args
There are two signatures::
find_package_handle_standard_args(
(DEFAULT_MSG|)
...
)
find_package_handle_standard_args(
[FOUND_VAR ]
[REQUIRED_VARS ...]
[VERSION_VAR ]
[HANDLE_COMPONENTS]
[CONFIG_MODE]
[FAIL_MESSAGE ]
)
The ``_FOUND`` variable will be set to ``TRUE`` if all
the variables ``...`` are valid and any optional
constraints are satisfied, and ``FALSE`` otherwise. A success or
failure message may be displayed based on the results and on
whether the ``REQUIRED`` and/or ``QUIET`` option was given to
the :command:`find_package` call.
The options are:
``(DEFAULT_MSG|)``
In the simple signature this specifies the failure message.
Use ``DEFAULT_MSG`` to ask for a default message to be computed
(recommended). Not valid in the full signature.
``FOUND_VAR ``
Obsolete. Specifies either ``_FOUND`` or
``_FOUND`` as the result variable. This exists only
for compatibility with older versions of CMake and is now ignored.
Result variables of both names are always set for compatibility.
``REQUIRED_VARS ...``
Specify the variables which are required for this package.
These may be named in the generated failure message asking the
user to set the missing variable values. Therefore these should
typically be cache entries such as ``FOO_LIBRARY`` and not output
variables like ``FOO_LIBRARIES``.
``VERSION_VAR ``
Specify the name of a variable that holds the version of the package
that has been found. This version will be checked against the
(potentially) specified required version given to the
:command:`find_package` call, including its ``EXACT`` option.
The default messages include information about the required
version and the version which has been actually found, both
if the version is ok or not.
``HANDLE_COMPONENTS``
Enable handling of package components. In this case, the command
will report which components have been found and which are missing,
and the ``_FOUND`` variable will be set to ``FALSE``
if any of the required components (i.e. not the ones listed after
the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are
missing.
``CONFIG_MODE``
Specify that the calling find module is a wrapper around a
call to ``find_package( NO_MODULE)``. This implies
a ``VERSION_VAR`` value of ``_VERSION``. The command
will automatically check whether the package configuration file
was found.
``FAIL_MESSAGE ``
Specify a custom failure message instead of using the default
generated message. Not recommended.
Example for the simple signature:
.. code-block:: cmake
find_package_handle_standard_args(LibXml2 DEFAULT_MSG
LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
The ``LibXml2`` package is considered to be found if both
``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid.
Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found
and ``REQUIRED`` was used, it fails with a
:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was
used or not. If it is found, success will be reported, including
the content of the first ````. On repeated CMake runs,
the same message will not be printed again.
Example for the full signature:
.. code-block:: cmake
find_package_handle_standard_args(LibArchive
REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
VERSION_VAR LibArchive_VERSION)
In this case, the ``LibArchive`` package is considered to be found if
both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid.
Also the version of ``LibArchive`` will be checked by using the version
contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given,
the default messages will be printed.
Another example for the full signature:
.. code-block:: cmake
find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
find_package_handle_standard_args(Automoc4 CONFIG_MODE)
In this case, a ``FindAutmoc4.cmake`` module wraps a call to
``find_package(Automoc4 NO_MODULE)`` and adds an additional search
directory for ``automoc4``. Then the call to
``find_package_handle_standard_args`` produces a proper success/failure
message.
#]=======================================================================]
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
# internal helper macro
macro(_FPHSA_FAILURE_MESSAGE _msg)
if (${_NAME}_FIND_REQUIRED)
message(FATAL_ERROR "${_msg}")
else ()
if (NOT ${_NAME}_FIND_QUIETLY)
message(STATUS "${_msg}")
endif ()
endif ()
endmacro()
# internal helper macro to generate the failure message when used in CONFIG_MODE:
macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
# _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
if(${_NAME}_CONFIG)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
else()
# If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
# List them all in the error message:
if(${_NAME}_CONSIDERED_CONFIGS)
set(configsText "")
list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
math(EXPR configsCount "${configsCount} - 1")
foreach(currentConfigIndex RANGE ${configsCount})
list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
set(configsText "${configsText} ${filename} (version ${version})\n")
endforeach()
if (${_NAME}_NOT_FOUND_MESSAGE)
set(configsText "${configsText} Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n")
endif()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
else()
# Simple case: No Config-file was found at all:
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
endif()
endif()
endmacro()
function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in
# new extended or in the "old" mode:
set(options CONFIG_MODE HANDLE_COMPONENTS)
set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR)
set(multiValueArgs REQUIRED_VARS)
set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} )
list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
if(${INDEX} EQUAL -1)
set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
set(FPHSA_REQUIRED_VARS ${ARGN})
set(FPHSA_VERSION_VAR)
else()
CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
if(FPHSA_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
endif()
if(NOT FPHSA_FAIL_MESSAGE)
set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG")
endif()
endif()
# now that we collected all arguments, process them
if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG")
set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
endif()
# In config-mode, we rely on the variable _CONFIG, which is set by find_package()
# when it successfully found the config-file, including version checking:
if(FPHSA_CONFIG_MODE)
list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
set(FPHSA_VERSION_VAR ${_NAME}_VERSION)
endif()
if(NOT FPHSA_REQUIRED_VARS)
message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
endif()
list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
string(TOUPPER ${_NAME} _NAME_UPPER)
string(TOLOWER ${_NAME} _NAME_LOWER)
if(FPHSA_FOUND_VAR)
if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$")
set(_FOUND_VAR ${FPHSA_FOUND_VAR})
else()
message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.")
endif()
else()
set(_FOUND_VAR ${_NAME_UPPER}_FOUND)
endif()
# collect all variables which were not found, so they can be printed, so the
# user knows better what went wrong (#6375)
set(MISSING_VARS "")
set(DETAILS "")
# check if all passed variables are valid
set(FPHSA_FOUND_${_NAME} TRUE)
foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
if(NOT ${_CURRENT_VAR})
set(FPHSA_FOUND_${_NAME} FALSE)
set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
else()
set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
endif()
endforeach()
if(FPHSA_FOUND_${_NAME})
set(${_NAME}_FOUND TRUE)
set(${_NAME_UPPER}_FOUND TRUE)
else()
set(${_NAME}_FOUND FALSE)
set(${_NAME_UPPER}_FOUND FALSE)
endif()
# component handling
unset(FOUND_COMPONENTS_MSG)
unset(MISSING_COMPONENTS_MSG)
if(FPHSA_HANDLE_COMPONENTS)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(${_NAME}_${comp}_FOUND)
if(NOT DEFINED FOUND_COMPONENTS_MSG)
set(FOUND_COMPONENTS_MSG "found components: ")
endif()
set(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}")
else()
if(NOT DEFINED MISSING_COMPONENTS_MSG)
set(MISSING_COMPONENTS_MSG "missing components: ")
endif()
set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}")
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
set(MISSING_VARS "${MISSING_VARS} ${comp}")
endif()
endif()
endforeach()
set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}")
set(DETAILS "${DETAILS}[c${COMPONENT_MSG}]")
endif()
# version handling:
set(VERSION_MSG "")
set(VERSION_OK TRUE)
set(VERSION ${${FPHSA_VERSION_VAR}})
# check with DEFINED here as the requested or found version may be "0"
if (DEFINED ${_NAME}_FIND_VERSION)
if(DEFINED ${FPHSA_VERSION_VAR})
if(${_NAME}_FIND_VERSION_EXACT) # exact version required
# count the dots in the version string
string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${VERSION}")
# add one dot because there is one dot more than there are components
string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS)
if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT)
# Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT
# is at most 4 here. Therefore a simple lookup table is used.
if (${_NAME}_FIND_VERSION_COUNT EQUAL 1)
set(_VERSION_REGEX "[^.]*")
elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2)
set(_VERSION_REGEX "[^.]*\\.[^.]*")
elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3)
set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*")
else ()
set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*")
endif ()
string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${VERSION}")
unset(_VERSION_REGEX)
if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD)
set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
set(VERSION_OK FALSE)
else ()
set(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
endif ()
unset(_VERSION_HEAD)
else ()
if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL VERSION)
set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
set(VERSION_OK FALSE)
else ()
set(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
endif ()
endif ()
unset(_VERSION_DOTS)
else() # minimum version specified:
if (${_NAME}_FIND_VERSION VERSION_GREATER VERSION)
set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
set(VERSION_OK FALSE)
else ()
set(VERSION_MSG "(found suitable version \"${VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")")
endif ()
endif()
else()
# if the package was not found, but a version was given, add that to the output:
if(${_NAME}_FIND_VERSION_EXACT)
set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
else()
set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
endif()
endif()
else ()
if(VERSION)
set(VERSION_MSG "(found version \"${VERSION}\")")
endif()
endif ()
if(VERSION_OK)
set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]")
else()
set(${_NAME}_FOUND FALSE)
endif()
# print the result:
if (${_NAME}_FOUND)
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
else ()
if(FPHSA_CONFIG_MODE)
_FPHSA_HANDLE_FAILURE_CONFIG_MODE()
else()
if(NOT VERSION_OK)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
else()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
endif()
endif()
endif ()
set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
endfunction()
indi-eqmod-1.0+20220129131520/cmake_modules/FindOggTheora.cmake 0000644 0001751 0001751 00000002472 14174600255 022504 0 ustar debian debian #
# Find the native Ogg/Theora includes and libraries
#
# This module defines
# OGGTHEORA_INCLUDE_DIR, where to find ogg/ogg.h and theora/theora.h
# OGGTHEORA_LIBRARIES, the libraries to link against to use Ogg/Theora.
# OGGTHEORA_FOUND, If false, do not try to use Ogg/Theora.
FIND_PATH(OGGTHEORA_ogg_INCLUDE_DIR ogg/ogg.h)
FIND_PATH(OGGTHEORA_theora_INCLUDE_DIR theora/theora.h)
FIND_LIBRARY(OGGTHEORA_ogg_LIBRARY ogg)
FIND_LIBRARY(OGGTHEORA_theoraenc_LIBRARY theoraenc)
FIND_LIBRARY(OGGTHEORA_theoradec_LIBRARY theoradec)
SET(OGGTHEORA_INCLUDE_DIRS
${OGGTHEORA_ogg_INCLUDE_DIR}
${OGGTHEORA_theora_INCLUDE_DIR}
)
#HACK multiple directories
SET(OGGTHEORA_INCLUDE_DIR ${OGGTHEORA_INCLUDE_DIRS})
SET(OGGTHEORA_LIBRARIES
${OGGTHEORA_theoraenc_LIBRARY}
${OGGTHEORA_theoradec_LIBRARY}
${OGGTHEORA_ogg_LIBRARY}
)
#HACK multiple libraries
SET(OGGTHEORA_LIBRARY ${OGGTHEORA_LIBRARIES})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGGTHEORA
"Could NOT find the ogg and theora libraries"
OGGTHEORA_ogg_LIBRARY
OGGTHEORA_theoraenc_LIBRARY
OGGTHEORA_theoradec_LIBRARY
OGGTHEORA_ogg_INCLUDE_DIR
OGGTHEORA_theora_INCLUDE_DIR
)
MARK_AS_ADVANCED(OGGTHEORA_ogg_INCLUDE_DIR OGGTHEORA_theora_INCLUDE_DIR
OGGTHEORA_ogg_LIBRARY OGGTHEORA_theoraenc_LIBRARY
OGGTHEORA_theoradec_LIBRARY
)
indi-eqmod-1.0+20220129131520/cmake_modules/FindMEADE.cmake 0000644 0001751 0001751 00000002477 14174600255 021445 0 ustar debian debian # - Try to find Meade DSI Library.
# Once done this will define
#
# MEADEDSI_FOUND - system has Meade DSI
# MEADEDSI_LIBRARIES - Link these to use Meade DSI
# Copyright (c) 2006, Jasem Mutlaq
# Based on FindLibfacile by Carsten Niehaus,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (MEADEDSI_LIBRARIES)
# in cache already
set(MEADEDSI_FOUND TRUE)
message(STATUS "Found MEADEDSI: ${MEADEDSI_LIBRARIES}")
else (MEADEDSI_LIBRARIES)
find_library(MEADEDSI_LIBRARIES NAMES dsi
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
set(CMAKE_REQUIRED_LIBRARIES ${MEADEDSI_LIBRARIES})
if(MEADEDSI_LIBRARIES)
set(MEADEDSI_FOUND TRUE)
else (MEADEDSI_LIBRARIES)
set(MEADEDSI_FOUND FALSE)
endif(MEADEDSI_LIBRARIES)
if (MEADEDSI_FOUND)
if (NOT MEADEDSI_FIND_QUIETLY)
message(STATUS "Found Meade DSI: ${MEADEDSI_LIBRARIES}")
endif (NOT MEADEDSI_FIND_QUIETLY)
else (MEADEDSI_FOUND)
if (MEADEDSI_FIND_REQUIRED)
message(FATAL_ERROR "Meade DSI not found. Please install Meade DSI library. http://linuxdsi.sourceforge.net")
endif (MEADEDSI_FIND_REQUIRED)
endif (MEADEDSI_FOUND)
mark_as_advanced(MEADEDSI_LIBRARIES)
endif (MEADEDSI_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindTOUPCAM.cmake 0000644 0001751 0001751 00000002676 14174600255 021743 0 ustar debian debian # - Try to find Toupcam Camera Library
# Once done this will define
#
# TOUPCAM_FOUND - system has Toupcam
# TOUPCAM_INCLUDE_DIR - the Toupcam include directory
# TOUPCAM_LIBRARIES - Link these to use Toupcam
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES)
# in cache already
set(TOUPCAM_FOUND TRUE)
message(STATUS "Found libsbig: ${TOUPCAM_LIBRARIES}")
else (TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES)
find_path(TOUPCAM_INCLUDE_DIR toupcam.h
PATH_SUFFIXES libtoupcam
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(TOUPCAM_LIBRARIES NAMES toupcam
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES)
set(TOUPCAM_FOUND TRUE)
else (TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES)
set(TOUPCAM_FOUND FALSE)
endif(TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES)
if (TOUPCAM_FOUND)
if (NOT TOUPCAM_FIND_QUIETLY)
message(STATUS "Found Toupcam: ${TOUPCAM_LIBRARIES}")
endif (NOT TOUPCAM_FIND_QUIETLY)
else (TOUPCAM_FOUND)
if (TOUPCAM_FIND_REQUIRED)
message(FATAL_ERROR "Toupcam not found. Please install Toupcam Library http://www.indilib.org")
endif (TOUPCAM_FIND_REQUIRED)
endif (TOUPCAM_FOUND)
mark_as_advanced(TOUPCAM_INCLUDE_DIR TOUPCAM_LIBRARIES)
endif (TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindSV305.cmake 0000644 0001751 0001751 00000002646 14174600255 021410 0 ustar debian debian # - Try to find SV305 Library
# Once done this will define
#
# SV305_FOUND - system has QHY
# SV305_INCLUDE_DIR - the QHY include directory
# SV305_LIBRARIES - Link these to use QHY
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (SV305_INCLUDE_DIR AND SV305_LIBRARIES)
# in cache already
set(SV305_FOUND TRUE)
message(STATUS "Found libsv305: ${SV305_LIBRARIES}")
else (SV305_INCLUDE_DIR AND SV305_LIBRARIES)
# find headers
find_path(SV305_INCLUDE_DIR NAMES SVBCameraSDK.h
PATH_SUFFIXES libsv305
${_obIncDir}
${GNUWIN32_DIR}/include
)
# find libraries
find_library(SV305_LIBRARIES NAMES SVBCameraSDK
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(SV305_INCLUDE_DIR AND SV305_LIBRARIES)
set(SV305_FOUND TRUE)
else (SV305_INCLUDE_DIR AND SV305_LIBRARIES)
set(SV305_FOUND FALSE)
endif(SV305_INCLUDE_DIR AND SV305_LIBRARIES)
if (SV305_FOUND)
if (NOT SV305_FIND_QUIETLY)
message(STATUS "Found SV305 libraries : ${SV305_LIBRARIES}")
endif (NOT SV305_FIND_QUIETLY)
else (SV305_FOUND)
if (SV305_FIND_REQUIRED)
message(FATAL_ERROR "SV305 libraries not found. Please install libsv305 http://www.indilib.org")
endif (SV305_FIND_REQUIRED)
endif (SV305_FOUND)
mark_as_advanced(SV305_INCLUDE_DIR SV305_LIBRARIES)
endif (SV305_INCLUDE_DIR AND SV305_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindQSI.cmake 0000644 0001751 0001751 00000002455 14174600255 021262 0 ustar debian debian # - Try to find Quantum Scientific Imaging Library
# Once done this will define
#
# QSI_FOUND - system has QSI
# QSI_INCLUDE_DIR - the QSI include directory
# QSI_LIBRARIES - Link these to use QSI
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (QSI_INCLUDE_DIR AND QSI_LIBRARIES)
# in cache already
set(QSI_FOUND TRUE)
message(STATUS "Found libqsiapi: ${QSI_LIBRARIES}")
else (QSI_INCLUDE_DIR AND QSI_LIBRARIES)
find_path(QSI_INCLUDE_DIR qsiapi.h
PATH_SUFFIXES qsiapi
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(QSI_LIBRARIES NAMES qsiapi
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(QSI_INCLUDE_DIR AND QSI_LIBRARIES)
set(QSI_FOUND TRUE)
else (QSI_INCLUDE_DIR AND QSI_LIBRARIES)
set(QSI_FOUND FALSE)
endif(QSI_INCLUDE_DIR AND QSI_LIBRARIES)
if (QSI_FOUND)
if (NOT QSI_FIND_QUIETLY)
message(STATUS "Found QSI: ${QSI_LIBRARIES}")
endif (NOT QSI_FIND_QUIETLY)
else (QSI_FOUND)
if (QSI_FIND_REQUIRED)
message(FATAL_ERROR "QSI not found. Please install libqsi http://www.indilib.org")
endif (QSI_FIND_REQUIRED)
endif (QSI_FOUND)
mark_as_advanced(QSI_INCLUDE_DIR QSI_LIBRARIES)
endif (QSI_INCLUDE_DIR AND QSI_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/UnityBuild.cmake 0000644 0001751 0001751 00000016277 14174600255 022124 0 ustar debian debian #
# Copyright (c) 2009-2012 Christoph Heindl
# Copyright (c) 2015 Csaba Kertész (csaba.kertesz@gmail.com)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
MACRO (COMMIT_UNITY_FILE UNITY_FILE FILE_CONTENT)
SET(DIRTY FALSE)
# Check if the build file exists
SET(OLD_FILE_CONTENT "")
IF (NOT EXISTS ${${UNITY_FILE}} AND NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${${UNITY_FILE}})
SET(DIRTY TRUE)
ELSE ()
# Check the file content
FILE(STRINGS ${${UNITY_FILE}} OLD_FILE_CONTENT)
STRING(REPLACE ";" "" OLD_FILE_CONTENT "${OLD_FILE_CONTENT}")
STRING(REPLACE "\n" "" NEW_CONTENT "${${FILE_CONTENT}}")
STRING(COMPARE EQUAL "${OLD_FILE_CONTENT}" "${NEW_CONTENT}" EQUAL_CHECK)
IF (NOT EQUAL_CHECK EQUAL 1)
SET(DIRTY TRUE)
ENDIF ()
ENDIF ()
IF (DIRTY MATCHES TRUE)
MESSAGE(STATUS "Write Unity Build file: " ${${UNITY_FILE}})
FILE(WRITE ${${UNITY_FILE}} "${${FILE_CONTENT}}")
ENDIF ()
# Create a dummy copy of the unity file to trigger CMake reconfigure if it is deleted.
SET(UNITY_FILE_PATH "")
SET(UNITY_FILE_NAME "")
GET_FILENAME_COMPONENT(UNITY_FILE_PATH ${${UNITY_FILE}} PATH)
GET_FILENAME_COMPONENT(UNITY_FILE_NAME ${${UNITY_FILE}} NAME)
CONFIGURE_FILE(${${UNITY_FILE}} ${UNITY_FILE_PATH}/CMakeFiles/${UNITY_FILE_NAME}.dummy)
ENDMACRO ()
MACRO (ENABLE_UNITY_BUILD TARGET_NAME SOURCE_VARIABLE_NAME UNIT_SIZE EXTENSION)
# Limit is zero based conversion of unit_size
MATH(EXPR LIMIT ${UNIT_SIZE}-1)
SET(FILES ${SOURCE_VARIABLE_NAME})
# Effectivly ignore the source files from the build, but keep track them for changes.
SET_SOURCE_FILES_PROPERTIES(${${FILES}} PROPERTIES HEADER_FILE_ONLY true)
# Counts the number of source files up to the threshold
SET(COUNTER ${LIMIT})
# Have one or more unity build files
SET(FILE_NUMBER 0)
SET(BUILD_FILE "")
SET(BUILD_FILE_CONTENT "")
SET(UNITY_BUILD_FILES "")
SET(_DEPS "")
FOREACH (SOURCE_FILE ${${FILES}})
IF (COUNTER EQUAL LIMIT)
SET(_DEPS "")
# Write the actual Unity Build file
IF (NOT ${BUILD_FILE} STREQUAL "" AND NOT ${BUILD_FILE_CONTENT} STREQUAL "")
COMMIT_UNITY_FILE(BUILD_FILE BUILD_FILE_CONTENT)
ENDIF ()
SET(UNITY_BUILD_FILES ${UNITY_BUILD_FILES} ${BUILD_FILE})
# Set the variables for the current Unity Build file
SET(BUILD_FILE ${CMAKE_CURRENT_BINARY_DIR}/unitybuild_${FILE_NUMBER}_${TARGET_NAME}.${EXTENSION})
SET(BUILD_FILE_CONTENT "// Unity Build file generated by CMake\n")
MATH(EXPR FILE_NUMBER ${FILE_NUMBER}+1)
SET(COUNTER 0)
ENDIF ()
# Add source path to the file name if it is not there yet.
SET(FINAL_SOURCE_FILE "")
SET(SOURCE_PATH "")
GET_FILENAME_COMPONENT(SOURCE_PATH ${SOURCE_FILE} PATH)
IF (SOURCE_PATH STREQUAL "" OR NOT EXISTS ${SOURCE_FILE})
SET(FINAL_SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE})
ELSE ()
SET(FINAL_SOURCE_FILE ${SOURCE_FILE})
ENDIF ()
# Treat only the existing files or moc_*.cpp files
STRING(FIND ${SOURCE_FILE} "moc_" MOC_POS)
IF (EXISTS ${FINAL_SOURCE_FILE} OR MOC_POS GREATER -1)
# Add md5 hash of the source file (except moc files) to the build file content
IF (MOC_POS LESS 0)
SET(MD5_HASH "")
FILE(MD5 ${FINAL_SOURCE_FILE} MD5_HASH)
SET(BUILD_FILE_CONTENT "${BUILD_FILE_CONTENT}// md5: ${MD5_HASH}\n")
ENDIF ()
# Add the source file to the build file content
IF (MOC_POS GREATER -1)
SET(BUILD_FILE_CONTENT "${BUILD_FILE_CONTENT}#include <${SOURCE_FILE}>\n")
ELSE ()
SET(BUILD_FILE_CONTENT "${BUILD_FILE_CONTENT}#include <${FINAL_SOURCE_FILE}>\n")
ENDIF ()
# Add the source dependencies to the Unity Build file
GET_SOURCE_FILE_PROPERTY(_FILE_DEPS ${SOURCE_FILE} OBJECT_DEPENDS)
IF (_FILE_DEPS)
SET(_DEPS ${_DEPS} ${_FILE_DEPS})
SET_SOURCE_FILES_PROPERTIES(${BUILD_FILE} PROPERTIES OBJECT_DEPENDS "${_DEPS}")
ENDIF()
# Keep counting up to the threshold. Increment counter.
MATH(EXPR COUNTER ${COUNTER}+1)
ENDIF ()
ENDFOREACH ()
# Write out the last Unity Build file
IF (NOT ${BUILD_FILE} STREQUAL "" AND NOT ${BUILD_FILE_CONTENT} STREQUAL "")
COMMIT_UNITY_FILE(BUILD_FILE BUILD_FILE_CONTENT)
ENDIF ()
SET(UNITY_BUILD_FILES ${UNITY_BUILD_FILES} ${BUILD_FILE})
SET(${SOURCE_VARIABLE_NAME} ${${SOURCE_VARIABLE_NAME}} ${UNITY_BUILD_FILES})
ENDMACRO ()
MACRO (UNITY_GENERATE_MOC TARGET_NAME SOURCES HEADERS)
SET(NEW_SOURCES "")
FOREACH (HEADER_FILE ${${HEADERS}})
IF (NOT EXISTS ${HEADER_FILE})
MESSAGE(FATAL_ERROR "Header file does not exist (mocing): ${HEADER_FILE}")
ENDIF ()
FILE(READ ${HEADER_FILE} FILE_CONTENT)
STRING(FIND "${FILE_CONTENT}" "Q_OBJECT" QOBJECT_POS)
STRING(FIND "${FILE_CONTENT}" "Q_SLOTS" QSLOTS_POS)
STRING(FIND "${FILE_CONTENT}" "Q_SIGNALS" QSIGNALS_POS)
STRING(FIND "${FILE_CONTENT}" "QObject" OBJECT_POS)
STRING(FIND "${FILE_CONTENT}" "slots" SLOTS_POS)
STRING(FIND "${FILE_CONTENT}" "signals" SIGNALS_POS)
IF (QOBJECT_POS GREATER 0 OR OBJECT_POS GREATER 0 OR QSLOTS_POS GREATER 0 OR Q_SIGNALS GREATER 0 OR
SLOTS_POS GREATER 0 OR SIGNALS GREATER 0)
# Generate the moc filename
GET_FILENAME_COMPONENT(HEADER_BASENAME ${HEADER_FILE} NAME_WE)
SET(MOC_FILENAME "moc_${HEADER_BASENAME}.cpp")
SET(NEW_SOURCES ${NEW_SOURCES} ; "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILENAME}")
ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILENAME}"
DEPENDS ${HEADER_FILE}
COMMAND ${QT_MOC_EXECUTABLE} ${HEADER_FILE} -o "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILENAME}")
ENDIF ()
ENDFOREACH ()
IF (NEW_SOURCES)
SET_SOURCE_FILES_PROPERTIES(${NEW_SOURCES} PROPERTIES GENERATED TRUE)
SET(${SOURCES} ${${SOURCES}} ; ${NEW_SOURCES})
ENDIF ()
ENDMACRO ()
indi-eqmod-1.0+20220129131520/cmake_modules/FindLibRaw.cmake 0000644 0001751 0001751 00000005625 14174600255 022010 0 ustar debian debian # - Find LibRaw
# Find the LibRaw library
# This module defines
# LibRaw_VERSION_STRING, the version string of LibRaw
# LibRaw_INCLUDE_DIR, where to find libraw.h
# LibRaw_LIBRARIES, the libraries needed to use LibRaw (non-thread-safe)
# LibRaw_r_LIBRARIES, the libraries needed to use LibRaw (thread-safe)
# LibRaw_DEFINITIONS, the definitions needed to use LibRaw (non-thread-safe)
# LibRaw_r_DEFINITIONS, the definitions needed to use LibRaw (thread-safe)
#
# Copyright (c) 2013, Pino Toscano
# Copyright (c) 2013, Gilles Caulier
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
FIND_PACKAGE(PkgConfig)
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(PC_LIBRAW libraw)
SET(LibRaw_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER})
PKG_CHECK_MODULES(PC_LIBRAW_R libraw_r)
SET(LibRaw_r_DEFINITIONS ${PC_LIBRAW_R_CFLAGS_OTHER})
ENDIF()
FIND_PATH(LibRaw_INCLUDE_DIR libraw.h
HINTS
${PC_LIBRAW_INCLUDEDIR}
${PC_LibRaw_INCLUDE_DIRS}
PATH_SUFFIXES libraw
)
FIND_LIBRARY(LibRaw_LIBRARIES NAMES raw
HINTS
${PC_LIBRAW_LIBDIR}
${PC_LIBRAW_LIBRARY_DIRS}
)
FIND_LIBRARY(LibRaw_r_LIBRARIES NAMES raw_r
HINTS
${PC_LIBRAW_R_LIBDIR}
${PC_LIBRAW_R_LIBRARY_DIRS}
)
IF(LibRaw_INCLUDE_DIR)
FILE(READ ${LibRaw_INCLUDE_DIR}/libraw_version.h _libraw_version_content)
STRING(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content})
SET(_libraw_version_major "${CMAKE_MATCH_1}")
STRING(REGEX MATCH "#define LIBRAW_MINOR_VERSION[ \t]*([0-9]*)\n" _version_minor_match ${_libraw_version_content})
SET(_libraw_version_minor "${CMAKE_MATCH_1}")
STRING(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content})
SET(_libraw_version_patch "${CMAKE_MATCH_1}")
IF(_version_major_match AND _version_minor_match AND _version_patch_match)
SET(LibRaw_VERSION_STRING "${_libraw_version_major}.${_libraw_version_minor}.${_libraw_version_patch}")
ELSE()
IF(NOT LibRaw_FIND_QUIETLY)
MESSAGE(STATUS "Failed to get version information from ${LibRaw_INCLUDE_DIR}/libraw_version.h")
ENDIF()
ENDIF()
ENDIF()
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibRaw
REQUIRED_VARS LibRaw_LIBRARIES LibRaw_INCLUDE_DIR
VERSION_VAR LibRaw_VERSION_STRING
)
MARK_AS_ADVANCED(LibRaw_VERSION_STRING
LibRaw_INCLUDE_DIR
LibRaw_LIBRARIES
LibRaw_r_LIBRARIES
LibRaw_DEFINITIONS
LibRaw_r_DEFINITIONS
)
indi-eqmod-1.0+20220129131520/cmake_modules/FindALTAIRCAM.cmake 0000644 0001751 0001751 00000003010 14174600255 022107 0 ustar debian debian # - Try to find Altair Camera Library
# Once done this will define
#
# ALTAIRCAM_FOUND - system has Altair
# ALTAIRCAM_INCLUDE_DIR - the Altair include directory
# ALTAIRCAM_LIBRARIES - Link these to use Altair
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES)
# in cache already
set(ALTAIRCAM_FOUND TRUE)
message(STATUS "Found libaltaircam: ${ALTAIRCAM_LIBRARIES}")
else (ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES)
find_path(ALTAIRCAM_INCLUDE_DIR altaircam.h
PATH_SUFFIXES libaltaircam
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(ALTAIRCAM_LIBRARIES NAMES altaircam
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES)
set(ALTAIRCAM_FOUND TRUE)
else (ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES)
set(ALTAIRCAM_FOUND FALSE)
endif(ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES)
if (ALTAIRCAM_FOUND)
if (NOT ALTAIRCAM_FIND_QUIETLY)
message(STATUS "Found Altaircam: ${ALTAIRCAM_LIBRARIES}")
endif (NOT ALTAIRCAM_FIND_QUIETLY)
else (ALTAIRCAM_FOUND)
if (ALTAIRCAM_FIND_REQUIRED)
message(FATAL_ERROR "Altaircam not found. Please install Altaircam Library http://www.indilib.org")
endif (ALTAIRCAM_FIND_REQUIRED)
endif (ALTAIRCAM_FOUND)
mark_as_advanced(ALTAIRCAM_INCLUDE_DIR ALTAIRCAM_LIBRARIES)
endif (ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindSBIG.cmake 0000644 0001751 0001751 00000002512 14174600255 021344 0 ustar debian debian # - Try to find SBIG Universal Library
# Once done this will define
#
# SBIG_FOUND - system has SBIG
# SBIG_INCLUDE_DIR - the SBIG include directory
# SBIG_LIBRARIES - Link these to use SBIG
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (SBIG_INCLUDE_DIR AND SBIG_LIBRARIES)
# in cache already
set(SBIG_FOUND TRUE)
message(STATUS "Found libsbig: ${SBIG_LIBRARIES}")
else (SBIG_INCLUDE_DIR AND SBIG_LIBRARIES)
find_path(SBIG_INCLUDE_DIR sbigudrv.h
PATH_SUFFIXES libsbig
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(SBIG_LIBRARIES NAMES sbig
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(SBIG_INCLUDE_DIR AND SBIG_LIBRARIES)
set(SBIG_FOUND TRUE)
else (SBIG_INCLUDE_DIR AND SBIG_LIBRARIES)
set(SBIG_FOUND FALSE)
endif(SBIG_INCLUDE_DIR AND SBIG_LIBRARIES)
if (SBIG_FOUND)
if (NOT SBIG_FIND_QUIETLY)
message(STATUS "Found SBIG: ${SBIG_LIBRARIES}")
endif (NOT SBIG_FIND_QUIETLY)
else (SBIG_FOUND)
if (SBIG_FIND_REQUIRED)
message(FATAL_ERROR "SBIG not found. Please install SBIG Library http://www.indilib.org")
endif (SBIG_FIND_REQUIRED)
endif (SBIG_FOUND)
mark_as_advanced(SBIG_INCLUDE_DIR SBIG_LIBRARIES)
endif (SBIG_INCLUDE_DIR AND SBIG_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/CMakeParseArguments.cmake 0000644 0001751 0001751 00000001642 14174600255 023663 0 ustar debian debian #.rst:
# CMakeParseArguments
# -------------------
#
# This module once implemented the :command:`cmake_parse_arguments` command
# that is now implemented natively by CMake. It is now an empty placeholder
# for compatibility with projects that include it to get the command from
# CMake 3.4 and lower.
#=============================================================================
# Copyright 2010 Alexander Neundorf
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
indi-eqmod-1.0+20220129131520/cmake_modules/FindGPHOTO2.cmake 0000644 0001751 0001751 00000005626 14174600255 021713 0 ustar debian debian # - Find the native sqlite3 includes and library
#
# This module defines
# GPHOTO2_INCLUDE_DIR, where to find libgphoto2 header files
# GPHOTO2_LIBRARIES, the libraries to link against to use libgphoto2
# GPHOTO2_FOUND, If false, do not try to use libgphoto2.
# GPHOTO2_VERSION_STRING, e.g. 2.4.14
# GPHOTO2_VERSION_MAJOR, e.g. 2
# GPHOTO2_VERSION_MINOR, e.g. 4
# GPHOTO2_VERSION_PATCH, e.g. 14
#
# also defined, but not for general use are
# GPHOTO2_LIBRARY, where to find the sqlite3 library.
#=============================================================================
# Copyright 2010 henrik andersson
#=============================================================================
SET(GPHOTO2_FIND_REQUIRED ${Gphoto2_FIND_REQUIRED})
find_path(GPHOTO2_INCLUDE_DIR gphoto2/gphoto2.h)
mark_as_advanced(GPHOTO2_INCLUDE_DIR)
set(GPHOTO2_NAMES ${GPHOTO2_NAMES} gphoto2 libgphoto2)
set(GPHOTO2_PORT_NAMES ${GPHOTO2_PORT_NAMES} gphoto2_port libgphoto2_port)
find_library(GPHOTO2_LIBRARY NAMES ${GPHOTO2_NAMES} )
find_library(GPHOTO2_PORT_LIBRARY NAMES ${GPHOTO2_PORT_NAMES} )
mark_as_advanced(GPHOTO2_LIBRARY)
mark_as_advanced(GPHOTO2_PORT_LIBRARY)
# Detect libgphoto2 version
FIND_PROGRAM(GPHOTO2CONFIG_EXECUTABLE NAMES gphoto2-config)
IF(GPHOTO2CONFIG_EXECUTABLE)
EXEC_PROGRAM(${GPHOTO2CONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GPHOTO2_VERSION)
string(REGEX REPLACE "^.*libgphoto2 ([0-9]+).*$" "\\1" GPHOTO2_VERSION_MAJOR "${GPHOTO2_VERSION}")
string(REGEX REPLACE "^.*libgphoto2 [0-9]+\\.([0-9]+).*$" "\\1" GPHOTO2_VERSION_MINOR "${GPHOTO2_VERSION}")
string(REGEX REPLACE "^.*libgphoto2 [0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" GPHOTO2_VERSION_PATCH "${GPHOTO2_VERSION}")
set(GPHOTO2_VERSION_STRING "${GPHOTO2_VERSION_MAJOR}.${GPHOTO2_VERSION_MINOR}.${GPHOTO2_VERSION_PATCH}")
ENDIF(GPHOTO2CONFIG_EXECUTABLE)
# handle the QUIETLY and REQUIRED arguments and set GPHOTO2_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GPHOTO2 DEFAULT_MSG GPHOTO2_LIBRARY GPHOTO2_INCLUDE_DIR)
IF(GPHOTO2_FOUND)
SET(Gphoto2_LIBRARIES ${GPHOTO2_LIBRARY} ${GPHOTO2_PORT_LIBRARY})
SET(Gphoto2_INCLUDE_DIRS ${GPHOTO2_INCLUDE_DIR})
# libgphoto2 dynamically loads and unloads usb library
# without calling any cleanup functions (since they are absent from libusb-0.1).
# This leaves usb event handling threads running with invalid callback and return addresses,
# which causes a crash after any usb event is generated, at least in Mac OS X.
# libusb1 backend does correctly call exit function, but ATM it crashes anyway.
# Workaround is to link against libusb so that it wouldn't get unloaded.
IF(APPLE)
find_library(USB_LIBRARY NAMES usb-1.0 libusb-1.0)
mark_as_advanced(USB_LIBRARY)
IF(USB_LIBRARY)
SET(Gphoto2_LIBRARIES ${Gphoto2_LIBRARIES} ${USB_LIBRARY})
ENDIF(USB_LIBRARY)
ENDIF(APPLE)
ENDIF(GPHOTO2_FOUND)
indi-eqmod-1.0+20220129131520/cmake_modules/FindMMAL.cmake 0000644 0001751 0001751 00000003032 14174600255 021344 0 ustar debian debian # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This module can find the MMAL camera libraries.
#
cmake_minimum_required(VERSION 3.0.0)
set (MMAL_LIBS mmal_core mmal_util mmal_vc_client)
set (EGL_LIBS brcmGLESv2 brcmEGL)
foreach(lib ${MMAL_LIBS} ${EGL_LIBS} vcos bcm_host m dl)
find_library(${lib}_LIBRARY
NAMES ${lib}
HINTS ${MMAL_DIR}/lib /opt/vc/lib
)
if (DEFINED ${lib}_LIBRARY)
set(MMAL_LIBRARIES ${MMAL_LIBRARIES} ${${lib}_LIBRARY})
else()
message(FATAL_ERROR "Failed to find ${${lib}_LIBRARY} library")
endif()
endforeach(lib)
find_path(BCM_INCLUDE_DIR NAMES bcm_host.h
HINTS "/opt/vc/include"
)
find_path(MMAL_BASE_INCLUDE_DIR NAMES mmal.h
HINTS "/opt/vc/include/interface/mmal"
)
find_path(MMAL_UTIL_INCLUDE_DIR NAMES mmal_util.h
HINTS "/opt/vc/include/interface/mmal/util"
)
if (MMAL_BASE_INCLUDE_DIR AND BCM_INCLUDE_DIR AND MMAL_UTIL_INCLUDE_DIR)
set(MMAL_INCLUDE_DIR ${MMAL_BASE_INCLUDE_DIR} ${BCM_INCLUDE_DIR} ${MMAL_UTIL_INCLUDE_DIR})
set(MMAL_FOUND TRUE)
endif()
indi-eqmod-1.0+20220129131520/cmake_modules/FindAIOUSB.cmake 0000644 0001751 0001751 00000003713 14174600255 021606 0 ustar debian debian # - Try to find libaiousb
# Once done this will define
#
# AIOUSB_FOUND - system has AIOUSB
# AIOUSB_INCLUDE_DIR - the AIOUSB include directory
# AIOUSB_LIBRARIES - Link these to use AIOUSB (C)
# AIOUSB_CPP_LIBRARIES - Link these to use AIOUSB (C++)
# Copyright (c) 2006, Jasem Mutlaq
# Based on FindLibfacile by Carsten Niehaus,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES)
# in cache already
set(AIOUSB_FOUND TRUE)
message(STATUS "Found libaiusb: ${AIOUSB_LIBRARIES}")
message(STATUS "Found libaiusbcpp: ${AIOUSB_CPP_LIBRARIES}")
else (AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES)
find_path(AIOUSB_INCLUDE_DIR aiousb.h
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(AIOUSB_LIBRARIES NAMES aiousb
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
find_library(AIOUSB_CPP_LIBRARIES NAMES aiousbcpp
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES)
set(AIOUSB_FOUND TRUE)
else (AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES)
set(AIOUSB_FOUND FALSE)
endif(AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES)
if (AIOUSB_FOUND)
if (NOT AIOUSB_FIND_QUIETLY)
message(STATUS "Found libaiousb: ${AIOUSB_LIBRARIES}")
message(STATUS "Found libaiusbcpp: ${AIOUSB_CPP_LIBRARIES}")
endif (NOT AIOUSB_FIND_QUIETLY)
else (AIOUSB_FOUND)
if (AIOUSB_FIND_REQUIRED)
message(FATAL_ERROR "libaiousb not found. Please install libaiousb. https://www.accesio.com")
endif (AIOUSB_FIND_REQUIRED)
endif (AIOUSB_FOUND)
mark_as_advanced(AIOUSB_INCLUDE_DIR AIOUSB_LIBRARIES AIOUSB_CPP_LIBRARIES)
endif (AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindAPOGEE.cmake 0000644 0001751 0001751 00000003115 14174600255 021560 0 ustar debian debian # - Try to find Apogee Instruments Library
# Once done this will define
#
# APOGEE_FOUND - system has APOGEE
# APOGEE_INCLUDE_DIR - the APOGEE include directory
# APOGEE_LIBRARY - Link these to use APOGEE
# Copyright (c) 2008, Jasem Mutlaq
# Based on FindLibfacile by Carsten Niehaus,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY)
# in cache already
set(APOGEE_FOUND TRUE)
message(STATUS "Found libapogee: ${APOGEE_LIBRARY}")
else (APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY)
find_path(APOGEE_INCLUDE_DIR ApogeeCam.h
PATH_SUFFIXES libapogee
${_obIncDir}
${GNUWIN32_DIR}/include
)
# Find Apogee Library
find_library(APOGEE_LIBRARY NAMES apogee
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY)
set(APOGEE_FOUND TRUE)
else (APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY)
set(APOGEE_FOUND FALSE)
endif(APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY)
if (APOGEE_FOUND)
if (NOT APOGEE_FIND_QUIETLY)
message(STATUS "Found APOGEE: ${APOGEE_LIBRARY}")
endif (NOT APOGEE_FIND_QUIETLY)
else (APOGEE_FOUND)
if (APOGEE_FIND_REQUIRED)
message(FATAL_ERROR "libapogee not found. Cannot compile Apogee CCD Driver. Please install libapogee and try again. http://www.indilib.org")
endif (APOGEE_FIND_REQUIRED)
endif (APOGEE_FOUND)
mark_as_advanced(APOGEE_INCLUDE_DIR APOGEE_LIBRARY)
endif (APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY)
indi-eqmod-1.0+20220129131520/cmake_modules/FindFFmpeg.cmake 0000644 0001751 0001751 00000015735 14174600255 021777 0 ustar debian debian # - Try to find ffmpeg libraries (libavcodec, libavdevice, libavformat, libavutil, and libswscale)
# Once done this will define
#
# FFMPEG_FOUND - system has ffmpeg or libav
# FFMPEG_INCLUDE_DIR - the ffmpeg include directory
# FFMPEG_LIBRARIES - Link these to use ffmpeg
# FFMPEG_LIBAVCODEC
# FFMPEG_LIBAVDEVICE
# FFMPEG_LIBAVFORMAT
# FFMPEG_LIBAVUTIL
# FFMPEG_LIBSWSCALE
#
# Copyright (c) 2008 Andreas Schneider
# Modified for other libraries by Lasse Kärkkäinen
# Modified for Hedgewars by Stepik777
# Modified for INDILIB by rlancaste
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
#
macro(_FFMPEG_PACKAGE_check_version)
if(EXISTS "${PACKAGE_INCLUDE_DIR}/version.h")
file(READ "${PACKAGE_INCLUDE_DIR}/version.h" _FFMPEG_PACKAGE_version_header)
string(REGEX MATCH "#define ${PACKAGE_NAME}_VERSION_MAJOR[ \t]+([0-9]+)" _VERSION_MAJOR_match "${_FFMPEG_PACKAGE_version_header}")
set(FFMPEG_PACKAGE_VERSION_MAJOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define ${PACKAGE_NAME}_VERSION_MINOR[ \t]+([0-9]+)" _VERSION_MINOR_match "${_FFMPEG_PACKAGE_version_header}")
set(FFMPEG_PACKAGE_VERSION_MINOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define ${PACKAGE_NAME}_VERSION_MICRO[ \t]+([0-9]+)" _VERSION_MICRO_match "${_FFMPEG_PACKAGE_version_header}")
set(FFMPEG_PACKAGE_VERSION_MICRO "${CMAKE_MATCH_1}")
set(FFMPEG_PACKAGE_VERSION ${FFMPEG_PACKAGE_VERSION_MAJOR}.${FFMPEG_PACKAGE_VERSION_MINOR}.${FFMPEG_PACKAGE_VERSION_MICRO})
if(${FFMPEG_PACKAGE_VERSION} VERSION_LESS ${FFMPEG_PACKAGE_FIND_VERSION})
set(FFMPEG_PACKAGE_VERSION_OK FALSE)
else(${FFMPEG_PACKAGE_VERSION} VERSION_LESS ${FFMPEG_PACKAGE_FIND_VERSION})
set(FFMPEG_PACKAGE_VERSION_OK TRUE)
endif(${FFMPEG_PACKAGE_VERSION} VERSION_LESS ${FFMPEG_PACKAGE_FIND_VERSION})
if(NOT FFMPEG_PACKAGE_VERSION_OK)
message(STATUS "${PACKAGE_NAME} version ${FFMPEG_PACKAGE_VERSION} found in ${PACKAGE_INCLUDE_DIR}, "
"but at least version ${FFMPEG_PACKAGE_FIND_VERSION} is required")
else(NOT FFMPEG_PACKAGE_VERSION_OK)
mark_as_advanced(FFMPEG_PACKAGE_VERSION_MAJOR FFMPEG_PACKAGE_VERSION_MINOR FFMPEG_PACKAGE_VERSION_MICRO)
endif(NOT FFMPEG_PACKAGE_VERSION_OK)
else(EXISTS "${PACKAGE_INCLUDE_DIR}/version.h")
set(FFMPEG_PACKAGE_VERSION_OK FALSE)
message(STATUS "${PACKAGE_NAME}'s version.h file was not found in the include directory: ${PACKAGE_INCLUDE_DIR}, please install this program.")
endif(EXISTS "${PACKAGE_INCLUDE_DIR}/version.h")
endmacro(_FFMPEG_PACKAGE_check_version)
# required ffmpeg library versions, Requiring at least FFMPEG 3.2.11, Hypatia
set(_avcodec_ver ">=57.64.101")
set(_avdevice_ver ">=57.1.100")
set(_avformat_ver ">=57.56.100")
set(_avutil_ver ">=55.34.100")
set(_swscale_ver ">=4.2.100")
if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
# in cache already
set(FFMPEG_FOUND TRUE)
else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_path(FFMPEG_INCLUDE_DIR
NAMES libavcodec/avcodec.h
PATHS ${FFMPEG_INCLUDE_DIRS} ${CMAKE_INSTALL_PREFIX}/include /usr/include /usr/local/include /opt/local/include /sw/include
PATH_SUFFIXES ffmpeg libav
)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(AVCODEC libavcodec${_avcodec_ver})
pkg_check_modules(AVDEVICE libavdevice${_avdevice_ver})
pkg_check_modules(AVFORMAT libavformat${_avformat_ver})
pkg_check_modules(AVUTIL libavutil${_avutil_ver})
pkg_check_modules(SWSCALE libswscale${_swscale_ver})
else (PKG_CONFIG_FOUND)
# LIBAVCODEC
set(PACKAGE_NAME "LIBAVCODEC")
set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libavcodec")
set(FFMPEG_PACKAGE_FIND_VERSION _avcodec_ver)
_FFMPEG_PACKAGE_check_version()
if(FFMPEG_PACKAGE_VERSION_OK)
set(AVCODEC_VERSION FFMPEG_PACKAGE_VERSION)
endif(FFMPEG_PACKAGE_VERSION_OK)
# LIBAVDEVICE
set(PACKAGE_NAME "LIBAVDEVICE")
set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libavdevice")
set(FFMPEG_PACKAGE_FIND_VERSION _avdevice_ver)
_FFMPEG_PACKAGE_check_version()
if(FFMPEG_PACKAGE_VERSION_OK)
set(AVDEVICE_VERSION FFMPEG_PACKAGE_VERSION)
endif(FFMPEG_PACKAGE_VERSION_OK)
# LIBAVFORMAT
set(PACKAGE_NAME "LIBAVFORMAT")
set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libavformat")
set(FFMPEG_PACKAGE_FIND_VERSION _avformat_ver)
_FFMPEG_PACKAGE_check_version()
if(FFMPEG_PACKAGE_VERSION_OK)
set(AVFORMAT_VERSION FFMPEG_PACKAGE_VERSION)
endif(FFMPEG_PACKAGE_VERSION_OK)
# LIBAVUTIL
set(PACKAGE_NAME "LIBAVUTIL")
set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libavutil")
set(FFMPEG_PACKAGE_FIND_VERSION _avutil_ver)
_FFMPEG_PACKAGE_check_version()
if(FFMPEG_PACKAGE_VERSION_OK)
set(AVUTIL_VERSION FFMPEG_PACKAGE_VERSION)
endif(FFMPEG_PACKAGE_VERSION_OK)
# LIBSWSCALE
set(PACKAGE_NAME "LIBSWSCALE")
set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libswscale")
set(FFMPEG_PACKAGE_FIND_VERSION _swscale_ver)
_FFMPEG_PACKAGE_check_version()
if(FFMPEG_PACKAGE_VERSION_OK)
set(SWSCALE_VERSION FFMPEG_PACKAGE_VERSION)
endif(FFMPEG_PACKAGE_VERSION_OK)
endif (PKG_CONFIG_FOUND)
find_library(FFMPEG_LIBAVCODEC
NAMES avcodec libavcodec
PATHS ${AVCODEC_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
find_library(FFMPEG_LIBAVDEVICE
NAMES avdevice libavdevice
PATHS ${AVDEVICE_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
find_library(FFMPEG_LIBAVFORMAT
NAMES avformat libavformat
PATHS ${AVFORMAT_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
find_library(FFMPEG_LIBAVUTIL
NAMES avutil libavutil
PATHS ${AVUTIL_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
find_library(FFMPEG_LIBSWSCALE
NAMES swscale libswscale
PATHS ${SWSCALE_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
#Only set FFMPEG to found if all the libraries are found in the right versions.
if(AVCODEC_VERSION AND
AVDEVICE_VERSION AND
AVFORMAT_VERSION AND
AVUTIL_VERSION AND
SWSCALE_VERSION AND
FFMPEG_LIBAVCODEC AND
FFMPEG_LIBAVDEVICE AND
FFMPEG_LIBAVFORMAT AND
FFMPEG_LIBAVUTIL AND
FFMPEG_LIBSWSCALE)
set(FFMPEG_FOUND TRUE)
endif()
if (FFMPEG_FOUND)
set(FFMPEG_LIBRARIES
${FFMPEG_LIBAVCODEC}
${FFMPEG_LIBAVDEVICE}
${FFMPEG_LIBAVFORMAT}
${FFMPEG_LIBAVUTIL}
${FFMPEG_LIBSWSCALE}
)
endif (FFMPEG_FOUND)
if (FFMPEG_FOUND)
if (NOT FFMPEG_FIND_QUIETLY)
message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
endif (NOT FFMPEG_FIND_QUIETLY)
else (FFMPEG_FOUND)
message(STATUS "Could not find up to date FFMPEG for INDI Webcam. Up to date versions of these packages are required: libavcodec, libavdevice, libavformat, libavutil, and libswscale")
if (FFMPEG_FIND_REQUIRED)
message(FATAL_ERROR "Error: FFMPEG is required by this package!")
endif (FFMPEG_FIND_REQUIRED)
endif (FFMPEG_FOUND)
endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
indi-eqmod-1.0+20220129131520/cmake_modules/FindIconv.cmake 0000644 0001751 0001751 00000004261 14174600255 021701 0 ustar debian debian #
# Copyright (C) 2010 Michael Bell
# 2015-2016 MariaDB Corporation AB
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the COPYING-CMAKE-SCRIPTS file.
#
# ICONV_EXTERNAL - Iconv is an external library (not libc)
# ICONV_FOUND - system has Iconv
# ICONV_INCLUDE_DIR - the Iconv include directory
# ICONV_LIBRARIES - Link these to use Iconv
# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
# ICONV_VERSION - Iconv version string
if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
# Already in cache, be silent
set(ICONV_FIND_QUIETLY TRUE)
endif (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
find_path(ICONV_INCLUDE_DIR iconv.h)
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
# There is some libiconv.so in /usr/local that must
# be avoided, iconv routines are in libc
ELSEIF(APPLE)
find_library(ICONV_LIBRARIES NAMES iconv libiconv PATHS
/usr/lib/
NO_CMAKE_SYSTEM_PATH)
SET(ICONV_EXTERNAL TRUE)
ELSE()
find_library(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2)
IF(ICONV_LIBRARIES)
SET(ICONV_EXTERNAL TRUE)
ENDIF()
ENDIF()
if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
set (ICONV_FOUND TRUE)
endif (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
IF(ICONV_EXTERNAL)
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
ENDIF()
if (ICONV_FOUND)
include(CheckCSourceCompiles)
CHECK_C_SOURCE_COMPILES("
#include
int main(){
iconv_t conv = 0;
const char* in = 0;
size_t ilen = 0;
char* out = 0;
size_t olen = 0;
iconv(conv, &in, &ilen, &out, &olen);
return 0;
}
" ICONV_SECOND_ARGUMENT_IS_CONST )
endif (ICONV_FOUND)
set (CMAKE_REQUIRED_INCLUDES)
set (CMAKE_REQUIRED_LIBRARIES)
if (ICONV_FOUND)
if (NOT ICONV_FIND_QUIETLY)
message (STATUS "Found Iconv: ${ICONV_LIBRARIES}")
endif (NOT ICONV_FIND_QUIETLY)
else (ICONV_FOUND)
if (Iconv_FIND_REQUIRED)
message (FATAL_ERROR "Could not find Iconv")
endif (Iconv_FIND_REQUIRED)
endif (ICONV_FOUND)
MARK_AS_ADVANCED(
ICONV_INCLUDE_DIR
ICONV_LIBRARIES
ICONV_EXTERNAL
ICONV_SECOND_ARGUMENT_IS_CONST
)
indi-eqmod-1.0+20220129131520/cmake_modules/FindLIMESUITE.cmake 0000644 0001751 0001751 00000003012 14174600255 022154 0 ustar debian debian # - Try to find LIMESUITE
# Once done this will define
#
# LIMESUITE_FOUND - system has LIMESUITE
# LIMESUITE_INCLUDE_DIR - the LIMESUITE include directory
# LIMESUITE_LIBRARIES - Link these to use LIMESUITE
# LIMESUITE_VERSION_STRING - Human readable version number of rtlsdr
# LIMESUITE_VERSION_MAJOR - Major version number of rtlsdr
# LIMESUITE_VERSION_MINOR - Minor version number of rtlsdr
# Copyright (c) 2017, Ilia Platone,
# Based on FindLibfacile by Carsten Niehaus,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (LIMESUITE_LIBRARIES)
# in cache already
set(LIMESUITE_FOUND TRUE)
message(STATUS "Found LIMESUITE: ${LIMESUITE_LIBRARIES}")
else (LIMESUITE_LIBRARIES)
find_library(LIMESUITE_LIBRARIES NAMES LimeSuite
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
/usr/local/lib
)
if(LIMESUITE_LIBRARIES)
set(LIMESUITE_FOUND TRUE)
else (LIMESUITE_LIBRARIES)
set(LIMESUITE_FOUND FALSE)
endif(LIMESUITE_LIBRARIES)
if (LIMESUITE_FOUND)
if (NOT LIMESUITE_FIND_QUIETLY)
message(STATUS "Found LIMESUITE: ${LIMESUITE_LIBRARIES}")
endif (NOT LIMESUITE_FIND_QUIETLY)
else (LIMESUITE_FOUND)
if (LIMESUITE_FIND_REQUIRED)
message(FATAL_ERROR "LIMESUITE not found. Please install libLimeSuite-dev")
endif (LIMESUITE_FIND_REQUIRED)
endif (LIMESUITE_FOUND)
mark_as_advanced(LIMESUITE_LIBRARIES)
endif (LIMESUITE_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindPLAYERONE.cmake 0000644 0001751 0001751 00000003221 14174600255 022154 0 ustar debian debian # - Try to find PlayerOne Library
# Once done this will define
#
# PLAYERONE_FOUND - system has PLAYERONE
# PLAYERONE_INCLUDE_DIR - the PLAYERONE include directory
# PLAYERONE_LIBRARIES - Link these to use ASI
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES)
# in cache already
set(PLAYERONE_FOUND TRUE)
message(STATUS "Found libplayerone: ${PLAYERONE_LIBRARIES}")
else (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES)
find_path(PLAYERONE_INCLUDE_DIR PlayerOneCamera.h
PATH_SUFFIXES libplayerone
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(PLAYERONECAM_LIBRARIES NAMES PlayerOneCamera
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if (PLAYERONECAM_LIBRARIES)
set(PLAYERONE_LIBRARIES ${PLAYERONECAM_LIBRARIES})
endif (PLAYERONECAM_LIBRARIES)
if(PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES)
set(PLAYERONE_FOUND TRUE)
else (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES)
set(PLAYERONE_FOUND FALSE)
endif(PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES)
if (PLAYERONE_FOUND)
if (NOT PLAYERONE_FIND_QUIETLY)
message(STATUS "Found PLAYERONE: ${PLAYERONE_LIBRARIES}")
endif (NOT PLAYERONE_FIND_QUIETLY)
else (PLAYERONE_FOUND)
if (PLAYERONE_FIND_REQUIRED)
message(FATAL_ERROR "PLAYERONE not found. Please install libPlayerOneCamera.2 http://www.indilib.org")
endif (PLAYERONE_FIND_REQUIRED)
endif (PLAYERONE_FOUND)
mark_as_advanced(PLAYERONE_INCLUDE_DIR PLAYERONE_LIBRARIES)
endif (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindNNCAM.cmake 0000644 0001751 0001751 00000002563 14174600255 021462 0 ustar debian debian # - Try to find NNCAM Camera Library
# Once done this will define
#
# NNCAM_FOUND - system has Levenhuk
# NNCAM_INCLUDE_DIR - the Levenhuk include directory
# NNCAM_LIBRARIES - Link these to use Levenhuk
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES)
# in cache already
set(NNCAM_FOUND TRUE)
message(STATUS "Found libnncam: ${NNCAM_LIBRARIES}")
else (NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES)
find_path(NNCAM_INCLUDE_DIR nncam.h
PATH_SUFFIXES libnncam
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(NNCAM_LIBRARIES NAMES nncam
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES)
set(NNCAM_FOUND TRUE)
else (NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES)
set(NNCAM_FOUND FALSE)
endif(NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES)
if (NNCAM_FOUND)
if (NOT NNCAM_FIND_QUIETLY)
message(STATUS "Found NNCAM: ${NNCAM_LIBRARIES}")
endif (NOT NNCAM_FIND_QUIETLY)
else (NNCAM_FOUND)
if (NNCAM_FIND_REQUIRED)
message(FATAL_ERROR "NNCAM not found. Please install NNCAM Library http://www.indilib.org")
endif (NNCAM_FIND_REQUIRED)
endif (NNCAM_FOUND)
mark_as_advanced(NNCAM_INCLUDE_DIR NNCAM_LIBRARIES)
endif (NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES)
indi-eqmod-1.0+20220129131520/cmake_modules/FindRT.cmake 0000644 0001751 0001751 00000001525 14174600255 021150 0 ustar debian debian # FindRT.cmake - Try to find the RT library
# Once done this will define
#
# RT_FOUND - System has rt
# RT_INCLUDE_DIR - The rt include directory
# RT_LIBRARIES - The libraries needed to use rt
# RT_DEFINITIONS - Compiler switches required for using rt
#
# Also creates an import target called RT::RT
find_path (RT_INCLUDE_DIR NAMES time.h
PATHS
/usr
/usr/local
/opt
PATH_SUFFIXES
)
find_library(RT_LIBRARIES NAMES rt
PATHS
/usr
/usr/local
/opt
)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(rt DEFAULT_MSG RT_LIBRARIES RT_INCLUDE_DIR)
mark_as_advanced(RT_INCLUDE_DIR RT_LIBRARIES)
if (NOT TARGET RT::RT)
add_library(RT::RT INTERFACE IMPORTED)
set_target_properties(RT::RT PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${RT_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${RT_LIBRARIES}
)
endif() indi-eqmod-1.0+20220129131520/eqmoderror.cpp 0000644 0001751 0001751 00000005072 14174600255 017074 0 ustar debian debian /* Copyright 2012 Geehalel (geehalel AT gmail DOT com) */
/* This file is part of the Skywatcher Protocol INDI driver.
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#include "eqmoderror.h"
#include "eqmodbase.h"
EQModError::EQModError(Severity sev, const char *msg, ...)
{
if (msg)
{
va_list ap;
va_start(ap, msg);
vsnprintf(message, ERROR_MSG_LENGTH, msg, ap);
va_end(ap);
}
else
message[0] = '\0';
severity = sev;
}
const char *EQModError::severityString()
{
switch (severity)
{
case EQModError::ErrInvalidCmd:
return ("Invalid command");
case EQModError::ErrCmdFailed:
return ("Command failed");
case EQModError::ErrInvalidParameter:
return ("Invalid parameter");
case EQModError::ErrDisconnect:
return ("Communication failed");
default:
return ("Unknown severity");
}
}
bool EQModError::DefaultHandleException(EQMod *device)
{
switch (severity)
{
case EQModError::ErrInvalidCmd:
case EQModError::ErrCmdFailed:
case EQModError::ErrInvalidParameter:
DEBUGFDEVICE(device->getDeviceName(), INDI::Logger::DBG_WARNING, "Warning: %s -> %s", severityString(),
message);
return true;
case EQModError::ErrDisconnect:
DEBUGFDEVICE(device->getDeviceName(), INDI::Logger::DBG_ERROR, "Error: %s -> %s", severityString(),
message);
//device->Disconnect();
device->abnormalDisconnect();
return false;
default:
DEBUGFDEVICE(device->getDeviceName(), INDI::Logger::DBG_ERROR, "Unhandled exception: %s -> %s",
severityString(), message);
//device->Disconnect();
device->abnormalDisconnect();
return false;
//break;
}
}
indi-eqmod-1.0+20220129131520/mach_gettime.h 0000644 0001751 0001751 00000000515 14174600255 017005 0 ustar debian debian /* complete rewrite May 2017, Rumen G.Bogdanovski */
#ifndef mach_time_h
#define mach_time_h
#ifdef __MACH__ /* Mac OSX prior Sierra is missing clock_gettime() */
#include
#include
void get_utc_time(struct timespec *ts);
#else
#define get_utc_time(ts) clock_gettime(CLOCK_MONOTONIC, ts)
#endif
#endif
indi-eqmod-1.0+20220129131520/eqmodbase.h 0000644 0001751 0001751 00000025414 14174600255 016324 0 ustar debian debian /* Copyright 2012 Geehalel (geehalel AT gmail DOT com) */
/* This file is part of the Skywatcher Protocol INDI driver.
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#pragma once
#include "config.h"
#include "skywatcher.h"
#ifdef WITH_ALIGN_GEEHALEL
#include "align/align.h"
#endif
#include "simulator/simulator.h"
#ifdef WITH_SCOPE_LIMITS
#include "scope-limits/scope-limits.h"
#endif
#include
#include
#include
typedef struct SyncData
{
double lst, jd;
double targetRA, targetDEC;
double telescopeRA, telescopeDEC;
double deltaRA, deltaDEC;
uint32_t targetRAEncoder, targetDECEncoder;
uint32_t telescopeRAEncoder, telescopeDECEncoder;
long deltaRAEncoder, deltaDECEncoder;
} SyncData;
#ifdef WITH_ALIGN
#include
class EQMod : public INDI::Telescope, public INDI::GuiderInterface, INDI::AlignmentSubsystem::AlignmentSubsystemForDrivers
#else
class EQMod : public INDI::Telescope, public INDI::GuiderInterface
#endif
{
protected:
// private:
Skywatcher *mount;
uint32_t currentRAEncoder, zeroRAEncoder, totalRAEncoder;
uint32_t currentDEEncoder, zeroDEEncoder, totalDEEncoder;
uint32_t homeRAEncoder, parkRAEncoder;
uint32_t homeDEEncoder, parkDEEncoder;
double currentRA, currentHA;
double currentDEC;
double alignedRA, alignedDEC;
double ghalignedRA, ghalignedDEC;
double targetRA;
double targetDEC;
#ifdef WITH_ALIGN_GEEHALEL
Align *align;
#endif
int last_motion_ns;
int last_motion_ew;
INDI::IEquatorialCoordinates lnradec;
INDI::IHorizontalCoordinates lnaltaz;
/* Time variables */
struct tm utc;
struct ln_date lndate;
struct timeval lasttimeupdate;
struct timespec lastclockupdate;
double juliandate;
int GuideTimerNS;
int GuideTimerWE;
INumber *GuideRateN = nullptr;
INumberVectorProperty *GuideRateNP = nullptr;
ITextVectorProperty *MountInformationTP = nullptr;
INumberVectorProperty *SteppersNP = nullptr;
INumberVectorProperty *CurrentSteppersNP = nullptr;
INumberVectorProperty *PeriodsNP = nullptr;
INumberVectorProperty *JulianNP = nullptr;
INumberVectorProperty *TimeLSTNP = nullptr;
ILightVectorProperty *RAStatusLP = nullptr;
ILightVectorProperty *DEStatusLP = nullptr;
INumberVectorProperty *SlewSpeedsNP = nullptr;
ISwitchVectorProperty *HemisphereSP = nullptr;
ISwitchVectorProperty *TrackDefaultSP = nullptr;
INumberVectorProperty *HorizontalCoordNP = nullptr;
INumberVectorProperty *StandardSyncNP = nullptr;
INumberVectorProperty *StandardSyncPointNP = nullptr;
INumberVectorProperty *SyncPolarAlignNP = nullptr;
ISwitchVectorProperty *SyncManageSP = nullptr;
ISwitchVectorProperty *ReverseDECSP = nullptr;
ISwitchVectorProperty *TargetPierSideSP = nullptr;
INumberVectorProperty *BacklashNP = nullptr;
ISwitchVectorProperty *UseBacklashSP = nullptr;
INumberVectorProperty *LEDBrightnessNP = nullptr;
#if defined WITH_ALIGN && defined WITH_ALIGN_GEEHALEL
ISwitch AlignMethodS[2];
ISwitchVectorProperty AlignMethodSP;
#endif
#if defined WITH_ALIGN || defined WITH_ALIGN_GEEHALEL
ISwitchVectorProperty *AlignSyncModeSP = nullptr;
#endif
ISwitchVectorProperty *AutoHomeSP = nullptr;
ISwitchVectorProperty *AuxEncoderSP = nullptr;
INumberVectorProperty *AuxEncoderNP = nullptr;
ISwitchVectorProperty *ST4GuideRateNSSP = nullptr;
ISwitchVectorProperty *ST4GuideRateWESP = nullptr;
ISwitchVectorProperty *PPECTrainingSP = nullptr;
ISwitchVectorProperty *PPECSP = nullptr;
ISwitchVectorProperty *SNAPPORT1SP = nullptr;
ISwitchVectorProperty *SNAPPORT2SP = nullptr;
INumber *MinPulseN = nullptr;
INumber *MinPulseTimerN = nullptr;
INumberVectorProperty *PulseLimitsNP = nullptr;
enum Hemisphere
{
NORTH = 0,
SOUTH = 1
};
typedef struct GotoParams
{
double ratarget, detarget, racurrent, decurrent;
uint32_t ratargetencoder, detargetencoder, racurrentencoder, decurrentencoder;
uint32_t limiteast, limitwest;
unsigned int iterative_count;
bool checklimits, outsidelimits, completed;
TelescopePierSide pier_side;
} GotoParams;
Hemisphere Hemisphere;
bool RAInverted, DEInverted;
TelescopePierSide TargetPier = PIER_UNKNOWN;
GotoParams gotoparams;
SyncData syncdata, syncdata2;
double tpa_alt, tpa_az;
void EncodersToRADec(uint32_t rastep, uint32_t destep, double lst, double *ra, double *de, double *ha,
TelescopePierSide *pierSide);
double EncoderToHours(uint32_t destep, uint32_t initdestep, uint32_t totalrastep, enum Hemisphere h);
double EncoderToDegrees(uint32_t destep, uint32_t initdestep, uint32_t totalrastep,
enum Hemisphere h);
double EncoderFromHour(double hour, uint32_t initstep, uint32_t totalstep, enum Hemisphere h);
double EncoderFromRA(double ratarget, TelescopePierSide p, double lst, uint32_t initstep, uint32_t totalstep,
enum Hemisphere h);
double EncoderFromDegree(double degree, uint32_t initstep, uint32_t totalstep,
enum Hemisphere h);
double EncoderFromDec(double detarget, TelescopePierSide p, uint32_t initstep, uint32_t totalstep,
enum Hemisphere h);
void EncoderTarget(GotoParams *g);
void SetSouthernHemisphere(bool southern);
void UpdateDEInverted();
double GetRATrackRate();
double GetDETrackRate();
double GetDefaultRATrackRate();
double GetDefaultDETrackRate();
static void timedguideNSCallback(void *userpointer);
static void timedguideWECallback(void *userpointer);
double GetRASlew();
double GetDESlew();
bool gotoInProgress();
bool loadProperties();
void setStepperSimulation(bool enable);
void computePolarAlign(SyncData s1, SyncData s2, double lat, double *tpaalt, double *tpaaz);
void starPolarAlign(double lst, double ra, double dec, double theta, double gamma, double *tra, double *tdec);
#if defined WITH_ALIGN || defined WITH_ALIGN_GEEHALEL
bool isStandardSync();
#endif
// Autohoming for EQ8
int ah_confirm_timeout;
bool ah_bSlewingUp_RA, ah_bSlewingUp_DE;
uint32_t ah_iPosition_RA, ah_iPosition_DE;
int ah_iChanges;
bool ah_bIndexChanged_RA, ah_bIndexChanged_DE;
uint32_t ah_sHomeIndexPosition_RA, ah_sHomeIndexPosition_DE;
int ah_waitRA, ah_waitDE;
// save PPEC status when guiding
bool restartguidePPEC;
// One bit for each axis
uint8_t pulseInProgress;
public:
EQMod();
virtual ~EQMod();
virtual const char *getDefaultName();
virtual bool Handshake();
virtual bool Disconnect();
virtual void TimerHit();
virtual bool ReadScopeStatus();
virtual bool initProperties();
virtual bool updateProperties();
virtual void ISGetProperties(const char *dev);
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n);
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n);
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n);
#ifdef WITH_ALIGN
virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
char *formats[], char *names[], int n);
#endif
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command);
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command);
virtual bool Abort();
virtual IPState GuideNorth(uint32_t ms);
virtual IPState GuideSouth(uint32_t ms);
virtual IPState GuideEast(uint32_t ms);
virtual IPState GuideWest(uint32_t ms);
bool Goto(double ra, double dec);
bool Park();
bool UnPark();
bool SetCurrentPark();
bool SetDefaultPark();
bool Sync(double ra, double dec);
// Call first time EQMod is run
void saveInitialParkPosition();
// Called when there is an unrecoverable tty error
void abnormalDisconnect();
static void abnormalDisconnectCallback(void *userpointer);
// Tracking
bool SetTrackMode(uint8_t mode);
bool SetTrackRate(double raRate, double deRate);
bool SetTrackEnabled(bool enabled);
virtual bool saveConfigItems(FILE *fp);
bool updateTime(ln_date *lndate_utc, double utc_offset);
bool updateLocation(double latitude, double longitude, double elevation);
double getLongitude();
double getLatitude();
double getJulianDate();
double getLst(double jd, double lng);
EQModSimulator *simulator;
#ifdef WITH_SCOPE_LIMITS
HorizonLimits *horizon;
#endif
// AutoHoming for EQ8
static const TelescopeStatus SCOPE_AUTOHOMING = static_cast(SCOPE_PARKED + 1);
enum AutoHomeStatus
{
AUTO_HOME_IDLE,
AUTO_HOME_CONFIRM,
AUTO_HOME_WAIT_PHASE1,
AUTO_HOME_WAIT_PHASE2,
AUTO_HOME_WAIT_PHASE3,
AUTO_HOME_WAIT_PHASE4,
AUTO_HOME_WAIT_PHASE5,
AUTO_HOME_WAIT_PHASE6
};
AutoHomeStatus AutohomeState;
int DBG_SCOPE_STATUS {0};
int DBG_COMM {0};
int DBG_MOUNT {0};
};
indi-eqmod-1.0+20220129131520/eqmod.cpp 0000644 0001751 0001751 00000001627 14174600255 016024 0 ustar debian debian /* This file is part of the Skywatcher Protocol INDI driver.
Copyright 2012 Geehalel (geehalel AT gmail DOT com)
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#include "eqmodbase.h"
static std::unique_ptr eqmod(new EQMod());
indi-eqmod-1.0+20220129131520/skywatcher.cpp 0000644 0001751 0001751 00000163362 14174600255 017110 0 ustar debian debian /* Copyright 2012 Geehalel (geehalel AT gmail DOT com) */
/* This file is part of the Skywatcher Protocol INDI driver.
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#include "skywatcher.h"
#include "eqmodbase.h"
#include
#include
#include
#include
Skywatcher::Skywatcher(EQMod *t)
{
debug = false;
debugnextread = false;
simulation = false;
telescope = t;
reconnect = false;
}
Skywatcher::~Skywatcher(void)
{
Disconnect();
}
void Skywatcher::setDebug(bool enable)
{
debug = enable;
}
bool Skywatcher::isDebug()
{
return debug;
}
void Skywatcher::setPortFD(int value)
{
PortFD = value;
}
void Skywatcher::setSimulation(bool enable)
{
simulation = enable;
}
bool Skywatcher::isSimulation()
{
return simulation;
}
const char *Skywatcher::getDeviceName()
{
return telescope->getDeviceName();
}
/* API */
bool Skywatcher::Handshake()
{
if (isSimulation())
{
telescope->simulator->Connect();
}
uint32_t tmpMCVersion = 0;
dispatch_command(InquireMotorBoardVersion, Axis1, nullptr);
//read_eqmod();
tmpMCVersion = Revu24str2long(response + 1);
MCVersion = ((tmpMCVersion & 0xFF) << 16) | ((tmpMCVersion & 0xFF00)) | ((tmpMCVersion & 0xFF0000) >> 16);
MountCode = MCVersion & 0xFF;
/* Check supported mounts here */
if ((MountCode == 0x80) || (MountCode == 0x81) /*|| (MountCode == 0x82)*/ || (MountCode == 0x90))
{
throw EQModError(EQModError::ErrDisconnect,
"Mount not supported: mount code 0x%x (0x80=GT, 0x81=MF, 0x82=114GT, 0x90=DOB)", MountCode);
//return false;
}
return true;
}
bool Skywatcher::Disconnect()
{
if (PortFD < 0)
return true;
StopMotor(Axis1);
StopMotor(Axis2);
// Deactivate motor (for geehalel mount only)
/*
if (MountCode == 0xF0) {
dispatch_command(Deactivate, Axis1, nullptr);
//read_eqmod();
}
*/
return true;
}
uint32_t Skywatcher::GetRAEncoder()
{
// Axis Position
dispatch_command(GetAxisPosition, Axis1, nullptr);
uint32_t steps = Revu24str2long(response + 1);
if (steps & 0x80000000)
DEBUGF(telescope->DBG_SCOPE_STATUS, "%s() = Ignoring invalid response %s", __FUNCTION__, response);
else
RAStep = steps;
gettimeofday(&lastreadmotorposition[Axis1], nullptr);
if (RAStep != lastRAStep)
{
DEBUGF(telescope->DBG_SCOPE_STATUS, "%s() = %ld", __FUNCTION__, static_cast(RAStep));
lastRAStep = RAStep;
}
return RAStep;
}
uint32_t Skywatcher::GetDEEncoder()
{
// Axis Position
dispatch_command(GetAxisPosition, Axis2, nullptr);
uint32_t steps = Revu24str2long(response + 1);
if (steps & 0x80000000)
DEBUGF(telescope->DBG_SCOPE_STATUS, "%s() = Ignoring invalid response %s", __FUNCTION__, response);
else
DEStep = steps;
gettimeofday(&lastreadmotorposition[Axis2], nullptr);
if (DEStep != lastDEStep)
{
DEBUGF(telescope->DBG_SCOPE_STATUS, "%s() = %ld", __FUNCTION__, static_cast(DEStep));
lastDEStep = DEStep;
}
return DEStep;
}
uint32_t Skywatcher::GetRAEncoderZero()
{
LOGF_DEBUG("%s() = %ld", __FUNCTION__, static_cast(RAStepInit));
return RAStepInit;
}
uint32_t Skywatcher::GetRAEncoderTotal()
{
LOGF_DEBUG("%s() = %ld", __FUNCTION__, static_cast(RASteps360));
return RASteps360;
}
uint32_t Skywatcher::GetRAEncoderHome()
{
LOGF_DEBUG("%s() = %ld", __FUNCTION__, static_cast(RAStepHome));
return RAStepHome;
}
uint32_t Skywatcher::GetDEEncoderZero()
{
LOGF_DEBUG("%s() = %ld", __FUNCTION__, static_cast(DEStepInit));
return DEStepInit;
}
uint32_t Skywatcher::GetDEEncoderTotal()
{
LOGF_DEBUG("%s() = %ld", __FUNCTION__, static_cast(DESteps360));
return DESteps360;
}
uint32_t Skywatcher::GetDEEncoderHome()
{
LOGF_DEBUG("%s() = %ld", __FUNCTION__, static_cast(DEStepHome));
return DEStepHome;
}
uint32_t Skywatcher::GetRAPeriod()
{
if (RAPeriod != lastRAPeriod)
{
DEBUGF(telescope->DBG_SCOPE_STATUS, "%s() = %ld", __FUNCTION__, static_cast(RAPeriod));
lastRAPeriod = RAPeriod;
}
return RAPeriod;
}
uint32_t Skywatcher::GetDEPeriod()
{
if (DEPeriod != lastDEPeriod)
{
DEBUGF(telescope->DBG_SCOPE_STATUS, "%s() = %ld", __FUNCTION__, static_cast(DEPeriod));
lastDEPeriod = DEPeriod;
}
return DEPeriod;
}
uint32_t Skywatcher::GetlastreadRAIndexer()
{
if (MountCode != 0x04 && MountCode != 0x05 && MountCode != 0x20)
throw EQModError(EQModError::ErrInvalidCmd, "Incorrect mount type");
DEBUGF(telescope->DBG_SCOPE_STATUS, "%s() = %ld", __FUNCTION__, static_cast(lastreadIndexer[Axis1]));
return lastreadIndexer[Axis1];
}
uint32_t Skywatcher::GetlastreadDEIndexer()
{
if (MountCode != 0x04 && MountCode != 0x05 && MountCode != 0x20)
throw EQModError(EQModError::ErrInvalidCmd, "Incorrect mount type");
DEBUGF(telescope->DBG_SCOPE_STATUS, "%s() = %ld", __FUNCTION__, static_cast(lastreadIndexer[Axis2]));
return lastreadIndexer[Axis2];
}
void Skywatcher::GetRAMotorStatus(ILightVectorProperty *motorLP)
{
ReadMotorStatus(Axis1);
if (!RAInitialized)
{
IUFindLight(motorLP, "RAInitialized")->s = IPS_ALERT;
IUFindLight(motorLP, "RARunning")->s = IPS_IDLE;
IUFindLight(motorLP, "RAGoto")->s = IPS_IDLE;
IUFindLight(motorLP, "RAForward")->s = IPS_IDLE;
IUFindLight(motorLP, "RAHighspeed")->s = IPS_IDLE;
}
else
{
IUFindLight(motorLP, "RAInitialized")->s = IPS_OK;
IUFindLight(motorLP, "RARunning")->s = (RARunning ? IPS_OK : IPS_BUSY);
IUFindLight(motorLP, "RAGoto")->s = ((RAStatus.slewmode == GOTO) ? IPS_OK : IPS_BUSY);
IUFindLight(motorLP, "RAForward")->s = ((RAStatus.direction == FORWARD) ? IPS_OK : IPS_BUSY);
IUFindLight(motorLP, "RAHighspeed")->s = ((RAStatus.speedmode == HIGHSPEED) ? IPS_OK : IPS_BUSY);
}
}
void Skywatcher::GetDEMotorStatus(ILightVectorProperty *motorLP)
{
ReadMotorStatus(Axis2);
if (!DEInitialized)
{
IUFindLight(motorLP, "DEInitialized")->s = IPS_ALERT;
IUFindLight(motorLP, "DERunning")->s = IPS_IDLE;
IUFindLight(motorLP, "DEGoto")->s = IPS_IDLE;
IUFindLight(motorLP, "DEForward")->s = IPS_IDLE;
IUFindLight(motorLP, "DEHighspeed")->s = IPS_IDLE;
}
else
{
IUFindLight(motorLP, "DEInitialized")->s = IPS_OK;
IUFindLight(motorLP, "DERunning")->s = (DERunning ? IPS_OK : IPS_BUSY);
IUFindLight(motorLP, "DEGoto")->s = ((DEStatus.slewmode == GOTO) ? IPS_OK : IPS_BUSY);
IUFindLight(motorLP, "DEForward")->s = ((DEStatus.direction == FORWARD) ? IPS_OK : IPS_BUSY);
IUFindLight(motorLP, "DEHighspeed")->s = ((DEStatus.speedmode == HIGHSPEED) ? IPS_OK : IPS_BUSY);
}
}
void Skywatcher::Init()
{
wasinitialized = false;
ReadMotorStatus(Axis1);
ReadMotorStatus(Axis2);
if (!RAInitialized && !DEInitialized)
{
//Read initial stepper values
dispatch_command(GetAxisPosition, Axis1, nullptr);
//read_eqmod();
RAStepInit = Revu24str2long(response + 1);
dispatch_command(GetAxisPosition, Axis2, nullptr);
//read_eqmod();
DEStepInit = Revu24str2long(response + 1);
LOGF_DEBUG("%s() : Motors not initialized -- read Init steps RAInit=%ld DEInit = %ld",
__FUNCTION__, static_cast(RAStepInit), static_cast(DEStepInit));
// Energize motors
LOGF_DEBUG("%s() : Powering motors", __FUNCTION__);
dispatch_command(Initialize, Axis1, nullptr);
//read_eqmod();
dispatch_command(Initialize, Axis2, nullptr);
//read_eqmod();
RAStepHome = RAStepInit;
DEStepHome = DEStepInit + (DESteps360 / 4);
}
else
{
// Mount already initialized by another driver / driver instance
// use default configuration && leave unchanged encoder values
wasinitialized = true;
RAStepInit = 0x800000;
DEStepInit = 0x800000;
RAStepHome = RAStepInit;
DEStepHome = DEStepInit + (DESteps360 / 4);
LOGF_WARN("%s() : Motors already initialized", __FUNCTION__);
LOGF_WARN("%s() : Setting default Init steps -- RAInit=%ld DEInit = %ld", __FUNCTION__,
static_cast(RAStepInit), static_cast(DEStepInit));
}
LOGF_DEBUG("%s() : Setting Home steps RAHome=%ld DEHome = %ld", __FUNCTION__,
static_cast(RAStepHome), static_cast(DEStepHome));
if (not(reconnect))
{
reconnect = true;
LOGF_WARN("%s() : First Initialization for this driver instance", __FUNCTION__);
// Initialize unreadable mount feature
//SetST4RAGuideRate('2');
//SetST4DEGuideRate('2');
//LOGF_WARN("%s() : Setting both ST4 guide rates to 0.5x (2)", __FUNCTION__);
}
// Problem with buildSkeleton: props are lost between connection/reconnections
// should reset unreadable mount feature
SetST4RAGuideRate('2');
SetST4DEGuideRate('2');
LOGF_WARN("%s() : Setting both ST4 guide rates to 0.5x (2)", __FUNCTION__);
if (HasSnapPort1())
{
TurnSnapPort1(false);
LOGF_DEBUG("%s() : Resetting snap port 1", __FUNCTION__);
}
if (HasSnapPort2())
{
TurnSnapPort2(false);
LOGF_DEBUG("%s() : Resetting snap port 2", __FUNCTION__);
}
//Park status
if (telescope->InitPark() == false)
{
telescope->SetAxis1Park(RAStepHome);
telescope->SetAxis1ParkDefault(RAStepHome);
telescope->SetAxis2Park(DEStepHome);
telescope->SetAxis2ParkDefault(DEStepHome);
LOGF_WARN("Loading parking data failed. Setting parking axis1: %d axis2: %d", RAStepHome, DEStepHome);
// JM 2018-11-26: Save current position as parked position
telescope->saveInitialParkPosition();
}
else
{
telescope->SetAxis1ParkDefault(RAStepHome);
telescope->SetAxis2ParkDefault(DEStepHome);
}
if (telescope->isParked())
{
//TODO get Park position, set corresponding encoder values, mark mount as parked
//parkSP->sp[0].s==ISS_ON
LOGF_DEBUG("%s() : Mount was parked", __FUNCTION__);
//if (wasinitialized) {
// LOGF_DEBUG("%s() : leaving encoders unchanged",
// __FUNCTION__);
//} else {
char cmdarg[7];
LOGF_DEBUG("%s() : Mount in Park position -- setting encoders RA=%ld DE = %ld",
__FUNCTION__, static_cast(telescope->GetAxis1Park()), static_cast(telescope->GetAxis2Park()));
cmdarg[6] = '\0';
long2Revu24str(telescope->GetAxis1Park(), cmdarg);
dispatch_command(SetAxisPositionCmd, Axis1, cmdarg);
//read_eqmod();
cmdarg[6] = '\0';
long2Revu24str(telescope->GetAxis2Park(), cmdarg);
dispatch_command(SetAxisPositionCmd, Axis2, cmdarg);
//read_eqmod();
//}
}
else
{
LOGF_DEBUG("%s() : Mount was not parked", __FUNCTION__);
if (wasinitialized)
{
LOGF_DEBUG("%s() : leaving encoders unchanged", __FUNCTION__);
}
else
{
//mount is supposed to be in the home position (pointing Celestial Pole)
char cmdarg[7];
LOGF_DEBUG("%s() : Mount in Home position -- setting encoders RA=%ld DE = %ld",
__FUNCTION__, static_cast(RAStepHome), static_cast(DEStepHome));
cmdarg[6] = '\0';
long2Revu24str(DEStepHome, cmdarg);
dispatch_command(SetAxisPositionCmd, Axis2, cmdarg);
//read_eqmod();
//LOGF_WARN("%s() : Mount is supposed to point North/South Celestial Pole", __FUNCTION__);
//TODO mark mount as unparked?
}
}
}
void Skywatcher::InquireBoardVersion(ITextVectorProperty *boardTP)
{
unsigned nprop = 0;
char *boardinfo[3];
const char *boardinfopropnames[] = { "MOUNT_TYPE", "MOTOR_CONTROLLER", "MOUNT_CODE" };
/*
uint32_t tmpMCVersion = 0;
dispatch_command(InquireMotorBoardVersion, Axis1, nullptr);
//read_eqmod();
tmpMCVersion=Revu24str2long(response+1);
MCVersion = ((tmpMCVersion & 0xFF) << 16) | ((tmpMCVersion & 0xFF00)) | ((tmpMCVersion & 0xFF0000) >> 16);
MountCode=MCVersion & 0xFF;
*/
minperiods[Axis1] = 6;
minperiods[Axis2] = 6;
nprop = 3;
// strcpy(boardinfopropnames[0],"MOUNT_TYPE");
boardinfo[0] = (char *)malloc(20 * sizeof(char));
switch (MountCode)
{
case 0x00:
strcpy(boardinfo[0], "EQ6");
break;
case 0x01:
strcpy(boardinfo[0], "HEQ5");
break;
case 0x02:
strcpy(boardinfo[0], "EQ5");
break;
case 0x03:
strcpy(boardinfo[0], "EQ3");
break;
case 0x04:
strcpy(boardinfo[0], "EQ8");
break;
case 0x05:
strcpy(boardinfo[0], "AZEQ6");
break;
case 0x06:
strcpy(boardinfo[0], "AZEQ5");
break;
case 0x0A:
strcpy(boardinfo[0], "Star Adventurer");
break;
case 0x20:
strcpy(boardinfo[0], "EQ8-R Pro");
break;
case 0x23:
strcpy(boardinfo[0], "EQ6-R Pro");
break;
case 0x31:
strcpy(boardinfo[0], "EQ5 Pro");
break;
case 0x80:
strcpy(boardinfo[0], "GT");
break;
case 0x81:
strcpy(boardinfo[0], "MF");
break;
case 0x82:
strcpy(boardinfo[0], "114GT");
break;
case 0x90:
strcpy(boardinfo[0], "DOB");
break;
case 0xA5:
strcpy(boardinfo[0], "AZ-GTi");
break;
case 0xF0:
strcpy(boardinfo[0], "GEEHALEL");
minperiods[Axis1] = 13;
minperiods[Axis2] = 16;
break;
default:
strcpy(boardinfo[0], "CUSTOM");
break;
}
boardinfo[1] = (char *)malloc(5);
sprintf(boardinfo[1], "%04x", (MCVersion >> 8));
boardinfo[1][4] = '\0';
boardinfo[2] = (char *)malloc(5);
sprintf(boardinfo[2], "0x%02X", MountCode);
boardinfo[2][4] = '\0';
// should test this is ok
IUUpdateText(boardTP, boardinfo, (char **)boardinfopropnames, nprop);
IDSetText(boardTP, nullptr);
LOGF_DEBUG("%s(): MountCode = %d, MCVersion = %lx, setting minperiods Axis1=%d Axis2=%d",
__FUNCTION__, MountCode, MCVersion, minperiods[Axis1], minperiods[Axis2]);
/* Check supported mounts here */
/*if ((MountCode == 0x80) || (MountCode == 0x81) || (MountCode == 0x82) || (MountCode == 0x90)) {
throw EQModError(EQModError::ErrDisconnect, "Mount not supported %s (mount code %d)",
boardinfo[0], MountCode);
}
*/
free(boardinfo[0]);
free(boardinfo[1]);
free(boardinfo[2]);
}
void Skywatcher::InquireFeatures()
{
uint32_t rafeatures = 0, defeatures = 0;
try
{
GetFeature(Axis1, GET_FEATURES_CMD);
rafeatures = Revu24str2long(response + 1);
GetFeature(Axis2, GET_FEATURES_CMD);
defeatures = Revu24str2long(response + 1);
}
catch (EQModError e)
{
LOGF_DEBUG("%s(): Mount does not support query features (%c command)", __FUNCTION__,
GetFeatureCmd);
rafeatures = 0;
defeatures = 0;
}
if ((rafeatures & 0x000000F0) != (defeatures & 0x000000F0))
{
LOGF_WARN("%s(): Found different features for RA (%d) and DEC (%d)", __FUNCTION__,
rafeatures, defeatures);
}
if (rafeatures & 0x00000010)
{
LOGF_WARN("%s(): Found RA PPEC training on", __FUNCTION__);
}
if (defeatures & 0x00000010)
{
LOGF_WARN("%s(): Found DE PPEC training on", __FUNCTION__);
}
AxisFeatures[Axis1].inPPECTraining = rafeatures & 0x00000010;
AxisFeatures[Axis1].inPPEC = rafeatures & 0x00000020;
AxisFeatures[Axis1].hasEncoder = rafeatures & 0x00000001;
AxisFeatures[Axis1].hasPPEC = rafeatures & 0x00000002;
AxisFeatures[Axis1].hasHomeIndexer = rafeatures & 0x00000004;
AxisFeatures[Axis1].isAZEQ = rafeatures & 0x00000008;
AxisFeatures[Axis1].hasPolarLed = rafeatures & 0x00001000;
AxisFeatures[Axis1].hasCommonSlewStart = rafeatures & 0x00002000; // supports :J3
AxisFeatures[Axis1].hasHalfCurrentTracking = rafeatures & 0x00004000;
AxisFeatures[Axis1].hasWifi = rafeatures & 0x00008000;
AxisFeatures[Axis2].inPPECTraining = defeatures & 0x00000010;
AxisFeatures[Axis2].inPPEC = defeatures & 0x00000020;
AxisFeatures[Axis2].hasEncoder = defeatures & 0x00000001;
AxisFeatures[Axis2].hasPPEC = defeatures & 0x00000002;
AxisFeatures[Axis2].hasHomeIndexer = defeatures & 0x00000004;
AxisFeatures[Axis2].isAZEQ = defeatures & 0x00000008;
AxisFeatures[Axis2].hasPolarLed = defeatures & 0x00001000;
AxisFeatures[Axis2].hasCommonSlewStart = defeatures & 0x00002000; // supports :J3
AxisFeatures[Axis2].hasHalfCurrentTracking = defeatures & 0x00004000;
AxisFeatures[Axis2].hasWifi = defeatures & 0x00008000;
}
bool Skywatcher::HasHomeIndexers()
{
return (AxisFeatures[Axis1].hasHomeIndexer) && (AxisFeatures[Axis2].hasHomeIndexer);
}
bool Skywatcher::HasAuxEncoders()
{
return (AxisFeatures[Axis1].hasEncoder) && (AxisFeatures[Axis2].hasEncoder);
}
bool Skywatcher::HasPPEC()
{
return AxisFeatures[Axis1].hasPPEC;
}
bool Skywatcher::HasSnapPort1()
{
return MountCode == 0x04 || MountCode == 0x05 || MountCode == 0x06 || MountCode == 0x0A || MountCode == 0x23
|| MountCode == 0xA5;
}
bool Skywatcher::HasSnapPort2()
{
return MountCode == 0x06;
}
bool Skywatcher::HasPolarLed()
{
return (AxisFeatures[Axis1].hasPolarLed) && (AxisFeatures[Axis2].hasPolarLed);
}
void Skywatcher::InquireRAEncoderInfo(INumberVectorProperty *encoderNP)
{
double steppersvalues[3];
const char *steppersnames[] = { "RASteps360", "RAStepsWorm", "RAHighspeedRatio" };
// Steps per 360 degrees
dispatch_command(InquireGridPerRevolution, Axis1, nullptr);
//read_eqmod();
RASteps360 = Revu24str2long(response + 1);
steppersvalues[0] = (double)RASteps360;
// Steps per Worm
dispatch_command(InquireTimerInterruptFreq, Axis1, nullptr);
//read_eqmod();
RAStepsWorm = Revu24str2long(response + 1);
// There is a bug in the earlier version firmware(Before 2.00) of motor controller MC001.
// Overwrite the GearRatio reported by the MC for 80GT mount and 114GT mount.
if ((MCVersion & 0x0000FF) == 0x80)
{
LOGF_WARN("%s: forcing RAStepsWorm for 80GT Mount (%x in place of %x)", __FUNCTION__,
0x162B97, RAStepsWorm);
RAStepsWorm = 0x162B97; // for 80GT mount
}
if ((MCVersion & 0x0000FF) == 0x82)
{
LOGF_WARN("%s: forcing RAStepsWorm for 114GT Mount (%x in place of %x)", __FUNCTION__,
0x205318, RAStepsWorm);
RAStepsWorm = 0x205318; // for 114GT mount
}
// Correct drift of 4.1 arcsec per minute with HEQ5 firmware 106
// drift correction = 1.00455, 64935/1.00455 = 64640 = 0xFC80
if (MCVersion == 0x10601)
{
LOGF_WARN("%s: forcing RAStepsWorm for HEQ5 with firmware 106 (%x in place of %x)", __FUNCTION__,
0xFC80, RAStepsWorm);
RAStepsWorm = 0xFC80;
}
steppersvalues[1] = static_cast(RAStepsWorm);
// Highspeed Ratio
dispatch_command(InquireHighSpeedRatio, Axis1, nullptr);
//read_eqmod();
//RAHighspeedRatio=Revu24str2long(response+1);
RAHighspeedRatio = Highstr2long(response + 1);
steppersvalues[2] = static_cast(RAHighspeedRatio);
// should test this is ok
IUUpdateNumber(encoderNP, steppersvalues, (char **)steppersnames, 3);
IDSetNumber(encoderNP, nullptr);
backlashperiod[Axis1] = static_cast(((SKYWATCHER_STELLAR_DAY * RAStepsWorm) / static_cast
(RASteps360)) / SKYWATCHER_BACKLASH_SPEED_RA);
}
void Skywatcher::InquireDEEncoderInfo(INumberVectorProperty *encoderNP)
{
double steppersvalues[3];
const char *steppersnames[] = { "DESteps360", "DEStepsWorm", "DEHighspeedRatio" };
// Steps per 360 degrees
dispatch_command(InquireGridPerRevolution, Axis2, nullptr);
//read_eqmod();
DESteps360 = Revu24str2long(response + 1);
steppersvalues[0] = (double)DESteps360;
// Steps per Worm
dispatch_command(InquireTimerInterruptFreq, Axis2, nullptr);
//read_eqmod();
DEStepsWorm = Revu24str2long(response + 1);
// There is a bug in the earlier version firmware(Before 2.00) of motor controller MC001.
// Overwrite the GearRatio reported by the MC for 80GT mount and 114GT mount.
if ((MCVersion & 0x0000FF) == 0x80)
{
LOGF_WARN("%s: forcing DEStepsWorm for 80GT Mount (%x in place of %x)", __FUNCTION__,
0x162B97, DEStepsWorm);
DEStepsWorm = 0x162B97; // for 80GT mount
}
if ((MCVersion & 0x0000FF) == 0x82)
{
LOGF_WARN("%s: forcing DEStepsWorm for 114GT Mount (%x in place of %x)", __FUNCTION__,
0x205318, DEStepsWorm);
DEStepsWorm = 0x205318; // for 114GT mount
}
// HEQ5 with firmware 106, use same rate as RA
// drift correction = 1.00455, 64935/1.00455 = 64640 = 0xFC80
if (MCVersion == 0x10601)
{
LOGF_WARN("%s: forcing DEStepsWorm for HEQ5 with firmware 106 (%x in place of %x)", __FUNCTION__,
0xFC80, DEStepsWorm);
DEStepsWorm = 0xFC80;
}
steppersvalues[1] = static_cast(DEStepsWorm);
// Highspeed Ratio
dispatch_command(InquireHighSpeedRatio, Axis2, nullptr);
//read_eqmod();
//DEHighspeedRatio=Revu24str2long(response+1);
DEHighspeedRatio = Highstr2long(response + 1);
steppersvalues[2] = static_cast(DEHighspeedRatio);
// should test this is ok
IUUpdateNumber(encoderNP, steppersvalues, (char **)steppersnames, 3);
IDSetNumber(encoderNP, nullptr);
backlashperiod[Axis2] =
(long)(((SKYWATCHER_STELLAR_DAY * (double)DEStepsWorm) / (double)DESteps360) / SKYWATCHER_BACKLASH_SPEED_DE);
}
bool Skywatcher::IsRARunning()
{
CheckMotorStatus(Axis1);
LOGF_DEBUG("%s() = %s", __FUNCTION__, (RARunning ? "true" : "false"));
return (RARunning);
}
bool Skywatcher::IsDERunning()
{
CheckMotorStatus(Axis2);
LOGF_DEBUG("%s() = %s", __FUNCTION__, (DERunning ? "true" : "false"));
return (DERunning);
}
void Skywatcher::ReadMotorStatus(SkywatcherAxis axis)
{
dispatch_command(GetAxisStatus, axis, nullptr);
//read_eqmod();
switch (axis)
{
case Axis1:
RAInitialized = (response[3] & 0x01);
RARunning = (response[2] & 0x01);
if (response[1] & 0x01)
RAStatus.slewmode = SLEW;
else
RAStatus.slewmode = GOTO;
if (response[1] & 0x02)
RAStatus.direction = BACKWARD;
else
RAStatus.direction = FORWARD;
if (response[1] & 0x04)
RAStatus.speedmode = HIGHSPEED;
else
RAStatus.speedmode = LOWSPEED;
break;
case Axis2:
DEInitialized = (response[3] & 0x01);
DERunning = (response[2] & 0x01);
if (response[1] & 0x01)
DEStatus.slewmode = SLEW;
else
DEStatus.slewmode = GOTO;
if (response[1] & 0x02)
DEStatus.direction = BACKWARD;
else
DEStatus.direction = FORWARD;
if (response[1] & 0x04)
DEStatus.speedmode = HIGHSPEED;
else
DEStatus.speedmode = LOWSPEED;
break;
default:
break;
}
gettimeofday(&lastreadmotorstatus[axis], nullptr);
}
void Skywatcher::SlewRA(double rate)
{
double absrate = fabs(rate);
uint32_t period = 0;
bool useHighspeed = false;
SkywatcherAxisStatus newstatus;
LOGF_DEBUG("%s() : rate = %g", __FUNCTION__, rate);
if (RARunning && (RAStatus.slewmode == GOTO))
{
throw EQModError(EQModError::ErrInvalidCmd, "Can not slew while goto is in progress");
}
if ((absrate < get_min_rate()) || (absrate > get_max_rate()))
{
throw EQModError(EQModError::ErrInvalidParameter,
"Speed rate out of limits: %.2fx Sidereal (min=%.2f, max=%.2f)", absrate, MIN_RATE, MAX_RATE);
}
//if (MountCode != 0xF0) {
if (absrate > SKYWATCHER_LOWSPEED_RATE)
{
absrate = absrate / RAHighspeedRatio;
useHighspeed = true;
}
//}
period = static_cast(((SKYWATCHER_STELLAR_DAY * RAStepsWorm) / static_cast(RASteps360)) / absrate);
if (rate >= 0.0)
newstatus.direction = FORWARD;
else
newstatus.direction = BACKWARD;
newstatus.slewmode = SLEW;
if (useHighspeed)
newstatus.speedmode = HIGHSPEED;
else
newstatus.speedmode = LOWSPEED;
SetMotion(Axis1, newstatus);
SetSpeed(Axis1, period);
if (!RARunning)
StartMotor(Axis1);
}
void Skywatcher::SlewDE(double rate)
{
double absrate = fabs(rate);
uint32_t period = 0;
bool useHighspeed = false;
SkywatcherAxisStatus newstatus;
LOGF_DEBUG("%s() : rate = %g", __FUNCTION__, rate);
if (DERunning && (DEStatus.slewmode == GOTO))
{
throw EQModError(EQModError::ErrInvalidCmd, "Can not slew while goto is in progress");
}
if ((absrate < get_min_rate()) || (absrate > get_max_rate()))
{
throw EQModError(EQModError::ErrInvalidParameter,
"Speed rate out of limits: %.2fx Sidereal (min=%.2f, max=%.2f)", absrate, MIN_RATE, MAX_RATE);
}
//if (MountCode != 0xF0) {
if (absrate > SKYWATCHER_LOWSPEED_RATE)
{
absrate = absrate / DEHighspeedRatio;
useHighspeed = true;
}
//}
period = (long)(((SKYWATCHER_STELLAR_DAY * (double)DEStepsWorm) / (double)DESteps360) / absrate);
LOGF_DEBUG("Slewing DE at %.2f %.2f %x %f\n", rate, absrate, period,
(((SKYWATCHER_STELLAR_DAY * (double)RAStepsWorm) / (double)RASteps360) / absrate));
if (rate >= 0.0)
newstatus.direction = FORWARD;
else
newstatus.direction = BACKWARD;
newstatus.slewmode = SLEW;
if (useHighspeed)
newstatus.speedmode = HIGHSPEED;
else
newstatus.speedmode = LOWSPEED;
SetMotion(Axis2, newstatus);
SetSpeed(Axis2, period);
if (!DERunning)
StartMotor(Axis2);
}
void Skywatcher::SlewTo(int32_t deltaraencoder, int32_t deltadeencoder)
{
SkywatcherAxisStatus newstatus;
bool useHighSpeed = false;
uint32_t lowperiod = 18, lowspeedmargin = 20000, breaks = 400;
/* highperiod = RA 450X DE (+5) 200x, low period 32x */
LOGF_DEBUG("%s() : deltaRA = %d deltaDE = %d", __FUNCTION__, deltaraencoder, deltadeencoder);
newstatus.slewmode = GOTO;
if (deltaraencoder >= 0)
newstatus.direction = FORWARD;
else
newstatus.direction = BACKWARD;
if (deltaraencoder < 0)
deltaraencoder = -deltaraencoder;
if (deltaraencoder > static_cast(lowspeedmargin))
useHighSpeed = true;
else
useHighSpeed = false;
if (useHighSpeed)
newstatus.speedmode = HIGHSPEED;
else
newstatus.speedmode = LOWSPEED;
if (deltaraencoder > 0)
{
SetMotion(Axis1, newstatus);
if (useHighSpeed)
SetSpeed(Axis1, minperiods[Axis1]);
else
SetSpeed(Axis1, lowperiod);
SetTarget(Axis1, deltaraencoder);
if (useHighSpeed)
breaks = ((deltaraencoder > 3200) ? 3200 : deltaraencoder / 10);
else
breaks = ((deltaraencoder > 200) ? 200 : deltaraencoder / 10);
SetTargetBreaks(Axis1, breaks);
StartMotor(Axis1);
}
if (deltadeencoder >= 0)
newstatus.direction = FORWARD;
else
newstatus.direction = BACKWARD;
if (deltadeencoder < 0)
deltadeencoder = -deltadeencoder;
if (deltadeencoder > static_cast(lowspeedmargin))
useHighSpeed = true;
else
useHighSpeed = false;
if (useHighSpeed)
newstatus.speedmode = HIGHSPEED;
else
newstatus.speedmode = LOWSPEED;
if (deltadeencoder > 0)
{
SetMotion(Axis2, newstatus);
if (useHighSpeed)
SetSpeed(Axis2, minperiods[Axis2]);
else
SetSpeed(Axis2, lowperiod);
SetTarget(Axis2, deltadeencoder);
if (useHighSpeed)
breaks = ((deltadeencoder > 3200) ? 3200 : deltadeencoder / 10);
else
breaks = ((deltadeencoder > 200) ? 200 : deltadeencoder / 10);
SetTargetBreaks(Axis2, breaks);
StartMotor(Axis2);
}
}
void Skywatcher::AbsSlewTo(uint32_t raencoder, uint32_t deencoder, bool raup, bool deup)
{
SkywatcherAxisStatus newstatus;
bool useHighSpeed = false;
int32_t deltaraencoder, deltadeencoder;
uint32_t lowperiod = 18, lowspeedmargin = 20000, breaks = 400;
/* highperiod = RA 450X DE (+5) 200x, low period 32x */
LOGF_DEBUG("%s() : absRA = %ld raup = %c absDE = %ld deup = %c", __FUNCTION__, static_cast(raencoder),
(raup ? '1' : '0'), static_cast(deencoder), (deup ? '1' : '0'));
deltaraencoder = static_cast(raencoder - RAStep);
deltadeencoder = static_cast(deencoder - DEStep);
newstatus.slewmode = GOTO;
if (raup)
newstatus.direction = FORWARD;
else
newstatus.direction = BACKWARD;
if (deltaraencoder < 0)
deltaraencoder = -deltaraencoder;
if (deltaraencoder > static_cast(lowspeedmargin))
useHighSpeed = true;
else
useHighSpeed = false;
if (useHighSpeed)
newstatus.speedmode = HIGHSPEED;
else
newstatus.speedmode = LOWSPEED;
if (deltaraencoder > 0)
{
SetMotion(Axis1, newstatus);
if (useHighSpeed)
SetSpeed(Axis1, minperiods[Axis1]);
else
SetSpeed(Axis1, lowperiod);
SetAbsTarget(Axis1, raencoder);
if (useHighSpeed)
breaks = ((deltaraencoder > 3200) ? 3200 : deltaraencoder / 10);
else
breaks = ((deltaraencoder > 200) ? 200 : deltaraencoder / 10);
breaks = (raup ? (raencoder - breaks) : (raencoder + breaks));
SetAbsTargetBreaks(Axis1, breaks);
StartMotor(Axis1);
}
if (deup)
newstatus.direction = FORWARD;
else
newstatus.direction = BACKWARD;
if (deltadeencoder < 0)
deltadeencoder = -deltadeencoder;
if (deltadeencoder > static_cast(lowspeedmargin))
useHighSpeed = true;
else
useHighSpeed = false;
if (useHighSpeed)
newstatus.speedmode = HIGHSPEED;
else
newstatus.speedmode = LOWSPEED;
if (deltadeencoder > 0)
{
SetMotion(Axis2, newstatus);
if (useHighSpeed)
SetSpeed(Axis2, minperiods[Axis2]);
else
SetSpeed(Axis2, lowperiod);
SetAbsTarget(Axis2, deencoder);
if (useHighSpeed)
breaks = ((deltadeencoder > 3200) ? 3200 : deltadeencoder / 10);
else
breaks = ((deltadeencoder > 200) ? 200 : deltadeencoder / 10);
breaks = (deup ? (deencoder - breaks) : (deencoder + breaks));
SetAbsTargetBreaks(Axis2, breaks);
StartMotor(Axis2);
}
}
void Skywatcher::SetRARate(double rate)
{
double absrate = fabs(rate);
uint32_t period = 0;
bool useHighspeed = false;
SkywatcherAxisStatus newstatus;
LOGF_DEBUG("%s() : rate = %g", __FUNCTION__, rate);
if ((absrate < get_min_rate()) || (absrate > get_max_rate()))
{
throw EQModError(EQModError::ErrInvalidParameter,
"Speed rate out of limits: %.2fx Sidereal (min=%.2f, max=%.2f)", absrate, MIN_RATE, MAX_RATE);
}
//if (MountCode != 0xF0) {
if (absrate > SKYWATCHER_LOWSPEED_RATE)
{
absrate = absrate / RAHighspeedRatio;
useHighspeed = true;
}
//}
period = static_cast(((SKYWATCHER_STELLAR_DAY * RAStepsWorm) / static_cast
(RASteps360)) / absrate);
newstatus.direction = ((rate >= 0.0) ? FORWARD : BACKWARD);
//newstatus.slewmode=RAStatus.slewmode;
newstatus.slewmode = SLEW;
if (useHighspeed)
newstatus.speedmode = HIGHSPEED;
else
newstatus.speedmode = LOWSPEED;
ReadMotorStatus(Axis1);
if (RARunning)
{
if (newstatus.speedmode != RAStatus.speedmode)
throw EQModError(EQModError::ErrInvalidParameter,
"Can not change rate while motor is running (speedmode differs).");
if (newstatus.direction != RAStatus.direction)
throw EQModError(EQModError::ErrInvalidParameter,
"Can not change rate while motor is running (direction differs).");
}
SetMotion(Axis1, newstatus);
SetSpeed(Axis1, period);
}
void Skywatcher::SetDERate(double rate)
{
double absrate = fabs(rate);
uint32_t period = 0;
bool useHighspeed = false;
SkywatcherAxisStatus newstatus;
LOGF_DEBUG("%s() : rate = %g", __FUNCTION__, rate);
if ((absrate < get_min_rate()) || (absrate > get_max_rate()))
{
throw EQModError(EQModError::ErrInvalidParameter,
"Speed rate out of limits: %.2fx Sidereal (min=%.2f, max=%.2f)", absrate, MIN_RATE, MAX_RATE);
}
//if (MountCode != 0xF0) {
if (absrate > SKYWATCHER_LOWSPEED_RATE)
{
absrate = absrate / DEHighspeedRatio;
useHighspeed = true;
}
//}
period = static_cast(((SKYWATCHER_STELLAR_DAY * DEStepsWorm) / static_cast
(DESteps360)) / absrate);
newstatus.direction = ((rate >= 0.0) ? FORWARD : BACKWARD);
//newstatus.slewmode=DEStatus.slewmode;
newstatus.slewmode = SLEW;
if (useHighspeed)
newstatus.speedmode = HIGHSPEED;
else
newstatus.speedmode = LOWSPEED;
ReadMotorStatus(Axis2);
if (DERunning)
{
if (newstatus.speedmode != DEStatus.speedmode)
throw EQModError(EQModError::ErrInvalidParameter,
"Can not change rate while motor is running (speedmode differs).");
if (newstatus.direction != DEStatus.direction)
throw EQModError(EQModError::ErrInvalidParameter,
"Can not change rate while motor is running (direction differs).");
}
SetMotion(Axis2, newstatus);
SetSpeed(Axis2, period);
}
void Skywatcher::StartRATracking(double trackspeed)
{
double rate;
if (trackspeed != 0.0)
rate = trackspeed / SKYWATCHER_STELLAR_SPEED;
else
rate = 0.0;
LOGF_DEBUG("%s() : trackspeed = %g arcsecs/s, computed rate = %g", __FUNCTION__, trackspeed,
rate);
if (rate != 0.0)
{
SetRARate(rate);
if (!RARunning)
StartMotor(Axis1);
}
else
StopMotor(Axis1);
}
void Skywatcher::StartDETracking(double trackspeed)
{
double rate;
if (trackspeed != 0.0)
rate = trackspeed / SKYWATCHER_STELLAR_SPEED;
else
rate = 0.0;
LOGF_DEBUG("%s() : trackspeed = %g arcsecs/s, computed rate = %g", __FUNCTION__, trackspeed,
rate);
if (rate != 0.0)
{
SetDERate(rate);
if (!DERunning)
StartMotor(Axis2);
}
else
StopMotor(Axis2);
}
void Skywatcher::SetSpeed(SkywatcherAxis axis, uint32_t period)
{
char cmd[7];
SkywatcherAxisStatus *currentstatus;
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c -- period=%ld", __FUNCTION__, AxisCmd[axis], static_cast(period));
ReadMotorStatus(axis);
if (axis == Axis1)
currentstatus = &RAStatus;
else
currentstatus = &DEStatus;
if ((currentstatus->speedmode == HIGHSPEED) && (period < minperiods[axis]))
{
LOGF_WARN("Setting axis %c period to minimum. Requested is %d, minimum is %d\n", AxisCmd[axis],
period, minperiods[axis]);
period = minperiods[axis];
}
long2Revu24str(period, cmd);
if ((axis == Axis1) && (RARunning && (currentstatus->slewmode == GOTO || currentstatus->speedmode == HIGHSPEED)))
throw EQModError(EQModError::ErrInvalidParameter,
"Can not change speed while motor is running and in goto or highspeed slew.");
if ((axis == Axis2) && (DERunning && (currentstatus->slewmode == GOTO || currentstatus->speedmode == HIGHSPEED)))
throw EQModError(EQModError::ErrInvalidParameter,
"Can not change speed while motor is running and in goto or highspeed slew.");
if (axis == Axis1)
RAPeriod = period;
else
DEPeriod = period;
dispatch_command(SetStepPeriod, axis, cmd);
//read_eqmod();
}
void Skywatcher::SetTarget(SkywatcherAxis axis, uint32_t increment)
{
char cmd[7];
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c -- increment=%ld", __FUNCTION__, AxisCmd[axis],
static_cast(increment));
long2Revu24str(increment, cmd);
//IDLog("Setting target for axis %c to %d\n", AxisCmd[axis], increment);
dispatch_command(SetGotoTargetIncrement, axis, cmd);
//read_eqmod();
Target[axis] = increment;
}
void Skywatcher::SetTargetBreaks(SkywatcherAxis axis, uint32_t increment)
{
char cmd[7];
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c -- increment=%ld", __FUNCTION__, AxisCmd[axis],
static_cast(increment));
long2Revu24str(increment, cmd);
//IDLog("Setting target for axis %c to %d\n", AxisCmd[axis], increment);
dispatch_command(SetBreakPointIncrement, axis, cmd);
//read_eqmod();
TargetBreaks[axis] = increment;
}
void Skywatcher::SetAbsTarget(SkywatcherAxis axis, uint32_t target)
{
char cmd[7];
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c -- target=%ld", __FUNCTION__, AxisCmd[axis], static_cast(target));
long2Revu24str(target, cmd);
//IDLog("Setting target for axis %c to %d\n", AxisCmd[axis], increment);
dispatch_command(SetGotoTarget, axis, cmd);
//read_eqmod();
Target[axis] = target;
}
void Skywatcher::SetAbsTargetBreaks(SkywatcherAxis axis, uint32_t breakstep)
{
char cmd[7];
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c -- breakstep=%ld", __FUNCTION__, AxisCmd[axis],
static_cast(breakstep));
long2Revu24str(breakstep, cmd);
//IDLog("Setting target for axis %c to %d\n", AxisCmd[axis], increment);
dispatch_command(SetBreakStep, axis, cmd);
//read_eqmod();
TargetBreaks[axis] = breakstep;
}
void Skywatcher::SetFeature(SkywatcherAxis axis, uint32_t command)
{
char cmd[7];
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c -- command=%ld", __FUNCTION__, AxisCmd[axis], static_cast(command));
long2Revu24str(command, cmd);
//IDLog("Setting target for axis %c to %d\n", AxisCmd[axis], increment);
dispatch_command(SetFeatureCmd, axis, cmd);
//read_eqmod();
}
void Skywatcher::GetFeature(SkywatcherAxis axis, uint32_t command)
{
char cmd[7];
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c -- command=%ld", __FUNCTION__, AxisCmd[axis], static_cast(command));
long2Revu24str(command, cmd);
//IDLog("Setting target for axis %c to %d\n", AxisCmd[axis], increment);
dispatch_command(GetFeatureCmd, axis, cmd);
//read_eqmod();
}
void Skywatcher::GetIndexer(SkywatcherAxis axis)
{
GetFeature(axis, GET_INDEXER_CMD);
lastreadIndexer[axis] = Revu24str2long(response + 1);
}
void Skywatcher::GetRAIndexer()
{
GetIndexer(Axis1);
}
void Skywatcher::GetDEIndexer()
{
GetIndexer(Axis2);
}
void Skywatcher::ResetIndexer(SkywatcherAxis axis)
{
SetFeature(axis, RESET_HOME_INDEXER_CMD);
}
void Skywatcher::ResetRAIndexer()
{
ResetIndexer(Axis1);
}
void Skywatcher::ResetDEIndexer()
{
ResetIndexer(Axis2);
}
void Skywatcher::TurnEncoder(SkywatcherAxis axis, bool on)
{
uint32_t command;
if (on)
command = ENCODER_ON_CMD;
else
command = ENCODER_OFF_CMD;
SetFeature(axis, command);
}
void Skywatcher::TurnRAEncoder(bool on)
{
TurnEncoder(Axis1, on);
}
void Skywatcher::TurnDEEncoder(bool on)
{
TurnEncoder(Axis2, on);
}
uint32_t Skywatcher::ReadEncoder(SkywatcherAxis axis)
{
dispatch_command(InquireAuxEncoder, axis, nullptr);
//read_eqmod();
return Revu24str2long(response + 1);
}
uint32_t Skywatcher::GetRAAuxEncoder()
{
return ReadEncoder(Axis1);
}
uint32_t Skywatcher::GetDEAuxEncoder()
{
return ReadEncoder(Axis2);
}
void Skywatcher::SetST4RAGuideRate(unsigned char r)
{
SetST4GuideRate(Axis1, r);
}
void Skywatcher::SetST4DEGuideRate(unsigned char r)
{
SetST4GuideRate(Axis2, r);
}
void Skywatcher::SetST4GuideRate(SkywatcherAxis axis, unsigned char r)
{
char cmd[2];
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c -- rate=%c", __FUNCTION__, AxisCmd[axis], r);
cmd[0] = r;
cmd[1] = '\0';
//IDLog("Setting target for axis %c to %d\n", AxisCmd[axis], increment);
dispatch_command(SetST4GuideRateCmd, axis, cmd);
//read_eqmod();
}
void Skywatcher::TurnPPECTraining(bool on)
{
uint32_t command;
if (on)
command = START_PPEC_TRAINING_CMD;
else
command = STOP_PPEC_TRAINING_CMD;
SetFeature(Axis1, command);
}
void Skywatcher::SetLEDBrightness(uint8_t value)
{
char cmd[3] = {0};
char hexa[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
cmd[0] = hexa[(value & 0xF0) >> 4];
cmd[1] = hexa[(value & 0x0F)];
try
{
dispatch_command(SetPolarScopeLED, Axis1, cmd);
}
catch (EQModError e)
{
DEBUGF(telescope->DBG_MOUNT, "%s(): Mount does not support led brightness (%c command)", __FUNCTION__,
SetPolarScopeLED);
}
}
void Skywatcher::TurnPPEC(bool on)
{
uint32_t command;
if (on)
command = TURN_PPEC_ON_CMD;
else
command = TURN_PPEC_OFF_CMD;
SetFeature(Axis1, command);
}
void Skywatcher::GetPPECStatus(bool *intraining, bool *inppec)
{
uint32_t features = 0;
GetFeature(Axis1, GET_FEATURES_CMD);
features = Revu24str2long(response + 1);
*intraining = AxisFeatures[Axis1].inPPECTraining = features & 0x00000010;
*inppec = AxisFeatures[Axis1].inPPEC = features & 0x00000020;
}
void Skywatcher::TurnSnapPort(SkywatcherAxis axis, bool on)
{
char snapcmd[2] = "0";
if (on)
snapcmd[0] = '1';
else
snapcmd[0] = '0';
snapportstatus[axis] = on;
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c -- snap=%c", __FUNCTION__, AxisCmd[axis], snapcmd);
dispatch_command(SetSnapPort, axis, snapcmd);
//read_eqmod();
}
void Skywatcher::TurnSnapPort1(bool on)
{
TurnSnapPort(Axis1, on);
}
void Skywatcher::TurnSnapPort2(bool on)
{
TurnSnapPort(Axis2, on);
}
bool Skywatcher::GetSnapPort1Status()
{
return snapportstatus[Axis1];
}
bool Skywatcher::GetSnapPort2Status()
{
return snapportstatus[Axis2];
}
void Skywatcher::SetAxisPosition(SkywatcherAxis axis, uint32_t step)
{
char cmd[7];
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c -- step=%ld", __FUNCTION__, AxisCmd[axis], static_cast(step));
long2Revu24str(step, cmd);
//IDLog("Setting target for axis %c to %d\n", AxisCmd[axis], increment);
dispatch_command(SetAxisPositionCmd, axis, cmd);
//read_eqmod();
}
void Skywatcher::SetRAAxisPosition(uint32_t step)
{
SetAxisPosition(Axis1, step);
}
void Skywatcher::SetDEAxisPosition(uint32_t step)
{
SetAxisPosition(Axis2, step);
}
void Skywatcher::StartMotor(SkywatcherAxis axis)
{
bool usebacklash = UseBacklash[axis];
uint32_t backlash = Backlash[axis];
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c", __FUNCTION__, AxisCmd[axis]);
if (usebacklash)
{
LOGF_INFO("Checking backlash compensation for axis %c", AxisCmd[axis]);
if (NewStatus[axis].direction != LastRunningStatus[axis].direction)
{
uint32_t currentsteps;
char cmd[7];
char motioncmd[3] = "20"; // lowspeed goto
motioncmd[1] = (NewStatus[axis].direction == FORWARD ? '0' : '1'); // same direction
bool *motorrunning;
struct timespec wait;
LOGF_INFO("Performing backlash compensation for axis %c, microsteps = %d", AxisCmd[axis],
backlash);
// Axis Position
dispatch_command(GetAxisPosition, axis, nullptr);
//read_eqmod();
currentsteps = Revu24str2long(response + 1);
// Backlash Speed
long2Revu24str(backlashperiod[axis], cmd);
dispatch_command(SetStepPeriod, axis, cmd);
//read_eqmod();
// Backlash motion mode
dispatch_command(SetMotionMode, axis, motioncmd);
//read_eqmod();
// Target for backlash
long2Revu24str(backlash, cmd);
dispatch_command(SetGotoTargetIncrement, axis, cmd);
//read_eqmod();
// Target breaks for backlash (no break steps)
long2Revu24str(backlash / 10, cmd);
dispatch_command(SetBreakPointIncrement, axis, cmd);
//read_eqmod();
// Start Backlash
dispatch_command(StartMotion, axis, nullptr);
//read_eqmod();
// Wait end of backlash
if (axis == Axis1)
motorrunning = &RARunning;
else
motorrunning = &DERunning;
wait.tv_sec = 0;
wait.tv_nsec = 100000000; // 100ms
ReadMotorStatus(axis);
while (*motorrunning)
{
nanosleep(&wait, nullptr);
ReadMotorStatus(axis);
}
// Restore microsteps
long2Revu24str(currentsteps, cmd);
dispatch_command(SetAxisPositionCmd, axis, cmd);
//read_eqmod();
// Restore Speed
long2Revu24str((axis == Axis1 ? RAPeriod : DEPeriod), cmd);
dispatch_command(SetStepPeriod, axis, cmd);
//read_eqmod();
// Restore motion mode
switch (NewStatus[axis].slewmode)
{
case SLEW:
if (NewStatus[axis].speedmode == LOWSPEED)
motioncmd[0] = '1';
else
motioncmd[0] = '3';
break;
case GOTO:
if (NewStatus[axis].speedmode == LOWSPEED)
motioncmd[0] = '2';
else
motioncmd[0] = '0';
break;
default:
motioncmd[0] = '1';
break;
}
dispatch_command(SetMotionMode, axis, motioncmd);
//read_eqmod();
// Restore Target
long2Revu24str(Target[axis], cmd);
dispatch_command(SetGotoTargetIncrement, axis, cmd);
//read_eqmod();
// Restore Target breaks
long2Revu24str(TargetBreaks[axis], cmd);
dispatch_command(SetBreakPointIncrement, axis, cmd);
//read_eqmod();
}
}
dispatch_command(StartMotion, axis, nullptr);
//read_eqmod();
}
void Skywatcher::StopRA()
{
LOGF_DEBUG("%s() : calling RA StopWaitMotor", __FUNCTION__);
StopWaitMotor(Axis1);
}
void Skywatcher::StopDE()
{
LOGF_DEBUG("%s() : calling DE StopWaitMotor", __FUNCTION__);
StopWaitMotor(Axis2);
}
void Skywatcher::SetMotion(SkywatcherAxis axis, SkywatcherAxisStatus newstatus)
{
char motioncmd[3];
SkywatcherAxisStatus *currentstatus;
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c -- dir=%s mode=%s speedmode=%s", __FUNCTION__, AxisCmd[axis],
((newstatus.direction == FORWARD) ? "forward" : "backward"),
((newstatus.slewmode == SLEW) ? "slew" : "goto"),
((newstatus.speedmode == LOWSPEED) ? "lowspeed" : "highspeed"));
CheckMotorStatus(axis);
if (axis == Axis1)
currentstatus = &RAStatus;
else
currentstatus = &DEStatus;
motioncmd[2] = '\0';
switch (newstatus.slewmode)
{
case SLEW:
if (newstatus.speedmode == LOWSPEED)
motioncmd[0] = '1';
else
motioncmd[0] = '3';
break;
case GOTO:
if (newstatus.speedmode == LOWSPEED)
motioncmd[0] = '2';
else
motioncmd[0] = '0';
break;
default:
motioncmd[0] = '1';
break;
}
if (newstatus.direction == FORWARD)
motioncmd[1] = '0';
else
motioncmd[1] = '1';
/*
#ifdef STOP_WHEN_MOTION_CHANGED
StopWaitMotor(axis);
dispatch_command(SetMotionMode, axis, motioncmd);
//read_eqmod();
#else
*/
if ((newstatus.direction != currentstatus->direction) || (newstatus.speedmode != currentstatus->speedmode) ||
(newstatus.slewmode != currentstatus->slewmode))
{
StopWaitMotor(axis);
dispatch_command(SetMotionMode, axis, motioncmd);
//read_eqmod();
}
//#endif
NewStatus[axis] = newstatus;
}
void Skywatcher::ResetMotions()
{
char motioncmd[3];
SkywatcherAxisStatus newstatus;
DEBUGF(telescope->DBG_MOUNT, "%s() ", __FUNCTION__);
motioncmd[2] = '\0';
//set to SLEW/LOWSPEED
newstatus.slewmode = SLEW;
newstatus.speedmode = LOWSPEED;
motioncmd[0] = '1';
// Keep directions
CheckMotorStatus(Axis1);
newstatus.direction = RAStatus.direction;
if (RAStatus.direction == FORWARD)
motioncmd[1] = '0';
else
motioncmd[1] = '1';
dispatch_command(SetMotionMode, Axis1, motioncmd);
//read_eqmod();
NewStatus[Axis1] = newstatus;
CheckMotorStatus(Axis2);
newstatus.direction = DEStatus.direction;
if (DEStatus.direction == FORWARD)
motioncmd[1] = '0';
else
motioncmd[1] = '1';
dispatch_command(SetMotionMode, Axis2, motioncmd);
//read_eqmod();
NewStatus[Axis2] = newstatus;
}
void Skywatcher::StopMotor(SkywatcherAxis axis)
{
ReadMotorStatus(axis);
if (axis == Axis1 && RARunning)
LastRunningStatus[Axis1] = RAStatus;
if (axis == Axis2 && DERunning)
LastRunningStatus[Axis2] = DEStatus;
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c", __FUNCTION__, AxisCmd[axis]);
dispatch_command(NotInstantAxisStop, axis, nullptr);
//read_eqmod();
}
void Skywatcher::InstantStopMotor(SkywatcherAxis axis)
{
ReadMotorStatus(axis);
if (axis == Axis1 && RARunning)
LastRunningStatus[Axis1] = RAStatus;
if (axis == Axis2 && DERunning)
LastRunningStatus[Axis2] = DEStatus;
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c", __FUNCTION__, AxisCmd[axis]);
dispatch_command(InstantAxisStop, axis, nullptr);
//read_eqmod();
}
void Skywatcher::StopWaitMotor(SkywatcherAxis axis)
{
bool *motorrunning;
struct timespec wait;
ReadMotorStatus(axis);
if (axis == Axis1 && RARunning)
LastRunningStatus[Axis1] = RAStatus;
if (axis == Axis2 && DERunning)
LastRunningStatus[Axis2] = DEStatus;
DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c", __FUNCTION__, AxisCmd[axis]);
dispatch_command(NotInstantAxisStop, axis, nullptr);
//read_eqmod();
if (axis == Axis1)
motorrunning = &RARunning;
else
motorrunning = &DERunning;
wait.tv_sec = 0;
wait.tv_nsec = 100000000; // 100ms
ReadMotorStatus(axis);
while (*motorrunning)
{
nanosleep(&wait, nullptr);
ReadMotorStatus(axis);
}
}
/* Utilities */
void Skywatcher::CheckMotorStatus(SkywatcherAxis axis)
{
struct timeval now;
DEBUGF(telescope->DBG_SCOPE_STATUS, "%s() : Axis = %c", __FUNCTION__, AxisCmd[axis]);
gettimeofday(&now, nullptr);
if (((now.tv_sec - lastreadmotorstatus[axis].tv_sec) + ((now.tv_usec - lastreadmotorstatus[axis].tv_usec) / 1e6)) >
SKYWATCHER_MAXREFRESH)
ReadMotorStatus(axis);
}
double Skywatcher::get_min_rate()
{
return MIN_RATE;
}
double Skywatcher::get_max_rate()
{
return MAX_RATE;
}
bool Skywatcher::dispatch_command(SkywatcherCommand cmd, SkywatcherAxis axis, char *command_arg)
{
for (uint8_t i = 0; i < EQMOD_MAX_RETRY; i++)
{
// Clear string
command[0] = '\0';
if (command_arg == nullptr)
snprintf(command, SKYWATCHER_MAX_CMD, "%c%c%c%c", SkywatcherLeadingChar, cmd, AxisCmd[axis], SkywatcherTrailingChar);
else
snprintf(command, SKYWATCHER_MAX_CMD, "%c%c%c%s%c", SkywatcherLeadingChar, cmd, AxisCmd[axis], command_arg,
SkywatcherTrailingChar);
int nbytes_written = 0;
if (!isSimulation())
{
int err_code = 0;
tcflush(PortFD, TCIOFLUSH);
if ((err_code = tty_write_string(PortFD, command, &nbytes_written)) != TTY_OK)
{
if (i == EQMOD_MAX_RETRY - 1)
{
char ttyerrormsg[ERROR_MSG_LENGTH];
tty_error_msg(err_code, ttyerrormsg, ERROR_MSG_LENGTH);
throw EQModError(EQModError::ErrDisconnect, "tty write failed, check connection: %s", ttyerrormsg);
}
else
{
struct timespec wait;
wait.tv_sec = 0;
wait.tv_nsec = 100000000; // 100ms
nanosleep(nullptr, &wait);
continue;
}
}
}
else
{
telescope->simulator->receive_cmd(command, &nbytes_written);
}
//if (INDI::Logger::debugSerial(cmd)) {
command[nbytes_written - 1] = '\0'; //hmmm, remove \r, the SkywatcherTrailingChar
DEBUGF(telescope->DBG_COMM, "dispatch_command: \"%s\", %d bytes written", command, nbytes_written);
debugnextread = true;
try
{
if (read_eqmod())
return true;
}
catch (EQModError)
{
// By this time, we just rethrow the error
// JM 2018-05-07 immediately rethrow if GET_FEATURES_CMD
if (i == EQMOD_MAX_RETRY - 1 || cmd == GetFeatureCmd)
throw;
}
DEBUG(telescope->DBG_COMM, "read error, will retry again...");
}
return true;
}
bool Skywatcher::read_eqmod()
{
int err_code = 0, nbytes_read = 0;
// Clear string
response[0] = '\0';
if (!isSimulation())
{
//Have to onsider cases when we read ! (error) or 0x01 (buffer overflow)
// Read until encountring a CR
//if ((err_code = tty_read_section(PortFD, response, 0x0D, 15, &nbytes_read)) != TTY_OK)
if ((err_code = tty_read_section(PortFD, response, 0x0D, EQMOD_TIMEOUT, &nbytes_read)) != TTY_OK)
{
char ttyerrormsg[ERROR_MSG_LENGTH];
tty_error_msg(err_code, ttyerrormsg, ERROR_MSG_LENGTH);
throw EQModError(EQModError::ErrDisconnect, "tty read failed, check connection: %s", ttyerrormsg);
//return false;
}
}
else
{
telescope->simulator->send_reply(response, &nbytes_read);
}
// Remove CR
response[nbytes_read - 1] = '\0';
if (debugnextread)
{
DEBUGF(telescope->DBG_COMM, "read_eqmod: \"%s\", %d bytes read", response, nbytes_read);
debugnextread = false;
}
switch (response[0])
{
case '=':
break;
case '!':
throw EQModError(EQModError::ErrCmdFailed, "Failed command %s - Reply %s", command, response);
default:
throw EQModError(EQModError::ErrInvalidCmd, "Invalid response to command %s - Reply %s", command, response);
}
return true;
}
uint32_t Skywatcher::Revu24str2long(char *s)
{
uint32_t res = 0;
res = HEX(s[4]);
res <<= 4;
res |= HEX(s[5]);
res <<= 4;
res |= HEX(s[2]);
res <<= 4;
res |= HEX(s[3]);
res <<= 4;
res |= HEX(s[0]);
res <<= 4;
res |= HEX(s[1]);
return res;
}
uint32_t Skywatcher::Highstr2long(char *s)
{
uint32_t res = 0;
res = HEX(s[0]);
res <<= 4;
res |= HEX(s[1]);
return res;
}
void Skywatcher::long2Revu24str(uint32_t n, char *str)
{
char hexa[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
str[0] = hexa[(n & 0xF0) >> 4];
str[1] = hexa[(n & 0x0F)];
str[2] = hexa[(n & 0xF000) >> 12];
str[3] = hexa[(n & 0x0F00) >> 8];
str[4] = hexa[(n & 0xF00000) >> 20];
str[5] = hexa[(n & 0x0F0000) >> 16];
str[6] = '\0';
}
// Park
// Backlash
void Skywatcher::SetBacklashRA(uint32_t backlash)
{
Backlash[Axis1] = backlash;
}
void Skywatcher::SetBacklashUseRA(bool usebacklash)
{
UseBacklash[Axis1] = usebacklash;
}
void Skywatcher::SetBacklashDE(uint32_t backlash)
{
Backlash[Axis2] = backlash;
}
void Skywatcher::SetBacklashUseDE(bool usebacklash)
{
UseBacklash[Axis2] = usebacklash;
}
indi-eqmod-1.0+20220129131520/CMakeLists.txt 0000644 0001751 0001751 00000020020 14174600255 016737 0 ustar debian debian PROJECT(indi-eqmod C CXX)
cmake_minimum_required(VERSION 3.0)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/")
include(GNUInstallDirs)
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
find_package(INDI REQUIRED)
find_package(Nova REQUIRED)
find_package(ZLIB REQUIRED)
find_package(GSL REQUIRED)
set(EQMOD_VERSION_MAJOR 1)
set(EQMOD_VERSION_MINOR 2)
if (CYGWIN)
add_definitions(-U__STRICT_ANSI__)
endif(CYGWIN)
option(WITH_ALIGN "Enable Alignment Subsystem" ON)
option(WITH_ALIGN_GEEHALEL "Enable EQMod Alignment" ON)
option(WITH_SCOPE_LIMITS "Enable Scope limits" ON)
set(INDI_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/indi")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/indi_eqmod.xml.cmake ${CMAKE_CURRENT_BINARY_DIR}/indi_eqmod.xml )
include_directories( ${CMAKE_CURRENT_BINARY_DIR})
include_directories( ${CMAKE_CURRENT_SOURCE_DIR})
include_directories( ${INDI_INCLUDE_DIR})
include_directories( ${NOVA_INCLUDE_DIR})
include_directories( ${NOVA_INCLUDE_DIR}/..)
include_directories( ${GSL_INCLUDE_DIR} )
include(CMakeCommon)
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.9.9)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-overflow")
ENDIF ()
########### EQMod ###############
set(eqmod_CXX_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/eqmod.cpp
${CMAKE_CURRENT_SOURCE_DIR}/eqmodbase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/eqmoderror.cpp
${CMAKE_CURRENT_SOURCE_DIR}/skywatcher.cpp)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(eqmod_CXX_SRCS ${eqmod_CXX_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/mach_gettime.cpp)
endif()
set(eqmod_CXX_SRCS ${eqmod_CXX_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/simulator/simulator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/simulator/skywatcher-simulator.cpp)
if(WITH_ALIGN_GEEHALEL)
set(eqmod_CXX_SRCS ${eqmod_CXX_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/align/align.cpp ${CMAKE_CURRENT_SOURCE_DIR}/align/pointset.cpp
${CMAKE_CURRENT_SOURCE_DIR}/align/triangulate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/align/triangulate_chull.cpp)
set(eqmod_C_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/align/htm.c ${CMAKE_CURRENT_SOURCE_DIR}/align/chull/chull.c)
endif(WITH_ALIGN_GEEHALEL)
if(WITH_SCOPE_LIMITS)
set(eqmod_CXX_SRCS ${eqmod_CXX_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/scope-limits/scope-limits.cpp)
endif(WITH_SCOPE_LIMITS)
IF (UNITY_BUILD)
ENABLE_UNITY_BUILD(eqmod_c eqmod_C_SRCS 10 c)
ENABLE_UNITY_BUILD(eqmod_cxx eqmod_CXX_SRCS 10 cpp)
ENDIF ()
add_executable(indi_eqmod_telescope ${eqmod_C_SRCS} ${eqmod_CXX_SRCS})
if(WITH_ALIGN)
target_link_libraries(indi_eqmod_telescope ${INDI_LIBRARIES} ${NOVA_LIBRARIES} ${INDI_ALIGN_LIBRARIES} ${GSL_LIBRARIES} ${ZLIB_LIBRARY})
else(WITH_ALIGN)
target_link_libraries(indi_eqmod_telescope ${INDI_LIBRARIES} ${NOVA_LIBRARIES})
endif(WITH_ALIGN)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
target_link_libraries(indi_eqmod_telescope rt)
endif (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
install(TARGETS indi_eqmod_telescope RUNTIME DESTINATION bin )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/indi_eqmod.xml indi_eqmod_sk.xml DESTINATION ${INDI_DATA_DIR})
install( FILES simulator/indi_eqmod_simulator_sk.xml DESTINATION ${INDI_DATA_DIR})
if(WITH_ALIGN_GEEHALEL)
install( FILES align/indi_align_sk.xml DESTINATION ${INDI_DATA_DIR})
endif(WITH_ALIGN_GEEHALEL)
if(WITH_SCOPE_LIMITS)
install( FILES scope-limits/indi_eqmod_scope_limits_sk.xml DESTINATION ${INDI_DATA_DIR})
endif(WITH_SCOPE_LIMITS)
########### AZ GTi ###############
set(azgti_CXX_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/azgti.cpp
${CMAKE_CURRENT_SOURCE_DIR}/azgtibase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/eqmodbase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/eqmoderror.cpp
${CMAKE_CURRENT_SOURCE_DIR}/skywatcher.cpp)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(azgti_CXX_SRCS ${azgti_CXX_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/mach_gettime.cpp)
endif()
set(azgti_CXX_SRCS ${azgti_CXX_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/simulator/simulator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/simulator/skywatcher-simulator.cpp)
if(WITH_ALIGN_GEEHALEL)
set(azgti_CXX_SRCS ${azgti_CXX_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/align/align.cpp ${CMAKE_CURRENT_SOURCE_DIR}/align/pointset.cpp
${CMAKE_CURRENT_SOURCE_DIR}/align/triangulate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/align/triangulate_chull.cpp)
set(azgti_C_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/align/htm.c ${CMAKE_CURRENT_SOURCE_DIR}/align/chull/chull.c)
endif(WITH_ALIGN_GEEHALEL)
if(WITH_SCOPE_LIMITS)
set(azgti_CXX_SRCS ${azgti_CXX_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/scope-limits/scope-limits.cpp)
endif(WITH_SCOPE_LIMITS)
IF (UNITY_BUILD)
ENABLE_UNITY_BUILD(azgti_c azgti_C_SRCS 10 c)
ENABLE_UNITY_BUILD(azgti_cxx azgti_CXX_SRCS 10 cpp)
ENDIF ()
add_executable(indi_azgti_telescope ${azgti_C_SRCS} ${azgti_CXX_SRCS})
if(WITH_ALIGN)
target_link_libraries(indi_azgti_telescope ${INDI_LIBRARIES} ${NOVA_LIBRARIES} ${INDI_ALIGN_LIBRARIES} ${GSL_LIBRARIES} ${ZLIB_LIBRARY})
else(WITH_ALIGN)
target_link_libraries(indi_azgti_telescope ${INDI_LIBRARIES} ${NOVA_LIBRARIES})
endif(WITH_ALIGN)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
target_link_libraries(indi_azgti_telescope rt)
endif (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
install(TARGETS indi_azgti_telescope RUNTIME DESTINATION bin )
########### Star Adventurer 2i ###############
set(staradventurer2i_CXX_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/staradventurer2i.cpp
${CMAKE_CURRENT_SOURCE_DIR}/staradventurer2ibase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/eqmodbase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/eqmoderror.cpp
${CMAKE_CURRENT_SOURCE_DIR}/skywatcher.cpp)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(staradventurer2i_CXX_SRCS ${staradventurer2i_CXX_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/mach_gettime.cpp)
endif()
set(staradventurer2i_CXX_SRCS ${staradventurer2i_CXX_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/simulator/simulator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/simulator/skywatcher-simulator.cpp)
if(WITH_ALIGN_GEEHALEL)
set(staradventurer2i_CXX_SRCS ${staradventurer2i_CXX_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/align/align.cpp ${CMAKE_CURRENT_SOURCE_DIR}/align/pointset.cpp
${CMAKE_CURRENT_SOURCE_DIR}/align/triangulate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/align/triangulate_chull.cpp)
set(staradventurer2i_C_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/align/htm.c ${CMAKE_CURRENT_SOURCE_DIR}/align/chull/chull.c)
endif(WITH_ALIGN_GEEHALEL)
if(WITH_SCOPE_LIMITS)
set(staradventurer2i_CXX_SRCS ${staradventurer2i_CXX_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/scope-limits/scope-limits.cpp)
endif(WITH_SCOPE_LIMITS)
IF (UNITY_BUILD)
ENABLE_UNITY_BUILD(staradventurer2i_c staradventurer2i_C_SRCS 10 c)
ENABLE_UNITY_BUILD(staradventurer2i_cxx staradventurer2i_CXX_SRCS 10 cpp)
ENDIF ()
add_executable(indi_staradventurer2i_telescope ${staradventurer2i_C_SRCS} ${staradventurer2i_CXX_SRCS})
if(WITH_ALIGN)
target_link_libraries(indi_staradventurer2i_telescope ${INDI_LIBRARIES} ${NOVA_LIBRARIES} ${INDI_ALIGN_LIBRARIES} ${GSL_LIBRARIES} ${ZLIB_LIBRARY})
else(WITH_ALIGN)
target_link_libraries(indi_staradventurer2i_telescope ${INDI_LIBRARIES} ${NOVA_LIBRARIES})
endif(WITH_ALIGN)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
target_link_libraries(indi_staradventurer2i_telescope rt)
endif (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
install(TARGETS indi_staradventurer2i_telescope RUNTIME DESTINATION bin )
###################################################################################################
######################################### Tests #################################################
###################################################################################################
set(INDI_BUILD_UNITTESTS TRUE)
find_package (GTest)
find_package (GMock)
IF (GTEST_FOUND)
IF (INDI_BUILD_UNITTESTS)
MESSAGE (STATUS "Building unit tests")
ADD_SUBDIRECTORY(test)
ELSE (INDI_BUILD_UNITTESTS)
MESSAGE (STATUS "Not building unit tests")
ENDIF (INDI_BUILD_UNITTESTS)
ELSE()
MESSAGE (STATUS "GTEST not found, not building unit tests")
ENDIF (GTEST_FOUND)
indi-eqmod-1.0+20220129131520/COPYING 0000644 0001751 0001751 00000104513 14174600255 015244 0 ustar debian debian GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
indi-eqmod-1.0+20220129131520/skywatcher.h 0000644 0001751 0001751 00000030403 14174600255 016542 0 ustar debian debian /* Copyright 2012 Geehalel (geehalel AT gmail DOT com) */
/* This file is part of the Skywatcher Protocol INDI driver.
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#pragma once
#include "eqmoderror.h"
#include
#include
#include
#include
class EQMod; // TODO
#include "simulator/simulator.h"
#define SKYWATCHER_MAX_CMD 16
#define SKYWATCHER_MAX_TRIES 3
#define SKYWATCHER_ERROR_BUFFER 1024
#define SKYWATCHER_SIDEREAL_DAY 86164.09053083288
#define SKYWATCHER_SIDEREAL_SPEED 15.04106864
#define SKYWATCHER_STELLAR_DAY 86164.098903691
#define SKYWATCHER_STELLAR_SPEED 15.041067179
#define SKYWATCHER_LOWSPEED_RATE 128
#define SKYWATCHER_MAXREFRESH 0.5
#define SKYWATCHER_BACKLASH_SPEED_RA 64
#define SKYWATCHER_BACKLASH_SPEED_DE 64
#define HEX(c) (((c) < 'A') ? ((c) - '0') : ((c) - 'A') + 10)
class Skywatcher
{
public:
Skywatcher(EQMod *t);
~Skywatcher();
bool Handshake();
bool Disconnect();
void setDebug(bool enable);
const char *getDeviceName();
bool HasHomeIndexers();
bool HasAuxEncoders();
bool HasPPEC();
bool HasSnapPort1();
bool HasSnapPort2();
bool HasPolarLed();
uint32_t GetRAEncoder();
uint32_t GetDEEncoder();
uint32_t GetRAEncoderZero();
uint32_t GetRAEncoderTotal();
uint32_t GetRAEncoderHome();
uint32_t GetDEEncoderZero();
uint32_t GetDEEncoderTotal();
uint32_t GetDEEncoderHome();
uint32_t GetRAPeriod();
uint32_t GetDEPeriod();
void GetRAMotorStatus(ILightVectorProperty *motorLP);
void GetDEMotorStatus(ILightVectorProperty *motorLP);
void InquireBoardVersion(ITextVectorProperty *boardTP);
void InquireFeatures();
void InquireRAEncoderInfo(INumberVectorProperty *encoderNP);
void InquireDEEncoderInfo(INumberVectorProperty *encoderNP);
void Init();
void SlewRA(double rate);
void SlewDE(double rate);
void StopRA();
void StopDE();
void SetRARate(double rate);
void SetDERate(double rate);
void SlewTo(int32_t deltaraencoder, int32_t deltadeencoder);
void AbsSlewTo(uint32_t raencoder, uint32_t deencoder, bool raup, bool deup);
void StartRATracking(double trackspeed);
void StartDETracking(double trackspeed);
bool IsRARunning();
bool IsDERunning();
// For AstroEQ (needs an explicit :G command at the end of gotos)
void ResetMotions();
void setSimulation(bool);
bool isSimulation();
bool simulation;
// Backlash
void SetBacklashRA(uint32_t backlash);
void SetBacklashUseRA(bool usebacklash);
void SetBacklashDE(uint32_t backlash);
void SetBacklashUseDE(bool usebacklash);
uint32_t GetlastreadRAIndexer();
uint32_t GetlastreadDEIndexer();
uint32_t GetRAAuxEncoder();
uint32_t GetDEAuxEncoder();
void TurnRAEncoder(bool on);
void TurnDEEncoder(bool on);
void TurnPPECTraining(bool on);
void TurnPPEC(bool on);
void GetPPECStatus(bool *intraining, bool *inppec);
void ResetRAIndexer();
void ResetDEIndexer();
void GetRAIndexer();
void GetDEIndexer();
void SetRAAxisPosition(uint32_t step);
void SetDEAxisPosition(uint32_t step);
void SetST4RAGuideRate(unsigned char r);
void SetST4DEGuideRate(unsigned char r);
void SetLEDBrightness(uint8_t value);
void TurnSnapPort1(bool on);
void TurnSnapPort2(bool on);
bool GetSnapPort1Status();
bool GetSnapPort2Status();
void setPortFD(int value);
private:
// Official Skywatcher Protocol
// See http://code.google.com/p/skywatcher/wiki/SkyWatcherProtocol
// Constants
static const char SkywatcherLeadingChar = ':';
static const char SkywatcherTrailingChar = 0x0d;
static constexpr double MIN_RATE = 0.05;
static constexpr double MAX_RATE = 800.0;
uint32_t minperiods[2];
// Types
enum SkywatcherCommand
{
Initialize = 'F',
InquireMotorBoardVersion = 'e',
InquireGridPerRevolution = 'a',
InquireTimerInterruptFreq = 'b',
InquireHighSpeedRatio = 'g',
InquirePECPeriod = 's',
InstantAxisStop = 'L',
NotInstantAxisStop = 'K',
SetAxisPositionCmd = 'E',
GetAxisPosition = 'j',
GetAxisStatus = 'f',
SetSnapPort = 'O', // EQ8/AZEQ6/AZEQ5/EQ6-R only
SetMotionMode = 'G',
SetGotoTargetIncrement = 'H',
SetBreakPointIncrement = 'M',
SetGotoTarget = 'S',
SetBreakStep = 'U',
SetStepPeriod = 'I',
StartMotion = 'J',
GetStepPeriod = 'D', // See Merlin protocol http://www.papywizard.org/wiki/DevelopGuide
ActivateMotor = 'B', // See eq6direct implementation http://pierre.nerzic.free.fr/INDI/
SetST4GuideRateCmd = 'P',
GetHomePosition = 'd', // Get Home position encoder count (default at startup)
SetFeatureCmd = 'W', // EQ8/AZEQ6/AZEQ5 only
GetFeatureCmd = 'q', // EQ8/AZEQ6/AZEQ5 only
InquireAuxEncoder = 'd', // EQ8/AZEQ6/AZEQ5 only
SetPolarScopeLED = 'V',
};
enum SkywatcherAxis
{
Axis1 = 0, // RA/AZ
Axis2 = 1, // DE/ALT
NUMBER_OF_SKYWATCHERAXIS
};
char AxisCmd[2] {'1', '2'};
enum SkywatcherDirection
{
BACKWARD = 0,
FORWARD = 1
};
enum SkywatcherSlewMode
{
SLEW = 0,
GOTO = 1
};
enum SkywatcherSpeedMode
{
LOWSPEED = 0,
HIGHSPEED = 1
};
typedef struct SkyWatcherFeatures
{
bool inPPECTraining = false;
bool inPPEC = false;
bool hasEncoder = false;
bool hasPPEC = false;
bool hasHomeIndexer = false;
bool isAZEQ = false;
bool hasPolarLed = false;
bool hasCommonSlewStart = false; // supports :J3
bool hasHalfCurrentTracking = false;
bool hasWifi = false;
} SkyWatcherFeatures;
enum SkywatcherGetFeatureCmd
{
GET_INDEXER_CMD = 0x00,
GET_FEATURES_CMD = 0x01
};
enum SkywatcherSetFeatureCmd
{
START_PPEC_TRAINING_CMD = 0x00,
STOP_PPEC_TRAINING_CMD = 0x01,
TURN_PPEC_ON_CMD = 0x02,
TURN_PPEC_OFF_CMD = 0X03,
ENCODER_ON_CMD = 0x04,
ENCODER_OFF_CMD = 0x05,
DISABLE_FULL_CURRENT_LOW_SPEED_CMD = 0x0006,
ENABLE_FULL_CURRENT_LOW_SPEED_CMD = 0x0106,
RESET_HOME_INDEXER_CMD = 0x08
};
typedef struct SkywatcherAxisStatus
{
SkywatcherDirection direction;
SkywatcherSlewMode slewmode;
SkywatcherSpeedMode speedmode;
} SkywatcherAxisStatus;
enum SkywatcherError
{
NO_ERROR,
ER_1,
ER_2,
ER_3
};
struct timeval lastreadmotorstatus[NUMBER_OF_SKYWATCHERAXIS];
struct timeval lastreadmotorposition[NUMBER_OF_SKYWATCHERAXIS];
// Functions
void CheckMotorStatus(SkywatcherAxis axis);
void ReadMotorStatus(SkywatcherAxis axis);
void SetMotion(SkywatcherAxis axis, SkywatcherAxisStatus newstatus);
void SetSpeed(SkywatcherAxis axis, uint32_t period);
void SetTarget(SkywatcherAxis axis, uint32_t increment);
void SetTargetBreaks(SkywatcherAxis axis, uint32_t increment);
void SetAbsTarget(SkywatcherAxis axis, uint32_t target);
void SetAbsTargetBreaks(SkywatcherAxis axis, uint32_t breakstep);
void StartMotor(SkywatcherAxis axis);
void StopMotor(SkywatcherAxis axis);
void InstantStopMotor(SkywatcherAxis axis);
void StopWaitMotor(SkywatcherAxis axis);
void SetFeature(SkywatcherAxis axis, uint32_t command);
void GetFeature(SkywatcherAxis axis, uint32_t command);
void TurnEncoder(SkywatcherAxis axis, bool on);
uint32_t ReadEncoder(SkywatcherAxis axis);
void ResetIndexer(SkywatcherAxis axis);
void GetIndexer(SkywatcherAxis axis);
void SetST4GuideRate(SkywatcherAxis axis, unsigned char r);
void SetAxisPosition(SkywatcherAxis axis, uint32_t step);
void TurnSnapPort(SkywatcherAxis axis, bool on);
bool read_eqmod();
bool dispatch_command(SkywatcherCommand cmd, SkywatcherAxis axis, char *arg);
uint32_t Revu24str2long(char *);
uint32_t Highstr2long(char *);
void long2Revu24str(uint32_t, char *);
double get_min_rate();
double get_max_rate();
bool isDebug();
// Variables
// See Skywatcher protocol
uint32_t MCVersion; // Motor Controller Version
uint32_t MountCode; //
uint32_t RASteps360;
uint32_t DESteps360;
uint32_t RAStepsWorm;
uint32_t DEStepsWorm;
// Motor controller multiplies speed values by this ratio when in low speed mode
uint32_t RAHighspeedRatio;
// This is a reflect of either using a timer interrupt with an interrupt count greater than 1 for low speed
// or of using microstepping only for low speeds and half/full stepping for high speeds
uint32_t DEHighspeedRatio;
uint32_t RAStep; // Current RA encoder position in step
uint32_t DEStep; // Current DE encoder position in step
uint32_t RAStepInit; // Initial RA position in step
uint32_t DEStepInit; // Initial DE position in step
uint32_t RAStepHome; // Home RA position in step
uint32_t DEStepHome; // Home DE position in step
uint32_t RAPeriod {256}; // Current RA worm period
uint32_t DEPeriod {256}; // Current DE worm period
uint32_t lastRAStep {0xFFFFFFFF};
uint32_t lastDEStep {0xFFFFFFFF};
uint32_t lastRAPeriod {0xFFFFFFFF};
uint32_t lastDEPeriod {0xFFFFFFFF};
bool RAInitialized, DEInitialized, RARunning, DERunning;
bool wasinitialized;
SkywatcherAxisStatus RAStatus, DEStatus;
SkyWatcherFeatures AxisFeatures[NUMBER_OF_SKYWATCHERAXIS];
int PortFD = -1;
char command[SKYWATCHER_MAX_CMD];
char response[SKYWATCHER_MAX_CMD];
bool debug;
bool debugnextread;
EQMod *telescope;
bool reconnect;
// Backlash
uint32_t Backlash[NUMBER_OF_SKYWATCHERAXIS];
bool UseBacklash[NUMBER_OF_SKYWATCHERAXIS];
uint32_t Target[NUMBER_OF_SKYWATCHERAXIS];
uint32_t TargetBreaks[NUMBER_OF_SKYWATCHERAXIS];
SkywatcherAxisStatus LastRunningStatus[NUMBER_OF_SKYWATCHERAXIS];
SkywatcherAxisStatus NewStatus[NUMBER_OF_SKYWATCHERAXIS];
uint32_t backlashperiod[NUMBER_OF_SKYWATCHERAXIS];
uint32_t lastreadIndexer[NUMBER_OF_SKYWATCHERAXIS];
bool snapportstatus[NUMBER_OF_SKYWATCHERAXIS];
const uint8_t EQMOD_TIMEOUT = 5;
const uint8_t EQMOD_MAX_RETRY = 3;
};
indi-eqmod-1.0+20220129131520/config.h.cmake 0000644 0001751 0001751 00000000633 14174600255 016704 0 ustar debian debian #ifndef CONFIG_H
#define CONFIG_H
/* Define INDI Data Dir */
#cmakedefine INDI_DATA_DIR "@INDI_DATA_DIR@"
/* Define Driver version */
#define EQMOD_VERSION_MAJOR @EQMOD_VERSION_MAJOR@
#define EQMOD_VERSION_MINOR @EQMOD_VERSION_MINOR@
#cmakedefine WITH_ALIGN
#cmakedefine WITH_ALIGN_GEEHALEL
#cmakedefine STOP_WHEN_MOTION_CHANGED
#cmakedefine WITH_SCOPE_LIMITS
#define MAX_PATH_LENGTH 512
#endif // CONFIG_H
indi-eqmod-1.0+20220129131520/AUTHORS 0000644 0001751 0001751 00000000046 14174600255 015255 0 ustar debian debian Geehalel (geehalel AT gmail DOT com)
indi-eqmod-1.0+20220129131520/test/ 0000755 0001751 0001751 00000000000 14174600255 015164 5 ustar debian debian indi-eqmod-1.0+20220129131520/test/test_eqmod.cpp 0000644 0001751 0001751 00000047047 14174600255 020050 0 ustar debian debian #include
#include
#include "config.h"
#include "eqmodbase.h"
using ::testing::_;
using ::testing::StrEq;
class TestEQMod : public EQMod
{
public:
TestEQMod()
{
zeroRAEncoder = 1000000;
totalRAEncoder = 360000;
zeroDEEncoder = 2000000;
totalDEEncoder = 360000;
initProperties();
}
bool TestEncoders() {
uint32_t destep = totalDEEncoder / 360;
// do not test at 90 degree edges because the result pier side is not stable because of float comparison
uint32_t demin = zeroDEEncoder - totalDEEncoder / 4 + 1;
uint32_t demax = zeroDEEncoder + totalDEEncoder * 3 / 4 - 1;
uint32_t rastep = totalRAEncoder / 360;
uint32_t ramin = zeroRAEncoder - totalRAEncoder / 2 + 1;
uint32_t ramax = zeroRAEncoder + totalRAEncoder / 2 - 1;
for (currentDEEncoder = demin; currentDEEncoder <= demax; currentDEEncoder += destep)
{
double de = EncoderToDegrees(currentDEEncoder, zeroDEEncoder, totalDEEncoder, Hemisphere);
uint32_t currentDEEncoder_res = EncoderFromDegree(de, zeroDEEncoder, totalDEEncoder, Hemisphere);
EXPECT_EQ(currentDEEncoder, currentDEEncoder_res);
}
for (currentRAEncoder = ramin; currentRAEncoder <= ramax; currentRAEncoder += rastep)
{
double ha = EncoderToHours(currentRAEncoder, zeroRAEncoder, totalRAEncoder, Hemisphere);
uint32_t currentRAEncoder_res = EncoderFromHour(ha, zeroRAEncoder, totalRAEncoder, Hemisphere);
EXPECT_EQ(currentRAEncoder, currentRAEncoder_res);
}
double lst;
for (currentDEEncoder = demin; currentDEEncoder <= demax; currentDEEncoder += destep)
{
for (currentRAEncoder = ramin; currentRAEncoder <= ramax; currentRAEncoder += rastep)
{
for (lst = 0.0; lst < 24.0; lst++)
{
EncodersToRADec(currentRAEncoder, currentDEEncoder, lst, ¤tRA, ¤tDEC, ¤tHA, ¤tPierSide);
uint32_t currentRAEncoder_res = EncoderFromRA(currentRA, currentPierSide, lst, zeroRAEncoder, totalRAEncoder, Hemisphere);
uint32_t currentDEEncoder_res = EncoderFromDec(currentDEC, currentPierSide, zeroDEEncoder, totalDEEncoder, Hemisphere);
EXPECT_EQ(currentDEEncoder, currentDEEncoder_res);
EXPECT_EQ(currentRAEncoder, currentRAEncoder_res);
}
}
}
return true;
}
bool TestEncoderTarget() {
double lst;
double ra, de;
// do not test at 90 degree edges because the result pier side is not stable because of float comparison
for (ra = 0.5; ra < 24.0; ra += 1.0)
{
for (de = -89.5; de <= 90.0; de += 1.0)
{
bzero(&gotoparams, sizeof(gotoparams));
gotoparams.ratarget = ra;
gotoparams.detarget = de;
gotoparams.racurrentencoder = currentRAEncoder;
gotoparams.decurrentencoder = currentDEEncoder;
gotoparams.completed = false;
gotoparams.checklimits = true;
gotoparams.outsidelimits = false;
gotoparams.pier_side = PIER_UNKNOWN; // Auto - keep counterweight down
if (Hemisphere == NORTH)
{
gotoparams.limiteast = zeroRAEncoder - (totalRAEncoder / 4) - (totalRAEncoder / 24); // 13h
gotoparams.limitwest = zeroRAEncoder + (totalRAEncoder / 4) + (totalRAEncoder / 24); // 23h
}
else
{
gotoparams.limiteast = zeroRAEncoder + (totalRAEncoder / 4) + (totalRAEncoder / 24); // 13h
gotoparams.limitwest = zeroRAEncoder - (totalRAEncoder / 4) - (totalRAEncoder / 24); // 23h
}
juliandate = getJulianDate();
lst = getLst(juliandate, getLongitude());
EncoderTarget(&gotoparams);
EncodersToRADec(gotoparams.ratargetencoder, gotoparams.detargetencoder, lst, ¤tRA, ¤tDEC, ¤tHA, nullptr);
EXPECT_NEAR(ra, currentRA, 0.001) << "ra=" << ra << " dec=" << de << std::endl;
EXPECT_NEAR(de, currentDEC, 0.001) << "ra=" << ra << " dec=" << de << std::endl;
// With counterweight down it can't go outside limits
EXPECT_FALSE(gotoparams.outsidelimits) << "limiteast=" << gotoparams.limiteast << " limitwest=" << gotoparams.limitwest << " pier_side=" << gotoparams.pier_side << " ratargetencoder=" << gotoparams.ratargetencoder << std::endl ;
}
}
return true;
}
bool TestHemisphereSymmetry() {
uint32_t destep = totalDEEncoder / 36;
// do not test at 90 degree edges because the result pier side is not stable because of float comparison
uint32_t demin = zeroDEEncoder - totalDEEncoder / 4 + 1;
uint32_t demax = zeroDEEncoder + totalDEEncoder * 3 / 4 - 1;
uint32_t rastep = totalRAEncoder / 36;
uint32_t ramin = zeroRAEncoder - totalRAEncoder / 2 + 1;
uint32_t ramax = zeroRAEncoder + totalRAEncoder / 2 - 1;
// test with lst = 0.0 and longitude = 0.0 so we can assume RA = HA
double lst = 0.0;
for (currentDEEncoder = demin; currentDEEncoder <= demax; currentDEEncoder += destep)
{
for (currentRAEncoder = ramin; currentRAEncoder <= ramax; currentRAEncoder += rastep)
{
updateLocation(50.0, 0.0, 0);
double RA_North, DEC_North, HA_North;
TelescopePierSide PierSide_North;
EncodersToRADec(currentRAEncoder, currentDEEncoder, lst, &RA_North, &DEC_North, &HA_North, &PierSide_North);
updateLocation(-50.0, 0.0, 0);
double RA_South, DEC_South, HA_South;
TelescopePierSide PierSide_South;
EncodersToRADec(currentRAEncoder, currentDEEncoder, lst, &RA_South, &DEC_South, &HA_South, &PierSide_South);
EXPECT_NEAR(RA_North, 24.0 - RA_South, 0.001);
EXPECT_NEAR(DEC_North, -DEC_South, 0.001);
EXPECT_NE(PierSide_North, PierSide_South);
}
}
return true;
}
};
TEST(EqmodTest, hemisphere_symmetry)
{
TestEQMod eqmod;
eqmod.TestHemisphereSymmetry();
}
TEST(EqmodTest, encoders_north)
{
TestEQMod eqmod;
eqmod.updateLocation(50.0, 15.0, 0);
eqmod.TestEncoders();
}
TEST(EqmodTest, encoders_south)
{
TestEQMod eqmod;
eqmod.updateLocation(-50.0, 15.0, 0);
eqmod.TestEncoders();
}
TEST(EqmodTest, encoder_target_north)
{
TestEQMod eqmod;
eqmod.updateLocation(50.0, 15.0, 0);
eqmod.TestEncoderTarget();
}
TEST(EqmodTest, encoder_target_south)
{
TestEQMod eqmod;
eqmod.updateLocation(-50.0, 15.0, 0);
eqmod.TestEncoderTarget();
}
#ifdef WITH_SCOPE_LIMITS
TEST(EqmodTest, scope_limits_properties)
{
TestEQMod eqmod;
{
ITextVectorProperty * const p = eqmod.getText("HORIZONLIMITSDATAFILE");
EXPECT_NE(p, nullptr);
if (p != nullptr)
{
EXPECT_NE(IUFindText(p, "HORIZONLIMITSFILENAME"), nullptr);
}
}
{
INumberVectorProperty * const p = eqmod.getNumber("HORIZONLIMITSPOINT");
EXPECT_NE(p, nullptr);
if (p != nullptr)
{
EXPECT_NE(IUFindNumber(p, "HORIZONLIMITS_POINT_AZ"), nullptr);
EXPECT_NE(IUFindNumber(p, "HORIZONLIMITS_POINT_ALT"), nullptr);
}
}
{
ISwitchVectorProperty * const p = eqmod.getSwitch("HORIZONLIMITSTRAVERSE");
EXPECT_NE(p, nullptr);
if (p != nullptr)
{
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSLISTFIRST"), nullptr);
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSLISTPREV"), nullptr);
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSLISTNEXT"), nullptr);
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSLISTLAST"), nullptr);
}
}
{
ISwitchVectorProperty * const p = eqmod.getSwitch("HORIZONLIMITSMANAGE");
EXPECT_NE(p, nullptr);
if (p != nullptr)
{
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSLISTADDCURRENT"), nullptr);
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSLISTDELETE"), nullptr);
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSLISTCLEAR"), nullptr);
}
}
{
ISwitchVectorProperty * const p = eqmod.getSwitch("HORIZONLIMITSFILEOPERATION");
EXPECT_NE(p, nullptr);
if (p != nullptr)
{
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSWRITEFILE"), nullptr);
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSLOADFILE"), nullptr);
}
}
{
ISwitchVectorProperty * const p = eqmod.getSwitch("HORIZONLIMITSONLIMIT");
EXPECT_NE(p, nullptr);
if (p != nullptr)
{
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSONLIMITTRACK"), nullptr);
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSONLIMITSLEW"), nullptr);
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSONLIMITGOTO"), nullptr);
}
}
{
ISwitchVectorProperty * const p = eqmod.getSwitch("HORIZONLIMITSLIMITGOTO");
EXPECT_NE(p, nullptr);
if (p != nullptr)
{
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSLIMITGOTODISABLE"), nullptr);
EXPECT_NE(IUFindSwitch(p, "HORIZONLIMITSLIMITGOTOENABLE"), nullptr);
}
}
{
IBLOBVectorProperty * const p = eqmod.getBLOB("HORIZONLIMITSDATAFITS");
EXPECT_NE(p, nullptr);
if (p != nullptr)
{
EXPECT_NE(IUFindBLOB(p, "HORIZONPOINTS"), nullptr);
}
}
}
TEST(EqmodTest, scope_limits_empty)
{
TestEQMod eqmod;
eqmod.updateLocation(50.0, 15.0, 0);
ISwitchVectorProperty * const onlimit = eqmod.getSwitch("HORIZONLIMITSONLIMIT");
ASSERT_NE(onlimit, nullptr);
ISwitch * const limittrack = IUFindSwitch(onlimit, "HORIZONLIMITSONLIMITTRACK");
ASSERT_NE(limittrack, nullptr);
ISwitch * const limitslew = IUFindSwitch(onlimit, "HORIZONLIMITSONLIMITSLEW");
ASSERT_NE(limitslew, nullptr);
ISwitch * const limitgoto = IUFindSwitch(onlimit, "HORIZONLIMITSONLIMITGOTO");
ASSERT_NE(limitgoto, nullptr);
HorizonLimits * const hl = eqmod.horizon;
ASSERT_NE(hl, nullptr);
// Because there are no horizon limits set, any altitude under the horizon will trigger the limit check
// So use that to test switches appropriately
for (int ftrack = ISS_OFF; ftrack <= ISS_ON; ftrack++)
{
limittrack->s = (ISState) ftrack;
for (int fslew = ISS_OFF; fslew <= ISS_ON; fslew++)
{
limitslew->s = (ISState) fslew;
for (int fgoto = ISS_OFF; fgoto <= ISS_ON; fgoto++)
{
limitgoto->s = (ISState) fgoto;
IDSetSwitch(onlimit, nullptr);
// Over the horizon (0 <= alt), so always outside limits
for (double alt = 0; alt < +90; alt += 0.7)
{
for (double az = -365; az < 365; az += 0.7)
{
// Inside limits, no aborts
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_IDLE, false), false);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_SLEWING, false), false);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_SLEWING, true), false);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_TRACKING, false), false);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_TRACKING, true), false);
// Remaining tests are improbable, and won't abort anything
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_IDLE, true), false);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_PARKING, false), false);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_PARKING, true), false);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_PARKED, false), false);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_PARKED, true), false);
}
}
// On or under horizon (alt < 0 strictly), so always outside limits
// Those tests output warnings thus are slower, so use larger verification strides
for (double alt = -0.001; -90 < alt; alt -= 10.1)
{
for (double az = -365; az < 365; az += 10.1)
{
// When idle, limits are not tested
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_IDLE, false), false);
// When slewing, limits may abort move without goto, and gotos
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_SLEWING, false), fslew == ISS_ON);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_SLEWING, true), fgoto == ISS_ON);
// When tracking, limits may abort move, also in the edge case of tracking during goto
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_TRACKING, false), ftrack == ISS_ON);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_TRACKING, true), ftrack == ISS_ON);
// Remaining tests are improbable, and won't abort anything
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_IDLE, true), false);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_PARKING, false), false);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_PARKING, true), false);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_PARKED, false), false);
ASSERT_EQ(hl->checkLimits(az, alt, INDI::Telescope::SCOPE_PARKED, true), false);
}
}
}
}
}
}
TEST(EqmodTest, scope_limits_altaz)
{
TestEQMod eqmod;
eqmod.updateLocation(50.0, 15.0, 0);
ISwitchVectorProperty * const onlimit = eqmod.getSwitch("HORIZONLIMITSONLIMIT");
ASSERT_NE(onlimit, nullptr);
ISwitch * const limittrack = IUFindSwitch(onlimit, "HORIZONLIMITSONLIMITTRACK");
ASSERT_NE(limittrack, nullptr);
ISwitch * const limitslew = IUFindSwitch(onlimit, "HORIZONLIMITSONLIMITSLEW");
ASSERT_NE(limitslew, nullptr);
ISwitch * const limitgoto = IUFindSwitch(onlimit, "HORIZONLIMITSONLIMITGOTO");
ASSERT_NE(limitgoto, nullptr);
HorizonLimits * const hl = eqmod.horizon;
ASSERT_NE(hl, nullptr);
// Use a configuration that aborts tracking out of limits
limittrack->s = ISS_ON;
limitslew->s = ISS_OFF;
limitgoto->s = ISS_OFF;
IDSetSwitch(onlimit, nullptr);
// Retrieve points properties
INumberVectorProperty * const ppoint = eqmod.getNumber("HORIZONTAL_COORD");
ASSERT_NE(ppoint, nullptr);
INumber * const paz = IUFindNumber(ppoint, "AZ");
ASSERT_NE(paz, nullptr);
INumber * const palt = IUFindNumber(ppoint, "ALT");
ASSERT_NE(palt, nullptr);
// Retrieve points management properties
ISwitchVectorProperty * const pmanage = eqmod.getSwitch("HORIZONLIMITSMANAGE");
ASSERT_NE(pmanage, nullptr);
ISwitch * const padd = IUFindSwitch(pmanage, "HORIZONLIMITSLISTADDCURRENT");
ASSERT_NE(padd, nullptr);
ISwitch * const pclear = IUFindSwitch(pmanage, "HORIZONLIMITSLISTCLEAR");
ASSERT_NE(pclear, nullptr);
ISState iss_on[] = { ISS_ON };
const char * manage_add[] = { "HORIZONLIMITSLISTADDCURRENT" };
const char * manage_clear[] = { "HORIZONLIMITSLISTCLEAR" };
// Add a single alt-az horizon point and test edge case points, then clear horizon points
paz->value = 30;
palt->value = 45;
IDSetNumber(ppoint, nullptr);
ASSERT_TRUE(hl->ISNewSwitch(eqmod.getDeviceName(), "HORIZONLIMITSMANAGE", iss_on, (char**) manage_add, 1));
ASSERT_EQ(hl->checkLimits(30, 50, INDI::Telescope::SCOPE_TRACKING, false), false);
ASSERT_EQ(hl->checkLimits(30, 40, INDI::Telescope::SCOPE_TRACKING, false), true);
ASSERT_EQ(hl->checkLimits(20, 50, INDI::Telescope::SCOPE_TRACKING, false), false);
ASSERT_EQ(hl->checkLimits(20, 40, INDI::Telescope::SCOPE_TRACKING, false), true);
ASSERT_EQ(hl->checkLimits(40, 50, INDI::Telescope::SCOPE_TRACKING, false), false);
ASSERT_EQ(hl->checkLimits(40, 40, INDI::Telescope::SCOPE_TRACKING, false), true);
ASSERT_TRUE(hl->ISNewSwitch(eqmod.getDeviceName(), "HORIZONLIMITSMANAGE", iss_on, (char**) manage_clear, 1));
// Try out some altitudes in horizontal circles, limit must trig as soon as we go lower than horizon altitude - no interpolation here
for (palt->value = 0; palt->value <= 90; palt->value += 10)
{
for (paz->value = 0; paz->value < 360; paz->value += 60)
{
IDSetNumber(ppoint, nullptr);
ASSERT_TRUE(hl->ISNewSwitch(eqmod.getDeviceName(), "HORIZONLIMITSMANAGE", iss_on, (char**) manage_add, 1));
}
for (double test_alt = 0; test_alt < 90; test_alt += 8.4)
for (double test_az = -365; test_az < +365; test_az += 26.7)
ASSERT_EQ(hl->checkLimits(test_az, test_alt, INDI::Telescope::SCOPE_TRACKING, false), test_alt < palt->value);
ASSERT_TRUE(hl->ISNewSwitch(eqmod.getDeviceName(), "HORIZONLIMITSMANAGE", iss_on, (char**) manage_clear, 1));
}
// Try out increasing altitude to test interpolation
paz->value = 0;
palt->value = 10;
IDSetNumber(ppoint, nullptr);
ASSERT_TRUE(hl->ISNewSwitch(eqmod.getDeviceName(), "HORIZONLIMITSMANAGE", iss_on, (char**) manage_add, 1));
paz->value = 180;
palt->value = 20;
IDSetNumber(ppoint, nullptr);
ASSERT_TRUE(hl->ISNewSwitch(eqmod.getDeviceName(), "HORIZONLIMITSMANAGE", iss_on, (char**) manage_add, 1));
// Test at horizon points
ASSERT_EQ(hl->checkLimits(0, 9, INDI::Telescope::SCOPE_TRACKING, false), true);
ASSERT_EQ(hl->checkLimits(0, 10, INDI::Telescope::SCOPE_TRACKING, false), false);
ASSERT_EQ(hl->checkLimits(180, 19, INDI::Telescope::SCOPE_TRACKING, false), true);
ASSERT_EQ(hl->checkLimits(180, 20, INDI::Telescope::SCOPE_TRACKING, false), false);
// Test in middles of horizon segments
ASSERT_EQ(hl->checkLimits(90, 14, INDI::Telescope::SCOPE_TRACKING, false), true);
ASSERT_EQ(hl->checkLimits(90, 15, INDI::Telescope::SCOPE_TRACKING, false), false);
ASSERT_EQ(hl->checkLimits(270, 14, INDI::Telescope::SCOPE_TRACKING, false), true);
ASSERT_EQ(hl->checkLimits(270, 15, INDI::Telescope::SCOPE_TRACKING, false), false);
// Test in quarters of horizon segments
ASSERT_EQ(hl->checkLimits(45, 15, INDI::Telescope::SCOPE_TRACKING, false), false);
ASSERT_EQ(hl->checkLimits(135, 15, INDI::Telescope::SCOPE_TRACKING, false), true);
ASSERT_EQ(hl->checkLimits(225, 15, INDI::Telescope::SCOPE_TRACKING, false), true);
ASSERT_EQ(hl->checkLimits(315, 15, INDI::Telescope::SCOPE_TRACKING, false), false);
ASSERT_TRUE(hl->ISNewSwitch(eqmod.getDeviceName(), "HORIZONLIMITSMANAGE", iss_on, (char**) manage_clear, 1));
}
#endif
int main(int argc, char **argv)
{
INDI::Logger::getInstance().configure("", INDI::Logger::file_off,
INDI::Logger::DBG_ERROR, INDI::Logger::DBG_ERROR);
::testing::InitGoogleTest(&argc, argv);
::testing::InitGoogleMock(&argc, argv);
me = strdup("indi_eqmod_driver");
return RUN_ALL_TESTS();
}
indi-eqmod-1.0+20220129131520/test/CMakeLists.txt 0000644 0001751 0001751 00000002272 14174600255 017727 0 ustar debian debian CMAKE_MINIMUM_REQUIRED (VERSION 3.0)
FIND_PACKAGE (GMock REQUIRED)
FIND_PACKAGE (Threads REQUIRED)
MESSAGE (STATUS "GTEST_BOTH_LIBRARIES ${GTEST_BOTH_LIBRARIES}")
MESSAGE (STATUS "GTEST_MAIN_LIBRARIES ${GTEST_MAIN_LIBRARIES}")
MESSAGE (STATUS "GTEST_LIBRARIES ${GTEST_LIBRARIES}")
MESSAGE (STATUS "GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIRS}")
MESSAGE (STATUS "GMOCK_LIBRARIES ${GMOCK_LIBRARIES}")
MESSAGE (STATUS "GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS}")
ENABLE_TESTING()
INCLUDE_DIRECTORIES ( ${GTEST_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES ( ${GMOCK_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES ( ${CMAKE_SOURCE_DIR} )
SET (test_eqmod_SRCS
test_eqmod.cpp ${eqmod_C_SRCS} ${eqmod_CXX_SRCS}
)
if (NOT MSVC)
set (PTHREAD_LIBRARIES -pthread)
endif()
ADD_EXECUTABLE(test_eqmod
${test_eqmod_SRCS}
)
if(WITH_ALIGN)
target_link_libraries(test_eqmod ${PTHREAD_LIBRARIES} ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARIES} ${INDI_LIBRARIES} ${NOVA_LIBRARIES} ${INDI_ALIGN_LIBRARIES} ${GSL_LIBRARIES} ${ZLIB_LIBRARY})
else(WITH_ALIGN)
target_link_libraries(test_eqmod ${PTHREAD_LIBRARIES} ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARIES} ${INDI_LIBRARIES} ${NOVA_LIBRARIES})
endif(WITH_ALIGN)
ADD_TEST(test_eqmod test_eqmod)
indi-eqmod-1.0+20220129131520/staradventurer2i.cpp 0000644 0001751 0001751 00000001567 14174600255 020226 0 ustar debian debian /*
Copyright(c) 2020 Jasem Mutlaq. All rights reserved.
AZ-GTi based on azgti
INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#include "staradventurer2i.h"
#include
static std::unique_ptr mount(new StarAdventurer2i());
indi-eqmod-1.0+20220129131520/azgtibase.cpp 0000644 0001751 0001751 00000002677 14174600255 016676 0 ustar debian debian /*******************************************************************************
Copyright(c) 2020 Jasem Mutlaq. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*******************************************************************************/
#include "azgtibase.h"
#include
AZGTIBase::AZGTIBase() : EQMod()
{
setTelescopeConnection(CONNECTION_TCP);
}
const char * AZGTIBase::getDefaultName()
{
return "AZ-GTi";
}
bool AZGTIBase::initProperties()
{
EQMod::initProperties();
tcpConnection->setDefaultHost("192.168.4.1");
tcpConnection->setDefaultPort(11880);
tcpConnection->setConnectionType(Connection::TCP::TYPE_UDP);
for (auto oneProperty : *getProperties())
{
oneProperty->setDeviceName(getDeviceName());
}
return true;
}
indi-eqmod-1.0+20220129131520/staradventurer2ibase.cpp 0000644 0001751 0001751 00000003424 14174600255 021053 0 ustar debian debian /*******************************************************************************
Copyright(c) 2020 Jasem Mutlaq. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*******************************************************************************/
#include "staradventurer2i.h"
#include
#include
StarAdventurer2i::StarAdventurer2i() : EQMod()
{
}
const char * StarAdventurer2i::getDefaultName()
{
return "Star Adventurer 2i";
}
bool StarAdventurer2i::initProperties()
{
EQMod::initProperties();
// For USB it should be
serialConnection->setDefaultBaudRate(Connection::Serial::B_115200);
tcpConnection->setDefaultHost("192.168.4.1");
tcpConnection->setDefaultPort(11880);
tcpConnection->setConnectionType(Connection::TCP::TYPE_UDP);
tcpConnection->setLANSearchEnabled(true);
if (strstr(getDeviceName(), "WiFi"))
setActiveConnection(tcpConnection);
else
setActiveConnection(serialConnection);
for (auto oneProperty : *getProperties())
{
oneProperty->setDeviceName(getDeviceName());
}
return true;
}
indi-eqmod-1.0+20220129131520/eqmoderror.h 0000644 0001751 0001751 00000002336 14174600255 016541 0 ustar debian debian /* Copyright 2012 Geehalel (geehalel AT gmail DOT com) */
/* This file is part of the Skywatcher Protocol INDI driver.
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#pragma once
#define ERROR_MSG_LENGTH 250
class EQMod;
class EQModError
{
public:
enum Severity
{
ErrDisconnect = 1,
ErrInvalidCmd,
ErrCmdFailed,
ErrInvalidParameter
} severity;
char message[ERROR_MSG_LENGTH];
EQModError(Severity sev, const char *msg, ...);
const char *severityString();
bool DefaultHandleException(EQMod *device);
};
indi-eqmod-1.0+20220129131520/INSTALL 0000644 0001751 0001751 00000002504 14174600255 015237 0 ustar debian debian SkyWatcher Protocol Driver INSTALL
==============
You must have CMake >= 2.4.7 in order to build this package.
1) $ tar -xzf indi-eqmod.tar.gz
2) $ mkdir indi-eqmod_build
3) $ cd indi-eqmod_build
4) $ cmake -DCMAKE_INSTALL_PREFIX=/usr . ../indi-eqmod
5) $ su -c 'make install' or sudo make install
Refer to README for instructions on using the driver.
CMake Compilation Options:
a) Logging: Debug messages may be logged into a file
with a different verbosity than the one used for client messages.
Log files names are /tmp/indi_eqmod_telescope_%TIMESTAMP%.log.
$ cmake -DCMAKE_INSTALL_PREFIX=/usr -DWITH_LOGGER:OPTION=TRUE . ../indi-eqmod
b) Simulator: included by default, can be suppressed if desired.
$ cmake -DCMAKE_INSTALL_PREFIX=/usr -DWITH_SIMULATOR:OPTION=FALSE . ../indi-eqmod
c) NOFMANY switches: it seems that some (of mine) versions
of Kstars do not support the display of NOFMANY switches, normal
switches are used by default.
$ cmake -DCMAKE_INSTALL_PREFIX=/usr -DWITH_NOFMANY:OPTION=TRUE . ../indi-eqmod
d) **SUPPRESSED** Stop motor when motion mode changes: always stop motor before changing
motion mode/speed. By default, the driver only emits commands for changing speed
when the motion mode is the same.
$ cmake -DCMAKE_INSTALL_PREFIX=/usr -DSTOP_WHEN_MOTION_CHANGED:OPTION=TRUE . ../indi-eqmod
That's it!
indi-eqmod-1.0+20220129131520/align/ 0000755 0001751 0001751 00000000000 14174600255 015277 5 ustar debian debian indi-eqmod-1.0+20220129131520/align/triangulate.cpp 0000644 0001751 0001751 00000004043 14174600255 020323 0 ustar debian debian /* Copyright 2013 Geehalel (geehalel AT gmail DOT com) */
/* This file is part of the Skywatcher Protocol INDI driver.
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#include "triangulate.h"
Triangulate::Triangulate(std::map *p)
{
pmap = p;
}
void Triangulate::Reset()
{
isvalid = false;
vvertices.clear();
vfaces.clear();
}
void Triangulate::AddPoint(HtmID id)
{
INDI_UNUSED(id);
isvalid = false;
}
XMLEle *Triangulate::toXML()
{
XMLEle *root;
std::vector::iterator it;
root = addXMLEle(nullptr, "triangulation");
for (it = vfaces.begin(); it != vfaces.end(); it++)
{
XMLEle *face;
XMLEle *vertex;
char pcdata[10];
face = addXMLEle(root, "face");
vertex = addXMLEle(face, "vindex");
snprintf(pcdata, sizeof(pcdata), "%d", pmap->at((*it)->v[0]).index);
editXMLEle(vertex, pcdata);
vertex = addXMLEle(face, "vindex");
snprintf(pcdata, sizeof(pcdata), "%d", pmap->at((*it)->v[1]).index);
editXMLEle(vertex, pcdata);
vertex = addXMLEle(face, "vindex");
snprintf(pcdata, sizeof(pcdata), "%d", pmap->at((*it)->v[2]).index);
editXMLEle(vertex, pcdata);
}
return (root);
}
std::vector Triangulate::getFaces()
{
isvalid = true;
return vfaces;
}
bool Triangulate::isValid()
{
return isvalid;
}
indi-eqmod-1.0+20220129131520/align/htm.c 0000644 0001751 0001751 00000030407 14174600255 016237 0 ustar debian debian /* This code is derived from the Hierarchical Triangular Mesh package found in
http://skyserver.org/htm/src/cpp/htmIndex.tar.gz
*/
#include "htm.h"
#include
#include
#include
/*
* cc_name2ID
* cc_isinside
* cc_startpane
* cc_parseVectors
* cc_vector2ID
* cc_radec2ID
* cc_ID2name
*/
double cc_Epsilon = 1.0E-15;
double cc_sqrt3 = 1.7320508075688772935;
uint64 cc_name2ID(const char *name);
double anchor[][3] = {
{ 0.0L, 0.0L, 1.0L }, // 0
{ 1.0L, 0.0L, 0.0L }, // 1
{ 0.0L, 1.0L, 0.0L }, // 2
{ -1.0L, 0.0L, 0.0L }, // 3
{ 0.0L, -1.0L, 0.0L }, // 4
{ 0.0L, 0.0L, -1.0L } // 5
};
struct _bases
{
char *name;
int ID;
int v1, v2, v3;
} bases[] = { { "S2", 10, 3, 5, 4 }, { "N1", 13, 4, 0, 3 }, { "S1", 9, 2, 5, 3 }, { "N2", 14, 3, 0, 2 },
{ "S3", 11, 4, 5, 1 }, { "N0", 12, 1, 0, 4 }, { "S0", 8, 1, 5, 2 }, { "N3", 15, 2, 0, 1 } };
int S_indexes[][3] = {
{ 1, 5, 2 }, //S0
{ 2, 5, 3 }, //S1
{ 3, 5, 4 }, //S2
{ 4, 5, 1 } //S3
};
int N_indexes[][3] = {
{ 1, 0, 4 }, //N0
{ 4, 0, 3 }, //N1
{ 3, 0, 2 }, //N2
{ 2, 0, 1 } //N3
};
// to save one indirection: int cc_sel[] = {10, 13, 9, 14, 11, 12, 8, 15};
int cc_isinside(double *p, double *v1, double *v2, double *v3);
static int cc_errcode;
int cc_startpane(double *v1, double *v2, double *v3, double xin, double yin, double zin, char *name)
{
int ix = (xin > 0 ? 4 : 0) + (yin > 0 ? 2 : 0) + (zin > 0 ? 1 : 0);
double *tvec;
char *s;
int baseID;
// printf("Startpane %f %f %f, (%d)\n", xin, yin, zin, ix);
baseID = bases[ix].ID;
tvec = anchor[bases[ix].v1];
v1[0] = tvec[0];
v1[1] = tvec[1];
v1[2] = tvec[2];
tvec = anchor[bases[ix].v2];
v2[0] = tvec[0];
v2[1] = tvec[1];
v2[2] = tvec[2];
tvec = anchor[bases[ix].v3];
v3[0] = tvec[0];
v3[1] = tvec[1];
v3[2] = tvec[2];
s = bases[ix].name;
name[0] = *s++;
name[1] = *s++;
name[2] = '\0';
return baseID;
}
int cc_parseVectors(char *spec, int *level, double *ra, double *dec)
{
char blank = ' ';
char *s = spec;
int scanned;
cc_errcode = 0;
// no token bs, we'll do it ourselves fast
// only deal with 'J2000 6 41.4 47.9' style for now
// States/Tokens: ^, J2000, whitespace (ws), int, ws, double, ws, double
// assume some leading whitespace. Only blanks for now
while (*s == blank)
s++;
if (*s++ != 'J')
{
cc_errcode = 1;
return cc_errcode;
}
if (*s++ != '2')
{
cc_errcode = 1;
return cc_errcode;
}
if (*s++ != '0')
{
cc_errcode = 1;
return cc_errcode;
}
if (*s++ != '0')
{
cc_errcode = 1;
return cc_errcode;
}
if (*s++ != '0')
{
cc_errcode = 1;
return cc_errcode;
}
while (*s == blank)
s++;
scanned = sscanf(s, "%d %lf %lf", level, ra, dec);
if (scanned != 3)
{
cc_errcode = 2;
return cc_errcode;
}
return cc_errcode;
}
uint64 cc_vector2ID(double x, double y, double z, int depth)
{
uint64 rstat = 0;
int startID;
char name[80];
int len = 0;
double v1[3], v2[3], v0[3];
double w1[3], w2[3], w0[3];
double p[3];
double dtmp;
p[0] = x;
p[1] = y;
p[2] = z;
//
// Get the ID of the level0 triangle, and its starting vertices
//
startID = cc_startpane(v0, v1, v2, x, y, z, name);
len = 2;
//
// Start searching for the children
///
while (depth-- > 0)
{
m4_midpoint(v0, v1, w2, dtmp);
m4_midpoint(v1, v2, w0, dtmp);
m4_midpoint(v2, v0, w1, dtmp);
/* prmag("v0", v0); */
/* prmag("v1", v1); */
/* prmag("v2", v2); */
/* prmag("w0", w0); */
/* prmag("w1", w1); */
/* prmag("w2", w2); */
/* prmag("The point", p); */
if (cc_isinside(p, v0, w2, w1))
{
name[len++] = '0';
copy_vec(v1, w2);
copy_vec(v2, w1);
}
else if (cc_isinside(p, v1, w0, w2))
{
name[len++] = '1';
copy_vec(v0, v1);
copy_vec(v1, w0);
copy_vec(v2, w2);
}
else if (cc_isinside(p, v2, w1, w0))
{
name[len++] = '2';
copy_vec(v0, v2);
copy_vec(v1, w1);
copy_vec(v2, w0);
}
else if (cc_isinside(p, w0, w1, w2))
{
name[len++] = '3';
copy_vec(v0, w0);
copy_vec(v1, w1);
copy_vec(v2, w2);
}
else
{
fprintf(stderr, "PANIC\n");
}
}
name[len] = '\0';
rstat = cc_name2ID(name);
return rstat;
}
uint64 cc_radec2ID(double ra, double dec, int depth)
{
uint64 rstat = 0;
int startID;
double x, y, z;
char name[80];
int len = 0;
double v1[3], v2[3], v0[3];
double w1[3], w2[3], w0[3];
double p[3];
double cd = cos(dec * cc_Pr);
double dtmp;
p[0] = x = cos(ra * cc_Pr) * cd;
p[1] = y = sin(ra * cc_Pr) * cd;
p[2] = z = sin(dec * cc_Pr);
//
// Get the ID of the level0 triangle, and its starting vertices
//
startID = cc_startpane(v0, v1, v2, x, y, z, name);
len = 2;
//
// Start searching for the children
///
while (depth-- > 0)
{
m4_midpoint(v0, v1, w2, dtmp);
m4_midpoint(v1, v2, w0, dtmp);
m4_midpoint(v2, v0, w1, dtmp);
if (cc_isinside(p, v0, w2, w1))
{
name[len++] = '0';
copy_vec(v1, w2);
copy_vec(v2, w1);
}
else if (cc_isinside(p, v1, w0, w2))
{
name[len++] = '1';
copy_vec(v0, v1);
copy_vec(v1, w0);
copy_vec(v2, w2);
}
else if (cc_isinside(p, v2, w1, w0))
{
name[len++] = '2';
copy_vec(v0, v2);
copy_vec(v1, w1);
copy_vec(v2, w0);
}
else if (cc_isinside(p, w0, w1, w2))
{
name[len++] = '3';
copy_vec(v0, w0);
copy_vec(v1, w1);
copy_vec(v2, w2);
}
}
name[len] = '\0';
rstat = cc_name2ID(name);
return rstat;
}
// typedef longlong uint64;
uint64 idByPoint(double x, double y, double z)
{
(void)x;
(void)y;
(void)z;
return 0;
}
int cc_isinside(double *p, double *v1, double *v2, double *v3) // p need not be nromalilzed!!!
{
double crossp[3];
// if (v1 X v2) . p < epsilon then false
// same for v2 X v3 and v3 X v1.
// else return true..
crossp[0] = v1[1] * v2[2] - v2[1] * v1[2];
crossp[1] = v1[2] * v2[0] - v2[2] * v1[0];
crossp[2] = v1[0] * v2[1] - v2[0] * v1[1];
if (p[0] * crossp[0] + p[1] * crossp[1] + p[2] * crossp[2] < -gEpsilon)
return 0;
crossp[0] = v2[1] * v3[2] - v3[1] * v2[2];
crossp[1] = v2[2] * v3[0] - v3[2] * v2[0];
crossp[2] = v2[0] * v3[1] - v3[0] * v2[1];
if (p[0] * crossp[0] + p[1] * crossp[1] + p[2] * crossp[2] < -gEpsilon)
return 0;
crossp[0] = v3[1] * v1[2] - v1[1] * v3[2];
crossp[1] = v3[2] * v1[0] - v1[2] * v3[0];
crossp[2] = v3[0] * v1[1] - v1[0] * v3[1];
if (p[0] * crossp[0] + p[1] * crossp[1] + p[2] * crossp[2] < -gEpsilon)
return 0;
return 1;
}
#ifdef NEVER
void SpatialVector::updateRaDec()
{
dec_ = asin(z_) / gPr; // easy.
float64 cd = cos(dec_ * gPr);
if (cd > gEpsilon || cd < -gEpsilon)
if (y_ > gEpsilon || y_ < -gEpsilon)
if (y_ < 0.0)
ra_ = 360 - acos(x_ / cd) / gPr;
else
ra_ = acos(x_ / cd) / gPr;
else
ra_ = (x_ < 0.0 ? 180.0 : 0.0);
else
ra_ = 0.0;
okRaDec_ = true;
}
#endif
uint64 cc_name2ID(const char *name)
{
uint64 out = 0, i;
size_t siz = 0;
if (name == 0) // null pointer-name
return 0;
if (name[0] != 'N' && name[0] != 'S') // invalid name
return 0;
siz = strlen(name); // determine string length
// at least size-2 required, don't exceed max
if (siz < 2)
return 0;
if (siz > HTMNAMEMAX)
return 0;
for (i = siz - 1; i > 0; i--)
{ // set bits starting from the end
if (name[i] > '3' || name[i] < '0')
{ // invalid name
return 0;
}
out += ((uint64)(name[i] - '0')) << 2 * (siz - i - 1);
}
i = 2; // set first pair of bits, first bit always set
if (name[0] == 'N')
i++; // for north set second bit too
out += (i << (2 * siz - 2));
/************************
// This code may be used later for hashing !
if(size==2)out -= 8;
else {
size -= 2;
uint32 offset = 0, level4 = 8;
for(i = size; i > 0; i--) { // calculate 4 ^ (level-1), level = size-2
offset += level4;
level4 *= 4;
}
out -= level4 - offset;
}
**************************/
return out;
}
#define HTM_INVALID_ID 1
/*
* cc_IDlevel is a trusting method (assumes that the id is well formed and
* valid) that returns the level of the trixel represented by the given
* htm id
*/
int cc_IDlevel(uint64 htmid)
{
uint32 size = 0, i;
#if defined(_WIN32)
uint64 IDHIGHBIT = 1;
uint64 IDHIGHBIT2 = 1;
IDHIGHBIT = IDHIGHBIT << 63;
IDHIGHBIT2 = IDHIGHBIT2 << 62;
#endif
// determine index of first set bit
for (i = 0; i < IDSIZE; i += 2)
{
if ((htmid << i) & IDHIGHBIT)
break;
/*
if ( (id << i) & IDHIGHBIT2 ) // invalid id
return HTM_INVALID_ID;
// but we trust you now...
*/
}
/* if(id == 0) */
/* return HTM_INVALID_ID; */
size = (IDSIZE - i) >> 1;
/* Size is the length of the string representing the name of the
trixel, the level is size - 2
*/
return size - 2;
}
int cc_ID2name(char *name, uint64 id)
{
uint32 size = 0, i;
int c; // a spare character;
#if defined(_WIN32)
uint64 IDHIGHBIT = 1;
uint64 IDHIGHBIT2 = 1;
IDHIGHBIT = IDHIGHBIT << 63;
IDHIGHBIT2 = IDHIGHBIT2 << 62;
#endif
// determine index of first set bit
for (i = 0; i < IDSIZE; i += 2)
{
if ((id << i) & IDHIGHBIT)
break;
if ((id << i) & IDHIGHBIT2) // invalid id
return HTM_INVALID_ID;
}
if (id == 0)
return HTM_INVALID_ID;
size = (IDSIZE - i) >> 1;
// fill characters starting with the last one
for (i = 0; i < size - 1; i++)
{
c = '0' + (int)((id >> i * 2) & (uint32)3);
name[size - i - 1] = (char)c;
}
// put in first character
if ((id >> (size * 2 - 2)) & 1)
{
name[0] = 'N';
}
else
{
name[0] = 'S';
}
name[size] = 0; // end string
return 0;
}
int cc_name2Triangle(char *name, double *v0, double *v1, double *v2)
{
int rstat = 0;
char *s;
double w1[3], w2[3], w0[3];
double dtmp;
//
// Get the top level hemi-demi-semi space
//
int k;
int anchor_offsets[3];
k = (int)name[1] - '0';
if (name[0] == 'S')
{
anchor_offsets[0] = S_indexes[k][0];
anchor_offsets[1] = S_indexes[k][1];
anchor_offsets[2] = S_indexes[k][2];
}
else
{
anchor_offsets[0] = N_indexes[k][0];
anchor_offsets[1] = N_indexes[k][1];
anchor_offsets[2] = N_indexes[k][2];
}
s = name + 2;
copy_vec(v0, anchor[anchor_offsets[0]]);
copy_vec(v1, anchor[anchor_offsets[1]]);
copy_vec(v2, anchor[anchor_offsets[2]]);
while (*s)
{
m4_midpoint(v0, v1, w2, dtmp);
m4_midpoint(v1, v2, w0, dtmp);
m4_midpoint(v2, v0, w1, dtmp);
switch (*s)
{
case '0':
copy_vec(v1, w2);
copy_vec(v2, w1);
break;
case '1':
copy_vec(v0, v1);
copy_vec(v1, w0);
copy_vec(v2, w2);
break;
case '2':
copy_vec(v0, v2);
copy_vec(v1, w1);
copy_vec(v2, w0);
break;
case '3':
copy_vec(v0, w0);
copy_vec(v1, w1);
copy_vec(v2, w2);
break;
}
s++;
}
return rstat;
}
indi-eqmod-1.0+20220129131520/align/indi_align_sk.xml 0000644 0001751 0001751 00000005662 14174600255 020624 0 ustar debian debian
~/.indi/AlignData.xml
0.0
0.0
Off
On
Off
0.0
0.0
Off
Off
Off
Off
0.0
0.0
0.0
0.0
0.0
0.0
indi-eqmod-1.0+20220129131520/align/align.cpp 0000644 0001751 0001751 00000075023 14174600255 017104 0 ustar debian debian /* Copyright 2012 Geehalel (geehalel AT gmail DOT com) */
/* This file is part of the Skywatcher Protocol INDI driver.
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#include "align.h"
#include "../eqmodbase.h"
#include
#include
#include
#include
using namespace INDI;
#define MATRIX_LOG(name, in) \
IDLog("Matrix %s:\n%g %g %g\n%g %g %g\n%g %g %g\n", name, in[0][0], in[0][1], in[0][2], in[1][0], in[1][1], \
in[1][2], in[2][0], in[2][1], in[2][2])
void inverse_matrix_3x3(double in[3][3], double out[3][3])
{
double det;
double a, b, c, d, e, f, g, h, i;
a = in[0][0];
b = in[0][1];
c = in[0][2];
d = in[1][0];
e = in[1][1];
f = in[1][2];
g = in[2][0];
h = in[2][1];
i = in[2][2];
det = (a * e * i) + (b * f * g) + (c * d * h) - (c * e * g) - (f * h * a) - (i * b * d);
/* if (abs(det) < 0.000001) {
IDLog("Align: Matrix determinant is lower than 0.000001 (%g)\n", det);
det=0.000001;
}*/
out[0][0] = (e * i - f * h) / det;
out[0][1] = (c * h - b * i) / det;
out[0][2] = (b * f - c * e) / det;
out[1][0] = (f * g - d * i) / det;
out[1][1] = (a * i - c * g) / det;
out[1][2] = (c * d - a * f) / det;
out[2][0] = (d * h - e * g) / det;
out[2][1] = (b * g - a * h) / det;
out[2][2] = (a * e - b * d) / det;
}
void mult_matrix_3x3(double in1[3][3], double in2[3][3], double out[3][3])
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
out[i][j] = 0.0;
for (int k = 0; k < 3; k++)
out[i][j] += in1[i][k] * in2[k][j];
}
}
}
// We declare an auto pointer to Align.
//std::unique_ptr align(0);
Align::Align(INDI::Telescope *t)
{
telescope = t;
pointset = new PointSet(t);
currentdeltaRA = 0.0;
currentdeltaDEC = 0.0;
lastnearestindex = -1;
AlignDataFileTP = nullptr;
AlignDataBP = nullptr;
AlignPointNP = nullptr;
AlignListSP = nullptr;
AlignModeSP = nullptr;
AlignTelescopeCoordsNP = nullptr;
AlignCountNP = nullptr;
}
Align::~Align()
{
delete (pointset);
}
const char *Align::getDeviceName()
{
return telescope->getDeviceName();
}
void Align::Init()
{
char *loadres = nullptr;
if (!pointset->isInitialized())
{
pointset->Init();
loadres = pointset->LoadDataFile(IUFindText(AlignDataFileTP, "ALIGNDATAFILENAME")->text);
if (loadres)
{
IDMessage(telescope->getDeviceName(), "Can not load Align Data File %s: %s",
IUFindText(AlignDataFileTP, "ALIGNDATAFILENAME")->text, loadres);
return;
}
IUFindNumber(AlignCountNP, "ALIGNCOUNT_POINTS")->value = pointset->getNbPoints();
IUFindNumber(AlignCountNP, "ALIGNCOUNT_TRIANGLES")->value = pointset->getNbTriangles();
IDSetNumber(AlignCountNP, nullptr);
}
}
void Align::ISGetProperties()
{
if (telescope->isConnected())
{
telescope->defineProperty(AlignDataFileTP);
telescope->defineProperty(AlignDataBP);
telescope->defineProperty(AlignPointNP);
telescope->defineProperty(AlignListSP);
telescope->defineProperty(AlignTelescopeCoordsNP);
telescope->defineProperty(AlignCountNP);
telescope->defineProperty(AlignModeSP);
}
}
bool Align::initProperties()
{
/* Load properties from the skeleton file */
telescope->buildSkeleton("indi_align_sk.xml");
AlignDataFileTP = telescope->getText("ALIGNDATAFILE");
AlignDataBP = telescope->getBLOB("ALIGNDATA");
AlignPointNP = telescope->getNumber("ALIGNPOINT");
AlignListSP = telescope->getSwitch("ALIGNLIST");
AlignModeSP = telescope->getSwitch("ALIGNMODE");
AlignTelescopeCoordsNP = telescope->getNumber("ALIGNTELESCOPECOORDS");
AlignCountNP = telescope->getNumber("ALIGNCOUNT");
return true;
}
bool Align::updateProperties()
{
/*IDLog("Align update properties connected = %d.\n",(telescope->isConnected()?1:0) ); */
if (telescope->isConnected())
{
telescope->defineProperty(AlignDataFileTP);
telescope->defineProperty(AlignDataBP);
telescope->defineProperty(AlignPointNP);
telescope->defineProperty(AlignListSP);
telescope->defineProperty(AlignTelescopeCoordsNP);
telescope->defineProperty(AlignCountNP);
telescope->defineProperty(AlignModeSP);
Init();
}
else if (AlignDataBP)
{
telescope->deleteProperty(AlignDataBP->name);
telescope->deleteProperty(AlignPointNP->name);
telescope->deleteProperty(AlignListSP->name);
telescope->deleteProperty(AlignTelescopeCoordsNP->name);
telescope->deleteProperty(AlignCountNP->name);
telescope->deleteProperty(AlignModeSP->name);
telescope->deleteProperty(AlignDataFileTP->name);
}
return true;
}
void Align::AlignNStar(double jd, IGeographicCoordinates *position, double currentRA, double currentDEC,
double *alignedRA, double *alignedDEC, bool ingoto)
{
//double pointaz = (pointset->range24(lst - currentRA - 12.0) * 360.0) / 24.0;
//double pointalt = currentDEC + pointset->lat;
double pointaz, pointalt;
//std::set *sortedpoints;
pointset->AltAzFromRaDec(currentRA, currentDEC, jd, &pointalt, &pointaz, position);
//sortedpoints=pointset->ComputeDistances(pointalt, pointaz, PointSet::None, ingoto);
std::vector face;
face = pointset->findFace(currentRA, currentDEC, jd, pointalt, pointaz, position, ingoto);
//if (sortedpoints->size() < 2) {
if (face.size() < 3)
{
//IDLog("AlignNstar: only %d points in set - using Nearest mode\n", sortedpoints->size());
AlignNearest(jd, position, currentRA, currentDEC, alignedRA, alignedDEC, ingoto);
}
else
{
/* Taki's Algorithm (p33): http://www.geocities.jp/toshimi_taki/matrix/matrix_method_rev_e.pdf */
//std::set::iterator it = sortedpoints->begin();
//PointSet::Point *point = pointset->getPoint(it->htmID);
std::vector::iterator it = face.begin();
PointSet::Point *point = pointset->getPoint(*it);
double celestialMatrix[3][3];
double invcelestialMatrix[3][3];
double telescopeMatrix[3][3];
double T[3][3];
double invT[3][3];
double l, m, n;
double L, M, N;
//int max=(sortedpoints->size() == 2)?2:3;
int max = 3;
for (int i = 0; i < max; i++)
{
//IDLog("Align NStar: align point %d htm = %s, telescope alt=%g az=%g\n", i, point->htmname, point->telescopeALT, point->telescopeAZ);
celestialMatrix[0][i] =
cos(point->aligndata.targetDEC * M_PI / 180.0) *
cos(((range24(point->aligndata.targetRA - point->aligndata.lst) * 360) / 24.0) * M_PI /
180.0);
celestialMatrix[1][i] =
cos(point->aligndata.targetDEC * M_PI / 180.0) *
sin(((range24(point->aligndata.targetRA - point->aligndata.lst) * 360) / 24.0) * M_PI /
180.0);
celestialMatrix[2][i] = sin(point->aligndata.targetDEC * M_PI / 180.0);
/*
telescopeMatrix[0][i]=cos(point->aligndata.telescopeDEC * M_PI / 180.0) *
cos(((pointset->range24(point->aligndata.telescopeRA - point->aligndata.lst) * 360) / 24.0) * M_PI / 180.0);
telescopeMatrix[1][i]=cos(point->aligndata.telescopeDEC * M_PI / 180.0) *
sin(((pointset->range24(point->aligndata.telescopeRA - point->aligndata.lst) * 360) / 24.0) * M_PI / 180.0);
telescopeMatrix[2][i]=sin(point->aligndata.telescopeDEC * M_PI / 180.0);
*/
/*
celestialMatrix[0][i]=cos(point->celestialALT * M_PI / 180.0) *
cos(point->celestialAZ * M_PI / 180.0);
celestialMatrix[1][i]=cos(point->celestialALT * M_PI / 180.0) *
sin(point->celestialAZ * M_PI / 180.0);
celestialMatrix[2][i]=sin(point->celestialALT * M_PI / 180.0);
*/
telescopeMatrix[0][i] = cos(point->telescopeALT * M_PI / 180.0) *
cos(range360(-180.0 - point->telescopeAZ) * M_PI / 180.0);
telescopeMatrix[1][i] = cos(point->telescopeALT * M_PI / 180.0) *
sin(range360(-180.0 - point->telescopeAZ) * M_PI / 180.0);
telescopeMatrix[2][i] = sin(point->telescopeALT * M_PI / 180.0);
it++;
//point = pointset->getPoint(it->htmID);
point = pointset->getPoint(*it);
}
//if (sortedpoints->size() == 2) {
if (face.size() == 2)
{
/* compute vector product of the two points */
/* and insert it in the set */
double norm = 1.0;
celestialMatrix[0][2] =
celestialMatrix[1][0] * celestialMatrix[2][1] - celestialMatrix[2][0] * celestialMatrix[1][1];
celestialMatrix[1][2] =
celestialMatrix[2][0] * celestialMatrix[0][1] - celestialMatrix[0][0] * celestialMatrix[2][1];
celestialMatrix[2][2] =
celestialMatrix[0][0] * celestialMatrix[1][1] - celestialMatrix[1][0] * celestialMatrix[0][1];
norm = sqrt(celestialMatrix[0][2] * celestialMatrix[0][2] + celestialMatrix[1][2] * celestialMatrix[1][2] +
celestialMatrix[2][2] * celestialMatrix[2][2]);
celestialMatrix[0][2] = celestialMatrix[0][2] / norm;
celestialMatrix[1][2] = celestialMatrix[1][2] / norm;
celestialMatrix[2][2] = celestialMatrix[2][2] / norm;
telescopeMatrix[0][2] =
telescopeMatrix[1][0] * telescopeMatrix[2][1] - telescopeMatrix[2][0] * telescopeMatrix[1][1];
telescopeMatrix[1][2] =
telescopeMatrix[2][0] * telescopeMatrix[0][1] - telescopeMatrix[0][0] * telescopeMatrix[2][1];
telescopeMatrix[2][2] =
telescopeMatrix[0][0] * telescopeMatrix[1][1] - telescopeMatrix[1][0] * telescopeMatrix[0][1];
norm = sqrt(telescopeMatrix[0][2] * telescopeMatrix[0][2] + telescopeMatrix[1][2] * telescopeMatrix[1][2] +
telescopeMatrix[2][2] * telescopeMatrix[2][2]);
telescopeMatrix[0][2] = telescopeMatrix[0][2] / norm;
telescopeMatrix[1][2] = telescopeMatrix[1][2] / norm;
telescopeMatrix[2][2] = telescopeMatrix[2][2] / norm;
}
//MATRIX_LOG("celestialMatrix", celestialMatrix);
//MATRIX_LOG("telescopeMatrix", telescopeMatrix);
inverse_matrix_3x3(celestialMatrix, invcelestialMatrix);
//MATRIX_LOG("invcelestialMatrix", invcelestialMatrix);
mult_matrix_3x3(telescopeMatrix, invcelestialMatrix, T);
inverse_matrix_3x3(T, invT);
//MATRIX_LOG("T", T);
//MATRIX_LOG("invT", invT);
if (!(ingoto))
{
double lst = 0;
lst = ln_get_apparent_sidereal_time(jd);
lst += (position->longitude / 15.0);
lst = range24(lst);
/*
l = cos(currentDEC * M_PI / 180.0) * cos(((pointset->range24(currentRA - lst) * 360) / 24.0) * M_PI / 180.0);
m = cos(currentDEC * M_PI / 180.0) * sin(((pointset->range24(currentRA - lst) * 360) / 24.0) * M_PI / 180.0);
n = sin(currentDEC * M_PI / 180.0);
*/
l = cos(pointalt * M_PI / 180.0) * cos(range360(-180.0 - pointaz) * M_PI / 180.0);
m = cos(pointalt * M_PI / 180.0) * sin(range360(-180.0 - pointaz) * M_PI / 180.0);
n = sin(pointalt * M_PI / 180.0);
L = invT[0][0] * l + invT[0][1] * m + invT[0][2] * n;
M = invT[1][0] * l + invT[1][1] * m + invT[1][2] * n;
N = invT[2][0] * l + invT[2][1] * m + invT[2][2] * n;
*alignedRA = atan(M / L) * 12.0 / M_PI;
//IDLog("Aligning RA = %g L=%g at LST = %g (point alt = %g az = %g)\n", *alignedRA, L, lst, pointalt, pointaz);
if (L < 0.0)
*alignedRA += 12.0;
//IDLog("Aligning RA = %g at LST = %g\n", *alignedRA, lst);
*alignedRA = range24(*alignedRA + lst);
//if (L < 0) *alignedRA += 12.0;
//if (*alignedRA < 0) *alignedRA = 24.0 + *alignedRA;
*alignedDEC = asin(N) * 180.0 / M_PI;
/*
alignedaz = atan(M/L) * 180.0 / M_PI;
//if (L < 0) alignedaz += 180.0;
//if (alignedaz < 0) alignedaz = 360.0 + alignedaz;
alignedaz = pointset->range360(-180.0 - alignedaz);
alignedalt = asin(N) * 180.0 / M_PI;
pointset->RaDecFromAltAz(alignedalt, alignedaz, jd, alignedRA, alignedDEC, position);
*/
}
else
{
double alignedalt, alignedaz;
double lst;
lst = ln_get_apparent_sidereal_time(jd);
lst += (position->longitude / 15.0);
lst = range24(lst);
L = cos(currentDEC * M_PI / 180.0) *
cos(((range24(currentRA - lst) * 360) / 24.0) * M_PI / 180.0);
M = cos(currentDEC * M_PI / 180.0) *
sin(((range24(currentRA - lst) * 360) / 24.0) * M_PI / 180.0);
N = sin(currentDEC * M_PI / 180.0);
// LMN should be RA/DEC relative to lst=0
//L = cos(pointalt * M_PI / 180.0) * cos(pointset->range360(-180.0 - pointaz) * M_PI / 180.0);
//M = cos(pointalt * M_PI / 180.0) * sin(pointset->range360(-180.0 - pointaz) * M_PI / 180.0);
//N = sin(pointalt * M_PI / 180.0);
//MATRIX_LOG("celestialMatrix", celestialMatrix);
//MATRIX_LOG("telescopeMatrix", telescopeMatrix);
//MATRIX_LOG("T", T);
//MATRIX_LOG("invT", invT);
l = T[0][0] * L + T[0][1] * M + T[0][2] * N;
m = T[1][0] * L + T[1][1] * M + T[1][2] * N;
n = T[2][0] * L + T[2][1] * M + T[2][2] * N;
/*
*alignedRA = atan(m/l) * 12.0 / M_PI;
if (l < 0) *alignedRA += 12.0;
if (*alignedRA < 0) *alignedRA = 24.0 + *alignedRA;
*alignedDEC = asin(n) * 180.0 / M_PI;
*/
alignedaz = atan(m / l) * 180.0 / M_PI;
if (l < 0)
alignedaz += 180.0;
// Eq 4-13 and 4-14 from Taki page 11
// when l >= 0 1st or 4th quadrant
// when l < 0 2nd or 3rd quadrant
// atan returns values between -M_PI / 2 and M_PI / 2
//IDLog("L %f M %F N %f l %f m %f n %f, Taki alignedaz %f\n", L, M, N, l, m, n, alignedaz);
//From Taki to kstars azimuth
alignedaz = range360(-180.0 - alignedaz);
alignedalt = asin(n) * 180.0 / M_PI;
pointset->RaDecFromAltAz(alignedalt, alignedaz, jd, alignedRA, alignedDEC, position);
currentdeltaRA = *alignedRA - currentRA;
currentdeltaDEC = *alignedDEC - currentDEC;
LOGF_INFO("GOTO ALign NStar: delta RA = %f, delta DEC = %f alt=%f az=%f",
currentdeltaRA, currentdeltaDEC, alignedalt, alignedaz);
}
//IDLog("ALign NStar: delta RA = %f, delta DEC = %f\n", (*alignedRA - currentRA), (*alignedDEC - currentDEC));
}
}
void Align::AlignNearest(double jd, INDI::IGeographicCoordinates *position, double currentRA, double currentDEC,
double *alignedRA, double *alignedDEC, bool ingoto)
{
//double pointaz = (pointset->range24(lst - currentRA - 12.0) * 360.0) / 24.0;
//double pointalt = currentDEC + pointset->lat;
double pointaz, pointalt;
std::set *sortedpoints;
pointset->AltAzFromRaDec(currentRA, currentDEC, jd, &pointalt, &pointaz, position);
sortedpoints = pointset->ComputeDistances(pointalt, pointaz, PointSet::None, ingoto);
if (sortedpoints->empty())
{
*alignedRA = currentRA;
*alignedDEC = currentDEC;
//IDLog("AlignNearest: empty set\n");
}
else
{
PointSet::Point *point = pointset->getPoint(sortedpoints->begin()->htmID);
if (lastnearestindex != point->index)
LOGF_INFO("Align: current point is %d\n", point->index);
lastnearestindex = point->index;
*alignedRA = currentRA;
*alignedDEC = currentDEC;
if (!(ingoto))
{
*alignedRA += (point->aligndata.targetRA - point->aligndata.telescopeRA);
*alignedDEC += (point->aligndata.targetDEC - point->aligndata.telescopeDEC);
}
else
{
*alignedRA -= (point->aligndata.targetRA - point->aligndata.telescopeRA);
*alignedDEC -= (point->aligndata.targetDEC - point->aligndata.telescopeDEC);
currentdeltaRA = *alignedRA - currentRA;
currentdeltaDEC = *alignedDEC - currentDEC;
LOGF_INFO("GOTO ALign Nearest: delta RA = %f, delta DEC = %f", currentdeltaRA,
currentdeltaDEC);
}
//IDLog("ALign Nearest: align point %s telescope alt = %f, az =%f\n", point->htmname, point->telescopeALT, point->telescopeAZ);
//IDLog("ALign Nearest: delta RA = %c %f, delta DEC = %c %f\n", (ingoto?'-':'+'), (point->aligndata.targetRA - point->aligndata.telescopeRA),
// (ingoto?'-':'+'), (point->aligndata.targetDEC - point->aligndata.telescopeDEC));
}
}
void Align::AlignGoto(SyncData globalsync, double jd, INDI::IGeographicCoordinates *position, double *gotoRA,
double *gotoDEC)
{
//ISwitch *aligngotosw;
//aligngotosw=IUFindSwitch(AlignOptionsSP,"ALIGNONGOTO");
//if (aligngotosw->s == ISS_ON) {
switch (GetAlignmentMode())
{
case SYNCS:
currentdeltaRA = -(syncdata.targetRA - syncdata.telescopeRA);
currentdeltaDEC = -(syncdata.targetDEC - syncdata.telescopeDEC);
*gotoRA -= (syncdata.targetRA - syncdata.telescopeRA) + globalsync.deltaRA;
*gotoDEC -= (syncdata.targetDEC - syncdata.telescopeDEC) + globalsync.deltaDEC;
LOGF_INFO("GOTO ALign: delta RA = %f, delta DEC = %f", currentdeltaRA,
currentdeltaDEC);
break;
case NEAREST:
AlignNearest(jd, position, *gotoRA - globalsync.deltaRA, *gotoDEC - globalsync.deltaDEC, gotoRA, gotoDEC,
true);
break;
case NSTAR:
AlignNStar(jd, position, *gotoRA - globalsync.deltaRA, *gotoDEC - globalsync.deltaDEC, gotoRA, gotoDEC,
true);
break;
case NONE:
currentdeltaRA = 0.0;
currentdeltaDEC = 0.0;
*gotoRA -= globalsync.deltaRA;
*gotoDEC -= globalsync.deltaDEC;
default:
break;
}
//}
}
void Align::AlignSync(SyncData globalsync, SyncData thissync)
{
INDI_UNUSED(globalsync);
double values[6] = { thissync.lst, thissync.jd, thissync.targetRA,
thissync.targetDEC, thissync.telescopeRA, thissync.telescopeDEC
};
const char *names[6] = { "ALIGNPOINT_SYNCTIME", "ALIGNPOINT_JD", "ALIGNPOINT_CELESTIAL_RA",
"ALIGNPOINT_CELESTIAL_DE", "ALIGNPOINT_TELESCOPE_RA", "ALIGNPOINT_TELESCOPE_DE"
};
/*syncdata.lst = lst; syncdata.jd = jd;
syncdata.targetRA = targetRA; syncdata.targetDEC = targetDEC;
syncdata.telescopeRA = telescopeRA; syncdata.telescopeDEC = telescopeDEC;
IDLog("AlignSync \n");
*/
// add point on sync
//alignsyncsw=IUFindSwitch(AlignOptionsSP,"ADDONSYNC");
//if (alignsyncsw->s == ISS_ON) {
syncdata.lst = thissync.lst;
syncdata.jd = thissync.jd;
syncdata.targetRA = thissync.targetRA;
syncdata.targetDEC = thissync.targetDEC;
syncdata.telescopeRA = thissync.telescopeRA;
syncdata.telescopeDEC = thissync.telescopeDEC;
pointset->AddPoint(syncdata, nullptr);
DEBUGF(INDI::Logger::DBG_SESSION,
"Align Sync: point added: lst=%.8f celestial RA %.8f DEC %.8f Telescope RA %.8f DEC %.8f", syncdata.lst,
syncdata.targetRA, syncdata.targetDEC, syncdata.telescopeRA, syncdata.telescopeDEC);
//IDLog(" Add Align point: %.8f %.8f %.8f %.8f %.8f\n", syncdata.lst, syncdata.targetRA, syncdata.targetDEC, syncdata.telescopeRA, syncdata.telescopeDEC);
pointset->setBlobData(AlignDataBP);
// JM 2015-12-10: Disable setting AlignData temporary
//IDSetBLOB(AlignDataBP, nullptr);
IUUpdateNumber(AlignPointNP, values, (char **)names, 6);
IDSetNumber(AlignPointNP, nullptr);
IUFindNumber(AlignCountNP, "ALIGNCOUNT_POINTS")->value = pointset->getNbPoints();
IUFindNumber(AlignCountNP, "ALIGNCOUNT_TRIANGLES")->value = pointset->getNbTriangles();
IDSetNumber(AlignCountNP, nullptr);
}
void Align::AlignStandardSync(SyncData globalsync, SyncData *thissync, IGeographicCoordinates *position)
{
double sra, sdec;
GetAlignedCoords(globalsync, thissync->jd, position, thissync->telescopeRA, thissync->telescopeDEC, &sra, &sdec);
thissync->telescopeRA = sra - globalsync.deltaRA;
thissync->telescopeDEC = sdec - globalsync.deltaDEC;
//thissync->targetRA -= globalsync.deltaRA;
//thissync->targetDEC -= globalsync.deltaDEC;
thissync->deltaRA = thissync->targetRA - thissync->telescopeRA;
thissync->deltaDEC = thissync->targetDEC - thissync->telescopeDEC;
//LOGF_INFO("Mount Synced (deltaRA = %.6f deltaDEC = %.6f)", thissync->deltaRA, thissync->deltaDEC);
}
Align::AlignmentMode Align::GetAlignmentMode()
{
ISwitch *sw;
sw = IUFindOnSwitch(AlignModeSP);
if (!sw)
return NONE;
if (!strcmp(sw->name, "NOALIGN"))
{
return NONE;
;
//return SYNCS;;
}
else if (!strcmp(sw->name, "ALIGNSYNC"))
{
return SYNCS;
}
else if (!strcmp(sw->name, "ALIGNNEAREST"))
{
return NEAREST;
}
else if (!strcmp(sw->name, "ALIGNNSTAR"))
{
return NSTAR;
}
else
return NONE;
}
void Align::GetAlignedCoords(SyncData globalsync, double jd, INDI::IGeographicCoordinates *position, double currentRA,
double currentDEC, double *alignedRA, double *alignedDEC)
{
//double values[2] = {currentRA + globalsync.deltaRA, currentDEC + globalsync.deltaDEC };
double values[2] = { currentRA, currentDEC };
const char *names[2] = { "ALIGNTELESCOPE_RA", "ALIGNTELESCOPE_DE" };
IUUpdateNumber(AlignTelescopeCoordsNP, values, (char **)names, 2);
IDSetNumber(AlignTelescopeCoordsNP, nullptr);
switch (GetAlignmentMode())
{
case NSTAR:
AlignNStar(jd, position, currentRA + globalsync.deltaRA, currentDEC + globalsync.deltaDEC, alignedRA,
alignedDEC, false);
break;
case NEAREST:
AlignNearest(jd, position, currentRA + globalsync.deltaRA, currentDEC + globalsync.deltaDEC, alignedRA,
alignedDEC, false);
break;
case SYNCS:
*alignedRA = currentRA + globalsync.deltaRA;
*alignedDEC = currentDEC + globalsync.deltaDEC;
//if (syncdata.lst != 0.0) {
// *alignedRA += (syncdata.targetRA - syncdata.telescopeRA);
// *alignedDEC += (syncdata.targetDEC - syncdata.telescopeDEC);
//}
break;
case NONE:
*alignedRA = currentRA + globalsync.deltaRA;
*alignedDEC = currentDEC + globalsync.deltaDEC;
break;
default:
*alignedRA = currentRA + globalsync.deltaRA;
*alignedDEC = currentDEC + globalsync.deltaDEC;
break;
}
}
bool Align::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
{
// first check if it's for our device
if (strcmp(dev, telescope->getDeviceName()) == 0)
{
if (AlignPointNP && strcmp(name, AlignPointNP->name) == 0)
{
AlignPointNP->s = IPS_OK;
IUUpdateNumber(AlignPointNP, values, names, n);
IDSetNumber(AlignPointNP, nullptr);
return true;
}
}
return false;
}
bool Align::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
{
/*
IDLog("Align: Enter IsNewSwitch for %s\n",name);
for(int x=0; xgetDeviceName()) == 0)
{
if (AlignModeSP && strcmp(name, AlignModeSP->name) == 0)
{
ISwitch *sw;
AlignModeSP->s = IPS_OK;
IUUpdateSwitch(AlignModeSP, states, names, n);
sw = IUFindOnSwitch(AlignModeSP);
IDSetSwitch(AlignModeSP, "Alignment mode set to %s", sw->label);
return true;
}
if (AlignListSP && strcmp(name, AlignListSP->name) == 0)
{
ISwitch *sw;
IUUpdateSwitch(AlignListSP, states, names, n);
sw = IUFindOnSwitch(AlignListSP);
if (!strcmp(sw->name, "ALIGNLISTADD"))
{
pointset->AddPoint(syncdata, nullptr);
IDMessage(telescope->getDeviceName(), "Align: added point to list");
;
pointset->setBlobData(AlignDataBP);
// JM 2015-12-10: Disable setting AlignData temporary
//IDSetBLOB(AlignDataBP, nullptr);
IUFindNumber(AlignCountNP, "ALIGNCOUNT_POINTS")->value = pointset->getNbPoints();
IUFindNumber(AlignCountNP, "ALIGNCOUNT_TRIANGLES")->value = pointset->getNbTriangles();
IDSetNumber(AlignCountNP, nullptr);
}
else if (!strcmp(sw->name, "ALIGNLISTCLEAR"))
{
pointset->Reset();
IDMessage(telescope->getDeviceName(), "Align: list cleared");
;
pointset->setBlobData(AlignDataBP);
// JM 2015-12-10: Disable setting AlignData temporary
//IDSetBLOB(AlignDataBP, nullptr);
IUFindNumber(AlignCountNP, "ALIGNCOUNT_POINTS")->value = pointset->getNbPoints();
IUFindNumber(AlignCountNP, "ALIGNCOUNT_TRIANGLES")->value = pointset->getNbTriangles();
IDSetNumber(AlignCountNP, nullptr);
}
else if (!strcmp(sw->name, "ALIGNWRITEFILE"))
{
char *res;
res = pointset->WriteDataFile(IUFindText(AlignDataFileTP, "ALIGNDATAFILENAME")->text);
if (res)
IDMessage(telescope->getDeviceName(), "Can not save Align Data to file %s: %s",
IUFindText(AlignDataFileTP, "ALIGNDATAFILENAME")->text, res);
else
IDMessage(telescope->getDeviceName(), "Align: Data saved in file %s",
IUFindText(AlignDataFileTP, "ALIGNDATAFILENAME")->text);
}
else if (!strcmp(sw->name, "ALIGNLOADFILE"))
{
char *res;
pointset->Reset();
res = pointset->LoadDataFile(IUFindText(AlignDataFileTP, "ALIGNDATAFILENAME")->text);
if (res)
IDMessage(telescope->getDeviceName(), "Can not load Align Data File %s: %s",
IUFindText(AlignDataFileTP, "ALIGNDATAFILENAME")->text, res);
else
IDMessage(telescope->getDeviceName(), "Align: Data loaded from file %s",
IUFindText(AlignDataFileTP, "ALIGNDATAFILENAME")->text);
pointset->setBlobData(AlignDataBP);
// JM 2015-12-10: Disable setting AlignData temporary
//IDSetBLOB(AlignDataBP, nullptr);
IUFindNumber(AlignCountNP, "ALIGNCOUNT_POINTS")->value = pointset->getNbPoints();
IUFindNumber(AlignCountNP, "ALIGNCOUNT_TRIANGLES")->value = pointset->getNbTriangles();
IDSetNumber(AlignCountNP, nullptr);
}
sw->s = ISS_OFF; // Reset back to off to allow pressing same button multiple times
AlignListSP->s = IPS_OK;
IDSetSwitch(AlignListSP, nullptr);
return true;
}
}
return false;
}
bool Align::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
{
if (strcmp(dev, telescope->getDeviceName()) == 0)
{
if (AlignDataFileTP && (strcmp(name, AlignDataFileTP->name) == 0))
{
/* char *loadres=nullptr;
pointset->Reset();
IUUpdateText(AlignDataFileTP,texts,names,n);
loadres=pointset->LoadDataFile(IUFindText(AlignDataFileTP,"ALIGNDATAFILENAME")->text);
if (loadres) {
IDMessage(telescope->getDeviceName(), "Can not load Align Data File %s: %s",
IUFindText(AlignDataFileTP,"ALIGNDATAFILENAME")->text, loadres);
AlignDataFileTP->s=IPS_ALERT;
} else
AlignDataFileTP->s=IPS_OK;
IDSetText(AlignDataFileTP,nullptr);
*/
IUUpdateText(AlignDataFileTP, texts, names, n);
IDSetText(AlignDataFileTP, nullptr);
return true;
}
}
return false;
}
bool Align::ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[],
char *names[], int num)
{
INDI_UNUSED(dev);
INDI_UNUSED(name);
INDI_UNUSED(sizes);
INDI_UNUSED(blobsizes);
INDI_UNUSED(blobs);
INDI_UNUSED(formats);
INDI_UNUSED(names);
INDI_UNUSED(num);
return false;
}
bool Align::saveConfigItems(FILE *fp)
{
if (AlignModeSP)
IUSaveConfigSwitch(fp, AlignModeSP);
return true;
}
indi-eqmod-1.0+20220129131520/align/htm.h 0000644 0001751 0001751 00000004575 14174600255 016253 0 ustar debian debian /* This code is derived from the Hierarchical Triangular Mesh package found in
http://skyserver.org/htm/src/cpp/htmIndex.tar.gz
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#define IDSIZE 64
typedef double float64;
#ifdef _WIN32
typedef __int64 int64;
typedef unsigned __int64 uint64;
typedef __int32 int32;
typedef unsigned __int32 uint32;
#else
typedef long long int64;
typedef unsigned long long uint64;
typedef long int32;
typedef unsigned long uint32;
#define IDHIGHBIT 0x8000000000000000LL
#define IDHIGHBIT2 0x4000000000000000LL
#endif
#define HTMNAMEMAX 32
#define prmag(lab, v) \
{ \
double prtmp = v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; \
if (prtmp > 1 + gEpsilon || prtmp < 1 - gEpsilon) \
printf("%s: Mag^2 = %f\n", lab, prtmp); \
}
#define m4_midpoint(v1, v2, w, tmp) \
{ \
w[0] = v1[0] + v2[0]; \
w[1] = v1[1] + v2[1]; \
w[2] = v1[2] + v2[2]; \
tmp = sqrt(w[0] * w[0] + w[1] * w[1] + w[2] * w[2]); \
w[0] /= tmp; \
w[1] /= tmp; \
w[2] /= tmp; \
}
#define copy_vec(d, s) \
{ \
d[0] = s[0]; \
d[1] = s[1]; \
d[2] = s[2]; \
}
static const double gEpsilon = 1.0E-15;
// const float64 gEpsilon = 1.0E-15;
const double cc_Pi = 3.1415926535897932385E0;
const double cc_Pr = 3.1415926535897932385E0 / 180.0;
typedef unsigned long long HtmID;
typedef char HtmName[HTMNAMEMAX];
uint64 cc_name2ID(const char *name);
int cc_ID2name(char *name, uint64 id);
int cc_isinside(double *p, double *v1, double *v2, double *v3);
int cc_startpane(double *v1, double *v2, double *v3, double xin, double yin, double zin, char *name);
int cc_parseVectors(char *spec, int *level, double *ra, double *dec);
uint64 cc_vector2ID(double x, double y, double z, int depth);
uint64 cc_radec2ID(double ra, double dec, int depth);
/* int cc_esolve(double *v1, double *v2,
double ax, double ay, double az, double d);*/
#ifdef __cplusplus
}
#endif
indi-eqmod-1.0+20220129131520/align/pointset.cpp 0000644 0001751 0001751 00000046232 14174600255 017657 0 ustar debian debian /* Copyright 2012 Geehalel (geehalel AT gmail DOT com) */
/* This file is part of the Skywatcher Protocol INDI driver.
The Skywatcher Protocol INDI driver is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Skywatcher Protocol INDI driver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Skywatcher Protocol INDI driver. If not, see .
*/
#include "pointset.h"
#include "triangulate.h"
#include "triangulate_chull.h"
#include "indicom.h"
#include
#include
#include
#include
#include
void PointSet::AltAzFromRaDec(double ra, double dec, double jd, double *alt, double *az, INDI::IGeographicCoordinates *pos)
{
INDI::IEquatorialCoordinates lnradec;
INDI::IGeographicCoordinates lnpos;
INDI::IHorizontalCoordinates lnaltaz;
lnradec.rightascension = ra;
lnradec.declination = dec;
if (pos)
{
lnpos.longitude = pos->longitude;
lnpos.latitude = pos->latitude;
}
else
{
lnpos.longitude = IUFindNumber(telescope->getNumber("GEOGRAPHIC_COORD"), "LONG")->value;
lnpos.latitude = IUFindNumber(telescope->getNumber("GEOGRAPHIC_COORD"), "LAT")->value;
}
INDI::EquatorialToHorizontal(&lnradec, &lnpos, jd, &lnaltaz);
*alt = lnaltaz.altitude;
*az = lnaltaz.azimuth;
}
void PointSet::AltAzFromRaDecSidereal(double ra, double dec, double lst, double *alt, double *az,
INDI::IGeographicCoordinates *pos)
{
struct ln_equ_posn lnradec;
struct ln_lnlat_posn lnpos;
struct ln_hrz_posn lnaltaz;
lnradec.ra = (ra * 360.0) / 24.0;
lnradec.dec = dec;
if (pos)
{
lnpos.lng = pos->longitude;
lnpos.lat = pos->latitude;
}
else
{
lnpos.lng = IUFindNumber(telescope->getNumber("GEOGRAPHIC_COORD"), "LONG")->value;
lnpos.lat = IUFindNumber(telescope->getNumber("GEOGRAPHIC_COORD"), "LAT")->value;
}
if (lnpos.lng > 180)
lnpos.lng -= 360;
ln_get_hrz_from_equ_sidereal_time(&lnradec, &lnpos, lst, &lnaltaz);
*alt = lnaltaz.alt;
*az = range360(lnaltaz.az + 180.0);
}
void PointSet::RaDecFromAltAz(double alt, double az, double jd, double *ra, double *dec, INDI::IGeographicCoordinates *pos)
{
INDI::IEquatorialCoordinates lnradec;
INDI::IGeographicCoordinates lnpos;
INDI::IHorizontalCoordinates lnaltaz;
lnaltaz.altitude = alt;
lnaltaz.azimuth = az;
if (pos)
{
lnpos.longitude = pos->longitude;
lnpos.latitude = pos->latitude;
}
else
{
lnpos.longitude = IUFindNumber(telescope->getNumber("GEOGRAPHIC_COORD"), "LONG")->value;
lnpos.latitude = IUFindNumber(telescope->getNumber("GEOGRAPHIC_COORD"), "LAT")->value;
}
INDI::HorizontalToEquatorial(&lnaltaz, &lnpos, jd, &lnradec);
*ra = lnradec.rightascension;
*dec = lnradec.declination;
}
/* Using haversine: http://en.wikipedia.org/wiki/Haversine_formula */
double sphere_unit_distance(double theta1, double theta2, double phi1, double phi2)
{
double sqrt_haversin_lat = sin(((phi2 - phi1) / 2) * (M_PI / 180));
double sqrt_haversin_long = sin(((theta2 - theta1) / 2) * (M_PI / 180));
return (2 *
asin(sqrt((sqrt_haversin_lat * sqrt_haversin_lat) + cos(phi1 * (M_PI / 180)) * cos(phi2 * (M_PI / 180)) *
(sqrt_haversin_long * sqrt_haversin_long))));
}
bool compelt(PointSet::Distance d1, PointSet::Distance d2)
{
return d1.value < d2.value;
}
PointSet::PointSet(INDI::Telescope *t)
{
telescope = t;
lnalignpos = nullptr;
PointSetInitialized = false;
}
const char *PointSet::getDeviceName()
{
return telescope->getDeviceName();
}
std::set *
PointSet::ComputeDistances(double alt, double az, PointFilter filter, bool ingoto)
{
INDI_UNUSED(filter);
std::map::iterator it;
std::set *distances =
new std::set(compelt);
std::set::iterator distit;
std::pair::iterator, bool> ret;
/* IDLog("Compute distances for point alt=%f az=%f\n", alt, az);*/
for (it = PointSetMap->begin(); it != PointSetMap->end(); it++)
{
double d;
if (ingoto)
d = sphere_unit_distance(az, (*it).second.celestialAZ, alt, (*it).second.celestialALT);
else
d = sphere_unit_distance(az, (*it).second.telescopeAZ, alt, (*it).second.telescopeALT);
Distance elt;
elt.htmID = (*it).first;
elt.value = d;
ret = distances->insert(elt);
/*IDLog(" Point %lld (alt=%f az=%f): distance %f \n", elt.htmID, (*it).second.celestialALT, (*it).second.celestialAZ, elt.value);*/
}
/*
IDLog(" Ordered distances for point alt=%f az=%f\n", alt, az);
for ( distit=distances->begin() ; distit != distances->end(); distit++ ) {
IDLog(" Point %lld: distance %f \n", distit->htmID, distit->value);
}
*/
return distances;
}
void PointSet::AddPoint(AlignData aligndata, INDI::IGeographicCoordinates *pos)
{
Point point;
point.aligndata = aligndata;
double horangle, altangle;
//point.celestialAZ = (range24(point.aligndata.lst - point.aligndata.targetRA - 12.0) * 360.0) / 24.0;
//point.telescopeAZ = (range24(point.aligndata.lst - point.aligndata.telescopeRA - 12.0) * 360.0) / 24.0;
//point.celestialALT = point.aligndata.targetDEC + lat;
//point.telescopeALT = point.aligndata.telescopeDEC + lat;
if (point.aligndata.jd > 0.0)
{
AltAzFromRaDec(point.aligndata.targetRA, point.aligndata.targetDEC, point.aligndata.jd, &point.celestialALT,
&point.celestialAZ, pos);
AltAzFromRaDec(point.aligndata.telescopeRA, point.aligndata.telescopeDEC, point.aligndata.jd,
&point.telescopeALT, &point.telescopeAZ, pos);
}
else
{
AltAzFromRaDecSidereal(point.aligndata.targetRA, point.aligndata.targetDEC, point.aligndata.lst,
&point.celestialALT, &point.celestialAZ, pos);
AltAzFromRaDecSidereal(point.aligndata.telescopeRA, point.aligndata.telescopeDEC, point.aligndata.lst,
&point.telescopeALT, &point.telescopeAZ, pos);
}
horangle = range360(-180.0 - point.celestialAZ) * M_PI / 180.0;
altangle = point.celestialALT * M_PI / 180.0;
point.cx = cos(altangle) * cos(horangle);
point.cy = cos(altangle) * sin(horangle);
point.cz = sin(altangle);
horangle = range360(-180.0 - point.telescopeAZ) * M_PI / 180.0;
altangle = point.telescopeALT * M_PI / 180.0;
point.tx = cos(altangle) * cos(horangle);
point.ty = cos(altangle) * sin(horangle);
point.tz = sin(altangle);
point.htmID = cc_radec2ID(point.celestialAZ, point.celestialALT, 19);
cc_ID2name(point.htmname, point.htmID);
point.index = getNbPoints();
PointSetMap->insert(std::pair(point.htmID, point));
Triangulation->AddPoint(point.htmID);
LOGF_INFO("Align Pointset: added point %d alt = %g az = %g\n", point.index,
point.celestialALT, point.celestialAZ);
LOGF_INFO("Align Triangulate: number of faces is %d\n", Triangulation->getFaces().size());
}
PointSet::Point *PointSet::getPoint(HtmID htmid)
{
return &(PointSetMap->find(htmid)->second);
}
int PointSet::getNbPoints()
{
return PointSetMap->size();
}
int PointSet::getNbTriangles()
{
return Triangulation->getFaces().size();
}
bool PointSet::isInitialized()
{
return PointSetInitialized;
}
void PointSet::Init()
{
// PointSetMap=nullptr;
PointSetMap = new std::map();
Triangulation = new TriangulateCHull(PointSetMap);
PointSetXmlRoot = nullptr;
PointSetInitialized = true;
}
void PointSet::Reset()
{
current.clear();
if (PointSetMap)
{
PointSetMap->clear();
//delete(PointSetMap);
}
//PointSetMap=nullptr;
if (PointSetXmlRoot)
delXMLEle(PointSetXmlRoot);
PointSetXmlRoot = nullptr;
if (lnalignpos)
free(lnalignpos);
lnalignpos = nullptr;
Triangulation->Reset();
}
char *PointSet::LoadDataFile(const char *filename)
{
wordexp_t wexp;
FILE *fp;
LilXML *lp;
static char errmsg[512];
AlignData aligndata;
XMLEle *alignxml, *sitexml;
XMLAtt *ap;
char *sitename;
std::map::iterator it;
if (wordexp(filename, &wexp, 0))
{
wordfree(&wexp);
return (char *)("Badly formed filename");
}
//if (filename == nullptr) return;
if (!(fp = fopen(wexp.we_wordv[0], "r")))
{
wordfree(&wexp);
return strerror(errno);
}
wordfree(&wexp);
lp = newLilXML();
if (PointSetXmlRoot)
delXMLEle(PointSetXmlRoot);
PointSetXmlRoot = readXMLFile(fp, lp, errmsg);
delLilXML(lp);
if (!PointSetXmlRoot)
return errmsg;
if (!strcmp(tagXMLEle(nextXMLEle(PointSetXmlRoot, 1)), "aligndata"))
return (char *)("Not an alignment data file");
sitexml = findXMLEle(PointSetXmlRoot, "site");
if (!sitexml)
return (char *)"No site found";
ap = findXMLAtt(sitexml, "name");
if (ap)
sitename = valuXMLAtt(ap);
else
sitename = (char *)"No sitename";
ap = findXMLAtt(sitexml, "lat");
if (!ap)
return (char *)"No latitude data found";
else
sscanf(valuXMLAtt(ap), "%lf", &lat);
ap = findXMLAtt(sitexml, "lon");
if (!ap)
return (char *)"No longitude data found";
else
sscanf(valuXMLAtt(ap), "%lf", &lon);
ap = findXMLAtt(sitexml, "alt");
if (!ap)
alt = 0.0;
else
sscanf(valuXMLAtt(ap), "%lf", &alt);
IDLog("Align: load file for site %s (lon %f lat %f alt %f)\n", sitename, lon, lat, alt);
IDLog(" number of points: %d\n", nXMLEle(sitexml));
// PointSetMap = new std::map