Making scripting support optional - page 3 - General Discussion and Assistance - CHDK Forum supplierdeeply

Making scripting support optional

  • 83 Replies
  • 34091 Views
*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: Making scripting support optional
« Reply #20 on: 16 / November / 2010, 00:42:23 »
Advertisements
@ultimA , I could not find the bad pixel stuff in the 3rd file??
« Last Edit: 16 / November / 2010, 01:23:28 by asm1989 »

*

Offline reyalp

  • ******
  • 14117
Re: Making scripting support optional
« Reply #21 on: 16 / November / 2010, 01:49:17 »
Here are the first three patches from a longer series. They include renames, decoupling the md from ubasic, and the refactored console. Unfortunately there is some minimal collision, I suggest applying the patches in this order, which will result in just a single hunk for script.c failing that is trivial to resolve by hand.
Great. This is much easier to follow. I've checked in the rename and md one, I probably won't get to the console one until tomorrow.

@ultimA , I could not find the bad pixel stuff in the 3rd file??
That's in the next set of patches he will post after I get these checked in. You can dig the changes out of the original patch if you want.

I guess this would be a lot easier if we used git  :-[
Don't forget what the H stands for.

*

Offline ultimA

  • ***
  • 137
Re: Making scripting support optional
« Reply #22 on: 16 / November / 2010, 10:27:27 »
@ultimA , I could not find the bad pixel stuff in the 3rd file??
Those are coming shortly, sorry for the wait. By creating and posting patches bit-by-bit allows the maintainers to better review code and it also avoids me doing triple work (i'm already doing double :) )
It is always nice to see there are interested people, helps a developer stay motivated :D:D:D:D If you want you can grab a working version of the non-script badpixel from http://chdk.setepontos.com/index.php?action=dlattach;topic=5793.0;attach=4300 but you will need to apply that patch to revision <977. It also breaks scripts in PTP, but you might not care.

regarding PTP, you want to make sure the script runs in the kbd task, not the PTP task.
No need to worry about that. Action stacks are always run in the kbd task, no matter where you initiate them.

*

Offline reyalp

  • ******
  • 14117
Re: Making scripting support optional
« Reply #23 on: 18 / November / 2010, 01:23:09 »
Great. This is much easier to follow. I've checked in the rename and md one, I probably won't get to the console one until tomorrow.
Ugh, been busy. I'll get to this in the next couple days :(
Don't forget what the H stands for.


*

Offline reyalp

  • ******
  • 14117
Re: Making scripting support optional
« Reply #24 on: 20 / November / 2010, 18:00:08 »
Finally got time to work on this, sorry for the delay. I'm checking it in, but there were a few issues

console.c and console.h are missing from chdk974_console.diff

For now, I'm using the versions of these from the previous patch. I've also put the .h in include/ instead of core

code in OPT_MD_DEBUG wasn't updated for the console rework. One difficulty of having lots of compile time option is code rot tends to set in on those that aren't compiled by default.

The patch added script.h back to motion_detector.c Didn't see why it was needed so I left it out, and added console.h so it would work with OPT_MD_DEBUG

on set_console_autoredraw,
- I'm not totally clear what the behavior was in the old version, but the script console looks OK to me so I'm not worrying about it. If people who used set_console_autoredraw in their scripts could check whether the current behavior is acceptable, that would be helpful
- we should set up a way to mark script functions as deprecated (print a warning in console) and remove them after some time. There is a lot of cruft building up in the script system.

I'm tempted to remove set_console_autoredraw quickly, because it hasn't been in the trunk for very long anyway.

If you can get the next patches up this weekend, I'll try to at least start working on them. Weekdays don't leave me a lot of time for CHDK.
Don't forget what the H stands for.

*

Offline ultimA

  • ***
  • 137
Re: Making scripting support optional
« Reply #25 on: 20 / November / 2010, 20:12:23 »
hi,

i'm sorry for forgetting to add the new files to svn. i am reposting the patch in this post. please revert the old one and use this. for the future, i suggest not applying patches to the trunk unless the known issues are discussed. i am not sure if the new files in the old patch are the same as here, there might have been changes, so please use this version of console.c/.h.

about OPT_MD_DEBUG:
this is strange because for me it builds fine, i also have OPT_MD_DEBUG enabled during build. it should work in the patch as it is. actually, including script.h instead of console.h in motion_detector.c is the right thing to do, so no change should be necessary. i do see some explanation is needed here:

you are right that generally, console_add_line should be used to add text to the console, and that function is defined in console.h. however, the old system seems to have the functionality/capability to log console output from scripts into a text file. i didn't want to remove this, since i do think it is useful for a lot of things (eg. either for debugging or looking at the output of unattended cameras after a long operation). so i kept "script_console_add_line" in script.c, which is just a wrapper around "console_add_line" AND in addition logs to file if logging has been started. console_add_line is declared in console.h, script_console_add_line is declared in script.h for scripts. md is called from scripts, so it always outputs in scripts, and so it is calling script_console_add_line. hence script.h should be included. in the end, scripts should call script_console_add_line, the rest should call console_add_line. i do acknowledge that this is a tiny bit quirky. after all else is done, i will probably refactor the logging too and make it part of the console instead of the scripts. in case i forget, someone please remind me after all the rest of the patches have been posted.

i have a couple of urgent things to get done, so i will only post the next patches a few days later, as i still need to prepare them.
« Last Edit: 20 / November / 2010, 20:18:36 by ultimA »

*

Offline reyalp

  • ******
  • 14117
Re: Making scripting support optional
« Reply #26 on: 20 / November / 2010, 20:44:55 »
hi,

i'm sorry for forgetting to add the new files to svn. i am reposting the patch in this post. please revert the old one and use this.
Seriously ? You could just update your tree, or diff your files against the latest trunk and let me know if there's anything wrong. I'm not reverting and re-patching just see if something has changed.

No need though, because the console.* in your latest patch are identical to what I used. The only other difference in that patch is in motion_detector.

Quote
for the future, i suggest not applying patches to the trunk unless the known issues are discussed.
We can fix it if it breaks, I'd rather actually get something done when I have time to work on it.

BTW, it did break, because
../platform/ixus65_sd630/libplatform.a(main.o): In function `console_init':

that's for the canon console, I'll have to rename those I guess.
Quote
about OPT_MD_DEBUG:
this is strange because for me it builds fine, i also have OPT_MD_DEBUG enabled during build. it should work in the patch as it is. actually, including script.h instead of console.h in motion_detector.c is the right thing to do, so no change should be necessary. i do see some explanation is needed here:
Ah, ok, I just assumed it was a mistake. My bad. Anyway, the call in md debug is just saying it saved it's own debug log, so that bit can probably do without logging.

Quote
i have a couple of urgent things to get done, so i will only post the next patches a few days later, as i still need to prepare them.
No problem, not trying to rush you.

Thanks again for working on this.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14117
Re: Making scripting support optional
« Reply #27 on: 20 / November / 2010, 21:33:02 »
Build fixed. Renamed canon console stuff to cam_console*
Don't forget what the H stands for.


*

Offline reyalp

  • ******
  • 14117
Re: Making scripting support optional
« Reply #28 on: 27 / November / 2010, 03:02:29 »
Don't forget what the H stands for.

*

Offline ultimA

  • ***
  • 137
Re: Making scripting support optional
« Reply #29 on: 29 / November / 2010, 14:15:52 »
Here is the patch for the action stack. The action stack is a new architectural feature that decouples the stack commands from scripts. It allows it to be reused for any other code piece, and extends the original stack by the ability to have multiple ones running semi-parallel (=interleaved). It is a pre-requirement for scriptless badpixel.bin and a general framework for other asnychronous jobs/commands/queries/whatever. Note that action stacks always run in the kbd thread, no matter where they were started from.

This patch migrates the original scripting functionality to use the new action stacks. Please somebody test scripting from PTP before submitting to trunk.

The next patch will be further cleanups, renames and codeshifting between files to allow for less and cleaner #ifdefs later for scripting. But before that, I'll wait 'till this right here makes it into the trunk.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal