Skip to content

Commit

Permalink
Improve support for changing cam clock frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
easytarget committed Jul 3, 2021
1 parent 56c5267 commit 3ba9e81
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions esp32-cam-webserver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ unsigned long imagesServed = 0; // Total image requests
// This will be displayed to identify the firmware
char myVer[] PROGMEM = __DATE__ " @ " __TIME__;

// Camera module bus communications frequency.
// Originally: config.xclk_freq_hz = 20000000, but this lead to visual artifacts on many modules.
// See https://github.com/espressif/esp32-camera/issues/150#issuecomment-726473652 et al.
#if !defined (XCLK_FREQ_HZ)
#define XCLK_FREQ_HZ 16500000;
#endif

// initial rotation
// can be set in myconfig.h
#if !defined(CAM_ROTATION)
Expand Down Expand Up @@ -482,8 +489,7 @@ void setup() {
config.pin_sscb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
// originally: config.xclk_freq_hz = 20000000;
config.xclk_freq_hz = 16500000; // See https://github.com/espressif/esp32-camera/issues/150#issuecomment-726473652 et al.
config.xclk_freq_hz = XCLK_FREQ_HZ;
config.pixel_format = PIXFORMAT_JPEG;
// Pre-allocate large buffers
if(psramFound()){
Expand Down
5 changes: 5 additions & 0 deletions myconfig.sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,8 @@ struct station stationList[] = {{"ssid1", "pass1", true},
// #define CAMERA_MODEL_M5STACK_WIDE
// #define CAMERA_MODEL_M5STACK_ESP32CAM // Originally: CAMERA_MODEL_M5STACK_NO_PSRAM
// #define CAMERA_MODEL_TTGO_T_JOURNAL

// Camera module bus communications frequency, setting too high can cause visual artifacts.
// Currently defaults to 16.5MHz, but some (non-clone) modules may be able to use the
// original frequency of 20MHz for to allow higher framerates etc.
// #define XCLK_FREQ_HZ 20000000;
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Version of upstream code */

char baseVersion[] = "4.0.alpha";
char baseVersion[] = "4.0.beta2";

0 comments on commit 3ba9e81

Please sign in to comment.