shooting script using Canon basic ? - page 6 - General Discussion and Assistance - CHDK Forum

shooting script using Canon basic ?

  • 73 Replies
  • 33151 Views
*

Offline srsa_4c

  • ******
  • 4426
Re: shooting script using Canon basic ?
« Reply #50 on: 15 / March / 2019, 15:19:03 »
Advertisements
I played something with the script today. It seems a timing problem. On the one hand I used a newer, faster SD card and put the camera on MF.
On the first run (only RAW), the camera took only three pictures :)
On the second and third runs the cam took 7 Pictures.
If I set the camera to only JPG, then the cam always make the 4 pictures (the first picture twice).
Have you tried only RAW?
I only made some test runs, nothing comprehensive.
It makes no sense trying the - obviously malfunctioning - script over and over again. It clearly needs to be changed or rewritten.

Quote
But basically, I still have problems starting scripts (like the firmware dump). I have the problem synonymous with the new SD card. Sometimes I have to start the camera 10 times. Is there a specific timing at power on?
I recall having problems starting scripts from time to time on various cameras. But unfortunately, I don't know what's behind that.

Quote
If there are threading problems like that maybe we can try to move some of the script's functionality to native code...
What does that mean?
The script relies on Canon Basic global variables that are written and read in different tasks. I have a feeling that this isn't working well enough, especially not on multiprocessor cameras.

The script has a main loop (mytask()) that runs in its own task.
The mycontroller() function is called from the firmware's CtrlSrv task, it is used for intercepting the keyboard.
The functions shoot_pre(), shoot_beforeexpo(), shoot_complete() are called from the firmware's shooting related tasks.

As a first try, global variables used in more than one task could be turned into pointers and they could point to a piece of memory that has no caching issues (uncached memory, for example).

If that's not enough, the functions listed above (those that run in firmware tasks) could be replaced with ARM code. But doing this is not trivial (loading code at runtime and making sure there are no caching and similar issues).

*

Online reyalp

  • ******
  • 13393
Re: shooting script using Canon basic ?
« Reply #51 on: 15 / March / 2019, 16:01:15 »
As a first try, global variables used in more than one task could be turned into pointers and they could point to a piece of memory that has no caching issues (uncached memory, for example).
If this is the problem, the various semaphore etc functions are generally available as eventprocs. OTOH, if the script engine itself isn't thread safe that wouldn't help.
Don't forget what the H stands for.

*

Offline c_joerg

  • *****
  • 1151
Re: shooting script using Canon basic ?
« Reply #52 on: 29 / December / 2020, 12:48:17 »
I tried to start a script with a 64GB with FAT32. At first I thought it wouldn't work. It took me 6 tries to get it to work. With my old 1GB card I always needed significantly less attempts.
I guess that's a timing problem. The card will probably take longer to initialize.
M100 100a, M3 101a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

*

Offline c_joerg

  • *****
  • 1151
Re: shooting script using Canon basic ?
« Reply #53 on: 03 / September / 2021, 08:23:28 »
Can there be a problem if in addition to "SCIPT" there is also "BOOTDISK" on the SD card?
M100 100a, M3 101a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd


*

Offline srsa_4c

  • ******
  • 4426
Re: shooting script using Canon basic ?
« Reply #54 on: 03 / September / 2021, 15:10:04 »
Can there be a problem if in addition to "SCIPT" there is also "BOOTDISK" on the SD card?
The SCRIPT and BOOTDISK flags can coexist without a problem.
However, if you use CHDK on a card with an active Canon Basic script, you can get in trouble. If you forget about the script, you might find yourself wondering when you inadvertently start it with SET. Or, if the CHDK port is configured to use ARAM, the camera will crash when you press SET.
In short: make sure you don't use a Canon Basic script and CHDK at the same time.

*

Offline c_joerg

  • *****
  • 1151
Re: shooting script using Canon basic ?
« Reply #55 on: 03 / September / 2021, 15:44:28 »
In short: make sure you don't use a Canon Basic script and CHDK at the same time.

I don't do that either. I only saw that I have "SCRIPT" and "BOOTDISK" on some cards because I used them differently.
I'm still looking why the scripts don't always start for me ...
M100 100a, M3 101a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

*

Offline Caefix

  • *****
  • 602
  • Sorry, busy deleting test shots...
Re: shooting script using Canon basic ?
« Reply #56 on: 09 / October / 2021, 10:00:57 »
But Basically, the Canon Basic is a great extension for cams without CHDK support ...
... like N2.
Quote
https://chdk.setepontos.com/index.php?topic=12880.msg147119#msg147119

Edit:  ;) https://chdk.setepontos.com/index.php?topic=13522.msg138130#msg138130
This script displayed orange 1-2-3 and
Edit2: 1-2 and 1 only.  :) ... no need to pull battery.
Code: [Select]
Exception!! Vector 0x10
Task name: cbasic1
00000890: SS:SoundComp
00001290: UI:SetSyncroDisplayDeviceController
00014390: UI:Button:0x00000858:PressWideButton

00014470: LCDMsg_ChangeColor
00014470: CreateProxyOfEventProcedure
00014470: CreateController
00014470: mycontroller
00014470: Peek32
00014470: Poke32
...
00014470: Peek32

Edit 3: ... Compared with N1  :haha
Quote
ASSERT!! EvntProc.c Line 222
Task name: cbasic1
00003440: UI:Button:0x0000085A:PressWideButton
:) With first basic addresses and needs like platform ID I could spend some worse time ...
« Last Edit: 09 / October / 2021, 15:09:05 by Caefix »
All lifetime is a loan from eternity.

*

Offline Caefix

  • *****
  • 602
  • Sorry, busy deleting test shots...
Re: shooting script using Canon basic ?
« Reply #57 on: 11 / October / 2021, 10:42:27 »
Now I have a little script  :D, that translates the
    ps="A/CHDK/LUALIB/GEN/propset"..pn..'.lua'-  to *.m files.
Lines are prefixed with "DIM PC_", comments cutted to save memory...

Since the "propset" (see propset*.h here) of the M6 is not known, finding that out is going to be the next move. Knowing the correct propcase numbers is essential for applying overrides.
I think I have identified the Tv propcases on M6:
PROPCASE_TV = 276
PROPCASE_TV2 = 275
So M6 is propset11.

Edit: The Lua-script is easy to modify for other purpose (add "DIM PROPCASE_"...)
« Last Edit: 18 / October / 2021, 15:15:47 by Caefix »
All lifetime is a loan from eternity.


*

Offline c_joerg

  • *****
  • 1151
Re: shooting script using Canon basic ?
« Reply #58 on: 12 / October / 2021, 11:44:56 »
Now I have a little script  :D, that translates the
    ps="A/CHDK/LUALIB/GEN/propset"..pn..'.lua'-  to *.m files.
What sense does that make with a Canon Basic Script?

I'm currently playing with my G9xII and Canon Basic Script. I only see the output of LCDMsg_SetStr when I go from play mode to record (regardless of the color). Is there a possibility that you can also see the output in play mode?

Is there a way to check the Canon Basic Script for syntax without inserting the SD card into the camera?
M100 100a, M3 101a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

*

Online reyalp

  • ******
  • 13393
Re: shooting script using Canon basic ?
« Reply #59 on: 12 / October / 2021, 13:22:56 »
Is there a way to check the Canon Basic Script for syntax without inserting the SD card into the camera?
You cannot check syntax without running it on the camera, since only canon knows the true syntax. You should be able to upload using standard PTP operations, for example from chdkptp like
Code: [Select]
chdkptp -c -e"exec require'extras/devutil'.init_cli()" -e"dptpsendobj extend.m extend.m"
Some cameras might require the destination (second argument) be A/extend.m instead of extend.m. The camera will crash if it's wrong.
Don't forget what the H stands for.

 

Related Topics