diff --git a/CMakeLists.txt b/CMakeLists.txt index 8220b82be..0fd0f872c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/indi-astroasis/oasis_filter_wheel.cpp b/indi-astroasis/oasis_filter_wheel.cpp index efee677a0..dc8000e6b 100644 --- a/indi-astroasis/oasis_filter_wheel.cpp +++ b/indi-astroasis/oasis_filter_wheel.cpp @@ -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 @@ -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); @@ -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; } diff --git a/indi-astroasis/oasis_filter_wheel.h b/indi-astroasis/oasis_filter_wheel.h index 46bb986d8..f3e323263 100644 --- a/indi-astroasis/oasis_filter_wheel.h +++ b/indi-astroasis/oasis_filter_wheel.h @@ -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; diff --git a/libastroasis/AOFocus.h b/libastroasis/AOFocus.h index 5d6e875ca..c7c49801f 100644 --- a/libastroasis/AOFocus.h +++ b/libastroasis/AOFocus.h @@ -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. * @@ -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); * @@ -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 */ @@ -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 @@ -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; /* @@ -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; /* @@ -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 @@ -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 } diff --git a/libastroasis/CMakeLists.txt b/libastroasis/CMakeLists.txt index 9d9539bdf..6d7818fd7 100644 --- a/libastroasis/CMakeLists.txt +++ b/libastroasis/CMakeLists.txt @@ -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/") diff --git a/libastroasis/OasisFilterWheel.h b/libastroasis/OasisFilterWheel.h index f6159135d..215b0ce7c 100644 --- a/libastroasis/OasisFilterWheel.h +++ b/libastroasis/OasisFilterWheel.h @@ -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 @@ -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. */ @@ -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 */ @@ -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 /* @@ -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; @@ -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 } diff --git a/libastroasis/arm64/liboasisfilterwheel.bin b/libastroasis/arm64/liboasisfilterwheel.bin index 6cadfbf63..6ccc6123e 100755 Binary files a/libastroasis/arm64/liboasisfilterwheel.bin and b/libastroasis/arm64/liboasisfilterwheel.bin differ diff --git a/libastroasis/arm64/liboasisfocuser.bin b/libastroasis/arm64/liboasisfocuser.bin index b8bf94e4a..37b0ca943 100755 Binary files a/libastroasis/arm64/liboasisfocuser.bin and b/libastroasis/arm64/liboasisfocuser.bin differ diff --git a/libastroasis/armhf/liboasisfilterwheel.bin b/libastroasis/armhf/liboasisfilterwheel.bin index d5c211997..c6edb77c6 100755 Binary files a/libastroasis/armhf/liboasisfilterwheel.bin and b/libastroasis/armhf/liboasisfilterwheel.bin differ diff --git a/libastroasis/armhf/liboasisfocuser.bin b/libastroasis/armhf/liboasisfocuser.bin index eb0637858..34e0bd1f2 100755 Binary files a/libastroasis/armhf/liboasisfocuser.bin and b/libastroasis/armhf/liboasisfocuser.bin differ diff --git a/libastroasis/mac/liboasisfilterwheel.bin b/libastroasis/mac/liboasisfilterwheel.bin new file mode 100755 index 000000000..bd91c9d78 Binary files /dev/null and b/libastroasis/mac/liboasisfilterwheel.bin differ diff --git a/libastroasis/mac/liboasisfocuser.bin b/libastroasis/mac/liboasisfocuser.bin new file mode 100755 index 000000000..05cfa16e5 Binary files /dev/null and b/libastroasis/mac/liboasisfocuser.bin differ diff --git a/libastroasis/x64/liboasisfilterwheel.bin b/libastroasis/x64/liboasisfilterwheel.bin index 860eb23e0..23716b740 100644 Binary files a/libastroasis/x64/liboasisfilterwheel.bin and b/libastroasis/x64/liboasisfilterwheel.bin differ diff --git a/libastroasis/x64/liboasisfocuser.bin b/libastroasis/x64/liboasisfocuser.bin index d5891b493..2d4969f35 100755 Binary files a/libastroasis/x64/liboasisfocuser.bin and b/libastroasis/x64/liboasisfocuser.bin differ