Bugfix for Focus stage driver for ZeissCAN

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Bugfix for Focus stage driver for ZeissCAN

Martin Kielhorn
Hi,
I think the current ZeissCAN device adapter doesn't handle negative positions correctly.
When we tried to aquisition a z-stack from -5 to 5 um the stage didn't move in the first half of the images.
I think I corrected it by adding the following two lines to micromanager1.3/DeviceAdapters/ZeissCAN/ZeissCAN.cpp:
if(steps<0)
     steps=steps+0xffffff+1;


int FocusStage::SetPositionSteps(long steps)
{
   // the hard part is to get the formatting of the string right.
   // it is a hex number from 800000 .. 7FFFFF, where everything larger than 800000 is a negative number!?
   // We can speed up communication by skipping leading 0s, but that makes the following more complicated:
   char tmp[98];
   // convert the steps into a twos-complement 6bit number
   if(steps<0)
     steps=steps+0xffffff+1;
 
   snprintf(tmp, 9, "%08lX", steps);
   string tmp2 = tmp;
   ostringstream cmd;
   cmd << "FPZT" << tmp2.substr(2,6).c_str();
   int ret = g_hub.ExecuteCommand(*this, *GetCoreCallback(),  cmd.str().c_str());
   if (ret != DEVICE_OK)
      return ret;

   return DEVICE_OK;
}

--
Martin Kielhorn
Randall Division of Cell & Molecular Biophysics
King's College London, New Hunt's House
Guy's Campus, London SE1 1UL, U.K.
tel: +44 (0) 207 848 6519,  fax: +44 (0) 207 848 6435

------------------------------------------------------------------------------

_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Bugfix for Focus stage driver for ZeissCAN

Nico Stuurman-4
Hi Martin,

> I think the current ZeissCAN device adapter doesn't handle negative  
> positions correctly.
> When we tried to aquisition a z-stack from -5 to 5 um the stage  
> didn't move in the first half of the images.
> I think I corrected it by adding the following two lines to  
> micromanager1.3/DeviceAdapters/ZeissCAN/ZeissCAN.cpp:
> if(steps<0)
>      steps=steps+0xffffff+1;

Thanks for spotting the bug and fixing it!

Committed to the repository, should be in today's or tomorrow's  
nightly build.  Let me know if anyone experience unexpected behavior  
with the ZeissCAN Z-drive.

Best,

Nico


------------------------------------------------------------------------------
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general