From 7840388985524e6f631a74740f96e48dd4d8cb11 Mon Sep 17 00:00:00 2001 From: Owen Date: Fri, 11 Sep 2020 06:04:01 +0200 Subject: [PATCH 1/5] Move all CSS into a include file, reduce whitespace count on primary html --- app_httpd.cpp | 18 + camera_index_ov2640.h | 1392 +++++++++++++++------------------------- camera_index_ov3660.h | 1408 ++++++++++++++++------------------------- css.h | 389 ++++++++++++ miniviewer.h | 466 ++------------ 5 files changed, 1504 insertions(+), 2169 deletions(-) create mode 100644 css.h diff --git a/app_httpd.cpp b/app_httpd.cpp index 59d9e24..a3aa539 100644 --- a/app_httpd.cpp +++ b/app_httpd.cpp @@ -20,6 +20,7 @@ #include "camera_index_ov2640.h" #include "camera_index_ov3660.h" #include "miniviewer.h" +#include "css.h" #include "favicon/favicons.h" //#define DEBUG_STREAM_DATA // Debug: dump info for each stream frame on serial port @@ -664,6 +665,15 @@ static esp_err_t favicon_ico_handler(httpd_req_t *req){ return httpd_resp_send(req, (const char *)favicon_ico, favicon_ico_len); } +static esp_err_t style_handler(httpd_req_t *req){ + flashLED(75); // a little feedback to user + delay(75); + flashLED(75); + httpd_resp_set_type(req, "text/css"); + httpd_resp_set_hdr(req, "Content-Encoding", "identity"); + return httpd_resp_send(req, (const char *)style_css, style_css_len); +} + static esp_err_t miniviewer_handler(httpd_req_t *req){ flashLED(75); // a little feedback to user delay(75); @@ -724,6 +734,13 @@ void startCameraServer(int hPort, int sPort){ .user_ctx = NULL }; + httpd_uri_t style_uri = { + .uri = "/style.css", + .method = HTTP_GET, + .handler = style_handler, + .user_ctx = NULL + }; + httpd_uri_t favicon_16x16_uri = { .uri = "/favicon-16x16.png", .method = HTTP_GET, @@ -780,6 +797,7 @@ void startCameraServer(int hPort, int sPort){ httpd_register_uri_handler(camera_httpd, &status_uri); httpd_register_uri_handler(camera_httpd, &capture_uri); httpd_register_uri_handler(camera_httpd, &miniviewer_uri); + httpd_register_uri_handler(camera_httpd, &style_uri); httpd_register_uri_handler(camera_httpd, &favicon_16x16_uri); httpd_register_uri_handler(camera_httpd, &favicon_32x32_uri); httpd_register_uri_handler(camera_httpd, &favicon_ico_uri); diff --git a/camera_index_ov2640.h b/camera_index_ov2640.h index 7a71e34..70e386d 100644 --- a/camera_index_ov2640.h +++ b/camera_index_ov2640.h @@ -1,893 +1,543 @@ -//File: index_ov2640.html +/* + * primary HTML for the OV2640 camera module + */ + const uint8_t index_ov2640_html[] = R"=====( - - - - ESP32 OV2640 - - - - - -
- -
-