Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit637fc967c463230c9ed7893e84f3a0f390a22615 (patch)
Author
 Syndamia <kamen@syndamia.com>
2024-05-19 21:04:33 +0300
Committer
 Syndamia <kamen@syndamia.com>
2024-05-19 21:04:33 +0300
Files8a2afb432121fdd3cd7741df11fafe89f2d52de9
uni-projects-637fc967c463230c9ed7893e84f3a0f390a22615.tar
uni-projects-637fc967c463230c9ed7893e84f3a0f390a22615.tar.gz
uni-projects-637fc967c463230c9ed7893e84f3a0f390a22615.zip
Parentb1960f8badfa7fddfc47eeefb04add97af26e3e8 (diff)
[iot/goam] take_photo tries 3 times to save photo and extracted serial console printing to its own function
1 files changed, 13 insertions, 6 deletions
-rw-r--r--Year 3/Internet of things/goam/main/main.c19
diff --git a/Year 3/Internet of things/goam/main/main.c b/Year 3/Internet of things/goam/main/main.c
index b74129d..3f3d46b 100644
--- a/Year 3/Internet of things/goam/main/main.c
+++ b/Year 3/Internet of things/goam/main/main.c
@@ -50,17 +50,24 @@ void print_chip_data() {
#define BTN_SHOOT_PIN 13
+void debug_serial_print_image(const char* image, size_t length) {
+ for (int i = 0; i < length; i++) {
+ printf("%d ", image[i]);
+ if (i % 12 == 0)
+ printf("\n");
+ }
+ printf("\n");
+}
+
void take_photo() {
ptc06_set_image_resolution(RES_640X480);
char* image;
size_t length = ptc06_get_image(&image);
- /* for (int i = 0; i < length; i++) { */
- /* printf("%d ", image[i]); */
- /* if (i % 12 == 0) */
- /* printf("\n"); */
- /* } */
- /* printf("\n"); */
+ for (int tries = 0; tries < 3; tries++) {
spiffs_write(SPIFFS_PREFIX "/capture.jpeg", image, length);
+ vTaskDelay(50 / portTICK_PERIOD_MS);
+ }
+ /* debug_serial_print_image(); */
free(image);
}