SX280 / 275 / 270 porting - page 21 - DryOS Development - CHDK Forum  

SX280 / 275 / 270 porting

  • 365 Replies
  • 202084 Views
Re: SX280 / 275 / 270 porting
« Reply #200 on: 30 / July / 2015, 21:02:04 »
Advertisements
Hi All,

First of all, thank you for everything that you are doing.

I have built a script that keys a "shoot_full_only" every time 5V is read at the USB port (i.e, there is a switch closing). The script is verified working on a SD1000.

This script does not work with the prealpha8 build on the SX280, firmware version 102d.

The script:

Code: [Select]
--[[
rem 28072015 This script sets and holds auto focus, then triggers a picture on 5v USB input
@title 8mm Sync Shooting
@param n number of shots
@default n 5
]]

-- restore camera to original state
function restore()
    set_aflock(0)
end

-- lock in the exposure and focus
press("shoot_half")
repeat
sleep(50)
until get_shooting() == true
set_aflock(1)

-- take picture on 5v USB input
num_picts = 0
while true
do
wait_click(0)
if is_key("remote") then
click("shoot_full_only")
num_picts = num_picts + 1
end
end

restore()
print(num_picts " pictures taken")
print("...done")

I have confirmed that basic Remote Shooting functionality works: Enable Remote Shooting, Switch Type OnePush, Control Mode Quick. With those settings, the camera takes a picture every time I close the USB switch, albeit, this only works with the <alt> menu closed.

Am I attempting to use some unsupported features of this prealpha? Any help? Please and thank you =]

Re: SX280 / 275 / 270 porting
« Reply #201 on: 30 / July / 2015, 21:28:42 »
This script does not work with the prealpha8 build on the SX280, firmware version 102d.
It would be quite helpful if you could expand on what "does not work" means?  That's not much to go on.  What do you see when you run the script? 

Did you try inserting some print( ) statements to see what is happening ? 

For instance, does the  is_key("remote")  ever become true?  Maybe the  click("shoot_full_only" )  is too fast and needs to be replaced with a press("shoot_full_only")  sleep(500 release("shoot_full_only") ?

(Update :  I fixed a couple of things in the script and attached an update)
« Last Edit: 30 / July / 2015, 21:43:23 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: SX280 / 275 / 270 porting
« Reply #202 on: 31 / July / 2015, 00:03:36 »
waterwingz,

Thank you for the prompt response! My apologies for not providing hardly any detail; I guess I was expecting a guru to tell me I was trying to use unsupported functionality in the prealpha build.

I added some print statements to the corrected code you provided me to see where the impasse is (see attachement). It turns out that supplying 5V to the USB port is not sufficient for wait_click(0) to let the script continue. However, if I press a button like DISP or MENU, the code does continue. At that point, is_key("remote") is not true because there is no voltage to the USB port.

Here's something interesting though: If I run the script and supply a continuous 5V to the USB port, then press DISP or MENU, wait_click(0) is passed AND is_key("remote") must evaluate to TRUE because "usb clicked" is printed to the console and the camera takes a picture.

So I think we've found that USB voltage is insufficient to trigger wait_click(0), but that there is no problem as of yet with is_key("remote") evaluating to TRUE with USB voltage input.

Thoughts? Maybe there is a workaround for wait_click(0) in this script?

Re: SX280 / 275 / 270 porting
« Reply #203 on: 31 / July / 2015, 08:16:50 »
So I think we've found that USB voltage is insufficient to trigger wait_click(0), but that there is no problem as of yet with is_key("remote") evaluating to TRUE with USB voltage input.
You've done some good detective work here but have not quite reached the correct conclusion from the available data.

In your previous post you mentioned that "basic Remote Shooting functionality works".   So it is definitely not an issue with "insufficient" USB voltage.  What is more likely happening is that the implementation of wait_click(  ) is not complete and does not check correctly for a change of state on the USB 5V power pin.

The code for the SX280 is not in the CHDK svn yet so I can't easily check this.   If srsa_4c does not get a chance to look at this first,   I'll find the source later today and have a look.

Quote
Maybe there is a workaround for wait_click(0) in this script?
The workaround part might be easy - depending on how bad the possible bug is in wait_click(0).

Take a look at USB Remote : Scripting Interface

 You can use:

Code: [Select]
if (get_usb_power(0)>0) then
        click("shoot_full_only")
        num_picts = num_picts + 1
end

or

Code: [Select]
if ( get_usb_power(1) == 1 ) then
        click("shoot_full_only")
        num_picts = num_picts + 1
        repeat  sleep(200) until get_usb_power(1) == 0
end
« Last Edit: 31 / July / 2015, 08:20:35 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline srsa_4c

  • ******
  • 4450
Re: SX280 / 275 / 270 porting
« Reply #204 on: 31 / July / 2015, 11:14:45 »
This script does not work with the prealpha8 build on the SX280, firmware version 102d.
I have no idea why this is happening, but I can confirm that the script does not work on my 102b camera either when using the latest prealpha release (which is based on official trunk r3449).

However, the script does work when using a current trunk based build. I'll upload a set of those later.

*

Offline srsa_4c

  • ******
  • 4450
Re: SX280 / 275 / 270 porting
« Reply #205 on: 31 / July / 2015, 15:44:50 »
Prealpha 9

This is based on today's CHDK trunk code.
The screen drawing method and the CHDK palette have changed considerably, you'll likely need to reset the CHDK colors (CHDK Settings -> Color Settings -> Reset All Colors) when upgrading.

Visible changes:
- transparent colors are available (this is still experimental and will likely change)
- the above script(s) should now run correctly
- (several CHDK improvements since r3449)

If you find any regressions (things that worked on the previous prealpha, but not on this one), please report them.

edit:
The builds are still good for all models (sx270, 275, 280), I just forgot to rename the files.

edit2:
obsolete builds removed
sx280hs-102b-1.4.0-4196-full.zip (680.06 kB - downloaded 69 times.)
sx280hs-102c_102d-1.4.0-4196-full.zip (680.11 kB - downloaded 79 times.)
« Last Edit: 17 / June / 2017, 12:02:51 by srsa_4c »

Re: SX280 / 275 / 270 porting
« Reply #206 on: 01 / August / 2015, 22:30:40 »
srsa_4c,

Thank you for fixing the bug so quick! I can confirm that wait_click(0) is operating as I expect now.


*

Offline reyalp

  • ******
  • 13792
Re: SX280 / 275 / 270 porting
« Reply #207 on: 08 / August / 2015, 20:28:16 »
This is based on today's CHDK trunk code.
Is this in your svn somewhere? I'd like to compare against the current trunk.
Don't forget what the H stands for.


Re: SX280 / 275 / 270 porting
« Reply #208 on: 09 / August / 2015, 21:53:49 »
Maybe it would be better to update the first post of this thread: the link to the latest release still points to prealpha 8
 ;)
Please, pardon me for possible mistakes: I'm not a native English speaker.
Corrections will be appreciated.

*

Offline iax

  • *
  • 45
Re: SX280 / 275 / 270 porting
« Reply #209 on: 20 / August / 2015, 16:56:59 »
hi I'd like to try to port the sx60. I understand the current work on the sx280 could be a good starting pont.  I'm currently struggling to put together a good environment to work on it. I'd like to have some recommendation about:

- as of today, what is the ideal build environment (OS + gcc + cross compiler + build tools) for a D6 camera? Is there anything like a virtual machine we can download with anything we need pre-installed?
- what are the recommended tools? Many years ago I've been using IDA, is this still recommended  or are there better options?

thanks

 

Related Topics