Code: [Select]void __attribute__((optimize("O0"))) LED_flasher(){ ...}
void __attribute__((optimize("O0"))) LED_flasher(){ ...}
Quote What is getm and how should it be used? I couldn't find anything on google about it, is it a CHDK only thing?You need to study the code & docs for chdkptp. It seems that reyalp no longer posts plain script code - just commands that run from the chdkptp command line
What is getm and how should it be used? I couldn't find anything on google about it, is it a CHDK only thing?
set_yield(-1,-1) -- disable script / keyboard task yield-- wait for the timer to wrap, so we know we are starting near zerolocal t0=peek(0xc0242014) while peek(0xc0242014) > t0 do endlocal tick0=get_tick_count() -- get the start time in ms-- wait for the counter to wrap ten more times to get a reasonable samplefor i=1 ,10 do t0=peek(0xc0242014) while peek(0xc0242014) > t0 do end endreturn get_tick_count() - tick0 -- return the elapsed time in ms
Until it's interrupted or yields, the current task gets all of the CPU. I think that's what you were asking?
This should eliminate the need for dummy variables, or other tricks to stop the compiler optimising the function away.
Is there any way to prevent other tasks from interrupting the process? Maybe some command to make the CPU ignore interrupts?
Quote from: Recyclojunk64 on 13 / April / 2014, 04:05:58Is there any way to prevent other tasks from interrupting the process? Maybe some command to make the CPU ignore interrupts?Bad coding practice at best. Dangerous to your camera at worst.
adequate for the task.
If the aim is to ensure both cameras are in exactly the same mode, that is understandable but plenty of SDM and CHDK users manage without it (including me). It does not take long to compare the settings and then leave them set.
the OP's original intent was to be able to do this while shooting stereo underwater.
Quote from: waterwingz on 13 / April / 2014, 17:50:39 the OP's original intent was to be able to do this while shooting stereo underwater. Seems a legitimate application.Comms speed required is another matter.
High-speed comms may be personally satisfying or a software challenge but what do you really need ?If the aim is to ensure both cameras are in exactly the same mode, that is understandable but plenty of SDM and CHDK users manage without it (including me).It does not take long to compare the settings and then leave them set.
void set_led_on(){ *((volatile int *) AF_LED_ADDRESS) = LED_ON; _SetHPTimerAfterTimeout(0,wait_until_this_time,set_led_off,set_led_off,0); wait_until_this_time += 512;}void set_led_off(){ *((volatile int *) AF_LED_ADDRESS) = LED_OFF; if (wait_until_this_time < 1000000) { _SetHPTimerAfterTimeout(0,wait_until_this_time,set_led_on,set_led_on,0); wait_until_this_time += 512; } else { wait_until_this_time = 256; start_LED_flasher = 1; }}void __attribute__((optimize("O0"))) LED_flasher(){ while (*(int*)0xc0242014 > 16)// wait till it's at the start { } _SetHPTimerAfterNow(wait_until_this_time,set_led_on,set_led_on,0); wait_until_this_time += 256;}
int master_current_bit = 0;int master_wait_untill = 2048;void master_send_bit();unsigned short master_message_buffer = 54321; //Just a random number at the momentvoid __attribute__((optimize("O0"))) LED_flasher(){ while (*(int*)0xc0242014 > 1024) //wait till it's at the start, wrap will coded later { } _SetHPTimerAfterTimeout(0,master_wait_untill,master_send_bit,master_send_bit,0);}void master_send_bit(){ if (master_message_buffer & (1 << master_current_bit)) //get the current bit { *((volatile int *) AF_LED_ADDRESS) = LED_ON; } else { *((volatile int *) AF_LED_ADDRESS) = LED_OFF; } if (master_current_bit < 16) //16 bits for now { master_current_bit++; master_wait_untill+=1024; _SetHPTimerAfterTimeout(0,master_wait_untill,master_send_bit,master_send_bit,0); } else { master_wait_untill = 2048; start_LED_flasher = 1; //allow it to run again }}
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