supplierdeeply

Dryos Basic scripting

  • 64 Replies
  • 21865 Views
Re: Dryos Basic scripting
« Reply #40 on: 18 / August / 2010, 18:30:42 »
Advertisements
Good work !

Of course, it would be useful to have some idea of how to find these magic numbers   :)

*

Offline reyalp

  • ******
  • 10949
Re: Dryos Basic scripting
« Reply #41 on: 18 / August / 2010, 19:01:48 »
@ewavr Nice.
Any idea how to run script in rec mode ? With that, we could make an intervalometer and some other stuff for cameras without CHDK ports.

Other random thoughts:
Would be really useful is being able to detect if an eventproc is registered without ASSERTing. I tried if func = 0 but that was no good.

How does autotest.m work ? I was hoping it would start automatically (without requiring SET) but haven't been able to get it to run at all. I think it should run without being in factory mode, but I might be mistaken.
Don't forget what the H stands for.

Re: Dryos Basic scripting
« Reply #42 on: 19 / August / 2010, 12:14:19 »
@ewavr Your method works fine on my a610 (VxWorks)!  I use the magic value 0x18D for printing text and 0x65 for switch back to preview. ControlViewEvent(0x64,0) shows the current language.

Driver_EnableEventProc() seems equivalent to Driver.Create(). After this I can use LEDDrive(<ID>,<0|1>) and BeepTest() on my a610. Another interesting function is GetLogToFile("A/romlog.txt",1).

It is possible to use PT_* (Product Test) functions? I had use RegisterProductTestEvent() to register these functions but PT_itoa(<value>) doesn't work.

Edit: Another solution (to find the magic value for printing text):
Code: (vb) [Select]
   SystemEventInit()
    UI_RegistDebugEventProc()
    for a=0 to 512
        sprintf(s,"%X",a)
        ControlViewEvent(a,s)
    next

CHDKLover
« Last Edit: 19 / August / 2010, 13:40:23 by CHDKLover »

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: Dryos Basic scripting
« Reply #43 on: 19 / August / 2010, 14:51:04 »
but PT_itoa(<value>) doesn't work.
PT_itoa() is not found in a710, but PT_atoi() works.


*

Offline reyalp

  • ******
  • 10949
Re: Dryos Basic scripting
« Reply #44 on: 19 / August / 2010, 14:55:01 »
It is possible to use PT_* (Product Test) functions? I had use RegisterProductTestEvent() to register these functions but PT_itoa(<value>) doesn't work.
I've used PT_* functions with RegisterProductTestEvent() from lua eventproc calls. For example PT_Playsound() works as expected.
Don't forget what the H stands for.

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: Dryos Basic scripting
« Reply #45 on: 19 / August / 2010, 14:58:50 »
Any idea how to run script in rec mode ?
Unfortunately no.
Quote
Other random thoughts:
Would be really useful is being able to detect if an eventproc is registered without ASSERTing. I tried if func = 0 but that was no good.
On a710 if eventproc is not registered, nothing happens (no assert).

edit: How about :
a=ExecuteEventProcedure("LEDDrive",8,2)
it returns 1, if procedure is found and -1 if not found.

It seems that on a710 terminate() (or Terminate()) fuction is never called.
« Last Edit: 19 / August / 2010, 15:45:10 by ewavr »

Re: Dryos Basic scripting
« Reply #46 on: 19 / August / 2010, 15:30:51 »
but PT_itoa(<value>) doesn't work.
PT_itoa() is not found in a710, but PT_atoi() works.

Not unusual. atoi is in the ANSI standard, itoa isn't. itoa and other non-standard extensions are very often left out when minimizing the libraries is an important concern.

Re: Dryos Basic scripting
« Reply #47 on: 19 / August / 2010, 17:07:49 »
Thanks, all right.
It was my mistake.

CHDKLover


*

Offline RaduP

  • *****
  • 890
Re: Dryos Basic scripting
« Reply #48 on: 23 / August / 2010, 16:42:12 »
For itoa() you can just use sprintf, so not a big deal :)
BTW, very, very impressive work with the scripting, I think this might open a whole new world of possibilities.

*

Offline pixeldoc2000

  • ****
  • 356
  • IXUS900Ti 1.00C, IXUS300HS 1.00D
    • pixel::doc homebase
Re: Dryos Basic scripting
« Reply #49 on: 25 / August / 2010, 15:53:09 »
Driver_EnableEventProc() seems equivalent to Driver.Create(). After this I can use LEDDrive(<ID>,<0|1>) and BeepTest() on my a610. Another interesting function is GetLogToFile("A/romlog.txt",1).

I've tested GetLogToFile on SD4000. I can get last Error from Camera ROM Log with this:

extend.m
Code: (c) [Select]
private sub Initialize()
  UI.CreatePublic()
  a=LCDMsg_Create()
  LCDMsg_SetStr(a,"Get ROM Log to file")
  System.Create()
  Driver.Create()
  GetLogToFile("A/romlog.txt",1)
  LCDMsg_SetStr(a,"done")
end sub

This can be usefully for porting but also for debugging Canon Basic Scripts themself.

I've tested the script above without System.Create() and camera did save assert to Camera Rom Log and shutdown because we first need to call System.Create() before Driver.Create() to use GetLogToFile().

After that, i startet the above script with System.Create() and got this romlog:

romlog.txt
Code: [Select]
ASSERT!! EvntProc.c Line 221
Occured Time  2010:08:25 20:32:30
Task ID: 14811165
Task name: CtrlSrv
SP: 0x00387C78
StackDump:
0x00000000
0xFF88BAEC
0x000000DD
0x00002F44
0x00387CBC
0x00000000
0x00387CD4
0x00000001
0x00000000
0x0000082A
0x0000083C
0xFF88BA1C
0x00002F58
0x00176F68
0x003D0EB4
0xFF97740C
0x003CE87C
0x003CE86C
0x00000001
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x0016E078
0x00176EF8
0x00000000
0xFF9BC854
0x00176EF8
0xFF888E30
0x00000070
0x00176EF8
0x00000860
0x00000000
0x20000000
0x00007DEC
0x00000000
0x00000862
0x0000082A
0xFF9BC594
0x00000000
0x001C7EA0
0x00003118
0x00000860
0x00000794
0x20000000
0x20000000
0x19980218
0x19980218
0xFF89309C
0x001C7EA0
0x00000001
0x00003118
0x00000860
0x00000794
0xFF8935A4
0x0003A478
0x00003100
0x19980218
0x19980218
0x19980218
0x19980218
0x19980218
0xFF892A78
0x0003A478
0x00372EE8
0x19980218
0xFF816AEC
0x19980218
0x19980218
0x00000808
ShootConDump:
0f 0f 0f 0f 0f 0f 0f 0f 0f 0f
CameraConDump:
07 0a 02 0f 0f 0f 0f 0f 0f 0f
00000160: *** Camera Log Start ***

00000200: UI:LogicalEvent:0x5001:adr:0,Para:0

00000230: UI:LogicalEvent:0x5006:adr:0,Para:0

00000260: SS:S-Imag

00000260: UI:ScreenLock

00000260: UI:ScreenUnLock

00000260: UI:LogicalEvent:0x300a:adr:0,Para:0

00000270: UI:HDMIConnectCnt

00000270: UI:PB.Create

00000270: UI:DispSwCon_TurnOnBackLight

00000270: UI:TurnOnBackLight

00000430: UI:DispSwCon_MuteOffPhysicalScreen

00000430: UI:MuteOffPhysicalScreen

00000430: UI:LogicalEvent:0x3138:adr:0,Para:0

00000440: UI:LogicalEvent:0x112c:adr:0,Para:0

00000460: UI:ScreenLock

00000460: UI:ScreenUnLock

00000480: UI:PB.CreateE

00000480: UI:AC:StartPB

00000480: UI:DispSwCon_TurnOnDisplayDevice

00000480: UI:AC:EBtn

00000480: UI:PB.Start

00000480: UI:DSIC:47,0

00000480: UI:CC_CompFlhJpg

00000480: UI:_CompFlhJpg

00000480: UI:PB.Flash

00000480: UI:ScreenLock

00000480: UI:LogicalEvent:0x321f:adr:0,Para:0

00000480: UI:DSIC:47,0

00000480: UI:ScreenUnLock

00000490: UI:LogicalEvent:0x320a:adr:0,Para:0

00001010: UI:ScreenLock

00001010: UI:ScreenUnLock

00001020: UI:LogicalEvent:0x3201:adr:0,Para:0

00001020: UI:ScreenLock

00001020: UI:ScreenUnLock

00001020: UI:ScreenLock

00001020: UI:ScreenUnLock

00001030: UI:PB.StartE

00001030: UI:PB.CTG

00001030: UI:PB.DPOF

00001030: UI:DSIC:48,0

00001040: UI:DispSw: Unlock

00001040: UI:DispSwCon:Unlock

00001040: UI:DispSwCon_TurnOnBackLight

00001040: UI:DispSwCon_MuteOffPhysicalScreen

00001040: UI:MuteOffPhysicalScreen

00001040: UI:AC:EnryPB

00001040: UI:AP:ChkCnctUSB              <------ Camera reguar startup ends here

00001720: UI:Button:0x0000089B:TouchRightButton        <-------- Set Button pressed to start cbasic script

00001820: UI:Button:0x00000860:PressSetButton

00001940: UI:Button:0x00000861:UnpressSetButton

00001940: UI:Button:0x0000089C:UntouchRightButton

00001940: UI:ScreenLock

00001940: UI:ScreenUnLock

00001940: UI:ScreenLock

00001940: UI:ScreenUnLock

00001960: UI.CreatePublic           <------ cbasic script start

00001970: LCDMsg_Create          <------ LCDMsg_Create()

00001970: UI:ScreenLock

00001970: UI:ScreenUnLock

00001970: LCDMsg_SetStr        <------ LCDMsg_SetStr("Get ROM Log to file")

00001980: Driver.Create      <---- Here the assert happend because of missing System.Create() call before Driver.Create()

Edit: actually Driver.Create() is not needed as GetLogToFile() gets registered by System.Create() at least on SD4000.

new extend.m
Code: (c) [Select]
private sub Initialize()
  UI.CreatePublic()
  a=LCDMsg_Create()
  LCDMsg_SetStr(a,"Get ROM Log to file")
  System.Create()
  GetLogToFile("A/romlog.txt",1)
  LCDMsg_SetStr(a,"done")
end sub
« Last Edit: 25 / August / 2010, 16:12:59 by pixeldoc2000 »

 

Related Topics