Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated focuser sdk and filter wheel sdk, and support macOS #1009

Merged
merged 48 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4d29c15
Oasis Focuser INDI driver initial version
astroasis May 5, 2023
766064f
Find Astroasis libraries
astroasis May 6, 2023
2e41da8
Initial version for Oasis Focuser INDI driver
astroasis May 7, 2023
7a2ab41
Initial version for Oasis Focuser INDI driver
astroasis May 7, 2023
262dc19
Oasis Focuser SDK header file
astroasis May 8, 2023
030560b
Added Astroasis driver
astroasis May 8, 2023
1090e96
Added readme and installation files
astroasis May 9, 2023
9493f49
Use version info from CMakeLists.txt
astroasis May 9, 2023
794ac20
Updated sdk version to 1.0.5
astroasis May 9, 2023
c22029c
Added spec file
astroasis May 9, 2023
4b3006a
Updated for coding style
astroasis May 9, 2023
1c6d1a3
Oasis focuser sdk lib file for armhf
astroasis May 9, 2023
11fc309
Oasis focuser sdk lib file for armhf
astroasis May 9, 2023
2b1cd33
Implemented ambient temeperature and backlash compensation direction …
astroasis May 9, 2023
d6d737c
Oasis focuser sdk lib file for x64
astroasis May 9, 2023
8bbc1ba
Disable build for x86
astroasis May 9, 2023
70bfaab
Merge branch 'master' of https://github.com/astroasis/indi-3rdparty
astroasis May 9, 2023
9e4a5bf
Merge remote-tracking branch 'upstream/master'
astroasis May 9, 2023
d2425a3
Merge remote-tracking branch 'upstream/master'
astroasis May 25, 2023
d19ea06
Fix incorrect Vender ID for Astroasis USB devices
astroasis May 25, 2023
40b0e31
Merge remote-tracking branch 'upstream/master'
astroasis May 26, 2023
368a74b
Fixed incorrect max position value
astroasis May 26, 2023
9f7c998
Merge remote-tracking branch 'upstream/master'
astroasis Jun 29, 2023
d7ea07f
Added libastroasis for building indi-astroasis on Fedora COPR
astroasis Jun 29, 2023
6e72360
Merge remote-tracking branch 'upstream/master'
astroasis Sep 25, 2023
3ad9cf8
Fix spelling
astroasis Sep 25, 2023
220b36b
Merge remote-tracking branch 'upstream/master'
astroasis Sep 26, 2023
e015275
Update for compilation and installation instructions
astroasis Sep 26, 2023
fa8a854
Merge remote-tracking branch 'upstream/master'
astroasis Sep 30, 2023
dc842b3
Merge remote-tracking branch 'upstream/master'
astroasis Sep 30, 2023
270a67a
Add Oasis Filter Wheel driver
astroasis Sep 30, 2023
8538735
Add Oasis Filter Wheel driver
astroasis Sep 30, 2023
8c7db60
Merge remote-tracking branch 'upstream/master'
astroasis Sep 30, 2023
3e4520e
Add Oasis filter wheel library file for 32bit arm
astroasis Sep 30, 2023
afa3aa4
Add Oasis filter wheel library file for 64bit arm
astroasis Sep 30, 2023
ca03b15
Update indi-astroasis change log
astroasis Oct 2, 2023
5da2516
Merge branch 'master' of https://github.com/astroasis/indi-3rdparty
astroasis Oct 2, 2023
0225881
Add Oasis Filter Wheel driver library files
astroasis Oct 2, 2023
89ff617
Merge remote-tracking branch 'upstream/master'
astroasis Oct 8, 2023
5d135f9
Update for coding style
astroasis Oct 8, 2023
1d65ddc
Merge remote-tracking branch 'upstream/master'
astroasis Jun 12, 2024
4281fc5
Updated liboasisfocuser to improve stability of USB HID communication…
astroasis Jun 12, 2024
a400944
Updated liboasisfocuser to improve stability of USB HID communication…
astroasis Jun 12, 2024
114ecec
Updated liboasisfocuser to improve stability of USB HID communication…
astroasis Jun 12, 2024
2dcfa19
Merge remote-tracking branch 'upstream/master'
astroasis Dec 11, 2024
6f961b6
Updated focuser sdk and filer wheel sdk
astroasis Dec 13, 2024
802a932
Add focuser and filter wheel dynamic library file for macOS
astroasis Dec 13, 2024
3e51777
Enable astroasis for macOS
astroasis Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(WITH_GPSD Off)
set(WITH_AHP_XC Off)
set(WITH_AHP_GT Off)
set(WITH_ASTROASIS Off)
# The drivers below are not yet compatible with Apple Silicon since their libraries are not universal binaries
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
SET(WITH_ASICAM Off)
Expand Down
44 changes: 22 additions & 22 deletions indi-astroasis/oasis_filter_wheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ bool OasisFilterWheel::initProperties()
{
INDI::FilterWheel::initProperties();

// Mode
IUFillSwitch(&ModeS[0], "MODE_0", "Fast", ISS_OFF);
IUFillSwitch(&ModeS[1], "MODE_1", "Normal", ISS_OFF);
IUFillSwitch(&ModeS[2], "MODE_2", "Slow", ISS_OFF);
IUFillSwitchVector(&ModeSP, ModeS, 3, getDeviceName(), "MODE", "Mode",
// Speed
IUFillSwitch(&SpeedS[0], "SPEED_FAST", "Fast", ISS_OFF);
IUFillSwitch(&SpeedS[1], "SPEED_NORMAL", "Normal", ISS_OFF);
IUFillSwitch(&SpeedS[2], "SPEED_SLOW", "Slow", ISS_OFF);
IUFillSwitchVector(&SpeedSP, SpeedS, 3, getDeviceName(), "SPEED", "Speed",
MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 0, IPS_IDLE);

// Auto run on power up
Expand Down Expand Up @@ -87,23 +87,23 @@ bool OasisFilterWheel::updateProperties()
AutoRunS[INDI_ENABLED].s = config.autorun ? ISS_ON : ISS_OFF;
AutoRunS[INDI_DISABLED].s = config.autorun ? ISS_OFF : ISS_ON;

ModeS[0].s = (config.mode == 0) ? ISS_ON : ISS_OFF;
ModeS[1].s = (config.mode == 1) ? ISS_ON : ISS_OFF;
ModeS[2].s = (config.mode == 2) ? ISS_ON : ISS_OFF;
SpeedS[0].s = (config.speed == 0) ? ISS_ON : ISS_OFF;
SpeedS[1].s = (config.speed == 1) ? ISS_ON : ISS_OFF;
SpeedS[2].s = (config.speed == 2) ? ISS_ON : ISS_OFF;
}
else
{
AutoRunSP.s = IPS_ALERT;
}

defineProperty(&ModeSP);
defineProperty(&SpeedSP);
defineProperty(&AutoRunSP);
defineProperty(&FactoryResetSP);
defineProperty(&CalibrateSP);
}
else
{
deleteProperty(ModeSP.name);
deleteProperty(SpeedSP.name);
deleteProperty(AutoRunSP.name);
deleteProperty(FactoryResetSP.name);
deleteProperty(CalibrateSP.name);
Expand Down Expand Up @@ -240,38 +240,38 @@ bool OasisFilterWheel::ISNewSwitch(const char *dev, const char *name, ISState *s
{
if (dev != nullptr && !strcmp(dev, getDeviceName()))
{
if (!strcmp(name, ModeSP.name))
if (!strcmp(name, SpeedSP.name))
{
OFWConfig config;
AOReturn ret;
int prev, target;

prev = IUFindOnSwitchIndex(&ModeSP);
IUUpdateSwitch(&ModeSP, states, names, n);
target = IUFindOnSwitchIndex(&ModeSP);
prev = IUFindOnSwitchIndex(&SpeedSP);
IUUpdateSwitch(&SpeedSP, states, names, n);
target = IUFindOnSwitchIndex(&SpeedSP);

config.mask = MASK_MODE;
config.mode = target;
config.mask = MASK_SPEED;
config.speed = target;

ret = OFWSetConfig(mID, &config);

if (ret == AO_SUCCESS)
{
ModeSP.s = IPS_OK;
SpeedSP.s = IPS_OK;
}
else
{
LOGF_ERROR("Failed to set Oasis filter wheel mode, ret = %d\n", ret);
LOGF_ERROR("Failed to set Oasis filter wheel speed, ret = %d\n", ret);

IUResetSwitch(&ModeSP);
IUResetSwitch(&SpeedSP);

if ((prev >= 0) && (prev < 3))
ModeS[prev].s = ISS_ON;
SpeedS[prev].s = ISS_ON;

ModeSP.s = IPS_ALERT;
SpeedSP.s = IPS_ALERT;
}

IDSetSwitch(&ModeSP, nullptr);
IDSetSwitch(&SpeedSP, nullptr);

return true;
}
Expand Down
6 changes: 3 additions & 3 deletions indi-astroasis/oasis_filter_wheel.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class OasisFilterWheel : public INDI::FilterWheel

bool GetConfig(OFWConfig *config);

// Mode
ISwitchVectorProperty ModeSP;
ISwitch ModeS[3];
// Speed
ISwitchVectorProperty SpeedSP;
ISwitch SpeedS[3];

// Auto run on power up
ISwitchVectorProperty AutoRunSP;
Expand Down
32 changes: 29 additions & 3 deletions libastroasis/AOFocus.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Suzhou Astroasis Vision Technology, Inc. All Rights Reserved.
* Copyright 2024 Suzhou Astroasis Vision Technology, Inc. All Rights Reserved.
*
* This is header file for Astroasis Oasis Focuser.
*
Expand Down Expand Up @@ -31,6 +31,7 @@
* AOFocuserMove(int id, int step);
* AOFocuserMoveTo(int id, int position);
* AOFocuserStopMove(int id);
* AOFocuserClearStall(int id);
* AOFocuserFirmwareUpgrade(int id, unsigned char *data, int len);
* AOFocuserGetSDKVersion(char *version);
*
Expand All @@ -50,12 +51,22 @@ extern "C" {
#define AOAPI
#endif

#define VERSION_INVALID 0

#define PROTOCAL_VERSION_16_0_3 0x10000300
#define PROTOCAL_VERSION_16_1_0 0x10010000

#define AO_FOCUSER_MAX_NUM 32 /* Maximum focuser numbers supported by this SDK */
#define AO_FOCUSER_VERSION_LEN 32 /* Buffer length for version strings */
#define AO_FOCUSER_NAME_LEN 32 /* Buffer length for name strings */

#define TEMPERATURE_INVALID 0x80000000 /* This value indicates the invalid value of ambient temperature */

#define AO_LOG_LEVEL_QUIET 0
#define AO_LOG_LEVEL_ERROR 1
#define AO_LOG_LEVEL_INFO 2
#define AO_LOG_LEVEL_DEBUG 3

typedef enum _AOReturn {
AO_SUCCESS = 0, /* Success */
AO_ERROR_INVALID_ID, /* Device ID is invalid */
Expand Down Expand Up @@ -85,6 +96,10 @@ typedef enum _AOReturn {
#define MASK_BEEP_ON_MOVE 0x00000020
#define MASK_BEEP_ON_STARTUP 0x00000040
#define MASK_BLUETOOTH 0x00000080
#define MASK_STALL_DETECTION 0x00000100
#define MASK_HEATING_TEMPERATURE 0x00000200
#define MASK_HEATING_ON 0x00000400
#define MASK_USB_POWER_CAPACITY 0x00000800
#define MASK_ALL 0xFFFFFFFF

typedef struct _AOFocuserVersion
Expand All @@ -105,6 +120,10 @@ typedef struct _AOFocuserConfig {
int beepOnMove; /* 0 - Turn off beep for move, others - Turn on beep for move */
int beepOnStartup; /* 0 - Turn off beep for device startup, others - Turn on beep for device startup */
int bluetoothOn; /* 0 - Turn off Bluetooth, others - Turn on Bluetooth */
int stallDetection; /* 0 - Turn off motor stall detection, others - Turn on motor stall detection */
int heatingTemperature; /* Target heating temperature in 0.01 degree unit */
int heatingOn; /* 0 - Turn off heating, others - Turn on heating */
int usbPowerCapacity; /* 0 - 500mA, 1 - 1000mA or higher */
} AOFocuserConfig;

/*
Expand All @@ -117,7 +136,12 @@ typedef struct _AOFocuserStatus {
int temperatureExt; /* External (ambient) temperature in 0.01 degree unit */
int temperatureDetection; /* 0 - ambient temperature probe is not inserted, others - ambient temperature probe is inserted */
int position; /* Current motor position */
int moving; /* 0 - Motor is not moving, others - Motor is moving */
int moving; /* 0 - motor is not moving, others - Motor is moving */
int stallDetection; /* 0 - motor stall is not detected, others - motor stall detected */
int heatingOn; /* 0 - heating is disabled, others - heating is enabled */
int heatingPower; /* Current heating power in 1% unit */
int dcPower; /* Current DC power in 0.1V unit */
int reserved[20];
} AOFocuserStatus;

/*
Expand All @@ -142,7 +166,7 @@ typedef struct _AOFocuserStatus {
*
* Remarks
* This function should be called before any other APIs except for
* AOCameraGetSDKVersion().
* AOFocuserGetSDKVersion().
* Each focuser has a unique ID. If one focuser is removed from USB port
* and then plugged in again, it will be considered as different focuser
* and will be assigned with different ID during next scan. If one focuser
Expand Down Expand Up @@ -170,9 +194,11 @@ AOAPI AOReturn AOFocuserSyncPosition(int id, int position);
AOAPI AOReturn AOFocuserMove(int id, int step);
AOAPI AOReturn AOFocuserMoveTo(int id, int position);
AOAPI AOReturn AOFocuserStopMove(int id);
AOAPI AOReturn AOFocuserClearStall(int id);
AOAPI AOReturn AOFocuserUpgrade(int id);
AOAPI AOReturn AOFocuserFirmwareUpgrade(int id, unsigned char *data, int len);
AOAPI AOReturn AOFocuserGetSDKVersion(char *version);
AOAPI AOReturn AOFocuserSetLogLevel(int level);

#ifdef __cplusplus
}
Expand Down
6 changes: 3 additions & 3 deletions libastroasis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.16)
project (libastroasis)

set (OASIS_FOCUSER_VERSION "1.0.7")
set (OASIS_FOCUSER_SOVERSION "1")
set (OASIS_FOCUSER_VERSION "2.0.2")
set (OASIS_FOCUSER_SOVERSION "2")

set (OASIS_FILTER_WHEEL_VERSION "1.0.0")
set (OASIS_FILTER_WHEEL_VERSION "1.2.1")
set (OASIS_FILTER_WHEEL_SOVERSION "1")

list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
Expand Down
41 changes: 35 additions & 6 deletions libastroasis/OasisFilterWheel.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2023 Suzhou Astroasis Vision Technology, Inc. All Rights Reserved.
* Copyright 2024 Suzhou Astroasis Vision Technology, Inc. All Rights Reserved.
*
* This is header file for Astroasis Oasis Filter Wheel .
* This is header file for Astroasis Oasis Filter Wheel.
*
* Note:
* 1. OFWScan() should be called before any other APIs (except for
Expand Down Expand Up @@ -40,6 +40,7 @@
* OFWGetCalibrateData(int id, AOCalibrateData* calibrate);
* OFWFirmwareUpgrade(int id, unsigned char *data, int len);
* OFWGetSDKVersion(char *version);
* OFWSetLogLevel(int level);
*
* Refer to SDK demo application for the details of the API usage.
*/
Expand All @@ -57,11 +58,21 @@ extern "C" {
#define AOAPI
#endif

#define VERSION_INVALID 0

#define PROTOCAL_VERSION_1_1_0 0x01010000
#define PROTOCAL_VERSION_1_2_0 0x01020000

#define OFW_MAX_NUM 32 /* Maximum filter wheel numbers supported by this SDK */
#define OFW_VERSION_LEN 32 /* Buffer length for version strings */
#define OFW_NAME_LEN 32 /* Buffer length for name strings */
#define OFW_SLOT_NAME_LEN 16 /* Buffer length for slot name strings */

#define AO_LOG_LEVEL_QUIET 0
#define AO_LOG_LEVEL_ERROR 1
#define AO_LOG_LEVEL_INFO 2
#define AO_LOG_LEVEL_DEBUG 3

typedef enum _AOReturn {
AO_SUCCESS = 0, /* Success */
AO_ERROR_INVALID_ID, /* Device ID is invalid */
Expand All @@ -83,9 +94,10 @@ typedef enum _AOReturn {
/*
* Used by OFWSetConfig() to indicate which field wants to be set
*/
#define MASK_MODE 0x00000001
#define MASK_SPEED 0x00000001
#define MASK_AUTORUN 0x00000002
#define MASK_BLUETOOTH 0x00000004
#define MASK_TURBO 0x00000008
#define MASK_ALL 0xFFFFFFFF

/*
Expand All @@ -104,20 +116,36 @@ typedef struct _OFWVersion
char built[24]; /* Null-terminated string which indicates firmware building time */
} OFWVersion;

/*
* Since protocal version 1.1.0:
* 1. Changed field "mode" to "speed"
* 2. Added field "turbo"
*/
typedef struct _OFWConfig {
unsigned int mask; /* Used by OFWSetConfig() to indicates which field wants to be set */
int mode; /* Mode of the filter wheel operation */
int autorun; /* Automatic switch to the target slot when power on */
unsigned int mask; /* Used by OFWSetConfig() to indicate which field wants to be set */
int speed; /* Motor speed. 0 - Fast, 1 - Normal, 2 - Slow */
int autorun; /* Automatic switch to the target slot when power on. 0 - Do not switch, 1 - Auto switch */
int bluetoothOn; /* 0 - Turn off Bluetooth, others - Turn on Bluetooth */
int turbo; /* 0 - Turn off turbo mode, others - Turn on turbo mode */
} OFWConfig;

typedef struct _OFWStatus {
int temperature; /* Internal (on board) temperature in 0.01 degree unit */
int filterStatus; /* Current motor position */
int filterPosition; /* Current motor position, zero - unknown position */
int seq; /* Sequence number for debug purpose */
} OFWStatus;

/*
* Since protocal version 1.1.0
* 1. Added field "index"
* 2. Added field "active"
* 3. Added field "temperature"
*/
typedef struct _OFWCalibrateData {
int index; /* Index of the calibration data */
int active; /* 0 - Non-active calibration data, 1 - Active calibration data */
int temperature; /* Calibration temperature */
int low[4]; /* Calibration low value */
int high[4]; /* Calibration high value */
} OFWCalibrateData;
Expand Down Expand Up @@ -182,6 +210,7 @@ AOAPI AOReturn OFWGetCalibrateData(int id, OFWCalibrateData *calibrate);
AOAPI AOReturn OFWUpgrade(int id);
AOAPI AOReturn OFWFirmwareUpgrade(int id, unsigned char *data, int len);
AOAPI AOReturn OFWGetSDKVersion(char *version);
AOAPI AOReturn OFWSetLogLevel(int level);

#ifdef __cplusplus
}
Expand Down
Binary file modified libastroasis/arm64/liboasisfilterwheel.bin
Binary file not shown.
Binary file modified libastroasis/arm64/liboasisfocuser.bin
Binary file not shown.
Binary file modified libastroasis/armhf/liboasisfilterwheel.bin
Binary file not shown.
Binary file modified libastroasis/armhf/liboasisfocuser.bin
Binary file not shown.
Binary file added libastroasis/mac/liboasisfilterwheel.bin
Binary file not shown.
Binary file added libastroasis/mac/liboasisfocuser.bin
Binary file not shown.
Binary file modified libastroasis/x64/liboasisfilterwheel.bin
Binary file not shown.
Binary file modified libastroasis/x64/liboasisfocuser.bin
Binary file not shown.
Loading