Skip to content

Commit

Permalink
Merge pull request #44 from hpsaturn/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
hpsaturn authored Oct 28, 2024
2 parents 8e1d877 + 2d56990 commit b8dca20
Show file tree
Hide file tree
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
Expand Up @@ -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();
```
Expand Down Expand Up @@ -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?

Expand Down Expand Up @@ -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
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions examples/esp32cam-basic-sender/esp32cam-basic-sender.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
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]
Expand Down
2 changes: 1 addition & 1 deletion examples/esp32cam-p2p-sender/esp32cam-p2p-sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion examples/freenove-basic-sender/freenove-basic-sender.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion examples/freenove-p2p-sender/freenove-p2p-sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
56 changes: 28 additions & 28 deletions examples/freenove-tank/freenove-tank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", "=======", "=======", "=====");
Expand All @@ -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");
}
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion examples/m5core2-basic-receiver/m5core2-basic-receiver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
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>
Expand Down
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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
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]
Expand Down
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>
Expand Down Expand Up @@ -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);
Expand Down
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
Expand Up @@ -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>
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions examples/multi-camera-one-receiver/m5cores3-camera1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down
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
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit b8dca20

Please sign in to comment.