Skip to content

Commit

Permalink
Merge pull request #44 from hpsaturn/devel
Browse files Browse the repository at this point in the history
Devel
hpsaturn authored Oct 28, 2024
2 parents 8e1d877 + 2d56990 commit b8dca20
Showing 40 changed files with 126 additions and 110 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@ void onDataReady(uint32_t lenght) {
It's also possible to define a specific target:
```cpp
uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
const uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
radio.setTarget(macRecv);
radio.init();
```
@@ -136,7 +136,7 @@ CamFreenove Camera;
```

>[!TIP]
>For now, it includes drivers for FreenoveS3, XIAOS3, M5UnitCamS3, Freenove WRover, ESP32Cam AI-Thinker and the TTGO T-Journal cameras, but you are able to define your custom camera like is shown in the [custom-camera-sender](https://github.com/hpsaturn/ESPNowCam/tree/master/examples/custom-camera-sender) example. If you can run it in a different camera, please notify me :D
>For now, it includes drivers for FreenoveS3, XIAOS3, M5UnitCamS3, Freenove WRover, ESP32Cam AI-Thinker and the TTGO T-Journal cameras, but you are able to define your custom camera like is shown in the [custom-camera-sender](https://github.com/hpsaturn/ESPNowCam/tree/master/examples/custom-camera-sender) example. If you can run it in a different camera, please notify me via a [GitHub issue](https://github.com/hpsaturn/ESPNowCam/issues/new) or please contribute with the project sending a pull request :D
### PSRAM or DRAM?

@@ -197,10 +197,9 @@ Some examples are for Arduino users (*.ino samples), but is possible too compile

I want to extend my gratitude to:

@ElectroZeusTIC and @AcoranTf for testing on Arduino IDE.
@UtaAoya for findings related to the M5UnitCam device.
@MeloCuentan for fixing issues with the AI-Thinker Camera and the new ESP32S3 RGB receiver.
@turmandreams for tests on the AI-Thinker Camera and the M5Core receiver.

[@ElectroZeusTIC](https://github.com/electrozeustic) and [@AcoranTf](https://github.com/AcoranTf) for testing on Arduino IDE.
[@UtaAoya](https://x.com/UtaAoya) for findings related to the M5UnitCam device.
[@MeloCuentan](https://github.com/MeloCuentan) for fixing issues with the AI-Thinker Camera and the new ESP32S3 RGB receiver.
[@turmandreams](https://github.com/turmandreams) for tests on the AI-Thinker Camera and the M5Core receiver.

---
9 changes: 8 additions & 1 deletion examples/custom-camera-sender/custom-camera-sender.cpp
Original file line number Diff line number Diff line change
@@ -15,7 +15,14 @@ camera_fb_t* fb;

bool has_psram = false;

// Please change this to your Camera pins:
// !! N O T E !!
// Please change this for your Camera pins if your camera
// is not listed in the examples or driver directory.

// If your new config works and it is not included in the
// drivers section, please notify it via an issue or please
// contribute to the proyect with a pull request. Thanks!

camera_config_t camera_config = {
.pin_pwdn = -1,
.pin_reset = 15,
4 changes: 2 additions & 2 deletions examples/esp32cam-basic-sender/esp32cam-basic-sender.ino
Original file line number Diff line number Diff line change
@@ -40,8 +40,8 @@ void setup() {
Serial.printf("PSRAM size: %dMb\r\n", psram_size);
}

// M5Core2 receiver target (P2P or 1:1 mode)
// uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// Optional set M5Core2 receiver target (P2P or 1:1 mode)
// const uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// radio.setTarget(macRecv);
radio.init();

2 changes: 1 addition & 1 deletion examples/esp32cam-basic-sender/platformio.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; ESPNowCam Freenove ESP32S3CAM
; https://github.com/hpsaturn/esp32s3-cam
; https://github.com/hpsaturn/ESPNowCam.git
; @Hpsaturn 2024

[platformio]
2 changes: 1 addition & 1 deletion examples/esp32cam-p2p-sender/esp32cam-p2p-sender.cpp
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ void setup() {
}

// M5Core2 receiver target (P2P or 1:1 mode)
uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
const uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
radio.setTarget(macRecv);
radio.init();

2 changes: 1 addition & 1 deletion examples/freenove-basic-sender/freenove-basic-sender.ino
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ void setup() {
}

// M5Core2 receiver target (P2P or 1:1 mode)
// uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// const uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// radio.setTarget(macRecv);
radio.init();

2 changes: 1 addition & 1 deletion examples/freenove-p2p-sender/freenove-p2p-sender.cpp
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ void setup() {
}

// M5Core2 receiver
uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
const uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
radio.setTarget(macRecv);
radio.init();

56 changes: 28 additions & 28 deletions examples/freenove-tank/freenove-tank.cpp
Original file line number Diff line number Diff line change
@@ -139,19 +139,19 @@ void onDataReady(uint32_t lenght) {
decodeMsg(lenght);
}

void wcli_reboot(String opts){
void wcli_reboot(char *args, Stream *response){
ESP.restart();
}

void wcli_kset(String opts) {
maschinendeck::Pair<String, String> operands = maschinendeck::SerialTerminal::ParseCommand(opts);
void wcli_kset(char *args, Stream *response) {
Pair<String, String> operands = wcli.parseCommand(args);
String key = operands.first();
String v = operands.second();
cfg.saveAuto(key,v);
}

void wcli_klist(String opts) {
maschinendeck::Pair<String, String> operands = maschinendeck::SerialTerminal::ParseCommand(opts);
void wcli_klist(char *args, Stream *response) {
Pair<String, String> operands = wcli.parseCommand(args);
String opt = operands.first();
Serial.printf("\n%11s \t%s \t%s \r\n", "KEYNAME", "DEFINED", "VALUE");
Serial.printf("\n%11s \t%s \t%s \r\n", "=======", "=======", "=====");
@@ -166,34 +166,34 @@ void wcli_klist(String opts) {
}
}

void wcli_setup(String opts) {
void wcli_setup(char *args, Stream *response) {
setup_mode = true;
Serial.println("\r\nSetup Mode Enable (fail-safe mode)\r\n");
}

void wcli_exit(String opts) {
void wcli_exit(char *args, Stream *response) {
setup_time = 0;
setup_mode = false;
}

void wcli_debug(String opts) {
void wcli_debug(char *args, Stream *response) {
debug = !debug;
cfg.saveBool(PKEYS::KDEBUG, debug);
}

void wcli_servoL(String opts) {
maschinendeck::Pair<String, String> operands = maschinendeck::SerialTerminal::ParseCommand(opts);
void wcli_servoL(char *args, Stream *response) {
Pair<String, String> operands = wcli.parseCommand(args);
attachServoLeft();
servoLeft.write(operands.first().toInt());
}

void wcli_servoR(String opts) {
maschinendeck::Pair<String, String> operands = maschinendeck::SerialTerminal::ParseCommand(opts);
void wcli_servoR(char *args, Stream *response) {
Pair<String, String> operands = wcli.parseCommand(args);
attachServoRight();
servoRight.write(operands.first().toInt());
}

void wcli_pauseCam(String opts){
void wcli_pauseCam(char *args, Stream *response){
cam_stopped = !cam_stopped;
Serial.printf("camera streaming %s\r\n", cam_stopped ? "stopped" : "resumed");
}
@@ -218,7 +218,7 @@ void loadVariables() {
degreesMaxR = degreesCenterR + spanRight + offsetRight;
}

void wcli_print(String opts) {
void wcli_print(char *args, Stream *response) {
loadVariables();
Serial.printf("LEFT => span: %i offset: %i center: %i\r\n", spanLeft, offsetLeft, degreesCenterL);
Serial.printf("LEFT => degreesMinL: %i degreesMaxL: %i\r\n\n", degreesMinL, degreesMaxL);
@@ -237,20 +237,20 @@ void setup() {

cfg.init("espnowcam");

wcli.disableConnectInBoot();
wcli.setSilentMode(true);
wcli.begin();

wcli.term->add("reboot", &wcli_reboot, "\tperform a ESP32 reboot");
wcli.term->add("setup", &wcli_setup,"\tTYPE THIS WORD to start to configure the device :D\n");
wcli.term->add("exit", &wcli_exit, "\texit of the setup mode. AUTO EXIT in 10 seg! :)");
wcli.term->add("klist", &wcli_klist, "\tlist valid preference keys");
wcli.term->add("kset", &wcli_kset, "\tset preference key (e.g on/off or 1/0 or text)");
wcli.term->add("print", &wcli_print, "\tprint current variables");
wcli.term->add("servoL", &wcli_servoL, "\tset value on servo L");
wcli.term->add("servoR", &wcli_servoR, "\tset value on servo R");
wcli.term->add("pauseCam", &wcli_pauseCam, "\tstop/resume camera stream");
wcli.term->add("debug", &wcli_debug, "\tdebugging flag toggle");
wcli.add("reboot", &wcli_reboot, "\tperform a ESP32 reboot");
wcli.add("setup", &wcli_setup,"\tTYPE THIS WORD to start to configure the device :D\n");
wcli.add("exit", &wcli_exit, "\texit of the setup mode. AUTO EXIT in 10 seg! :)");
wcli.add("klist", &wcli_klist, "\tlist valid preference keys");
wcli.add("kset", &wcli_kset, "\tset preference key (e.g on/off or 1/0 or text)");
wcli.add("print", &wcli_print, "\tprint current variables");
wcli.add("servoL", &wcli_servoL, "\tset value on servo L");
wcli.add("servoR", &wcli_servoR, "\tset value on servo R");
wcli.add("pauseCam", &wcli_pauseCam, "\tstop/resume camera stream");
wcli.add("debug", &wcli_debug, "\tdebugging flag toggle");

wcli.begin();

// Allow allocation of all timers
ESP32PWM::allocateTimer(0);
@@ -287,11 +287,11 @@ void setup() {
delay(1000);

// BE CAREFUL WITH IT, IF JPG LEVEL CHANGES, INCREASE IT
recv_buff = (uint8_t*) ps_malloc(100* sizeof( uint8_t ) ) ;
recv_buff = static_cast<uint8_t*>(ps_malloc(100 * sizeof(uint8_t)));
radio.setRecvBuffer(recv_buff);
radio.setRecvCallback(onDataReady);

uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
const uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
radio.setTarget(macRecv);
radio.init(244);

Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ void setup() {
}

// M5Core2 receiver target (P2P or 1:1 mode)
// uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// const uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// radio.setTarget(macRecv);
radio.init();

2 changes: 1 addition & 1 deletion examples/m5core2-basic-receiver/m5core2-basic-receiver.ino
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ void setup() {
}

// BE CAREFUL WITH IT, IF JPG LEVEL CHANGES, INCREASE IT
fb = (uint8_t*) ps_malloc(5000* sizeof( uint8_t ) ) ;
fb = static_cast<uint8_t *>(ps_malloc(5000 * sizeof(uint8_t)));

radio.setRecvBuffer(fb);
radio.setRecvCallback(onDataReady);
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ void setup() {
}

// BE CAREFUL WITH IT, IF JPG LEVEL CHANGES, INCREASE IT
fb = (uint8_t *)ps_malloc(15000 * sizeof(uint8_t));
fb = static_cast<uint8_t*>(ps_malloc(15000 * sizeof(uint8_t)));

radio.setRecvBuffer(fb);
radio.setRecvCallback(onDataReady);
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ static void print_FPS(int x, int y, const char *msg, uint32_t &frame, uint_fast6
if (millis() - time_stamp > 1000) {
time_stamp = millis();
char output[40];
sprintf(output, "%s %2d FPS JPG: %05d\r\n",msg, frame, len);
sprintf(output, "%s %2d FPS JPG: %05d\r\n", msg, frame, len);
// M5.Display.drawString(output, x, y);
frame = 0;
Serial.print(output);
@@ -53,7 +53,7 @@ void setup() {
}

// BE CAREFUL WITH IT, IF JPG LEVEL CHANGES, INCREASE IT
fb = (uint8_t *)ps_malloc(5000 * sizeof(uint8_t));
fb = static_cast<uint8_t *>(ps_malloc(5000 * sizeof(uint8_t)));

radio.setRecvBuffer(fb);
radio.setRecvCallback(onDataReady);
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**************************************************
* ESPNowCam video Receiver
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
* This file is part ESPNowCam tests project:
* https://github.com/hpsaturn/ESPNowCam.git
**************************************************/

#include <Arduino.h>
2 changes: 1 addition & 1 deletion examples/makerfabs-basic-receiver/platformio.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; ESPNowCam Freenove ESP32S3CAM
; https://github.com/hpsaturn/esp32s3-cam
; https://github.com/hpsaturn/ESPNowCam.git
; @Hpsaturn 2024

[platformio]
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@
* Use with: freenove-nojpg-sender example
*
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
* This file is part ESPNowCam tests project:
* https://github.com/hpsaturn/ESPNowCam.git
**************************************************/

#include <Arduino.h>
4 changes: 2 additions & 2 deletions examples/makerfabs-nojpg-receiver/platformio.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; ESPNowCam Freenove ESP32S3CAM
; https://github.com/hpsaturn/esp32s3-cam
; ESPNowCam Freenove ESPNowCam
; https://github.com/hpsaturn/ESPNowCam.git
; @Hpsaturn 2024

[platformio]
6 changes: 3 additions & 3 deletions examples/makerfabs-receiver/makerfabs-receiver.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**************************************************
* ESPNowCam video Receiver
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
* This file is part ESPNowCam tests project:
* https://github.com/hpsaturn/ESPNowCam
**************************************************/

#include <Arduino.h>
@@ -64,7 +64,7 @@ void setup() {
}

// BE CAREFUL WITH IT, IF JPG LEVEL CHANGES, INCREASE IT
fb = (uint8_t *)ps_malloc(30000 * sizeof(uint8_t));
fb = static_cast<uint8_t*>(ps_malloc(30000 * sizeof(uint8_t)));

radio.setRecvBuffer(fb);
radio.setRecvCallback(onDataReady);
10 changes: 5 additions & 5 deletions examples/multi-camera-one-receiver/m5core2-multi-receiver.cpp
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* ESPNowCam video Receiver
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
* https://github.com/hpsaturn/ESPNowCam.git
**************************************************/

#include <Arduino.h>
@@ -41,13 +41,13 @@ void setup() {
}

// BE CAREFUL WITH IT, IF JPG LEVEL CHANGES, INCREASE IT
fb_camera1 = (uint8_t*) ps_malloc(5000* sizeof( uint8_t ) ) ;
fb_camera2 = (uint8_t*) ps_malloc(5000* sizeof( uint8_t ) ) ;
fb_camera1 = static_cast<uint8_t*>(ps_malloc(5000 * sizeof(uint8_t)));
fb_camera2 = static_cast<uint8_t*>(ps_malloc(5000 * sizeof(uint8_t)));

// TJournal Camera 24:0a:c4:2f:8e:90
uint8_t camera1[6] = {0x24, 0x0A, 0xC4, 0x2F, 0x8E, 0x90};
const uint8_t camera1[6] = {0x24, 0x0A, 0xC4, 0x2F, 0x8E, 0x90};
// XIAOSense Camera 74:4d:bd:81:4e:fc
uint8_t camera2[6] = {0x74, 0x4D, 0xBD, 0x81, 0x4E, 0xFC};
const uint8_t camera2[6] = {0x74, 0x4D, 0xBD, 0x81, 0x4E, 0xFC};

radio.setRecvFilter(fb_camera1, camera1, onCamera1DataReady);
radio.setRecvFilter(fb_camera2, camera2, onCamera2DataReady);
8 changes: 4 additions & 4 deletions examples/multi-camera-one-receiver/m5cores3-camera1.cpp
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* ESPNowCam video Transmitter
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
* https://github.com/hpsaturn/ESPNowCam
**************************************************/

#include <M5CoreS3.h>
@@ -13,7 +13,7 @@
ESPNowCam radio;
int32_t dw, dh;

static void drawFPS() {
static inline void drawFPS() {
static uint_least64_t timeStamp = 0;
frame++;
if (millis() - timeStamp > 1000) {
@@ -56,9 +56,9 @@ void setup() {
}

// M5Core2 receiver MAC: B8:F0:09:C6:0E:CC
// uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// const uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// Makerfabs receiver 7C:DF:A1:F3:73:3C
uint8_t macRecv[6] = {0x7C,0xDF,0xA1,0xF3,0x73,0x3C};
const uint8_t macRecv[6] = {0x7C,0xDF,0xA1,0xF3,0x73,0x3C};

radio.setTarget(macRecv);
radio.init();
12 changes: 6 additions & 6 deletions examples/multi-camera-one-receiver/makerfabs-multi-receiver.cpp
Original file line number Diff line number Diff line change
@@ -85,16 +85,16 @@ void setup() {
}

// BE CAREFUL WITH IT, IF JPG LEVEL CHANGES, INCREASE IT
fb_camera1 = (uint8_t *)ps_malloc(20000 * sizeof(uint8_t));
fb_camera2 = (uint8_t *)ps_malloc(10000 * sizeof(uint8_t));
fb_camera3 = (uint8_t *)ps_malloc(10000 * sizeof(uint8_t));
fb_camera1 = static_cast<uint8_t*>(ps_malloc(20000 * sizeof(uint8_t)));
fb_camera2 = static_cast<uint8_t*>(ps_malloc(10000 * sizeof(uint8_t)));
fb_camera3 = static_cast<uint8_t*>(ps_malloc(10000 * sizeof(uint8_t)));

// M5CoreS3 Camera f4:12:fa:85:f4:9c
uint8_t camera1[6] = {0xF4, 0x12, 0xFA, 0x85, 0xF4, 0x9C};
const uint8_t camera1[6] = {0xF4, 0x12, 0xFA, 0x85, 0xF4, 0x9C};
// TJournal Camera 24:0a:c4:2f:8e:90
uint8_t camera2[6] = {0x24, 0x0A, 0xC4, 0x2F, 0x8E, 0x90};
const uint8_t camera2[6] = {0x24, 0x0A, 0xC4, 0x2F, 0x8E, 0x90};
// XIAOSense Camera 74:4d:bd:81:4e:fc
uint8_t camera3[6] = {0x74, 0x4D, 0xBD, 0x81, 0x4E, 0xFC};
const uint8_t camera3[6] = {0x74, 0x4D, 0xBD, 0x81, 0x4E, 0xFC};

radio.setRecvFilter(fb_camera1, camera1, onCamera1DataReady);
radio.setRecvFilter(fb_camera2, camera2, onCamera2DataReady);
6 changes: 3 additions & 3 deletions examples/multi-camera-one-receiver/tjournal-camera2.cpp
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* ESPNowCam video Transmitter
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
* https://github.com/hpsaturn/ESPNowCam
**************************************************/

#include <Arduino.h>
@@ -33,9 +33,9 @@ void setup() {
}

// M5Core2 receiver MAC: B8:F0:09:C6:0E:CC
// uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// const uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// Makerfabs receiver 7C:DF:A1:F3:73:3C
uint8_t macRecv[6] = {0x7C,0xDF,0xA1,0xF3,0x73,0x3C};
const uint8_t macRecv[6] = {0x7C,0xDF,0xA1,0xF3,0x73,0x3C};
radio.setTarget(macRecv);
radio.init();

6 changes: 3 additions & 3 deletions examples/multi-camera-one-receiver/xiao-camera3.cpp
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
*
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
* https://github.com/hpsaturn/ESPNowCam
**************************************************/

#include <Arduino.h>
@@ -51,9 +51,9 @@ void setup() {
}

// M5Core2 receiver MAC: B8:F0:09:C6:0E:CC
// uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// const uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// Makerfabs receiver 7C:DF:A1:F3:73:3C
uint8_t macRecv[6] = {0x7C,0xDF,0xA1,0xF3,0x73,0x3C};
const uint8_t macRecv[6] = {0x7C,0xDF,0xA1,0xF3,0x73,0x3C};
radio.setTarget(macRecv);
radio.init();

2 changes: 1 addition & 1 deletion examples/tft-3.5-basic-receiver/platformio.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; ESPNowCam Basic Receiver (TFT 3.5 ILI9486)
; https://github.com/hpsaturn/esp32s3-cam
; https://github.com/hpsaturn/ESPNowCam.git
; @Hpsaturn 2024

[platformio]
4 changes: 2 additions & 2 deletions examples/tft-3.5-basic-receiver/tft-3.5-basic-receiver.ino
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**************************************************
* ESPNowCam video Receiver
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
* This file is part ESPNowCam tests project:
* https://github.com/hpsaturn/ESPNowCam
**************************************************/

#include <Arduino.h>
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ void setup(void) {
tft.setTextColor(TFT_WHITE);

// BE CAREFUL WITH IT, IF JPG LEVEL CHANGES, INCREASE IT
fb = (uint8_t *)malloc(30000 * sizeof(uint8_t));
fb = static_cast<uint8_t*>(malloc(30000 * sizeof(uint8_t)));

radio.setRecvBuffer(fb);
radio.setRecvCallback(onDataReady);
4 changes: 2 additions & 2 deletions examples/tjournal-espnow-sender/tjournal-espnow-sender.cpp
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* ESPNowCam video Transmitter
* by @hpsaturn Copyright (C) 2024
* This file is part ESP32S3 camera tests project:
* https://github.com/hpsaturn/esp32s3-cam
* https://github.com/hpsaturn/ESPNowCam
**************************************************/

#include <Arduino.h>
@@ -33,7 +33,7 @@ void setup() {
}

// Makerfabs receiver 7C:DF:A1:F3:73:3C
// uint8_t macRecv[6] = {0x7C,0xDF,0xA1,0xF3,0x73,0x3C};
// const uint8_t macRecv[6] = {0x7C,0xDF,0xA1,0xF3,0x73,0x3C};
// radio.setTarget(macRecv);
radio.init();

4 changes: 2 additions & 2 deletions examples/xiao-fpv-sender/xiao-fpv-sender.cpp
Original file line number Diff line number Diff line change
@@ -49,8 +49,8 @@ void setup() {
Serial.printf("PSRAM size: %dMb\r\n", psram_size);
}

// M5Core2 receiver B8:F0:09:C6:0E:CC
// uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// Optional M5Core2 receiver B8:F0:09:C6:0E:CC
// const uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// radio.setTarget(macRecv);
radio.init();

10 changes: 5 additions & 5 deletions examples/xiao-internal-jpg-sender/xiao-internal-jpg-sender.cpp
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ OneButton btnB(GPIO_NUM_0, true);
void processFrame() {
if (Camera.get()) {
radio.sendData(Camera.fb->buf, Camera.fb->len);
delay(40); // ==> weird delay when you are using only DRAM.
delay(60); // ==> weird delay when you are using only DRAM.
printFPS("CAM:");
Camera.free();
}
@@ -53,10 +53,10 @@ void setup() {
Serial.printf("PSRAM size: %dMb\r\n", psram_size);
}

// Makerfabs receiver 7C:DF:A1:F3:73:3C
// uint8_t macRecv[6] = {0x7C, 0xDF, 0xA1, 0xF3, 0x73, 0x3C};
// M5Core2 receiver B8:F0:09:C6:0E:CC
// uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// Optional Makerfabs receiver 7C:DF:A1:F3:73:3C
// const uint8_t macRecv[6] = {0x7C, 0xDF, 0xA1, 0xF3, 0x73, 0x3C};
// Optional M5Core2 receiver B8:F0:09:C6:0E:CC
// const uint8_t macRecv[6] = {0xB8,0xF0,0x09,0xC6,0x0E,0xCC};
// radio.setTarget(macRecv);
radio.init();

2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "EspNowCam",
"version": "0.1.14",
"version": "0.1.15",
"homepage":"https://github.com/hpsaturn/esp32s3-cam",
"keywords":
[
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=EspNowCam
version=0.1.14
version=0.1.15
author=@hpsaturn
maintainer=Antonio Vanegas <hpsaturn@gmail.com>
sentence=ESPNowCam, a straightforward video streamer for popular ESP32Cam models, leveraging the ESPNow protocol. No need for IPs, routers, or credentials—keeping it simple! :D
18 changes: 8 additions & 10 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
; ESPNowCam
; https://github.com/hpsaturn/esp32s3-cam
; https://github.com/hpsaturn/ESPNowCam
; @Hpsaturn 2024

[platformio]
src_dir = ./examples/
lib_dir = ./examples/lib

[env]
platform = espressif32@6.6.0
platform = espressif32@6.9.0
framework = arduino
monitor_speed = 115200
monitor_filters =
@@ -20,7 +20,7 @@ build_flags =
-D CORE_DEBUG_LEVEL=3
-D BOARD_HAS_PSRAM=1
lib_deps =
nanopb/Nanopb@0.4.8
nanopb/Nanopb@0.4.9
extra_scripts = pre:prebuild.py

[esp32common]
@@ -42,8 +42,8 @@ build_flags =
extends = esp32common
lib_deps =
${esp32common.lib_deps}
https://github.com/m5stack/M5CoreS3.git
m5stack/M5Unified@^0.1.6
m5stack/M5CoreS3@1.0.0
m5stack/M5Unified@^0.1.17
build_flags =
${env.build_flags}
-DESP32S3
@@ -198,15 +198,13 @@ board_build.arduino.memory_type = dio_opi ;
build_src_filter = -<*> +<common/> +<freenove-tank/>
lib_deps =
${esp32common.lib_deps}
madhephaestus/ESP32Servo@1.1.2
https://github.com/hpsaturn/easy-preferences.git
https://github.com/hpsaturn/SerialTerminal.git
hpsaturn/ESP32 Wifi CLI @^0.2.1
madhephaestus/ESP32Servo@3.0.5
hpsaturn/EasyPreferences@^0.1.0
hpsaturn/ESP32 Wifi CLI @^0.3.2

[env:m5stickCplus-joystick-tank]
extends = esp32common
board = esp32dev
upload_speed = 1500001
build_src_filter = -<*> +<common/> +<m5stickCplus-joystick-tank/>
lib_deps =
${esp32common.lib_deps}
4 changes: 2 additions & 2 deletions src/ESPNowCam.cpp
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ size_t encodeMsg(Frame msg);
bool encode_uint8_array(pb_ostream_t *stream, const pb_field_t *field, void *const *arg) {
if (!pb_encode_tag_for_field(stream, field))
return false;
return pb_encode_string(stream, (uint8_t *)(outdata + chunk_pos), chunk_size_left);
return pb_encode_string(stream, static_cast<uint8_t*>(outdata + chunk_pos), chunk_size_left);
}

void msgSentCb(const uint8_t *macAddr, esp_now_send_status_t status) {
@@ -97,7 +97,7 @@ bool sendMessage(uint32_t msglen, const uint8_t *mac) {
return false;
}

bool ESPNowCam::setTarget(uint8_t *macAddress) {
bool ESPNowCam::setTarget(const uint8_t *macAddress) {
memcpy(targetAddress, macAddress, 6);
return false;
}
6 changes: 3 additions & 3 deletions src/ESPNowCam.h
Original file line number Diff line number Diff line change
@@ -13,8 +13,8 @@ extern "C" {
typedef void (*RecvCb)(uint32_t lenght);
}

#define CSL_VERSION "0.1.14"
#define CSL_REVISION 079
#define ENC_VERSION "0.1.15"
#define ENC_REVISION 080

class ESPNowCam {
private:
@@ -24,7 +24,7 @@ class ESPNowCam {
void setRecvBuffer(uint8_t *fb);
void setRecvFilter(uint8_t *fb, const uint8_t *macAddr, RecvCb cb);
bool sendData(uint8_t* data, uint32_t lenght);
bool setTarget(uint8_t* macAddress);
bool setTarget(const uint8_t* macAddress);
bool init(uint8_t chunksize = 244);
};

4 changes: 2 additions & 2 deletions src/Utils.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


static void printDataChksum(uint8_t * jpg_data, uint32_t jpg_len){
static inline void printDataChksum(uint8_t * jpg_data, uint32_t jpg_len){
uint32_t checksum = 0;
Serial.println("JPG Frame:");
for (int i = 0; i < jpg_len; i++) {
@@ -12,7 +12,7 @@ static void printDataChksum(uint8_t * jpg_data, uint32_t jpg_len){

static uint16_t frame = 0;

static void printFPS(const char *msg) {
static inline void printFPS(const char *msg) {
static uint_least64_t timeStamp = 0;
frame++;
if (millis() - timeStamp > 1000) {
2 changes: 2 additions & 0 deletions src/drivers/CamAIThinker.h
Original file line number Diff line number Diff line change
@@ -36,6 +36,8 @@ class CamAIThinker : public CameraBase {
config.fb_count = 2;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
fb = nullptr;
sensor = nullptr;
}
};

2 changes: 2 additions & 0 deletions src/drivers/CamFreenove.h
Original file line number Diff line number Diff line change
@@ -36,6 +36,8 @@ class CamFreenove : public CameraBase {
config.fb_count = 2;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
fb = nullptr;
sensor = nullptr;
}
};

2 changes: 2 additions & 0 deletions src/drivers/CamFreenoveWR.h
Original file line number Diff line number Diff line change
@@ -35,6 +35,8 @@ class CamFreenoveWR : public CameraBase {
config.fb_count = 2;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
fb = nullptr;
sensor = nullptr;
}
};

2 changes: 2 additions & 0 deletions src/drivers/CamTJournal.h
Original file line number Diff line number Diff line change
@@ -35,6 +35,8 @@ class CamTJournal : public CameraBase {
config.fb_count = 1;
config.fb_location = CAMERA_FB_IN_DRAM;
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
fb = nullptr;
sensor = nullptr;
}
};

2 changes: 2 additions & 0 deletions src/drivers/CamXiao.h
Original file line number Diff line number Diff line change
@@ -37,6 +37,8 @@ class CamXiao : public CameraBase {
config.fb_count = 2;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
fb = nullptr;
sensor = nullptr;
}
};

2 changes: 2 additions & 0 deletions src/drivers/UnitCamS3.h
Original file line number Diff line number Diff line change
@@ -35,6 +35,8 @@ class UnitCamS3 : public CameraBase {
config.fb_count = 2;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
fb = nullptr;
sensor = nullptr;
}
};

0 comments on commit b8dca20

Please sign in to comment.