Programmatic changing configurations in Maxim

Discussion in 'Scripting and Programming' started by dwormuth, Feb 18, 2016.

  1. dwormuth

    dwormuth Cyanogen Customer

    Joined:
    Feb 18, 2016
    Messages:
    7
    Location:
    Syracuse, NY
    Is there a COM method to programmatically determine the current configuration and change the current active configuration?


    Sent from my iPhone using Tapatalk
     
  2. Tim

    Tim Staff Member

    Joined:
    Sep 25, 2014
    Messages:
    1,431
    No, there is currently no COM method for changing the active configuration.

    If you need to change it from outside MaxIm DL gui, the only way to do it is via script. You would need to shutdown MaxIm DL, edit the registry entry listed below with the desired configuration name, and then restart MaxIm DL.

    HKEY_CURRENT_USER\SOFTWARE\Diffraction Limited\MaxIm DL 6\CurrentVersion\CurrentConfig
     
  3. DaveLane

    DaveLane Cyanogen Customer

    Joined:
    Sep 6, 2016
    Messages:
    21
    Location:
    Halifax, NS
    In searching for a solution for how to do this, I found this post from last year.

    While changing the registry entry changes the text displayed in the File->Configurations... dialog box "save current configurations" field, it does not change the actual configuration. I have found that you have to copy the associated configuration text files to effect an actual change in the configuration settings.

    These files are found in:

    c:\Users\USERNAME\Documents\MaxIm DL 6\Settings\

    c:\Users\USERNAME\Documents\MaxIm DL 6\Settings\MaxIm CCD\

    and others sub-directories for more obscure settings.

    The files are named CONFIGTYPE,CONFIGNAME.txt. To effect change, you need to copy the files to just CONFIGTYPE.txt. For example "CameraControl,CG16M.txt" needs to be copied to just CameraControl.txt in the same directory.

    If you are only interested in changing the camera and other control-type settings (but not the image processing or other settings), only copying the files in the "MaxIm CCD" directory seems to do the trick.

    --- Dave
     
  4. Horst Ziegler

    Horst Ziegler Cyanogen Customer

    Joined:
    Jun 11, 2015
    Messages:
    22
    Location:
    Mondsee Austria
    Hi,

    I can store 2 different Setups with 2 different config names.
    I then can open the desired configuration and MaxIm DL will restart with the correct Setup.
    Is it possible to start MaxIm DL via script with the desired config?

    Thanks and regards
    Horst
     
  5. DaveLane

    DaveLane Cyanogen Customer

    Joined:
    Sep 6, 2016
    Messages:
    21
    Location:
    Halifax, NS
    Horst,

    As Tim noted above, you can't to this by MaxIm scripting. I have been able to do this with my own script (in my Abbey Ridge Auto-Pilot software) successfully using the algorithm that I noted above. If you are stuck and need to do this, I can probably make available my software and script (that could be run from a cmd line)

    Dave
     
  6. Horst Ziegler

    Horst Ziegler Cyanogen Customer

    Joined:
    Jun 11, 2015
    Messages:
    22
    Location:
    Mondsee Austria
    Dave,

    it is hard to understand, why Diffraction is not able to offer such a simple but important function. It is just to call the 'File / Configuration / Load' function from outside via script.
    I use CCDCommander / FocusMax / MaxImDL and 2 Setups on my EQ8 (Esprit120 with Moravian 8300 and Esprit100 with Moravian 16200.
    One day I like to take a widefield Image with setup2 (Esprit100) and the other day a closeup with setup1 (Esprit120)
    Today I have to manually start MaxIm first, toggle the camara control and Setup the camera, then to start FocusMax and open the correct configuration and finally to start CCDCommander and run the Actions. CCDCommander could do everything with Scripting automatically if scripts were available.

    Thanks and regards
    Horst
     
  7. Doug

    Doug Staff Member

    Joined:
    Sep 25, 2014
    Messages:
    3,258
    Configuration / Load requires a restart of MaxIm DL, which would explode the COM interface.
     
  8. Horst Ziegler

    Horst Ziegler Cyanogen Customer

    Joined:
    Jun 11, 2015
    Messages:
    22
    Location:
    Mondsee Austria
    So I have to live with manual handling of the process before I can start CCDC. Because it is not only the exchange of the camera but also concerns the imaging processes Dave's solution seems not to be practicable for me
    It's a pity

    Thanks and regards
    Horst
     
  9. DaveLane

    DaveLane Cyanogen Customer

    Joined:
    Sep 6, 2016
    Messages:
    21
    Location:
    Halifax, NS
    It would not explode the COM interface if the calling script knew it had to unload Maxim and reload for the change in configuration to become active. The challenge would be if more than one software application was connected to MaxIm.

    Horst, if CCD Commander can be disconnected from MaxIm when my script runs, it would likely work.

    Dave
     
  10. Doug

    Doug Staff Member

    Joined:
    Sep 25, 2014
    Messages:
    3,258
    So if we were to implement it, there are two scenarios:

    1. We try to shut down. This could lead to errors or even crashes in calling applications.
    2. We don't try to shut down. This would require the calling application to shut us down. It would fail if (a) the program was launched manually instead of by calling a COM object, (b) if another program was also connected, (c) if Microsoft ever screws up (never happens, right?), or (d) if the programmer doesn't read the manual (never happens, right?).

    Seems sketchy.
     
  11. DaveLane

    DaveLane Cyanogen Customer

    Joined:
    Sep 6, 2016
    Messages:
    21
    Location:
    Halifax, NS
    Doug,

    You are right, it is sketchy when the calling script doesn't control everything. What I have done in my scripts is:

    - disconnect the COM interface (I know if anything is connected or not and disconnect the other apps)
    - if MaxIm does not shutdown, I run the taskkill command
    - if after a few secs it doesn't shutdown, run taskkill again with force flag!
    - then I change configuration (copy all the config files, etc.)
    - reconnect the COM interface

    It works and is reliable for me (because the running script is in control of everything).

    Of course the better solution would be if changing the configuration didn't require MaxIm to restart, but I understand it was probably a heck of a lot easier :) to just restart (given the bunch of hardware that might be connected).

    I think the underlying issue is MaxIm only supporting fully one camera at at time. Yes, the Guider Camera is there, but the software interface is all different (and there was a show stopper bug, now fixed). Also connecting requires both cameras to be connected at the same time. If you could have any number of cameras configured and connect to each individually and operate with the same software interface it would be more flexible.

    The way I have my multi-camera code working now (still testing) is when a camera switch is needed, there is a time penalty to disconnect, shutdown Maxim, change config, restart Maxim, reconnect, etc. Also from what I can tell so far, the camera drivers leave the cooler on when I disconnect and switch cameras. I am not 100% certain this works in all cases!

    I've been scripting Maxim now for about 13-14 years for quite sophisticated robotic observatories (only observatories in the world that are operated entirely from Twitter/Facebook!) and so far I've been able to do everything I have wanted to do with few work arounds or other software (PinPoint)!

    MaxIm is top tier for camera (and observatory) control and scripted processing/calibration --- I think dev focus should be on improving these features. MaxIm is behind on the sophisticated pretty picture processing (the likes of PixInsight, Images Plus, etc.). It would be hard to catch up on that front.

    Anyway, my rambling message is done!

    --- Dave
     
  12. Bob Denny

    Bob Denny Cyanogen Customer

    Joined:
    Oct 12, 2014
    Messages:
    489
    Location:
    DC-3 Dreams, SP, Mesa, Arizona +1 480 396 9700
    I have done this using a COM scriptable program called AutoIt. Within an ACP observing run, I can drop my connection to MaxIm's camera object, load a new MaxIm Configuration, stop and restart MaxIm, reconnect to the camera, and press on. The secret is that AutoIt is scriptable. The other secret is that ACP does not use any of MaxIm's observatory control (since it is itself an observatory control system among other things :)). I set this up as part of an as yet unfinished project for mixing spectrographic observations with normal image acquisition. I am waiting on hardware and low level control to be completed.
     
  13. Doug

    Doug Staff Member

    Joined:
    Sep 25, 2014
    Messages:
    3,258
    Believe it or not, MaxIm DL is 20 years old. October 1, 1997 was the official release date for Version 1.

    Any program so old has a substantial architectural legacy, resulting from decisions made when the world was a very different place. We've had a refactoring project going on the camera controls for some time (years actually). It's kinda like rebuilding a highway without closing it. Eventually it will be possible to fully support multiple cameras, but there's still a lot to do.

    And yes, we've chosen to concentrate our efforts on equipment control, scripting, and image pre-processing - all the stuff you need to do to generate the highest-quality data. We leave the more artistic stuff to Photoshop and similar programs.
     
  14. DaveLane

    DaveLane Cyanogen Customer

    Joined:
    Sep 6, 2016
    Messages:
    21
    Location:
    Halifax, NS
    (hope that is 97, not 77!)

    I believe it - my own ECU Planetarium turned 25 years this past March. I think I bought nearly the first version of MaxIm.

    I just check my CD stack and found a CD with copyright 1997 CD (clearly I have to clean my office more frequently!) --- Dave

    [​IMG]
     

    Attached Files:

  15. Doug

    Doug Staff Member

    Joined:
    Sep 25, 2014
    Messages:
    3,258
    LOL date fixed.

    We distributed on floppy disks at the beginning, so that's not your original disk.

    You are customer #84, purchased December 22, 1997. Version 1.41 (the 7th release).
     
  16. DaveLane

    DaveLane Cyanogen Customer

    Joined:
    Sep 6, 2016
    Messages:
    21
    Location:
    Halifax, NS
    I guess I will have to check my floppy library at home!!!
     
  17. Horst Ziegler

    Horst Ziegler Cyanogen Customer

    Joined:
    Jun 11, 2015
    Messages:
    22
    Location:
    Mondsee Austria
    Dave,

    I use CCDCommander for fully automated Image processing. That was my plan at least.
    The sequence as defined in the Setup of CCDC is the following:

    - CCDC is started
    - CCDC calls MaxIm to control the camera as selected in MaxIm
    - CCDC calls FocusMax to control the autofocus (alternatively autofocus with MaxIm which i also used)
    - CCDC calls the Ascom driver to control the EQ8 Mount

    That means, the main system to control everythin is CCDC and scripting to select different camera setups should be placed here.
    All other solutions would mean manual input or additional scripting elsewhere but not integrated in the automated process flow
    CCDC is able to run external scripts as first Action. I would need such a script.
    I should also talk to Tom How, who developed the Maxim DL Multiple Camera Synchronisation which I also used, but on 2 Computers.

    Thanks and regards
    Horst
     
  18. Colin Haig

    Colin Haig Cyanogen Customer

    Joined:
    Oct 27, 2014
    Messages:
    989
    Oh geez... I've been a customer of both Dave and Doug for years... and am just starting to throw out the floppies. And Desktop Universe too ;-)
     
  19. Doug

    Doug Staff Member

    Joined:
    Sep 25, 2014
    Messages:
    3,258
    I still use Desktop Universe!
     
    Bob Denny likes this.

Share This Page