Canon Basic scripting (DIGIC 8, DIGIC X models)

Started by srsa, September 03, 2020, 01:11:27 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

c_joerg

Quote from: names_are_hard on July 23, 2021, 08:28:33 PM
With 1,086,947,603 shutter activations? 
No, because of 701 TotalShoot and 173 PowerOnCount
Quote from: kitor on July 23, 2021, 07:51:51 PM
RP is anomaly.
Yes, of course, TotalShutter on RP is anomaly.
EOS R

names_are_hard

Oh, I understand now, you were talking about something different to everyone else in the thread.  Now my confusion makes sense :)

c_joerg

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

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

Quote from: names_are_hard 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.

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

QuoteSince 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).

Quotereported 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.
If you have a dead R, RP, 250D mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

j1080

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

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

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


c_joerg

The following code

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

-<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

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

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

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.
If you have a dead R, RP, 250D mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

c_joerg

Quote from: kitor on January 06, 2022, 08:54:29 PM
All you need to do on EOS is

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.

Quote from: kitor on January 06, 2022, 08:54:29 PM
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

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.
If you have a dead R, RP, 250D mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

c_joerg

Quote from: names_are_hard on July 23, 2021, 04: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

Too many Canon cameras.
If you have a dead R, RP, 250D mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

c_joerg

Yes, but manual sensor cleaning increases the TotalShutter by +3. TotalShoot remains constant.
EOS R

kitor

Huh, this is even more complicated.

<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:
<TotalShoot>0</TotalShoot>
<TotalShutter>4</TotalShutter>
<TotalMirror>4</TotalMirror>


Too many Canon cameras.
If you have a dead R, RP, 250D mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

anykill

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

QuoteThen... what can I do with scripting? where can i learn the commands...
A lot of things, from nothing interesting to bricking your camera.

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

QuoteCan 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.
If you have a dead R, RP, 250D mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

wddxnyr

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

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

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?

' 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

Quote from: lorenzo353 on January 29, 2022, 03:01:42 PM
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

"B:/ROM.TXT"

I found it under 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 A:
EOS R