Skip to content

Commit

Permalink
ZWO ASI Cameras: update SDK to version 1.37
Browse files Browse the repository at this point in the history
  • Loading branch information
agalasso committed Feb 17, 2025
1 parent e2ef6f5 commit a6bfd6a
Show file tree
Hide file tree
Showing 19 changed files with 135 additions and 12 deletions.
Binary file removed WinLibs/ASICamera2.dll
Binary file not shown.
21 changes: 16 additions & 5 deletions build/unpack_zwo_libs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ MAC=
WIN=
while [ $# -gt 0 ]; do
case $1 in
*ASI_Camera_SDK.zip)
# combined
TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' EXIT
unzip -d "$TMP" "$1"
shift
"$0" "$TMP/ASI_Camera_SDK/ASI_linux_mac_SDK"* "$TMP/ASI_Camera_SDK/ASI_Windows_SDK"*
exit
;;
*ASI_linux_mac_SDK_*.tar.bz2) MAC=$1; shift ;;
*ASI_Windows_SDK_*.zip) WIN=$1; shift ;;
*) usage ;;
Expand All @@ -39,12 +48,14 @@ TMP=$TOP/tmp/zwosdk
mkdir -p "$TMP"/win "$TMP"/mac
trap 'rm -rf "$TMP"' INT TERM QUIT EXIT

DEST=$TOP/cameras/zwolibs

# windows
if [ -n "$WIN" ]; then
unzip -q -d "$TMP"/win "$WIN"
cp "$TMP/win/ASI SDK/include/ASICamera2.h" "$TOP"/cameras/
cp "$TMP/win/ASI SDK/lib/x86/ASICamera2.lib" "$TOP"/cameras/
cp "$TMP/win/ASI SDK/lib/x86/ASICamera2.dll" "$TOP"/WinLibs/
cp "$TMP/win/ASI SDK/include/ASICamera2.h" "$DEST"/include/
cp "$TMP/win/ASI SDK/lib/x86/ASICamera2.lib" "$DEST"/win/x86/
cp "$TMP/win/ASI SDK/lib/x86/ASICamera2.dll" "$DEST"/win/x86/
fi

# osx and linux
Expand All @@ -58,11 +69,11 @@ if [ -n "$MAC" ]; then
fi
# linux: use static libs
for d in armv6 armv7 armv8 x64 x86; do
cp "$TMP"/mac/"$root"/lib/$d/libASICamera2.a "$TOP"/cameras/zwolibs/$d/
cp "$TMP"/mac/"$root"/lib/$d/libASICamera2.a "$TOP"/cameras/zwolibs/linux/"$d"/
done
# mac: use dynamic libs
for d in mac; do
# follow symbolic link
cp "$TMP"/mac/"$root"/lib/$d/libASICamera2.dylib "$TOP"/cameras/zwolibs/$d/
cp "$TMP"/mac/"$root"/lib/"$d"/libASICamera2.dylib "$TOP"/cameras/zwolibs/"$d"/
done
fi
Binary file removed cameras/ASICamera2.lib
Binary file not shown.
Binary file removed cameras/zwolibs/armv6/libASICamera2.a
Binary file not shown.
Binary file removed cameras/zwolibs/armv7/libASICamera2.a
Binary file not shown.
Binary file removed cameras/zwolibs/armv8/libASICamera2.a
Binary file not shown.
113 changes: 111 additions & 2 deletions cameras/ASICamera2.h → cameras/zwolibs/include/ASICamera2.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ while(1)
#define ASICAMERA_API
#endif

#define ASICAMERA_ID_MAX 128
#define ASICAMERA_ID_MAX 256

typedef enum ASI_BAYER_PATTERN{
ASI_BAYER_RG=0,
Expand Down Expand Up @@ -110,6 +110,11 @@ typedef enum ASI_ERROR_CODE{ //ASI ERROR CODE
ASI_ERROR_EXPOSURE_IN_PROGRESS,
ASI_ERROR_GENERAL_ERROR,//general error, eg: value is out of valid range
ASI_ERROR_INVALID_MODE,//the current mode is wrong
ASI_ERROR_GPS_NOT_SUPPORTED, //this camera do not support GPS
ASI_ERROR_GPS_VER_ERR, //the FPGA GPS ver is too low
ASI_ERROR_GPS_FPGA_ERR, //failed to read or write data to FPGA
ASI_ERROR_GPS_PARAM_OUT_OF_RANGE, //start line or end line out of range, should make them between 0 ~ MaxHeight - 1
ASI_ERROR_GPS_DATA_INVALID, //GPS has not yet found the satellite or FPGA cannot read GPS data
ASI_ERROR_END
}ASI_ERROR_CODE;

Expand Down Expand Up @@ -170,7 +175,13 @@ typedef enum ASI_CONTROL_TYPE{ //Control type//
ASI_FAN_ON,
ASI_PATTERN_ADJUST,
ASI_ANTI_DEW_HEATER,

ASI_FAN_ADJUST,
ASI_PWRLED_BRIGNT,
ASI_USBHUB_RESET,
ASI_GPS_SUPPORT,
ASI_GPS_START_LINE,
ASI_GPS_END_LINE,
ASI_ROLLING_INTERVAL,//microsecond
}ASI_CONTROL_TYPE;

typedef struct _ASI_CONTROL_CAPS
Expand Down Expand Up @@ -204,6 +215,27 @@ typedef struct _ASI_SUPPORTED_MODE{
ASI_CAMERA_MODE SupportedCameraMode[16];// this array will content with the support camera mode type.ASI_MODE_END is the end of supported camera mode
}ASI_SUPPORTED_MODE;

typedef struct _ASI_DATE_TIME{
int Year;
int Month;
int Day;
int Hour;
int Minute;
int Second;
int Msecond;
int Usecond; //Minimum Unit 0.1us, Maximum number 9999
char Unused[64]; //Using the Unused field to store concatenated strings
} ASI_DATE_TIME;

typedef struct _ASI_GPS_DATA {
ASI_DATE_TIME Datetime;
double Latitude; // +: North Latitude -: South Latitude
double Longitude; // +: East longitude -: West longitude
int Altitude; // Minimum Unit 0.1m, Maximum number 99999
int SatelliteNum; // Maximum number 99
char Unused[64];
} ASI_GPS_DATA;

#ifndef __cplusplus
#define ASI_CONTROL_TYPE int
#define ASI_BOOL int
Expand Down Expand Up @@ -634,6 +666,38 @@ ASI_ERROR_TIMEOUT: no image get and timeout
ASICAMERA_API ASI_ERROR_CODE ASIGetVideoData(int iCameraID, unsigned char* pBuffer, long lBuffSize, int iWaitms);


/***************************************************************************
Descriptions:
get data from the video buffer.the buffer is very small
you need to call this API as fast as possible, otherwise frame will be discarded
so the best way is maintain one buffer loop and call this API in a loop
please make sure the buffer size is biger enough to hold one image
otherwise the this API will crash
Paras:
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
unsigned char* pBuffer, caller need to malloc the buffer, make sure the size is big enough
the size in byte:
8bit mono:width*height
16bit mono:width*height*2
RGB24:width*height*3
int iWaitms, this API will block and wait iWaitms to get one image. the unit is ms
-1 means wait forever. this value is recommend set to exposure*2+500ms
GPS_DATA *gpsData, if camera support GPS, the GPS data will pass to incomming parameter,
the GPS data struct is define at the top of this file.
return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_TIMEOUT: no image get and timeout
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIGetVideoDataGPS(int iCameraID, unsigned char* pBuffer, long lBuffSize, int iWaitms, ASI_GPS_DATA *gpsData);


/***************************************************************************
Descriptions:
PulseGuide of the ST4 port on. this function only work on the module which have ST4 port
Expand Down Expand Up @@ -748,6 +812,33 @@ ASI_ERROR_TIMEOUT: no image get and timeout
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIGetDataAfterExp(int iCameraID, unsigned char* pBuffer, long lBuffSize);

/***************************************************************************
Descriptions:
get data after exposure.
please make sure the buffer size is biger enough to hold one image
otherwise the this API will crash
Paras:
int CameraID: this is get from the camera property use the API ASIGetCameraProperty
unsigned char* pBuffer, caller need to malloc the buffer, make sure the size is big enough
the size in byte:
8bit mono:width*height
16bit mono:width*height*2
RGB24:width*height*3
GPS_DATA *gpsData, if camera support GPS, the GPS data will pass to incomming parameter,
the GPS data struct is define at the top of this file.
return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_TIMEOUT: no image get and timeout
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIGetDataAfterExpGPS(int iCameraID, unsigned char* pBuffer, long lBuffSize, ASI_GPS_DATA *gpsData);

/***************************************************************************
Descriptions:
get camera id stored in flash, only available for USB3.0 camera
Expand Down Expand Up @@ -932,6 +1023,24 @@ ASI_ERROR_GENERAL_ERROR : the parameter is not right
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIGetTriggerOutputIOConf(int iCameraID, ASI_TRIG_OUTPUT_PIN pin, ASI_BOOL *bPinHigh, long *lDelay, long *lDuration);

/***************************************************************************
Description:
Get the GPS data
Paras:
int CameraID: this is get from the camera property use the API ASIGetCameraProperty.
ASI_GPS_DATA* startLineGPSData: the GPS data of the start line. the start line number is set by ASISetControlValue(..., ASI_GPS_START_LINE,...). the default value is 0
ASI_GPS_DATA* endLineGPSData: the GPS data of the end line. the end line number is set by ASISetControlValue(..., ASI_GPS_END_LINE,...). the default value is MaxHeight - 1
return:
ASI_SUCCESS : Operation is successful
ASI_ERROR_CAMERA_CLOSED : camera didn't open
ASI_ERROR_INVALID_ID : no camera of this ID is connected or ID value is out of boundary
ASI_ERROR_GPS_NOT_SUPPORTED : this camera do not support GPS
ASI_ERROR_GPS_VER_ERR : the FPGA GPS ver is too low
ASI_ERROR_GPS_FPGA_ERR : failed to read or write data to FPGA
ASI_ERROR_GPS_DATA_INVALID : GPS has not yet found the satellite or FPGA cannot read GPS data
***************************************************************************/
ASICAMERA_API ASI_ERROR_CODE ASIGPSGetData(int iCameraID, ASI_GPS_DATA* startLineGPSData, ASI_GPS_DATA* endLineGPSData);
#ifdef __cplusplus
}
#endif
Expand Down
Binary file added cameras/zwolibs/linux/armv6/libASICamera2.a
Binary file not shown.
Binary file added cameras/zwolibs/linux/armv7/libASICamera2.a
Binary file not shown.
Binary file added cameras/zwolibs/linux/armv8/libASICamera2.a
Binary file not shown.
Binary file added cameras/zwolibs/linux/x64/libASICamera2.a
Binary file not shown.
Binary file added cameras/zwolibs/linux/x86/libASICamera2.a
Binary file not shown.
Binary file modified cameras/zwolibs/mac/libASICamera2.dylib
Binary file not shown.
Binary file added cameras/zwolibs/win/x86/ASICamera2.dll
Binary file not shown.
Binary file added cameras/zwolibs/win/x86/ASICamera2.lib
Binary file not shown.
Binary file removed cameras/zwolibs/x64/libASICamera2.a
Binary file not shown.
Binary file removed cameras/zwolibs/x86/libASICamera2.a
Binary file not shown.
2 changes: 1 addition & 1 deletion src/cam_zwo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#ifdef ZWO_ASI

# include "cam_zwo.h"
# include "cameras/ASICamera2.h"
# include "ASICamera2.h"

# ifdef __WINDOWS__

Expand Down
11 changes: 7 additions & 4 deletions thirdparty/thirdparty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,10 @@ if(WIN32)
list(APPEND PHD_LINK_EXTERNAL ${PHD_PROJECT_ROOT_DIR}/cameras/ShoestringLXUSB_DLL.lib)
list(APPEND PHD_COPY_EXTERNAL_ALL ${PHD_PROJECT_ROOT_DIR}/WinLibs/ShoestringLXUSB_DLL.dll)

# ASI cameras
list(APPEND PHD_LINK_EXTERNAL ${PHD_PROJECT_ROOT_DIR}/cameras/ASICamera2.lib)
list(APPEND PHD_COPY_EXTERNAL_ALL ${PHD_PROJECT_ROOT_DIR}/WinLibs/ASICamera2.dll)
# ZWO ASI cameras
list(APPEND PHD_LINK_EXTERNAL ${PHD_PROJECT_ROOT_DIR}/cameras/zwolibs/win/x86/ASICamera2.lib)
list(APPEND PHD_COPY_EXTERNAL_ALL ${PHD_PROJECT_ROOT_DIR}/cameras/zwolibs/win/x86/ASICamera2.dll)
include_directories(${PHD_PROJECT_ROOT_DIR}/cameras/zwolibs/include)

# ToupTek cameras
list(APPEND PHD_LINK_EXTERNAL ${PHD_PROJECT_ROOT_DIR}/cameras/toupcam/win/x86/toupcam.lib)
Expand Down Expand Up @@ -780,6 +781,7 @@ if(APPLE)
if(NOT asiCamera2)
message(FATAL_ERROR "Cannot find the asiCamera2 drivers")
endif()
include_directories(${PHD_PROJECT_ROOT_DIR}/cameras/zwolibs/include)
add_definitions(-DHAVE_ZWO_CAMERA=1)
list(APPEND PHD_LINK_EXTERNAL ${asiCamera2})
list(APPEND phd2_OSX_FRAMEWORKS ${asiCamera2})
Expand Down Expand Up @@ -919,12 +921,13 @@ if(UNIX AND NOT APPLE)
find_library(asiCamera2
NAMES ASICamera2
NO_DEFAULT_PATHS
PATHS ${PHD_PROJECT_ROOT_DIR}/cameras/zwolibs/${zwoarch})
PATHS ${PHD_PROJECT_ROOT_DIR}/cameras/zwolibs/linux/${zwoarch})

if(NOT asiCamera2)
message(FATAL_ERROR "Cannot find the asiCamera2 drivers")
endif()
message(STATUS "Found ASICamera2 lib ${asiCamera2}")
include_directories(${PHD_PROJECT_ROOT_DIR}/cameras/zwolibs/include)
add_definitions(-DHAVE_ZWO_CAMERA=1)
list(APPEND PHD_LINK_EXTERNAL ${asiCamera2})

Expand Down

0 comments on commit a6bfd6a

Please sign in to comment.