supplierdeeply

A800 Porting Thread

  • 277 Replies
  • 29776 Views
  • Publish
    Re: A800 Porting Thread
    « Reply #250 on: 24 / May / 2012, 19:54:12 »
    Advertisements
    Qanthelas, I used trunk 1863. As I don’t know possible side effects of not calling the firmware routine, I prefer to block them in a higher level, at shooting_set_zoom.
    I added to the full compiled version the 2 modified files: core\shooting.c e platform\generic\wrappers.c. The modifications are indicated by <<====.

    *

    Offline reyalp

    • ******
    • 9963
  • Publish
    Re: A800 Porting Thread
    « Reply #251 on: 24 / May / 2012, 23:13:45 »
    I have done some more tests. I have identified that the Voltage drop is associate with the calling of _MoveFocusLensToDistance((short*)&newpos) in wrappers.c in the sequence shooting_set_zoom => shooting_set_focus(dist, SET_NOW) => lens_set_focus_pos(s). So, not calling this function I have seen no Voltage drop. As I don’t know the program logic, what are the implications of not calling shooting_set_focus(dist, SET_NOW) in shooting_set_zoom ? (By the way, not calling lens_set_zoom_point(v); in shooting_set_zoom but calling just shooting_set_focus this voltage problem occurs).
      In lens_set_zoom_point in wrappers.c, adding || defined (CAMERA_a800) similar to the ixus220 (and not making also the call above mentioned)  the zoom scripts worked fine and the camera hangs no more. What shall I do to test if this is a valid modification ?
    Good work. AFAIK the reason for calling setfocus is that normally if you change the zoom, the focus position is lost.

    It would be interesting to know if SD override also causes the voltage drop.
    Don't forget what the H stands for.

  • Publish
    Re: A800 Porting Thread
    « Reply #252 on: 26 / May / 2012, 01:16:25 »
    It would be interesting to know if SD override also causes the voltage drop.

    I have done the test and indeed the voltage drops.
      I have programmed SD -> Voltage normal
      I press slightly (and keep slightly pressed) the shooting button and Focus is adjusted(?). Voltage Normal.
      I release the button. Voltage drops.
      Recovering: if it is possible some optical Zoom in and I press Zoom in the voltage goes back to normal. Also if it is possible some optical zoom out and I press zoom out. So moving optical zoom gears restores the normal power consumption.

    *

    Offline reyalp

    • ******
    • 9963
  • Publish
    Re: A800 Porting Thread
    « Reply #253 on: 27 / May / 2012, 00:30:57 »
    FWIW, it has been noted previously that manual focus (in the canon firmware, unrelated to CHDK overrides) draws noticeably more power than AF. No idea if this is related.
    Don't forget what the H stands for.


  • Publish
    Re: A800 Porting Thread
    « Reply #254 on: 13 / June / 2012, 02:03:17 »
    Does focus-bracketing work with the A800 (set_focus x in .bas script) and the latest build?  I'm hoping to do both exposure and focus bracketing of macro photos if I buy this camera.

    Could someone run the following script and report back whether you see the reported focus range changing "Focus=x-y":

    Code: [Select]
    @title focusTest script
    @default a 0
    @default b 90
    @default n 10
    @default z 10

    print "focusTest"

    rem --- camera setup before test ----------------------------------------
    rem   camera in Canon Manual Mode
    rem   <alt> "up" to put camera into manual focus mode

    rem set_focus doesn't work with sd500/ixus700
    rem http://chdk.setepontos.com/index.php?topic=273.0
    rem http://chdk.setepontos.com/index.php?topic=6439.0

    rem --- useage -----------------------------------------------------------
    rem  set b= starting base focus point in mm (when a=0)
    rem  set n= focus steps to be made in z mm increments
    rem  set z= step size increments in mm
    rem
    rem  used vars list: ..c.e..h..klm.o.....uvw...
    rem  a^ b^ d=dof f=focusmd g=focus i=index j=index n^ p=apertureVal
    rem  q=nearlimit r=farlimit s=scene
    rem  t=timeval x=nearlimit y=farlimit z^


    rem --- go into macro mode -----------------------------------------------
    rem get_focus_mode: 0=auto,1=MF,3=inf??,4=macro,5=supermacro
    f=get_focus_mode
    if f=4 then goto "skipMacroMd"
      click "left"
      sleep 300
      click "left"
      sleep 200
    :skipMacroMd

    rem --- turn off nd filter (stops cam from white balancing bkgrnd) -------
    rem 0=off/auto 1=in 2=out
    set_nd_filter 2

    rem --- fetch automatic params that cam would set ------------------------
    press "shoot_half"
    sleep 1000
    x=get_near_limit
    y=get_far_limit
    d=get_dof
    get_av96 p
    get_sv96 s
    get_tv96 t
    release "shoot_half"

    rem --- take darker(faster) shots optionally at difft focus points -------
    rem for i=0 to 4
      let i=2
      for j=0 to n

        g= (j*z)+b
        set_focus g
        rem sleep required after changing focus
        sleep 500
        q=get_near_limit
        r=get_far_limit
        print "Focus=",q,"-",r

      set_tv96_direct t+(i*32)
      set_sv96 s
      set_av96 p
      set_nd_filter 2
      shoot
      sleep 2000
      next j
    rem next i

    rem --- all done! --------------------------------------------------------
    set_aflock 0
    print "AutoFocusLimits were ",x,"mm-",y,"mm"
    end


    Note: I edited this script to remove the exposure bracketing mentioned in the comments.

    Also, not sure if helpful:  The SD500 has a similar focus problem to what seems to be mentioned here where the camera would crash after focus settings were changed.  Some found that changing the zoom before/after the focus change would prevent crashes (but I cannot get it to work).  May be related to the power issue mentioned above.  To read more on the SD500 issue see http://chdk.setepontos.com/index.php?topic=273.30  (reply#38).


    Thank you!
    « Last Edit: 13 / June / 2012, 02:17:29 by montana »

  • Publish
    Re: A800 Porting Thread
    « Reply #255 on: 15 / June / 2012, 00:08:18 »
    Could someone run the following script and report back whether you see the reported focus range changing "Focus=x-y":

    I've successfully used the A800 for focus stacking using a script to set min and max focus distances and no of steps. I also ran your FocusTest script and it did work OK, reporting  "Focus=x-y" at each step.  I was running CHDK_DE 1.1.0 rev 1855.  Hope this helps.




  • Publish
    Re: A800 Porting Thread
    « Reply #256 on: 15 / June / 2012, 02:09:39 »
    Thanks Devon.   Next stop amazon.com...  :)

    --

    I have a theory about the power issue which may be common to all cams with no manual focus (based on zero knowledge of how any of this works):

    1) assume that there is one stepper motor to drive both the zoom mechanism and the focus mechanism
    2) assume that there is a solenoid, that gets activated and pushes against a spring, to engage the motor gear to the focus mechanism, for brief moments of focus for every shot (using a lot of power, but, controlled by canon fw developers, to only be activated for a short time)
    3) my theory is that the code snippet that CHDK calls to set focus, activates the solenoid but doesn't release it, since, the release solenoid code is somewhere in the canon zoom routine code (perhaps to add a small delay before releasing)

    Something like:
    Code: [Select]
    void canon_set_focus_code(int focusVal) {
      turnOn_focusSolenoid();
      turnMotorTo(focusVal);
      //theory is that set focus code returns without releasing the focus solenoid
    }

    void canon_set_zoom_code(int zoomVal) {
        turnMotorTo(zoomVal)
        focusVal=determineRequiredFocusSetting();
        canon_set_focus_code(focusVal);
        turnOff_focusSolenoid();  //<<< theory is that release of focus solenoid is here instead of above
    }

    I did install chdk-shell and attempted to figure out whether this theory had any merit with my current SD500 cam but ran out of energy when I discovered that the disassembled camera code is not included with the environment (at least I couldn't find it, but did find the binary file via the SD500 page, but not disassembled).
    « Last Edit: 15 / June / 2012, 02:19:31 by montana »

    *

    Offline reyalp

    • ******
    • 9963
  • Publish
    Re: A800 Porting Thread
    « Reply #257 on: 15 / June / 2012, 23:06:52 »
    I have a theory about the power issue which may be common to all cams with no manual focus (based on zero knowledge of how any of this works):

    1) assume that there is one stepper motor to drive both the zoom mechanism and the focus mechanism
    2) assume that there is a solenoid, that gets activated and pushes against a spring, to engage the motor gear to the focus mechanism, for brief moments of focus for every shot (using a lot of power, but, controlled by canon fw developers, to only be activated for a short time)
    3) my theory is that the code snippet that CHDK calls to set focus, activates the solenoid but doesn't release it, since, the release solenoid code is somewhere in the canon zoom routine code (perhaps to add a small delay before releasing)
    Speculation without analyzing the firmware is unlikely to be useful. If you have the knowledge required to understand the disassembly, lack of a disassembled file should not be an obstacle.

    The actual CHDK code just calls an event proc from the Canon firmware like MoveFocusLensToDistance. If there is a corresponding function that needs to be called at the end of the move, it's not obvious. There are however a lot of focus related eventprocs, here's soem examples from greping "FocusLens" in the D10 dump...
    Code: [Select]
    SetFocusLensSpeed
    GetFocusLensPullInMaxSpeed
    MoveFocusLensWithDistance
    GetFocusLensLoadSubjectDistance
    GetFocusLensSubjectDistance
    GetFocusLensHoldVoltage
    SetFocusLensHoldVoltage
    GetFocusLensDriveVoltage
    SetFocusLensDriveVoltage
    EnableFocusLensGainLockWithVoltage
    GetFocusLensResetVoltage
    GetFocusLensSettingWaitVoltage
    SetFocusLensSettingWaitVoltage
    SetFocusLensSpeedTable
    ShowFocusLensCurrentSpeedTable
    GetFocusLensLoadCamTable
    SetFocusLensDefaultPullOutTable
    MoveFocusLensToTerminate
    MoveFocusLensWithPositionWithoutBacklash
    EnableFocusLensWaveLock
    DisableFocusLensWaveLock
    DisableFocusLensGainLock
    SetFocusLensCondition
    MoveFocusLensWithPosition
    GetFocusLensMoveMinPosition
    GetFocusLensResetPosition
    GetFocusLensResetDefaultPosition
    GetFocusLensCurrentPosition
    GetFocusLensMoveMaxPosition
    GetFocusLensPositionRatio
    GetFocusLensSubjectDistanceNumber
    EnableFocusLens
    DisableFocusLens
    EscapeFocusLens
    ResetFocusLens
    CancelFocusLensMaxSpeedLimit
    SetFocusLensMaxSpeedLimit
    MoveFocusLensToPositionWithSpeed
    MoveFocusLensToPositionWithMaxSpeed
    MoveFocusLensToDistance
    IsFocusLensOutSidePosition
    MoveFocusLensToTerminatePosition
    MoveFocusLensToPosition
    GetCurrentFocusLensPosition
    ReloadFocusLensAdjustment
    *HoldVoltage and *DriveVoltage ? Hmmm

    If you build an eventproc enabled build, you can play with these interactively using ptp.  At your own risk, of course... if something in CHDK is going to be dangerous, fiddling with the lens control is probably high on the list. I would stay away from the ones with "adjustment" in the name, these likely relate to factory adjustment stored in flash.
    Don't forget what the H stands for.


  • Publish
    Re: A800 Porting Thread
    « Reply #258 on: 17 / June / 2012, 18:50:04 »
    Quote
    Speculation without analyzing the firmware is unlikely to be useful. If you have the knowledge required to understand the disassembly, lack of a disassembled file should not be an obstacle.

    I agree with both your points.  Lack of time and the time required to gain the required knowledge of CHDK is my only obstacle.

    Once I have time I'll play around with doing something like this:

    Code: [Select]
    //Inside core/shooting.c modify shooting_set_focus()
    //I am assuming that this fn gets called when set_focus is called within a .bas script...
    void shooting_set_focus (int v, short is_now)
    {
    ... (existing code)...
    //place the following at the very end of this routine
    #ifdef CAM_NEEDS_FOCUS_SOLENOID_RELEASE
    ExecuteEventProcedure("GetFocusLensResetVoltage"); //not sure if this is correct syntax
    #endif
    }

    //inside platform/ixus700_sd500/platform_camera.h  (SD500 will be test cam once new A800 arrives)
    //#undef CAM_CAN_SD_OVERRIDE
    #define CAM_CAN_SD_OVERRIDE
    #define CAM_NEEDS_FOCUS_SOLENOID_RELEASE

    In a .bas script, the SD500 will hang if you attempt to shoot after a set_focus call (with build where CAM_CAN_SD_OVERRIDE is defined).  So it should be a quick test.  If it works I'll follow up with a multimeter and perform a current use check before and after the code change.
    « Last Edit: 17 / June / 2012, 19:07:17 by montana »

  • Publish
    Re: A800 Porting Thread
    « Reply #259 on: 20 / June / 2012, 10:09:38 »
    I only have the A800 so don't know if this is unique to only this camera.

    I noticed the numbering of image files does not always continue where I left off if I remove all the images from the card and continue shooting. I have been shooting a time-lapse an image every 15 min during daylight since March. The camera is still crashing on me. anywhere from 1 hour to 4 days between crashes.

    If I remove all the images from the card the numbering starts at IMG_0650.JPG

    As a work around I have been leaving the last image on the card and deleting the rest. I can tell that at the beginning the count started at 0000.

     

    Related Topics