Skip to content

Commit

Permalink
validated PSRAM on all examples. Freenove build flag issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
hpsaturn committed Jan 15, 2024
1 parent a3448d3 commit 06744f7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
5 changes: 5 additions & 0 deletions examples/basic_m5cores3/basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ void setup() {
}
CoreS3.Display.drawString("Camera Init Success", dw / 2, dh / 2);
CoreS3.Camera.sensor->set_framesize(CoreS3.Camera.sensor, FRAMESIZE_QVGA);

if(psramFound()){
size_t psram_size = esp_spiram_get_size() / 1048576;
Serial.printf("PSRAM size: %dMb\r\n", psram_size);
}
}

void loop() {
Expand Down
8 changes: 7 additions & 1 deletion examples/espnow_m5cores3/espnow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ int32_t dw, dh;

void setup() {
Serial.begin(115200);

auto cfg = M5.config();
CoreS3.begin(cfg);
CoreS3.Display.setTextColor(GREEN);
Expand All @@ -27,6 +28,11 @@ void setup() {
}
CoreS3.Display.drawString("Camera Init Success", dw / 2, dh / 2);
CoreS3.Camera.sensor->set_framesize(CoreS3.Camera.sensor, FRAMESIZE_QVGA);

if(psramFound()){
size_t psram_size = esp_spiram_get_size() / 1048576;
Serial.printf("PSRAM size: %dMb\r\n", psram_size);
}

jm = joystick.newJoystickMsg();
joystick.init();
Expand All @@ -38,7 +44,7 @@ void loop() {
uint8_t *out_jpg = NULL;
size_t out_jpg_len = 0;
frame2jpg(CoreS3.Camera.fb, 32, &out_jpg, &out_jpg_len);
Serial.printf("jpg data size: %i\r\n",out_jpg_len);
// Serial.printf("jpg data size: %i\r\n",out_jpg_len);
jm.az = sizeof(CoreS3.Camera.fb);
jm.ax = out_jpg_len;
jm.ay = CoreS3.Display.height();
Expand Down
3 changes: 2 additions & 1 deletion examples/freenove_webcam/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ void setup() {
// if PSRAM IC present, init with UXGA resolution and higher JPEG quality
// for larger pre-allocated frame buffer.
if(psramFound()){
Serial.println("PSRAM found");
size_t psram_size = esp_spiram_get_size() / 1048576;
Serial.printf("PSRAM size: %dMb\r\n", psram_size);
config.jpeg_quality = 10;
config.fb_count = 2;
config.grab_mode = CAMERA_GRAB_LATEST;
Expand Down
11 changes: 6 additions & 5 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ monitor_filters =
build_flags =
-D CORE_DEBUG_LEVEL=0
-D BOARD_HAS_PSRAM=1
-mfix-esp32-psram-cache-issue
'-DWIFI_SSID="${wifi.ssid}"'
'-DWIFI_PASS="${wifi.password}"'

[env:freenove-webcam]
extends = env
board = esp32-s3-devkitc-1
board_build.arduino.memory_type = dio_opi ;
build_src_filter = -<*> +<freenove_webcam/>

[m5cores3_common]
Expand All @@ -37,10 +38,10 @@ lib_deps =
https://github.com/m5stack/M5CoreS3.git
m5stack/M5Unified@^0.1.6
build_flags =
${env.build_flags}
-DESP32S3
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MODE=1
${env.build_flags}
-DESP32S3
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MODE=1

[env:basic_m5cores3]
extends = m5cores3_common
Expand Down

0 comments on commit 06744f7

Please sign in to comment.