Old script now fails - Script Writing - CHDK Forum

Old script now fails

  • 4 Replies
  • 3088 Views
*

Offline bugbear

  • **
  • 57
  • A630
    • woodwork on geocities
Old script now fails
« on: 12 / July / 2016, 14:34:41 »
Advertisements
Long ago ... I wrote a uBasic script to do custom focus bracketing on an A630 with a reversed macro lens.

I have been running CHDK 0.9.4 "for ever".

Recently, I was looking to write a new script that did combined focus AND exposure stacking, and found a web page saying this was a standard part of "new" CHDK.

Sounded good, so I downloaded and installed 1.4.1.

First thing to do - make sure it loads OK. No problem.
Second thing to do - test run the provided shoot.bas. No problem.
Regression test my old focus script. Ah. I can edit the parameters, but I get an instant Parse Error when I hit the shutter.

Is there a "master list" of changes I can check against to debug this?
(or is there a nice way to debug, these days?)

  BugBear

Code: [Select]
rem BugBear
@title Focus
@param a Number of ±steps
@default a 2
@param b delta [tenths of mm]
@default b 20

if a<1 then let a=2
if b<1 then let b=1

print_screen 0
print_screen 1

get_prop 12 t
if t = 1 then goto "manual"
print "focus not set to manual"
goto "endprog"

:manual

sleep 500
get_focus g
f=g*10
e=13520 - ((2520 * 10000)/f)
print "init e, g", e, g
rem calculate step size in mm/1000
b = b * 100
b = b / a

for s=-a to a
  d=e+(s * b)
  f=(2520 * 10000)/(13520 - d)
  f=f/10
  print "try d f", d, f
  if f < 65535 then goto "fsane"
    print "gross f, skip"
    goto "loop"
:fsane
  if f > 0 then goto "fplus"
    print "negative f, skip"
    goto "loop"
:fplus
  if f > 31 then goto "fpossible"
    print "tiny f, skip"
    goto "loop"
:fpossible
  set_focus f
  shoot
  print "shoot d f", d, f
:loop
next s

set_focus g

:endprog
end
« Last Edit: 12 / July / 2016, 15:30:48 by bugbear »

*

Offline reyalp

  • ******
  • 14117
Re: Old script now fails
« Reply #1 on: 12 / July / 2016, 15:51:38 »
Recently, I was looking to write a new script that did combined focus AND exposure stacking, and found a web page saying this was a standard part of "new" CHDK.
Maybe I'm misunderstanding, but I don't think this is true. You can do SD or exposure bracketing in the menu, but I think you'd still need a script to combine them.

Quote
Regression test my old focus script. Ah. I can edit the parameters, but I get an instant Parse Error when I hit the shutter.
The first thing to do is to double check that it's saved in plain ASCII /ANSI text, not utf-8, other unicode or wordpad etc format.

Quote
Is there a "master list" of changes I can check against to debug this?
Not going back to 0.9.x, for sure. However, ubasic syntax has changed very little. Some functions have been added, but few if any have been removed.

The only thing I can think of offhand is https://chdk.setepontos.com/index.php?topic=4408.0 but from a quick look it doesn't seem like it applies to your script.
Don't forget what the H stands for.

*

Offline bugbear

  • **
  • 57
  • A630
    • woodwork on geocities
Re: Old script now fails
« Reply #2 on: 12 / July / 2016, 16:17:11 »
Thanks for your hint about character set; it appears that the "±" in the parameter line

Code: [Select]
@param a Number of ±steps
was enough to blow it.

Onwards to the next hurdle!

 BugBear

*

Offline bugbear

  • **
  • 57
  • A630
    • woodwork on geocities
Re: Old script now fails
« Reply #3 on: 12 / July / 2016, 16:21:39 »
Recently, I was looking to write a new script that did combined focus AND exposure stacking, and found a web page saying this was a standard part of "new" CHDK.
Maybe I'm misunderstanding, but I don't think this is true. You can do SD or exposure bracketing in the menu, but I think you'd still need a script to combine them.

I followed a google search to this:

https://chdk.setepontos.com/index.php?topic=8147

and I thought SDM functionality had been incorporated into the later builds

(if anyone cares I wish to take shots of the inside of a HiFi amplifier,
for instructional web page use; so I don't want "Art" or "Realism",
I want everything as visible as possible.)

 BugBear
« Last Edit: 12 / July / 2016, 16:24:17 by bugbear »


*

Offline reyalp

  • ******
  • 14117
Re: Old script now fails
« Reply #4 on: 12 / July / 2016, 17:20:08 »
Thanks for your hint about character set; it appears that the "±" in the parameter line

Code: [Select]
@param a Number of ±steps
was enough to blow it.
Good to know. I would have expected it to just garble that character without causing harm since ubasic treats @param as a comment, but it might have caused your editor to save as unicode.

Quote
and I thought SDM functionality had been incorporated into the later builds
Nope, very few SDM features have been added to CHDK.
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal