A1400 porting thread - page 13 - DryOS Development - CHDK Forum

A1400 porting thread

  • 130 Replies
  • 41865 Views
Re: A1400 porting thread
« Reply #120 on: 11 / June / 2015, 18:47:26 »
Advertisements
Reading back through this porting thread,  there are a lot of posts from January 2014 about problems with set_zoom( ).  There does not seem to be anything suggested those problems were solved.  Clearly, this is not a new issue.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: A1400 porting thread
« Reply #121 on: 12 / June / 2015, 02:17:45 »
Hi both cameras zoom perfectly without the chdk script. It's only when I load it that the zoom sees to induce a crash, or doesn't work at all. I'll copy slowzoom.lua to the forum later today.

Re: A1400 porting thread
« Reply #122 on: 12 / June / 2015, 08:19:49 »
Hi

Here is the code for the slow zoom script I've been using:

Code: [Select]
--[[

 Slow Zoom Video v1.2

@title Slow Zoom Video 1.2
@param    z Zoom Step (1/10%)
 @default z 10
 @range   z 1 100
@param    r Zoom Step Delay (mSec)
 @default r 500
 @range   r 10 2000
--]]
 
zoom_step = z
zoom_delay = r

zoom_timer = 0
zoom_position_percent = 0
zoom_position_step = 0

function restore()
    if get_movie_status() == 4 then StartStopVideo() end
    set_draw_title_line(1)   
end

function update_status_line(msg)
    local x = (get_gui_screen_width() - string.len(msg)*8)/2
    local y = get_gui_screen_height()-16
    draw_string(x, y,msg,258,265)
end

function StartStopVideo()
    local rec, vid = get_mode()
    local vid_button = get_video_button()
    if rec and vid and vid_button == 0 then
        press("shoot_full")
        sleep(300)
        release("shoot_full")
    elseif rec and vid_button == 1 then
        press("video")
        sleep(300)
        release("video")
    end
end

function rezoom(step)
    if get_tick_count() > zoom_timer then
        zoom_position_percent = zoom_position_percent + step
        if(zoom_position_percent<0)   then zoom_position_percent = 0 end
        if(zoom_position_percent>1000) then zoom_position_percent = 1000 end
        zstep=((get_zoom_steps()-1)*zoom_position_percent)/1000
        if zstep ~= zoom_position_step then
            zoom_position_step = zstep
            set_zoom(zoom_position_step)
        end
        zoom_timer = get_tick_count() + zoom_delay
        --print("Zoom:"..(zoom_position_percent/10).."."..(zoom_position_percent%10).."%. Step:"..zoom_position_step)
    end
end
 
-- check CHDK release and version for compatability   
    bi=get_buildinfo()
    chdk_version = tonumber(string.sub(string.gsub(bi.build_number, "%p", ""), 0, 3))
    if ( tonumber(bi.build_revision) > 0 ) then build = tonumber(bi.build_revision)
    else build = tonumber(string.match(bi.build_number,'-(%d+)$')) end
    if (chdk_version<130) then
        error("CHDK 1.3.0 or higher required.")
    end
    if (build<3487) then   
        error("CHDK build 3487 or higher required")
    end
     
-- disable title line, console, and script exit via full press
    set_console_autoredraw(-1)
    cls()
    set_exit_key("no_key")
    set_draw_title_line(0)
    set_zoom(zoom_position_step)
    sleep(200)
 
if ( get_mode() == false ) then
    set_record(1)
    while ( get_mode() == false ) do sleep(100) end
    sleep(1000)
end
 
repeat
    update_status_line("Press MENU to exit")
    wait_click(100)
    if     is_key("set") or is_key("video") or is_key("shoot_full") or is_key("display")then StartStopVideo()
    elseif is_key("zoom_in")  then while(is_pressed("zoom_in"))  do sleep(20) rezoom( zoom_step) end
    elseif is_key("zoom_out") then while(is_pressed("zoom_out")) do sleep(20) rezoom(-zoom_step) end           
    end   
until is_key("menu")
 
restore()

Given that zooming in by slow increments works OK on the A1400, would a possible approach be to integrate the script above into the bookscanner script, so that when bookscanner.lua sets the required parameters, it sets the zoom via slow increments?


Re: A1400 porting thread
« Reply #123 on: 12 / June / 2015, 09:21:46 »
Hi

Here is the code for the slow zoom script I've been using:

Code: [Select]
...snip...
function rezoom(step)
    if get_tick_count() > zoom_timer then
        zoom_position_percent = zoom_position_percent + step
        if(zoom_position_percent<0)   then zoom_position_percent = 0 end
        if(zoom_position_percent>1000) then zoom_position_percent = 1000 end
        zstep=((get_zoom_steps()-1)*zoom_position_percent)/1000
        if zstep ~= zoom_position_step then
            zoom_position_step = zstep
            set_zoom(zoom_position_step)
        end
        zoom_timer = get_tick_count() + zoom_delay
        --print("Zoom:"..(zoom_position_percent/10).."."..(zoom_position_percent%10).."%. Step:"..zoom_position_step)
    end
end
...snip...
Given that zooming in by slow increments works OK on the A1400,
It's probably mentioned in this thread, but does this script cause the camera to crash when you use larger zoom steps?  The script uses the same set_zoom( ) function as bookscanner.lua so the function obviously does something here that it does not do in the other script.  Maybe larger zoom steps trip over some internal timing issue as they take longer to complete?

Quote
would a possible approach be to integrate the script above into the bookscanner script, so that when bookscanner.lua sets the required parameters, it sets the zoom via slow increments?
It's just code - anything is possible and that might actually work.  I think that you could also use click("zoom_out") to actually bypass the problem completely but getting to an exact zoom position might be tricky.

However, as srsa_4c pointed out,  there are a few build options for zoom functionality that we could try out first if you are up for doing a little testing?  As per my previous post, it's not clear those were tested throughly based on what I've read in this porting thread.
Ported :   A1200    SD940   G10    Powershot N    G16


Re: A1400 porting thread
« Reply #124 on: 12 / June / 2015, 09:45:52 »
Hi, I've not tested larger zoom increments using slowzoom, but that would be a good place to start troubleshooting; happy to do any testing to iron out bugs  :)

Re: A1400 porting thread
« Reply #125 on: 12 / June / 2015, 23:43:27 »
Hi, I've not tested larger zoom increments using slowzoom, but that would be a good place to start troubleshooting; happy to do any testing to iron out bugs  :)
According to this post : http://chdk.setepontos.com/index.php?topic=11006.msg109116#msg109116  and subsequent follow-up post,  some of the #defines in the A1400 platform_camera.h related to zoom control need to be removed.

I've rebuilt the 1.3.0 version with this change :
Code: [Select]
    #define CAM_NEED_SET_ZOOM_DELAY         300  // Define to add a delay after setting the zoom position
//    #define CAM_USE_OPTICAL_MAX_ZOOM_STATUS 1    // Use ZOOM_OPTICAL_MAX to reset zoom_status
//    #define CAM_USE_ALT_SET_ZOOM_POINT      1    // Define to use the alternate code in lens_set_zoom_point()
//    #define CAM_USE_ALT_PT_MoveOpticalZoomAt 1    // Define to use the PT_MoveOpticalZoomAt() function
leaving CAM_NEED_SET_ZOOM_DELAY as I don't see how it would hurt and may help.

Installation file attached for testing - SD Card Lock booting only.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: A1400 porting thread
« Reply #126 on: 17 / June / 2015, 08:14:51 »
Hi, I'll install this onto an SD card and report back. I can't use Stick to install, is this alternative method the best way of doing it manually? http://chdk.wikia.com/wiki/Using_SDMinste_to_Create_Dual_Partition_SD_cards

Re: A1400 porting thread
« Reply #127 on: 17 / June / 2015, 10:14:20 »
Hi, I'll install this onto an SD card and report back. I can't use Stick to install, is this alternative method the best way of doing it manually? http://chdk.wikia.com/wiki/Using_SDMinste_to_Create_Dual_Partition_SD_cards
The A1400 was released in 2013 and so does not need (and cannot use) a dual partition card.   SDMinste is for creating dual parition cards.

Complete information about the many ways to install CHDK is found here :  http://chdk.wikia.com/wiki/Prepare_your_SD_card

As you can boot the standard CHDK installation for the A1400,  I'd recommend using that with the "Method 2 - Using CHDK itself to make the SD card bootable." so that the SD card is setup correctly.  Then simply "unzip" the files and folders from the test version onto the SD card over the standard install.

Tell us more about why you cannot use STICK?
Ported :   A1200    SD940   G10    Powershot N    G16


Re: A1400 porting thread
« Reply #128 on: 17 / June / 2015, 10:38:24 »
Hi, I didn't think it was possible to manually assign a build using Stick, I thought it did this automatically?

Actually, could I install the default CHDK build onto an SD card and then overwrite it with the test build?

Re: A1400 porting thread
« Reply #129 on: 17 / June / 2015, 10:48:31 »
Hi, I didn't think it was possible to manually assign a build using Stick, I thought it did this automatically?
You probably want to take a look at this > STICK : Installing an unsupported build

Quote
Actually, could I install the default CHDK build onto an SD card and then overwrite it with the test build?
Yes - assuming overwrite just means "unzipping" without reformatting.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics