See the cloud document of this article at https://note.youdao.com/share/?token=48C579B49B5840609AB9B6D7D375B742&gid=7195236
In this document We suppose the filter position is from 1 to N. For example. the QHYCFW3S-7(1.25inch) filter has 7 posiiton. The position is 1,2,3,4,5,6,7 . For QHYCFW2 and QHYCFW3, the filter posiiton is marked on the disk.
In this document We suppose the filter position is from 1 to N. For example. the QHYCFW3S-7(1.25inch) filter has 7 posiiton. The position is 1,2,3,4,5,6,7 . For QHYCFW2 and QHYCFW3, the filter posiiton is marked on the disk.
1. Get to know if there is the Filter wheel connected on the QHYCFW port
uint32_t ret;
ret = IsQHYCCDCFWPlugged(h);
if (ret==QHYCCD_SUCCESS ) printf(“Found CFW”);
else prinf(“no CFW found”):
Supported CFW: QHYCFW2,QHYCFW3, internal CFW of QHY “A” series, miniCAM5F/6F
Supported Camera: The camera with 4PIN QHYCFW socket. “A“ series, miniCAM5F/6F
For QHY9, no matter to connec QHYCFW1/2/3, it has no a detection method to get to know if the CFW connect. So it will always return QHYCCD_SUCCESS (CFW connected)
2. Get to know how many filter slot that the connected filter wheel has
double maxslot;
maxslot=GetQHYCCDParam(h, CONTROL_CFWSLOTSNUM);
for example, if the filter wheel has 5 position. The maxslot will be 5.
Note: Currently Only support QHY 4PIN socket + external CFW (eg. QHY183M+CFW2/3 etc) and QHY16803A QHY09000A QHY90A . For all camera which do not supported, it will return 9 (9 positions)
3.Send the GOTO command
You can send an ASCII character . The range is ‘0’ to ‘F’ . ‘0’ is position 1. ‘F’ is position 16.
uint32_t ret;
char targetpos[1];
cfwcommand[0]=’0′;
ret = SendOrder2QHYCCDCFW(m_CameraHandle, &targetpos, 1);
Please note the currentPos is the ASCII charactor. The range from ‘0’ to ‘f’.
ASCII
|
‘0’
|
‘1’
|
‘2’
|
‘3’
|
‘4’
|
‘5’
|
‘6’
|
‘7’
|
‘8’
|
‘9’
|
‘A’
|
‘B’
|
Filter Position
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
4.Get to know the current position of the filter wheel
uint32_t ret;
char currentPos[64];
ret = GetQHYCCDCFWStatus(h, currentPos);
printf (“current Position in ASCII %c”,)
Please note the currentPos is the ASCII charactor. The range from ‘0’ to ‘F’.
ASCII
|
‘0’
|
‘1’
|
‘2’
|
‘3’
|
‘4’
|
‘5’
|
‘6’
|
‘7’
|
‘8’
|
‘9’
|
‘A’
|
‘B’
|
Filter Position
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
5.When send command to the CFW to start rotating. How to know if the CFW has arrived the target position?
You can use the GetQHYCCDCFWStatus in a loop to check the current postion. And if the current position == target position (both in ASCII character), it shows the CFW arrived the target position.
To avoid a dead loop. You can make a timeout to let it come out when the timeout period comes. But it is best to let the timeout enough long. For some slow CFW it may need some times. We recommand 25sec timeout period.
To avoid too fast USB IO call. You can add a SLEEP during this loop checking.
Here is some sample codes which used in the indi-qhyccd, for a reference
bool QHYCCD::SelectFilter(int position)
{
char targetpos = 0;
char currentpos[64] = {0};
int checktimes = 0;
int ret = 0;
if (isSimulation())
ret = QHYCCD_SUCCESS;
else
{
// JM: THIS WILL CRASH! I am using another method with same result!
//sprintf(&targetpos,”%d”,position – 1);
targetpos = ‘0’ + (position – 1);
ret = SendOrder2QHYCCDCFW(m_CameraHandle, &targetpos, 1);
}
if (ret == QHYCCD_SUCCESS)
{
while (checktimes < 50)
{
ret = GetQHYCCDCFWStatus(m_CameraHandle, currentpos);
LOGF_DEBUG(“%s: checking position %c target position(int) %d target position(char) %c”, camid, currentpos[0],position,targetpos);
if (ret == QHYCCD_SUCCESS)
{
if (targetpos == currentpos[0])
{
break;
}
}
usleep(1000*500);
checktimes++;
}
CurrentFilter = position;
SelectFilterDone(position);
LOGF_DEBUG(“%s: Filter changed to %d”, camid, position);
return true;
}
else
LOGF_ERROR(“Changing filter failed (%d)”, ret);
return false;
}