Skip to content

Commit

Permalink
AHP libraries from Debian and Fedora repos (#1045)
Browse files Browse the repository at this point in the history
* Depend on upstream libahp-gt and libahp-xc

* Fix issues in indi_ahp_xc

* AHP GT driver detects the controller during connection

---------

Co-authored-by: Ilia Platone <[email protected]>
  • Loading branch information
iliaplatone and Ilia Platone authored Mar 9, 2025
1 parent 85c053c commit d66bc05
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 2,034 deletions.
24 changes: 1 addition & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,9 @@ IF (UNIX OR APPLE)
STRING(FIND ${SOURCE_FILE} libsbig DIR6_FOUND)
STRING(FIND ${SOURCE_FILE} libinovasdk DIR8_FOUND)
STRING(FIND ${SOURCE_FILE} libsvbony DIR9_FOUND)
STRING(FIND ${SOURCE_FILE} libahp-xc DIR10_FOUND)
STRING(FIND ${SOURCE_FILE} libahp-gt DIR11_FOUND)
IF (NOT ${DIR1_FOUND} EQUAL -1 OR NOT ${DIR2_FOUND} EQUAL -1 OR NOT ${DIR3_FOUND} EQUAL -1 OR NOT ${DIR4_FOUND} EQUAL -1 OR
NOT ${DIR5_FOUND} EQUAL -1 OR NOT ${DIR6_FOUND} EQUAL -1 OR NOT ${DIR7_FOUND} EQUAL -1 OR NOT ${DIR8_FOUND} EQUAL -1 OR
NOT ${DIR9_FOUND} EQUAL -1 OR NOT ${DIR10_FOUND} EQUAL -1 OR NOT ${DIR11_FOUND} EQUAL -1)
NOT ${DIR9_FOUND} EQUAL -1)
LIST(REMOVE_ITEM ALL_SOURCE_FILES ${SOURCE_FILE})
ENDIF ()
ENDFOREACH ()
Expand Down Expand Up @@ -340,16 +338,6 @@ endif()
add_subdirectory(libpktriggercord)
endif (WITH_PENTAX)

# libahp-xc
if (WITH_AHP_XC)
add_subdirectory(libahp-xc)
endif(WITH_AHP_XC)

# libahp-gt
if (WITH_AHP_GT)
add_subdirectory(libahp-gt)
endif(WITH_AHP_GT)

#toupbase dependencies
if (WITH_TOUPBASE)
add_subdirectory(libmeadecam)
Expand Down Expand Up @@ -712,8 +700,6 @@ if (WITH_AHP_XC)
find_package(AHPXC)
if(AHP_XC_FOUND)
add_subdirectory(indi-ahp-xc)
else(AHP_XC_FOUND)
add_subdirectory(libahp-xc)
endif(AHP_XC_FOUND)
endif(WITH_AHP_XC)

Expand Down Expand Up @@ -879,14 +865,6 @@ if (WITH_PLAYERONE AND NOT PLAYERONE_FOUND)
message(STATUS "libplayerone was not found and will now be built. Please install this libplayerone first before running cmake again to install indi-playerone.")
endif (WITH_PLAYERONE AND NOT PLAYERONE_FOUND)

if (WITH_AHP_XC AND NOT AHP_XC_FOUND)
message(STATUS "libahp-xc was not found and will now be built. Please install libahp-xc first before running cmake again to install indi-ahp-xc.")
endif (WITH_AHP_XC AND NOT AHP_XC_FOUND)

if (WITH_AHP_GT AND NOT AHP_GT_FOUND)
message(STATUS "libahp-gt was not found and will now be built. Please install libahp-gt first before running cmake again to install indi-ahpgt.")
endif (WITH_AHP_GT AND NOT AHP_GT_FOUND)

if (WITH_ASTROASIS AND NOT ASTROASIS_FOUND)
message(STATUS "libastroasis was not found and will now be built. Please install libastroasis first before running cmake again to install indi-astroasis.")
endif (WITH_ASTROASIS AND NOT ASTROASIS_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion indi-ahp-xc/indi_ahp_xc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ bool AHP_XC::Connect()
if(serialConnection->port() == nullptr)
return false;

if(0 != ahp_xc_connect(serialConnection->port(), false))
if(0 != ahp_xc_connect(serialConnection->port()))
{
ahp_xc_disconnect();
return false;
Expand Down
47 changes: 22 additions & 25 deletions indi-eqmod/ahp-gt/ahpgtbase.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/** \file indi_ahp_gt.cpp
\brief Driver for the GT1 GOTO telescope mount controller.
\brief Driver for the GT GOTO telescope mount controllers.
\author Ilia Platone
\example indi_ahp_gt.cpp
Driver for the GT1 GOTO telescope mount controller.
Driver for the GT GOTO telescope mount controllers.
See https://www.iliaplatone.com/gt1 for more information
*/

Expand All @@ -30,16 +30,13 @@ bool AHPGTBase::Handshake()
{
if(!ahp_gt_connect_fd(PortFD))
{
if(!ahp_gt_detect_device())
{
ahp_gt_set_motor_steps(0, 200);
ahp_gt_set_motor_teeth(0, 1);
ahp_gt_read_values(0);
ahp_gt_set_motor_steps(1, 200);
ahp_gt_set_motor_teeth(1, 1);
ahp_gt_read_values(1);
return true;
}
ahp_gt_set_motor_steps(0, 200);
ahp_gt_set_motor_teeth(0, 1);
ahp_gt_read_values(0);
ahp_gt_set_motor_steps(1, 200);
ahp_gt_set_motor_teeth(1, 1);
ahp_gt_read_values(1);
return true;
}
}
Disconnect();
Expand Down Expand Up @@ -198,12 +195,12 @@ bool AHPGTBase::updateProperties()
GTDEConfigurationNP[GT_MOTOR_TEETH].setValue(ahp_gt_get_motor_teeth(1));
GTDEConfigurationNP[GT_WORM_TEETH].setValue(ahp_gt_get_worm_teeth(1));
GTDEConfigurationNP[GT_CROWN_TEETH].setValue(ahp_gt_get_crown_teeth(1));
GTDEConfigurationNP[GT_MAX_SPEED].setValue(ahp_gt_get_max_speed(1));
GTDEConfigurationNP[GT_ACCELERATION].setValue(ahp_gt_get_acceleration_angle(1) * 180.0 / M_PI);
GTDEConfigurationNP[GT_MAX_SPEED].setValue(get_max_speed(1));
GTDEConfigurationNP[GT_ACCELERATION].setValue(get_acceleration_angle(1) * 180.0 / M_PI);
GTDEConfigurationNP.apply();
for(int x = 0; x < GT_N_MOUNT_CONFIG; x++)
GTMountConfigSP[x].setState(ISS_OFF);
int fork = (ahp_gt_get_mount_flags() & isForkMount) ? 1 : 0;
int fork = (get_mount_flags() & isForkMount) ? 1 : 0;
int azeq = 0;
azeq |= ((ahp_gt_get_features(0) & isAZEQ) != 0) ? 1 : 0;
azeq |= ((ahp_gt_get_features(1) & isAZEQ) != 0) ? 1 : 0;
Expand All @@ -214,7 +211,7 @@ bool AHPGTBase::updateProperties()
else
GTMountConfigSP[GT_GEM].setState(ISS_ON);
GTMountConfigSP.apply();
GTConfigurationNP[GT_PWM_FREQ].setValue(ahp_gt_get_pwm_frequency() * 700 + 1500);
GTConfigurationNP[GT_PWM_FREQ].setValue(ahp_gt_get_pwm_frequency(0) * 700 + 1500);
GTConfigurationNP.apply();
}
else
Expand Down Expand Up @@ -263,7 +260,7 @@ bool AHPGTBase::ISNewNumber(const char *dev, const char *name, double values[],
}
if(!strcmp(GTConfigurationNP.getName(), name))
{
ahp_gt_set_pwm_frequency((GTConfigurationNP[GT_PWM_FREQ].getValue() - 1500) / 700);
ahp_gt_set_pwm_frequency(0, (GTConfigurationNP[GT_PWM_FREQ].getValue() - 1500) / 366);
ahp_gt_write_values(0, &progress, &write_finished);
ahp_gt_write_values(1, &progress, &write_finished);
updateProperties();
Expand All @@ -284,12 +281,12 @@ bool AHPGTBase::ISNewSwitch(const char *dev, const char *name, ISState *states,
case GT_GEM:
ahp_gt_set_features(0, static_cast<SkywatcherFeature>(ahp_gt_get_features(0) & ~static_cast<int>(isAZEQ)));
ahp_gt_set_features(1, static_cast<SkywatcherFeature>(ahp_gt_get_features(1) & ~static_cast<int>(isAZEQ)));
ahp_gt_set_mount_flags(static_cast<GT1Flags>(0));
ahp_gt_set_mount_flags(static_cast<GTFlags>(0));
break;
case GT_AZEQ:
ahp_gt_set_features(0, static_cast<SkywatcherFeature>(ahp_gt_get_features(0) | static_cast<int>(isAZEQ)));
ahp_gt_set_features(1, static_cast<SkywatcherFeature>(ahp_gt_get_features(1) | static_cast<int>(isAZEQ)));
ahp_gt_set_mount_flags(static_cast<GT1Flags>(0));
ahp_gt_set_mount_flags(static_cast<GTFlags>(0));
break;
case GT_FORK:
ahp_gt_set_features(0, static_cast<SkywatcherFeature>(ahp_gt_get_features(0) & ~static_cast<int>(isAZEQ)));
Expand All @@ -311,19 +308,19 @@ bool AHPGTBase::ISNewSwitch(const char *dev, const char *name, ISState *states,
}
if(!strcmp(GTRASteppingModeSP.getName(), name))
{
ahp_gt_set_stepping_mode(0, static_cast<GT1SteppingMode>(GTRASteppingModeSP.findOnSwitchIndex()));
ahp_gt_set_stepping_mode(0, static_cast<GTSteppingMode>(GTRASteppingModeSP.findOnSwitchIndex()));
ahp_gt_write_values(0, &progress, &write_finished);
updateProperties();
}
if(!strcmp(GTRAWindingSP.getName(), name))
{
ahp_gt_set_stepping_conf(0, static_cast<GT1SteppingConfiguration>(GTRAWindingSP.findOnSwitchIndex()));
ahp_gt_set_stepping_conf(0, static_cast<GTSteppingConfiguration>(GTRAWindingSP.findOnSwitchIndex()));
ahp_gt_write_values(0, &progress, &write_finished);
updateProperties();
}
if(!strcmp(GTRAGPIOConfigSP.getName(), name))
{
ahp_gt_set_feature(0, static_cast<GT1Feature>(GTRAGPIOConfigSP.findOnSwitchIndex()));
ahp_gt_set_feature(0, static_cast<GTFeature>(GTRAGPIOConfigSP.findOnSwitchIndex()));
ahp_gt_write_values(0, &progress, &write_finished);
updateProperties();
}
Expand All @@ -335,19 +332,19 @@ bool AHPGTBase::ISNewSwitch(const char *dev, const char *name, ISState *states,
}
if(!strcmp(GTDESteppingModeSP.getName(), name))
{
ahp_gt_set_stepping_mode(1, static_cast<GT1SteppingMode>(GTDESteppingModeSP.findOnSwitchIndex()));
ahp_gt_set_stepping_mode(1, static_cast<GTSteppingMode>(GTDESteppingModeSP.findOnSwitchIndex()));
ahp_gt_write_values(1, &progress, &write_finished);
updateProperties();
}
if(!strcmp(GTDEWindingSP.getName(), name))
{
ahp_gt_set_stepping_conf(1, static_cast<GT1SteppingConfiguration>(GTDEWindingSP.findOnSwitchIndex()));
ahp_gt_set_stepping_conf(1, static_cast<GTSteppingConfiguration>(GTDEWindingSP.findOnSwitchIndex()));
ahp_gt_write_values(1, &progress, &write_finished);
updateProperties();
}
if(!strcmp(GTDEGPIOConfigSP.getName(), name))
{
ahp_gt_set_feature(1, static_cast<GT1Feature>(GTDEGPIOConfigSP.findOnSwitchIndex()));
ahp_gt_set_feature(1, static_cast<GTFeature>(GTDEGPIOConfigSP.findOnSwitchIndex()));
ahp_gt_write_values(1, &progress, &write_finished);
updateProperties();
}
Expand Down
38 changes: 0 additions & 38 deletions libahp-gt/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit d66bc05

Please sign in to comment.