Skip to content

Commit 4c89814

Browse files
authored
Fix app_httpd.cpp's flash pinout declaration.
Flash pinout had to be declared manually, not using the data from <camera_pins.h>, not following DRY. The change enables <app_httpd.cpp> to get what the board is from the file <config.h>, and properly pull the flash pinout variable.
1 parent 7b0298b commit 4c89814

File tree

2 files changed

+15
-39
lines changed

2 files changed

+15
-39
lines changed

Diff for: libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino

+11-38
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,16 @@
1+
#include "config.h"
2+
3+
14
#include "esp_camera.h"
25
#include <WiFi.h>
3-
4-
//
5-
// WARNING!!! PSRAM IC required for UXGA resolution and high JPEG quality
6-
// Ensure ESP32 Wrover Module or other board with PSRAM is selected
7-
// Partial images will be transmitted if image exceeds buffer size
8-
//
9-
// You must select partition scheme from the board menu that has at least 3MB APP space.
10-
// Face Recognition is DISABLED for ESP32 and ESP32-S2, because it takes up from 15
11-
// seconds to process single frame. Face Detection is ENABLED if PSRAM is enabled as well
12-
13-
// ===================
14-
// Select camera model
15-
// ===================
16-
//#define CAMERA_MODEL_WROVER_KIT // Has PSRAM
17-
#define CAMERA_MODEL_ESP_EYE // Has PSRAM
18-
//#define CAMERA_MODEL_ESP32S3_EYE // Has PSRAM
19-
//#define CAMERA_MODEL_M5STACK_PSRAM // Has PSRAM
20-
//#define CAMERA_MODEL_M5STACK_V2_PSRAM // M5Camera version B Has PSRAM
21-
//#define CAMERA_MODEL_M5STACK_WIDE // Has PSRAM
22-
//#define CAMERA_MODEL_M5STACK_ESP32CAM // No PSRAM
23-
//#define CAMERA_MODEL_M5STACK_UNITCAM // No PSRAM
24-
//#define CAMERA_MODEL_M5STACK_CAMS3_UNIT // Has PSRAM
25-
//#define CAMERA_MODEL_AI_THINKER // Has PSRAM
26-
//#define CAMERA_MODEL_TTGO_T_JOURNAL // No PSRAM
27-
//#define CAMERA_MODEL_XIAO_ESP32S3 // Has PSRAM
28-
// ** Espressif Internal Boards **
29-
//#define CAMERA_MODEL_ESP32_CAM_BOARD
30-
//#define CAMERA_MODEL_ESP32S2_CAM_BOARD
31-
//#define CAMERA_MODEL_ESP32S3_CAM_LCD
32-
//#define CAMERA_MODEL_DFRobot_FireBeetle2_ESP32S3 // Has PSRAM
33-
//#define CAMERA_MODEL_DFRobot_Romeo_ESP32S3 // Has PSRAM
346
#include "camera_pins.h"
357

36-
// ===========================
37-
// Enter your WiFi credentials
38-
// ===========================
39-
const char *ssid = "**********";
40-
const char *password = "**********";
8+
//==========================================================
9+
// Please refer to <config.h> to setup wifi and board model.
10+
//==========================================================
11+
12+
const char *ssid = WIFI_SSID;
13+
const char *password = WIFI_PASSWORD;
4114

4215
void startCameraServer();
4316
void setupLedFlash(int pin);
@@ -68,8 +41,8 @@ void setup() {
6841
config.pin_reset = RESET_GPIO_NUM;
6942
config.xclk_freq_hz = 20000000;
7043
config.frame_size = FRAMESIZE_UXGA;
71-
config.pixel_format = PIXFORMAT_JPEG; // for streaming
72-
//config.pixel_format = PIXFORMAT_RGB565; // for face detection/recognition
44+
//config.pixel_format = PIXFORMAT_JPEG; // for streaming
45+
config.pixel_format = PIXFORMAT_RGB565; // for face detection/recognition
7346
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
7447
config.fb_location = CAMERA_FB_IN_PSRAM;
7548
config.jpeg_quality = 12;

Diff for: libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14+
#include "config.h"
15+
1416
#include "esp_http_server.h"
1517
#include "esp_timer.h"
1618
#include "esp_camera.h"
@@ -19,6 +21,7 @@
1921
#include "esp32-hal-ledc.h"
2022
#include "sdkconfig.h"
2123
#include "camera_index.h"
24+
#include "camera_pins.h"
2225

2326
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
2427
#include "esp32-hal-log.h"
@@ -30,7 +33,7 @@
3033
// LED FLASH setup
3134
#if CONFIG_LED_ILLUMINATOR_ENABLED
3235

33-
#define LED_LEDC_GPIO 22 //configure LED pin
36+
#define LED_LEDC_GPIO LED_GPIO_NUM
3437
#define CONFIG_LED_MAX_INTENSITY 255
3538

3639
int led_duty = 0;

0 commit comments

Comments
 (0)