* The timer shot task operation runs as a task generated by the interrupt * routine. It reserves a semaphore in the first phase of the function to avoid * conflicting image sensor access with other tasks. The secured semaphore will * not be released until the captured image is exported to SD. In addition, the * timer will also stop temporarily. * @param pvParameters Current instance of ESP3
| 625 | * @param pvParameters Current instance of ESP32Cam |
| 626 | */ |
| 627 | void ESP32Cam::_timerShotTask(void* pvParametes) { |
| 628 | // Take a Mutex that avoids contention for image sensor resources. |
| 629 | if (enq(portMAX_DELAY) == pdTRUE) { |
| 630 | |
| 631 | // Receive current instance of ESP32Cam |
| 632 | ESP32Cam* esp32cam = reinterpret_cast<ESP32Cam*>(pvParametes); |
| 633 | |
| 634 | // Temporarily stop the timer during execution to suppress task overlap. |
| 635 | timerStop(esp32cam->_hwTimer); |
| 636 | |
| 637 | // Assemble the file name of the destination of the captured image. |
| 638 | char fn[esp32cam->_captureName.length() + sizeof('\0') + 20]; |
| 639 | strcpy(fn, esp32cam->_captureName.c_str()); |
| 640 | esp32cam->_appendTimestamp(fn); |
| 641 | |
| 642 | // Capture and export to SD |
| 643 | esp32cam->_export(fn, nullptr); |
| 644 | |
| 645 | // Release the resource and restart the timer increment. |
| 646 | timerStart(esp32cam->_hwTimer); |
| 647 | deq(); |
| 648 | // Purge itself |
| 649 | vTaskDelete(NULL); |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | /** |
| 654 | * Temporarily stops the timerShot cycle. |
nothing calls this directly
no test coverage detected