diff options
| Commit | d37664b485dd38485eec4aafa41f10e48f30da57 (patch) | |
|---|---|---|
| Author | 2024-05-28 16:02:36 +0300 | |
| Committer | 2024-05-28 16:02:36 +0300 | |
| Files | 0843d67ae8f375b6688f9301ba6618072c71d402 | |
| uni-projects-d37664b485dd38485eec4aafa41f10e48f30da57.tar uni-projects-d37664b485dd38485eec4aafa41f10e48f30da57.tar.gz uni-projects-d37664b485dd38485eec4aafa41f10e48f30da57.zip | ||
| Parent | a2ecddfd0351b6c53b3cb9d5f8d88743924d9e01 (diff) | |
[iot/goam] Implemented remote photo taking
4 files changed, 26 insertions, 7 deletions
| -rw-r--r-- | Year 3/Internet of things/goam/main/main.c | 5 | ||||
| -rw-r--r-- | Year 3/Internet of things/goam/main/main.h | 2 | ||||
| -rw-r--r-- | Year 3/Internet of things/goam/main/webserver.c | 5 | ||||
| -rw-r--r-- | Year 3/Internet of things/goam/webserver/index.html | 21 |
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 { <img src="/spiffs/capture.jpeg"/> <a class="button full-width" href="/spiffs/capture.jpeg" download="capture.jpeg">Click to Download</a> + <br> + + <form action="/config" target="dummyframe" method="POST"> + <input name="remote_photo" type="hidden" value=""> + <input class="full-width" type="submit" value="Take remote photo"> + </form> + <iframe id="dummyframe" name="dummyframe" hidden></iframe> <h1>Configure static network</h1> @@ -66,23 +73,23 @@ iframe { <form action="/config" target="dummyframe" method="POST"> <input name="ssid" type="text" placeholder="Name (SSID)"> <input name="pass" type="text" placeholder="Password"> - <input class="button" type="submit" value="Save"> + <input type="submit" value="Save"> </form> <h1>Configure timelapse</h1> <form action="/config" target="dummyframe" method="POST"> <input name="timelapse_period" type="number" placeholder="Timelapse period" min="10"> - <input class="button" type="submit" value="Save"> + <input type="submit" value="Save"> </form> <form action="/config" target="dummyframe" method="POST"> <input name="timelapse_change" type="hidden" value="1"> - <input class="button" type="submit" value="Start timelapse"> + <input type="submit" value="Start timelapse"> </form> <form action="/config" target="dummyframe" method="POST"> <input name="timelapse_change" type="hidden" value="0"> - <input class="button" type="submit" value="Stop timelapse"> + <input type="submit" value="Stop timelapse"> </form> <h1>Configure behaviour</h1> @@ -93,7 +100,7 @@ iframe { <option value="">Only send to <code>/camera</code> listeners</option> <option value="" selected>Save and send</option> </select> - <input class="button" type="submit" value="Apply"> + <input type="submit" value="Apply"> </form> <br> <form action="/config" target="dummyframe" method="POST"> @@ -102,7 +109,7 @@ iframe { <option value="">320x240</option> <option value=""">160x120</option> </select> - <input class="button" type="submit" value="Apply"> + <input type="submit" value="Apply"> </form> <br> <form action="/config" target="dummyframe" method="POST"> @@ -110,7 +117,7 @@ iframe { <option value="¦" selected>Normal</option> <option value="§">Inverted</option> </select> - <input class="button" type="submit" value="Apply"> + <input type="submit" value="Apply"> </form> </article> <script> |
