In fact, these values (0 and 8) exist before and after the photo is taken in a normal situation. When it fails, there is no evidence of what happens.
Anyway, since it is a rare event I used a Watchdog timer to bypass the issue if it happens.
Thanks for all your valuable comments.
Control time of a function's execution time
Re: Control time of a function's execution time
The troublesome function was:dannyf wrote: Fri Feb 24, 2023 1:30 pmthat means that the routine returns execution to the main loop, just with the unexpected value (8). you will need to see 1) why it returns that value; and 2) how you would continue execution if that value is returned.before and after the mentioned while loop in normal situation, they are 0 and 8, respectively.
so the question now is much simpler.
Code: Select all
myCAM.get_bit(ARDUCHIP_TRIG , CAP_DONE_MASK)
Code: Select all
//Get corresponding bit status
uint8_t ArduCAM::get_bit(uint8_t addr, uint8_t bit)
{
uint8_t temp;
temp = read_reg(addr);
temp = temp & bit;
return temp;
}
Code: Select all
#define CAP_DONE_MASK 0x08
Not ever returning a value of 8 is perhaps unexpected (in other words, to continue to return 0 no matter how many times you try). However, I thought that possibility had been excluded? If so, maybe sometimes it does not return either 0 or 8, in that it does not return at all. Either way, if you really wanted to know why you would have to dig deeper, into Arducam and perhaps beyond.
Re: Control time of a function's execution time
Thanks all for your helpful contributions!
Re: Control time of a function's execution time
thank you dannyf. I totally understand!