Bug - Build: Allbest #16 29-dec-07 - Camera: S2 IS - Script gets overwritten
Problem Summary:
I was writing a script to get information about what is supported in the build, and to gather information from the camera. When the script reached a certain size -- more than 3K but less than 4K, the script began to crash the camera. I started looking for problems in my code, but didn't see anything obvious, so I moved the last subroutine up before the previous one, to see if length of script or some other factor related to the order of the code might be causing the problem.
Changing the order of the code caused the script to crash earlier, but in both cases, the script crashed when trying to execute the code near the end of the script. (I also tried putting some dummy code at the end, to extend the length of the script, but this failed also).
The camera crashes, and in several test versions, including the current one, the beginning of the script is overwritten in the camera, with garbage from memory.
Camera: S2 IS, firmware 1.00f
Other builds tried: Allbest build #10 13-Dec-07 -- Same results
Script that caused the problem:
(Please note that this script is not a final script, and that it has several modifications that were made only to try to isolate, solve or work around this problem. For example, I rem'd out print_screen logging in an attempt to see if the print screen logging routine, which writes to files, might be responsible for overwriting my script (it wasn't). However, the script below, in it's current form, does crash my camera, and the beginning does get overwritten in the camera when it is run.) It is well under 8K, but one thing I do not know is whether or not Allbest has a smaller size restriction for scripts than the 8K size generally published for recent CHDK builds.)
---------------------------------------------------------------------------------------------------------
rem Author - Tom Friend
rem script to check for the implementation of various features
rem in the build and camera (or emulation) that the script is run on
@title Feature Check
rem Dumps camera property values 0 - 255 (whether meaningful or not)
rem Only works if supported by the build, of course
@param c Property Values? (1=Yes)
@default c 0
rem Do not change the following line -- it is used by check_default routine
@default d 25
rem ****************************************************************
rem *** main routine
:main
gosub "print_header"
gosub "check_default"
print "@default:",e
gosub "check_extended_variables"
print "extended variables:",e
gosub "check_tick_count"
print "get_tick_count:",e
gosub "check_property_support"
print "property support:",e
sleep 2000
if c=1 then gosub "dump_props"
end
rem ****************************************************************
rem ********************
rem *** print_header ***
:print_header
rem print_screen 1
print "Feature Check"
print " v0.1 - by Tom Friend"
print " "
sleep 2000
print " 1 = implemented"
print " 0 = not implemented"
print " "
sleep 2000
return
rem *** end -- print_header ***
rem *********************
rem *** check_default ***
rem checks to see if @default is implemented
:check_default
if d=25 then e=1 else e=0
return
rem *** end - check_default ***
rem ********************************
rem *** check_extended_variables ***
:check_extended_variables
A=1
z=4
if (A=1) and (z=4) then e=1 else e=0
return
rem *** end - check_extended_variables ***
rem ************************
rem *** check_tick_count ***
rem *** checks for implementation of get_tick_count ***
rem *** Note: I don't know if this test is legitimate or sufficient.
rem *** However, I can't think of a more reliable test at the moment
:check_tick_count
i=0
j=0
i = get_tick_count
j = get_tick_count
if (i<>j) and (i>0) and (j>0) then e=1 else e=0
return
rem *** end - check_tick_count ***
rem ******************************
rem *** check_property_support ***
rem *** test: tries to get white balance (wb) property
:check_property_support
e = 1
i = 3000
get_prop 206 i
rem if get_prop worked, "i" should be changed
if i=3000 then e=0
return
rem *** end - check_property_support ***
rem ******************
rem *** dump_props ***
:dump_props
print " "
gosub "check_property_support"
if e=1 then gosub "dump_them" else gosub "no_props"
return
:no_props
print "Cannot dump properties."
print "Not supported in this
print " build and/or environment."
return
rem Just a simple dump by the numbers for now.
rem Dump them 4 at a time, with a pause.
:dump_them
print "Camera property dump:"
print " "
k = 0
for i=0 to 63
for j=0 to 3
get_prop k l
print " Property:",k," Value:",l
k=k+1
next j
sleep 1500
next i
return
rem *** end - dump_props ***
rem *** end of source file *************************************
---------------------------------------------------------------------------------------------------------