Author Topic: Canon Basic scripting (DIGIC 8, DIGIC X models)  (Read 65167 times)

c_joerg

  • Member
  • ***
  • Posts: 137
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #75 on: July 23, 2021, 08:36:27 PM »
With 1,086,947,603 shutter activations? 
No, because of 701 TotalShoot and 173 PowerOnCount
RP is anomaly.
Yes, of course, TotalShutter on RP is anomaly.
EOS R

names_are_hard

  • Developer
  • Hero Member
  • *****
  • Posts: 628
  • Dev: 200D, 750D, 850D, 7D2
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #76 on: July 23, 2021, 09:24:12 PM »
Oh, I understand now, you were talking about something different to everyone else in the thread.  Now my confusion makes sense :)

c_joerg

  • Member
  • ***
  • Posts: 137
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #77 on: July 23, 2021, 09:36:58 PM »
It was understood that we would like to know whether there is a fixed start number for TotalShutter at RP.
For that you would need an unused RP. And I don't think the RP from j1080 is a total new one.
EOS R

names_are_hard

  • Developer
  • Hero Member
  • *****
  • Posts: 628
  • Dev: 200D, 750D, 850D, 7D2
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #78 on: July 23, 2021, 10:04:27 PM »
Okay, but your comments about different cams, in a Digic 8 and X thread were confusing and don't seem relevant.

From this thread, there are numbers from multiple different cams.  All TotalShutter numbers look to have a similar large offset applied.  But, does TotalShoot have a different, *smaller* offset applied?  How would we know?  It's a reasonable assumption that TotalShoot might start at 0, but TotalShutter *clearly doesn't*, so it's also reasonable to doubt that assumption.

Cam1 TotalShoot: 1780
Cam1 TotalShutter: 1086948659

Cam2 TotalShoot: 701
Cam2 TotalShutter: 1086947603

From these numbers it's still entirely possible that RP has an offset of 700 applied to TotalShoot, similar to how it seems to have an offset of approximately 1086947300 applied to TotalShutter.  If that was true, j1080s cam would have taken 1 prior shot.  Or there could be no offset, and it's taken 701.  Or an offset of -10000 and it's real number is 10701.  Notably, my 200D (bought new...  probably) reported a negative TotalShoot when I first had it!

Likely it will be easier to reverse the firmware to determine the logic, than to prove we have a new cam where we can totally trust the values.

c_joerg

  • Member
  • ***
  • Posts: 137
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #79 on: July 24, 2021, 08:36:40 AM »
Okay, but your comments about different cams, in a Digic 8 and X thread were confusing and don't seem relevant.

Sorry for the confusion.
Since the CameraInfo part is already available in the Powershot firmware, I assumed that this part also ended up in the firmware of the R and was only expanded.
EOS R

kitor

  • Developer
  • Senior
  • *****
  • Posts: 410
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #80 on: July 24, 2021, 09:49:56 AM »
Quote
Since the CameraInfo part is already available in the Powershot firmware

This was a good point anyway. I was unaware of that coming to us from Powershot world (like Basic did).

Quote
reported a negative TotalShoot when I first had it!
Are you sure TotalShoot and not shutter_count_plus_lv_actuations? We have three* different counters, not two!:

On "old" cameras (up to D7, PROP_SHUTTER_COUNTER):
buf[0] -> shutter_count = number of still shots with physical shutter actuations
buf[1] -> shutter_count_plus_lv_actuations = number of physical shutter actuations, including enter/exit LV which does open/close shutter

on "new" cameras (D8+)
PROP_MECHA_COUNTER (TotalShutter) -> equivalent of shutter_count*
PROP_RELEASE_COUNTER (TotalShoot)  -> above + number of silent pictures (with no physical shutter actuations)

I believe you write about shutter_count or shutter_count_plus_lv_actuations, not TotalShoot.


*We still need to confirm that on D8 DSLR, as either:
- PROP_MECHA_COUNTER is equivalent of shutter_count_plus_lv_actuations and not shutter_count (would make sense by prop name)
- there's additional prop that is equivalent of one "missing" on D8, which is missing just on mirrorless
Too many Canon cameras.
WTB: High shutter count, slightly malfunctioning or otherwise damaged EOS R. The camera body is enough. EU only.
If you have a dead M50/R/RP mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

j1080

  • New to the forum
  • *
  • Posts: 3
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #81 on: July 24, 2021, 01:44:08 PM »
So there might be something weird going on with the TotalShutter integer type of the RP's firmware versions.

@names_are_hard Wasnt expecting that, just mentioned as i didnt belive that its brandnew and been wondering about those numbers.
                            TotalRunningTime is reported in seconds, tested that, but still 13+ hours.

@kitor The box itself wasnt sealed, but all the items inside. The body itself had a packaging with some kind of aluminium-sticker on it.
           I dont belive its new, even if sold as.




names_are_hard

  • Developer
  • Hero Member
  • *****
  • Posts: 628
  • Dev: 200D, 750D, 850D, 7D2
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #82 on: July 24, 2021, 03:25:10 PM »
Don't know why I had it in my brain as hours, seconds does make a lot more sense!  Basically, for the RP, we don't really know what these numbers mean.  There are some fields where we can make some obvious guesses, and likely be right, but that's about it.

Don't recall which precise field it is for 200D, point being, it was negative so I don't put it past them to apply a negative offset to one of the other fields (plus code for some existing cams already applies a fix for this, I've seen it somewhere).

Nic2

  • Just arrived
  • *
  • Posts: 1
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #83 on: November 17, 2021, 08:20:39 PM »
Thanks for the guide. I would suggest to update the first post with the info that this only works on SDHC cards; SDXC is not supported. Took me a while to figure out, any may be relevant for whoever is next. Tested on M50.


names_are_hard

  • Developer
  • Hero Member
  • *****
  • Posts: 628
  • Dev: 200D, 750D, 850D, 7D2
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #84 on: November 26, 2021, 04:06:49 PM »
Canon Basic dumper confirmed to work on 850D.

c_joerg

  • Member
  • ***
  • Posts: 137
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #85 on: January 06, 2022, 06:27:17 PM »
The following code

Code: [Select]
dim c
private sub Initialize()
    System.Create()
    Driver.Create()
    for c=1 to 3
      BeepDrive(3)
      Wait(500)
    next
   
    CamInfo_Debug(1)
   
    for c=1 to 2
      BeepDrive(3)
      Wait(500)
    next
end sub

Runs on M100 but crashes EOS R and R5 with

Code: [Select]
-<ErrorList>
-<Kind>
<ID>E70</ID>
<Count>1</Count>
-<ErrorLog>
<BatTemperature>max:0 min:0</BatTemperature>
<FirstOccurTime>2022.01.06 17:59:34</FirstOccurTime>
<LastOccurTime>2022.01.06 17:59:34</LastOccurTime>
-<Log>
<DateTime>2022.01.06 17:59:34</DateTime>
<Reason>DS-EID:101</Reason>
<BatTemperature>0</BatTemperature>
<LensID>0000103c</LensID>
<ReleaseCount>265</ReleaseCount>
</Log>
</ErrorLog>
</Kind>
</ErrorList>

Any Idea why?
Commands are different on M and R?

EOS R

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 8604
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #86 on: January 06, 2022, 07:05:52 PM »
IANAP but M100 is true PowerShot codebase and Digic 7. R is "hybrid" and Digic 8 and R5 is Digic X.
Maybe ask srsa first.

kitor

  • Developer
  • Senior
  • *****
  • Posts: 410
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #87 on: January 06, 2022, 08:54:29 PM »
R is EOS codebase. Digic 8 is more  "Eos with some features cherrypicked from PowerShots" than "merge of codebases".

All you need to do on EOS is
Code: [Select]
private sub Initialize()
    CamInfo_Debug(1)
end sub

Just for the record, there are no such EvProcs as BeepDrive or Wait available.
Interpreter is (most likely) the same. Available commands beyond keywords are different.
Too many Canon cameras.
WTB: High shutter count, slightly malfunctioning or otherwise damaged EOS R. The camera body is enough. EU only.
If you have a dead M50/R/RP mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

c_joerg

  • Member
  • ***
  • Posts: 137
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #88 on: January 07, 2022, 10:43:42 AM »
All you need to do on EOS is
Code: [Select]
private sub Initialize()
    CamInfo_Debug(1)
end sub

Yes I know.
With my M100 and G9xII I sometimes have the problem that it doesn't work (I suspect timing or SD card). With the beep I can immediately hear whether it worked. This simplifies troubleshooting.
I was hoping that these simple commands would also work with the R.

Interpreter is (most likely) the same. Available commands beyond keywords are different.

I was hoping a simple shooting Canon basic script would work on the R too
https://chdk.setepontos.com/index.php?topic=13522.0
Is there an overview about keywords?
EOS R

kitor

  • Developer
  • Senior
  • *****
  • Posts: 410
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #89 on: January 07, 2022, 12:57:14 PM »
https://www.magiclantern.fm/forum/index.php?topic=25662.0

First post contains all EvProcs available on RP. R is very similar.

At least on EOS codebase if script is not executed, error is printed on UART. Maybe if you enable uart redirect first, you'll get something interesting there.
Too many Canon cameras.
WTB: High shutter count, slightly malfunctioning or otherwise damaged EOS R. The camera body is enough. EU only.
If you have a dead M50/R/RP mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

c_joerg

  • Member
  • ***
  • Posts: 137
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #90 on: January 08, 2022, 07:08:33 PM »
We don't know much about RP yet, nobody can give you a definitive answer.  How much do these values go up on every cam due to testing Canon does in the factory?  We don't know.

A new R6 with TotalShoot = 0. That's what I would have expected...
https://www.dslr-forum.de/showpost.php?p=16258298&postcount=46
TotalShutter = 3 comes from the fact that the camera was switched off 3 times. The curtain closes. That is counted on R5/R6.
EOS R

kitor

  • Developer
  • Senior
  • *****
  • Posts: 410
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #91 on: January 08, 2022, 08:42:52 PM »
Funny, as it does not increase on R.
Too many Canon cameras.
WTB: High shutter count, slightly malfunctioning or otherwise damaged EOS R. The camera body is enough. EU only.
If you have a dead M50/R/RP mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

c_joerg

  • Member
  • ***
  • Posts: 137
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #92 on: January 08, 2022, 08:47:39 PM »
Yes, but manual sensor cleaning increases the TotalShutter by +3. TotalShoot remains constant.
EOS R

kitor

  • Developer
  • Senior
  • *****
  • Posts: 410
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #93 on: January 08, 2022, 09:14:35 PM »
Huh, this is even more complicated.

Code: [Select]
<TotalShoot>3432</TotalShoot>
<TotalShutter>3250</TotalShutter>

On R:
Turn on/off increases none (even though it closes shutter on shutdown)
Regular (shutter) shot increased both
Silent shot increases TotalShoot
Running cleanup process from menu increases TotalShutter by 3

So it is not "TotalShoot - Total Shutter = number of silent shots". I need to update ML GUI as that was my assumption.

Thanks for bringing it into attention!

PS:
DSLRs have third field, "TotalMirror". From 850D:
Code: [Select]
<TotalShoot>0</TotalShoot>
<TotalShutter>4</TotalShutter>
<TotalMirror>4</TotalMirror>

Too many Canon cameras.
WTB: High shutter count, slightly malfunctioning or otherwise damaged EOS R. The camera body is enough. EU only.
If you have a dead M50/R/RP mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

anykill

  • New to the forum
  • *
  • Posts: 18
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #94 on: January 11, 2022, 01:50:14 PM »
I am very noob at scripting and programming, I am just a Photographer....
Then... what can I do with scripting? where can i learn the commands...
Can I use scripts to focus stacking?
or to save Raw video like on EOS M?
Thank you for the answers even if I got flamed here.

kitor

  • Developer
  • Senior
  • *****
  • Posts: 410
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #95 on: January 12, 2022, 09:16:14 AM »
Quote
Then... what can I do with scripting? where can i learn the commands...
A lot of things, from nothing interesting to bricking your camera.

Quote
where can i learn the commands...
Nowhere. Availability differs per model.
Just a typo, or calling non-existent function will result in camera crash.

Quote
Can I use scripts to focus stacking?
or to save Raw video like on EOS M?
No and no. (real answer: maybe and maybe, but previous points apply)

Canon Basic is a factory tool for setting up and testing cameras.
It is simply unsafe to use without proper knowledge. If devs tell you "execute this cbasic script", it means we know that it is safe(ish) to run and what will be the outcome.

And remark: Scripts from CHDK forums will not work, due to "availability" point. "Our" models don't have many of the functions that those use. So yes, they will usually crash, not gently.
Too many Canon cameras.
WTB: High shutter count, slightly malfunctioning or otherwise damaged EOS R. The camera body is enough. EU only.
If you have a dead M50/R/RP mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

wddxnyr

  • Just arrived
  • *
  • Posts: 1
Sharing eos m6 ii rom dump files
« Reply #96 on: January 15, 2022, 06:37:16 PM »
Hi all,
Thank you all very much for your work.
I just tested canon basic scripting and it works on M6 II (digic 8). So I dumped the latest rom with firmware v1.1.1
I understand that you guys are not working on this camera; but just in case this might be helpful.
Let me know if you want these rom files. Also let me know if there is anything I can help.
Thanks for your time!

lorenzo353

  • New to the forum
  • *
  • Posts: 31
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #97 on: January 29, 2022, 03:01:42 PM »
Hi,

FYI,

https://github.com/lclevy/cbasic_examples
"The goal of this repository is to promote collaboration between camera hackers and **provide validated scripts** : tested on given Digic version, given Camera or firmware version."


Can be also discussed on https://discord.com/channels/671072748985909258/936696899120005230

Lorenzo

c_joerg

  • Member
  • ***
  • Posts: 137
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #98 on: February 08, 2022, 11:24:59 AM »
I'm currently trying Canon Basic on the EOS R and have had a few crashes ;)
I would like to record the temperature and voltage. Would the following script work?
Since I don't know what the temperature in float or int is, I would first record the HEX value.

I took the example with the files from the other examples. Why do you actually close the file after OpenFileCREAT?

Is there an example somewhere to record the time?

Code: [Select]
' Not tested!
' author c_joerg

dim count = 0

private sub Initialize()
  fileName = "B:/CCDTemp.TXT"
  RemoveFile(fileName)

  f = OpenFileCREAT(fileName)
  CloseFile(f)

  f = OpenFileWR(fileName)
 
  do while count < 10
     WriteFileString(f, "CCDTemperature: 0x%08X  ", GetCCDTemperature())
     WriteFileString(f, "BatteryVoltage: 0x%08X\n", GetBatteryVoltage())
     SleepTask(1000)
     count = count + 1
  loop
   
  CloseFile(f)

end sub
EOS R

c_joerg

  • Member
  • ***
  • Posts: 137
Re: Canon Basic scripting (DIGIC 8, DIGIC X models)
« Reply #99 on: February 09, 2022, 07:22:01 AM »
https://github.com/lclevy/cbasic_examples
"The goal of this repository is to promote collaboration between camera hackers and **provide validated scripts** : tested on given Digic version, given Camera or firmware version."
in some scripts i found path like

Code: [Select]
"B:/ROM.TXT"
I found it under
Code: [Select]
cbasic_examples/Universal/
Does this also work for cameras with only one card slot like the R or RP?
With my CHDK cameras this is always
Code: [Select]
A:
EOS R