From d37664b485dd38485eec4aafa41f10e48f30da57 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 28 May 2024 16:02:36 +0300 Subject: [iot/goam] Implemented remote photo taking --- Year 3/Internet of things/goam/main/main.c | 5 +++++ Year 3/Internet of things/goam/main/main.h | 2 ++ Year 3/Internet of things/goam/main/webserver.c | 5 +++++ Year 3/Internet of things/goam/webserver/index.html | 21 ++++++++++++++------- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Year 3/Internet of things/goam/main/main.c b/Year 3/Internet of things/goam/main/main.c index 3f2cf6a..c582dd1 100644 --- a/Year 3/Internet of things/goam/main/main.c +++ b/Year 3/Internet of things/goam/main/main.c @@ -193,6 +193,11 @@ static void timelapse_callback(TimerHandle_t timer) { ESP_LOGI(TAG, "Taking timelapse photo"); } +void main_force_photo() { + press_push_button(BTN_SHOOT_PIN); +} + + /* * On boot */ diff --git a/Year 3/Internet of things/goam/main/main.h b/Year 3/Internet of things/goam/main/main.h index 765d1b5..95c1765 100644 --- a/Year 3/Internet of things/goam/main/main.h +++ b/Year 3/Internet of things/goam/main/main.h @@ -7,3 +7,5 @@ void main_store_invertion(int32_t value); void main_store_timelapse_period(int32_t value); void main_start_timelapse(); void main_stop_timelapse(); + +void main_force_photo(); diff --git a/Year 3/Internet of things/goam/main/webserver.c b/Year 3/Internet of things/goam/main/webserver.c index fe6861d..d7cde5d 100644 --- a/Year 3/Internet of things/goam/main/webserver.c +++ b/Year 3/Internet of things/goam/main/webserver.c @@ -126,6 +126,7 @@ const char resolution_param[] = "resolution"; const char invertion_param[] = "invertion"; const char timelapse_period_param[] = "timelapse_period"; const char timelapse_change_param[] = "timelapse_change"; +const char remote_photo_param[] = "remote_photo"; static void main_store_request(const char* value, void (*main_store)(int32_t)) { if (*value == '%') value++; @@ -144,6 +145,7 @@ static esp_err_t post_config_handler(httpd_req_t *req) { } // Get values + char* remote_photo = get_value(buffer, remote_photo_param, sizeof(remote_photo_param)-1); char* ssid = get_value(buffer, ssid_param, sizeof(ssid_param)-1); char* pass = get_value(buffer, pass_param, sizeof(pass_param)-1); @@ -160,6 +162,9 @@ static esp_err_t post_config_handler(httpd_req_t *req) { } // Value logic + if (remote_photo != NULL) { + main_force_photo(); + } if (ssid != NULL && pass != NULL) { wifi_store_network(ssid, pass); } diff --git a/Year 3/Internet of things/goam/webserver/index.html b/Year 3/Internet of things/goam/webserver/index.html index afce35c..4a6d2f7 100644 --- a/Year 3/Internet of things/goam/webserver/index.html +++ b/Year 3/Internet of things/goam/webserver/index.html @@ -59,6 +59,13 @@ iframe { Click to Download +
+ +
+ + +
+

Configure static network

@@ -66,23 +73,23 @@ iframe {
- +

Configure timelapse

- +
- +
- +

Configure behaviour

@@ -93,7 +100,7 @@ iframe { - +
@@ -102,7 +109,7 @@ iframe { - +

@@ -110,7 +117,7 @@ iframe { - +