Then try passing 0 as the first argument (which is the time base).
QuoteThen try passing 0 as the first argument (which is the time base).Doesn't really seem to like me doing that. The LED comes on, and the camera crashes shortly after. Also tried messing around with different numbers but it always crashes just after turning the LED on.
HP timer functions, they use a 20 bit hw counter, retrieved by GetCurrentMachineTime() aka *(int*)0xc0242014
con 11> cconnected: Canon PowerShot D10, max packet size 512con 4> =t={} for i=1,100 do local t0,t1=peek(0xc0242014),peek(0xc0242014) table.insert(t,t1-t0) end return t5:return:table:{[1]=11,[2]=8,[3]=8,[4]=8,[5]=7,[6]=8,[7]=7,[8]=8,[9]=7,[10]=9,[11]=8,[12]=7,[13]=7,[14]=8,[15]=8,[16]=8,[17]=8,[18]=8,[19]=8,[20]=8,[21]=7,[22]=7,[23]=8,[24]=14,[25]=7,[26]=7,[27]=8,[28]=8,[29]=7,[30]=7,[31]=8,[32]=8,[33]=7,[34]=7,[35]=7,[36]=7,[37]=7,[38]=8,[39]=7,[40]=8,[41]=8,[42]=8,[43]=7,[44]=8,[45]=7,[46]=8,[47]=8,[48]=7,[49]=10,[50]=8,[51]=7,[52]=8,[53]=8,[54]=7,[55]=8,[56]=7,[57]=8,[58]=7,[59]=7,[60]=8,[61]=7,[62]=8,[63]=8,[64]=7,[65]=8,[66]=8,[67]=7,[68]=8,[69]=8,[70]=8,[71]=8,[72]=8,[73]=8,[74]=12,[75]=7,[76]=8,[77]=7,[78]=8,[79]=7,[80]=8,[81]=7,[82]=7,[83]=8,[84]=7,[85]=8,[86]=7,[87]=8,[88]=7,[89]=8,[90]=8,[91]=7,[92]=8,[93]=7,[94]=8,[95]=7,[96]=8,[97]=7,[98]=7,[99]=10,[100]=8,}con 5> dis___> cconnected: Canon PowerShot A540, max packet size 512con> =t={} for i=1,100 do local t0,t1=peek(0xc0242014),peek(0xc0242014) table.insert(t,t1-t0) end return t1:return:table:{[1]=22,[2]=17,[3]=18,[4]=17,[5]=16,[6]=18,[7]=15,[8]=16,[9]=15,[10]=18,[11]=16,[12]=15,[13]=15,[14]=16,[15]=15,[16]=16,[17]=15,[18]=17,[19]=16,[20]=15,[21]=15,[22]=16,[23]=15,[24]=38,[25]=16,[26]=15,[27]=16,[28]=15,[29]=15,[30]=15,[31]=15,[32]=15,[33]=1535,[34]=19,[35]=16,[36]=15,[37]=15,[38]=15,[39]=15,[40]=15,[41]=15,[42]=15,[43]=16,[44]=16,[45]=16,[46]=15,[47]=15,[48]=15,[49]=31,[50]=16,[51]=16,[52]=15,[53]=15,[54]=15,[55]=15,[56]=15,[57]=15,[58]=15,[59]=15,[60]=15,[61]=15,[62]=15,[63]=15,[64]=15,[65]=15,[66]=19,[67]=15,[68]=15,[69]=15,[70]=15,[71]=15,[72]=15,[73]=16,[74]=36,[75]=16,[76]=15,[77]=15,[78]=16,[79]=15,[80]=15,[81]=15,[82]=15,[83]=19,[84]=16,[85]=15,[86]=15,[87]=15,[88]=15,[89]=16,[90]=15,[91]=16,[92]=15,[93]=15,[94]=15,[95]=16,[96]=15,[97]=15,[98]=15,[99]=31,[100]=16,}con 1> dis___> cconnected: Canon PowerShot ELPH 130 IS, max packet size 512con> =t={} for i=1,100 do local t0,t1=peek(0xc0242014),peek(0xc0242014) table.insert(t,t1-t0) end return t1:return:table:{[1]=11,[2]=9,[3]=8,[4]=8,[5]=7,[6]=182,[7]=9,[8]=7,[9]=8,[10]=7,[11]=8,[12]=7,[13]=7,[14]=8,[15]=8,[16]=9,[17]=8,[18]=8,[19]=7,[20]=8,[21]=7,[22]=7,[23]=8,[24]=15,[25]=7,[26]=7,[27]=7,[28]=8,[29]=8,[30]=7,[31]=8,[32]=8,[33]=7,[34]=8,[35]=8,[36]=8,[37]=8,[38]=7,[39]=8,[40]=7,[41]=7,[42]=8,[43]=7,[44]=8,[45]=7,[46]=8,[47]=8,[48]=7,[49]=11,[50]=7,[51]=7,[52]=8,[53]=7,[54]=8,[55]=8,[56]=7,[57]=8,[58]=7,[59]=8,[60]=7,[61]=8,[62]=7,[63]=8,[64]=7,[65]=8,[66]=8,[67]=8,[68]=7,[69]=8,[70]=7,[71]=7,[72]=7,[73]=8,[74]=13,[75]=8,[76]=7,[77]=8,[78]=8,[79]=7,[80]=8,[81]=7,[82]=7,[83]=8,[84]=8,[85]=8,[86]=7,[87]=8,[88]=7,[89]=8,[90]=8,[91]=8,[92]=7,[93]=8,[94]=7,[95]=8,[96]=7,[97]=8,[98]=8,[99]=10,[100]=8,}
It would also be nice to be able to time some things with better than 10ms precision.
I was curious what level of precision I would get reading this from lua:
The A540 seems to run at a different speed than the other two cameras ?
As I posted earlier, I've wondered if some cameras actually run the kbd task (and thus the script engine) on a 20 mSec tic time rather than 10 mSec. That would explain some of the strange timing values reported.
It occurs to me that it could be quite useful to implement our own sub-10ms time function, for CHDK code and script. You could for example sleep with ~10ms granularity, and then use a busy loop to for a more precise time.It would also be nice to be able to time some things with better than 10ms precision.Since the hardware counter wraps nearly (but not exactly ) once a second, it would be nice to have some higher level function to deal with this. Perhaps something like: http://pubs.opengroup.org/onlinepubs/009695399/functions/gettimeofday.html
void delay_test(){ long variable_to_increment = 0; while (variable_to_increment < 1073741824) { variable_to_increment++; } if (variable_to_increment > 1073741820) //Just to be sure the above isn't somehow skipped { *((volatile int *) AF_LED_ADDRESS) = LED_ON; }}
And the LED turns on immediately on both those cameras. (The previous test that was similar to this was done on the ixus 65)
Is "variable_to_increment" local to the function in one case and global in the other? This will change the compiled code and speed a lot. The compiler might even optimize the loop out completely.
But so it's possible then that the compiler might realise that all it needs to do to get out of the loop is to set variable_to_increment to 1073741824 and just get rid of the loop?I also had put unread_variable = *(short*)0xc090004a; in it and that made no difference, so perhaps the compiler even realised that that wasn't necessary and got rid of it aswell? I will try something else and see if I can get it to actually delay.
asm volatile ("nop\n");
Started by fudgey General Discussion and Assistance
Started by srsa_4c « 1 2 » General Discussion and Assistance
Started by lipefrs « 1 2 » Script Writing
Started by reyalp DryOS Development
Started by reyalp General Discussion and Assistance