mirror of
https://github.com/EyeTrackVR/OpenIris.git
synced 2025-11-04 15:39:42 +08:00
feat: Feature/m5stack camera f (#90)
This commit is contained in:
parent
2602845b71
commit
26b4451d98
2
.github/workflows/build_release_bins.yml
vendored
2
.github/workflows/build_release_bins.yml
vendored
@ -31,7 +31,7 @@ jobs:
|
|||||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
steps:
|
steps:
|
||||||
- id: set-matrix
|
- id: set-matrix
|
||||||
run: echo "matrix={\"target_name\":[\"esp32AIThinker\",\"esp32M5Stack\",\"esp32Cam\",\"esp_eye\",\"wrover\",\"wrooms3QIO\",\"wrooms3QIOUSB\",\"wrooms3\",\"wrooms3USB\",\"xiaosenses3\",\"xiaosenses3_USB\"],\"target_build_type\":[\"\", \"_release\"]}" >> $GITHUB_OUTPUT
|
run: echo "matrix={\"target_name\":[\"esp32AIThinker\",\"esp32M5Stack\",\"esp32M5Stack-Camera-F\",\"esp32Cam\",\"esp_eye\",\"wrover\",\"wrooms3QIO\",\"wrooms3QIOUSB\",\"wrooms3\",\"wrooms3USB\",\"xiaosenses3\",\"xiaosenses3_USB\",\"Babble-wrooms-s3\",\"Babble_USB-wrooms-s3\"],\"target_build_type\":[\"\", \"_release\"]}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
build:
|
build:
|
||||||
needs: setup
|
needs: setup
|
||||||
|
|||||||
28
CHANGELOG.md
28
CHANGELOG.md
@ -3,6 +3,34 @@
|
|||||||
[](https://semver.org)
|
[](https://semver.org)
|
||||||
> All notable changes to this project will be documented in this file
|
> All notable changes to this project will be documented in this file
|
||||||
|
|
||||||
|
## [2.9.1](https://github.com/EyeTrackVR/OpenIris/compare/v2.9.0...v2.9.1) (2025-01-30)
|
||||||
|
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
* Add babble firmware to CI matrix ([#86](https://github.com/EyeTrackVR/OpenIris/issues/86)) ([28a053d](https://github.com/EyeTrackVR/OpenIris/commit/28a053d65323a4f48ad8de4992fe496ab3e63225))
|
||||||
|
|
||||||
|
## [2.9.0](https://github.com/EyeTrackVR/OpenIris/compare/v2.8.0...v2.9.0) (2025-01-28)
|
||||||
|
|
||||||
|
|
||||||
|
### 🍕 Features
|
||||||
|
|
||||||
|
* Fix AsyncWebServer dependency ([#85](https://github.com/EyeTrackVR/OpenIris/issues/85)) ([42c3311](https://github.com/EyeTrackVR/OpenIris/commit/42c33112972414cb5121b1052184fd0443de3164))
|
||||||
|
|
||||||
|
## [2.8.0](https://github.com/EyeTrackVR/OpenIris/compare/v2.7.0...v2.8.0) (2025-01-15)
|
||||||
|
|
||||||
|
|
||||||
|
### 🍕 Features
|
||||||
|
|
||||||
|
* Fix typo in SerialManager ([#84](https://github.com/EyeTrackVR/OpenIris/issues/84)) ([f460867](https://github.com/EyeTrackVR/OpenIris/commit/f4608674978edf5728e495824ed615d9d45f85fd))
|
||||||
|
|
||||||
|
## [2.7.0](https://github.com/EyeTrackVR/OpenIris/compare/v2.6.0...v2.7.0) (2025-01-12)
|
||||||
|
|
||||||
|
|
||||||
|
### 🍕 Features
|
||||||
|
|
||||||
|
* Release 2.7.0 ([#83](https://github.com/EyeTrackVR/OpenIris/issues/83)) ([c7aef84](https://github.com/EyeTrackVR/OpenIris/commit/c7aef8457eb68fef6713daaf81c6eb23491d9ec7))
|
||||||
|
|
||||||
## [2.7.0-beta.2](https://github.com/EyeTrackVR/OpenIris/compare/v2.7.0-beta.1...v2.7.0-beta.2) (2025-01-12)
|
## [2.7.0-beta.2](https://github.com/EyeTrackVR/OpenIris/compare/v2.7.0-beta.1...v2.7.0-beta.2) (2025-01-12)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,22 @@ build_flags = ${env.build_flags}
|
|||||||
; CAMERA PINOUT DEFINITIONS
|
; CAMERA PINOUT DEFINITIONS
|
||||||
${pinoutsAIThinker.build_flags}
|
${pinoutsAIThinker.build_flags}
|
||||||
|
|
||||||
|
[env:esp32M5Stack-Camera-F]
|
||||||
|
board = m5stack-timer-cam
|
||||||
|
build_type = debug
|
||||||
|
build_flags = ${env.build_flags}
|
||||||
|
-DDEBUG_MODE=1
|
||||||
|
-DCORE_DEBUG_LEVEL=4
|
||||||
|
${pinoutsM5Stack_Camera_F.build_flags}
|
||||||
|
|
||||||
|
[env:esp32M5Stack-Camera-F_release]
|
||||||
|
board = m5stack-timer-cam
|
||||||
|
build_type = release
|
||||||
|
build_flags = ${env.build_flags}
|
||||||
|
-DDEBUG_MODE=0
|
||||||
|
-DCORE_DEBUG_LEVEL=1
|
||||||
|
${pinoutsM5Stack_Camera_F.build_flags}
|
||||||
|
|
||||||
[env:esp32M5Stack]
|
[env:esp32M5Stack]
|
||||||
board = esp32cam
|
board = esp32cam
|
||||||
build_type = debug
|
build_type = debug
|
||||||
@ -103,6 +119,7 @@ build_type = debug
|
|||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DCORE_DEBUG_LEVEL=4
|
-DCORE_DEBUG_LEVEL=4
|
||||||
-DDEBUG_MODE=1
|
-DDEBUG_MODE=1
|
||||||
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
||||||
${pinoutsESPS3WROVER.build_flags}
|
${pinoutsESPS3WROVER.build_flags}
|
||||||
upload_flags = --no-stub
|
upload_flags = --no-stub
|
||||||
@ -114,6 +131,7 @@ build_type = release
|
|||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DDEBUG_MODE=0
|
-DDEBUG_MODE=0
|
||||||
-DCORE_DEBUG_LEVEL=1
|
-DCORE_DEBUG_LEVEL=1
|
||||||
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
||||||
${pinoutsESPS3WROVER.build_flags}
|
${pinoutsESPS3WROVER.build_flags}
|
||||||
upload_flags = --no-stub
|
upload_flags = --no-stub
|
||||||
@ -150,6 +168,7 @@ build_type = debug
|
|||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DCORE_DEBUG_LEVEL=4
|
-DCORE_DEBUG_LEVEL=4
|
||||||
-DDEBUG_MODE=1
|
-DDEBUG_MODE=1
|
||||||
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
||||||
${pinoutsESPS3WROOM.build_flags}
|
${pinoutsESPS3WROOM.build_flags}
|
||||||
|
|
||||||
@ -159,6 +178,7 @@ build_type = release
|
|||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DDEBUG_MODE=0
|
-DDEBUG_MODE=0
|
||||||
-DCORE_DEBUG_LEVEL=1
|
-DCORE_DEBUG_LEVEL=1
|
||||||
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
||||||
${pinoutsESPS3WROOM.build_flags}
|
${pinoutsESPS3WROOM.build_flags}
|
||||||
|
|
||||||
@ -199,6 +219,7 @@ build_type = debug
|
|||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DCORE_DEBUG_LEVEL=4
|
-DCORE_DEBUG_LEVEL=4
|
||||||
-DDEBUG_MODE=1
|
-DDEBUG_MODE=1
|
||||||
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
||||||
${pinoutSWROOMBABBLES3.build_flags}
|
${pinoutSWROOMBABBLES3.build_flags}
|
||||||
upload_flags = --no-stub
|
upload_flags = --no-stub
|
||||||
@ -214,6 +235,7 @@ build_type = debug
|
|||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DCORE_DEBUG_LEVEL=1
|
-DCORE_DEBUG_LEVEL=1
|
||||||
-DDEBUG_MODE=0
|
-DDEBUG_MODE=0
|
||||||
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
||||||
${pinoutSWROOMBABBLES3.build_flags}
|
${pinoutSWROOMBABBLES3.build_flags}
|
||||||
upload_flags = --no-stub
|
upload_flags = --no-stub
|
||||||
@ -261,8 +283,6 @@ build_type = debug
|
|||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DCORE_DEBUG_LEVEL=4
|
-DCORE_DEBUG_LEVEL=4
|
||||||
-DDEBUG_MODE=1
|
-DDEBUG_MODE=1
|
||||||
#-DARDUINO_USB_MODE=1
|
|
||||||
#-DARDUINO_USB_CDC_ON_BOOT=1
|
|
||||||
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
-DSERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
||||||
${pinoutsESPS3XIAOSENSE.build_flags}
|
${pinoutsESPS3XIAOSENSE.build_flags}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
platform = https://github.com/platformio/platform-espressif32.git
|
platform = https://github.com/platformio/platform-espressif32.git
|
||||||
framework = arduino
|
framework = arduino
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
custom_firmware_version = 2.7.0
|
custom_firmware_version = 2.9.1
|
||||||
monitor_rts = 0
|
monitor_rts = 0
|
||||||
monitor_dtr = 0
|
monitor_dtr = 0
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
@ -18,14 +18,14 @@ monitor_filters =
|
|||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
board_build.partitions = min_spiffs.csv
|
board_build.partitions = min_spiffs.csv
|
||||||
;build_unflags = -Os ; disable optimization for size
|
;build_unflags = -Os ; disable optimization for size
|
||||||
|
lib_compat_mode = strict
|
||||||
lib_ldf_mode = deep+
|
lib_ldf_mode = deep+
|
||||||
;115200 is used for compatability - if you are on windows and want the code to flash faster use 921600
|
;115200 is used for compatability - if you are on windows and want the code to flash faster use 921600
|
||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
lib_deps =
|
lib_deps =
|
||||||
# https://github.com/espressif/esp32-camera
|
# https://github.com/espressif/esp32-camera
|
||||||
esp32-camera
|
esp32-camera
|
||||||
https://github.com/me-no-dev/ESPAsyncWebServer.git
|
ESP32Async/ESPAsyncWebServer @ 3.6.0
|
||||||
https://github.com/me-no-dev/AsyncTCP.git
|
|
||||||
https://github.com/bblanchon/ArduinoJson.git
|
https://github.com/bblanchon/ArduinoJson.git
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
pre:tools/customname.py
|
pre:tools/customname.py
|
||||||
|
|||||||
@ -1,6 +1,43 @@
|
|||||||
#!! DO NOT CHANGE ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
|
#!! DO NOT CHANGE ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
|
||||||
# IF YOU ARE A USER DO NOT TOUCH THIS FILE
|
# IF YOU ARE A USER DO NOT TOUCH THIS FILE
|
||||||
|
|
||||||
|
[pinoutsM5Stack_Camera_F]
|
||||||
|
pwdn_gpio_num = -1
|
||||||
|
reset_gpio_num = 15
|
||||||
|
xclk_gpio_num = 27
|
||||||
|
siod_gpio_num = 25
|
||||||
|
sioc_gpio_num = 23
|
||||||
|
y9_gpio_num = 19
|
||||||
|
y8_gpio_num = 36
|
||||||
|
y7_gpio_num = 18
|
||||||
|
y6_gpio_num = 39
|
||||||
|
y5_gpio_num = 5
|
||||||
|
y4_gpio_num = 34
|
||||||
|
y3_gpio_num = 35
|
||||||
|
y2_gpio_num = 32
|
||||||
|
vsync_gpio_num = 22
|
||||||
|
href_gpio_num = 26
|
||||||
|
pclk_gpio_num = 21
|
||||||
|
build_flags =
|
||||||
|
'-DCAMERA_MODULE_NAME="M5STACK_CAMERA_F"'
|
||||||
|
-DCONFIG_CAMERA_MODULE_M5STACK_CAMERA_F=1
|
||||||
|
-DPWDN_GPIO_NUM=${pinoutsM5Stack_Camera_F.PWDN_GPIO_NUM}
|
||||||
|
-DRESET_GPIO_NUM=${pinoutsM5Stack_Camera_F.RESET_GPIO_NUM}
|
||||||
|
-DXCLK_GPIO_NUM=${pinoutsM5Stack_Camera_F.XCLK_GPIO_NUM}
|
||||||
|
-DSIOD_GPIO_NUM=${pinoutsM5Stack_Camera_F.SIOD_GPIO_NUM}
|
||||||
|
-DSIOC_GPIO_NUM=${pinoutsM5Stack_Camera_F.SIOC_GPIO_NUM}
|
||||||
|
-DY9_GPIO_NUM=${pinoutsM5Stack_Camera_F.Y9_GPIO_NUM}
|
||||||
|
-DY8_GPIO_NUM=${pinoutsM5Stack_Camera_F.Y8_GPIO_NUM}
|
||||||
|
-DY7_GPIO_NUM=${pinoutsM5Stack_Camera_F.Y7_GPIO_NUM}
|
||||||
|
-DY6_GPIO_NUM=${pinoutsM5Stack_Camera_F.Y6_GPIO_NUM}
|
||||||
|
-DY5_GPIO_NUM=${pinoutsM5Stack_Camera_F.Y5_GPIO_NUM}
|
||||||
|
-DY4_GPIO_NUM=${pinoutsM5Stack_Camera_F.Y4_GPIO_NUM}
|
||||||
|
-DY3_GPIO_NUM=${pinoutsM5Stack_Camera_F.Y3_GPIO_NUM}
|
||||||
|
-DY2_GPIO_NUM=${pinoutsM5Stack_Camera_F.Y2_GPIO_NUM}
|
||||||
|
-DVSYNC_GPIO_NUM=${pinoutsM5Stack_Camera_F.VSYNC_GPIO_NUM}
|
||||||
|
-DHREF_GPIO_NUM=${pinoutsM5Stack_Camera_F.HREF_GPIO_NUM}
|
||||||
|
-DPCLK_GPIO_NUM=${pinoutsM5Stack_Camera_F.PCLK_GPIO_NUM}
|
||||||
|
|
||||||
[pinoutsESPCAM_M5STACK]
|
[pinoutsESPCAM_M5STACK]
|
||||||
pwdn_gpio_num = -1
|
pwdn_gpio_num = -1
|
||||||
reset_gpio_num = 15
|
reset_gpio_num = 15
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
"include": "/lib/src"
|
"include": "/lib/src"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"version": "2.7.0",
|
"version": "2.9.1",
|
||||||
"frameworks": "arduino",
|
"frameworks": "arduino",
|
||||||
"platforms": "espressif32"
|
"platforms": "espressif32"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,7 @@ void SerialManager::send_frame() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SerialManager::init() {
|
void SerialManager::init() {
|
||||||
#ifndef SERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
#ifdef SERIAL_MANAGER_USE_HIGHER_FREQUENCY
|
||||||
Serial.begin(3000000);
|
Serial.begin(3000000);
|
||||||
#endif
|
#endif
|
||||||
if (SERIAL_FLUSH_ENABLED) {
|
if (SERIAL_FLUSH_ENABLED) {
|
||||||
|
|||||||
@ -1,13 +1,5 @@
|
|||||||
#include "baseAPI.hpp"
|
#include "baseAPI.hpp"
|
||||||
|
|
||||||
//! These have to be called before the constructor of the class because they are
|
|
||||||
//! static C++ 11 does not have inline variables, sadly. So we have to do this.
|
|
||||||
// const char *BaseAPI::MIMETYPE_HTML{"text/html"};
|
|
||||||
// const char *BaseAPI::MIMETYPE_CSS{"text/css"};
|
|
||||||
// const char *BaseAPI::MIMETYPE_JS{"application/javascript"};
|
|
||||||
// const char *BaseAPI::MIMETYPE_PNG{"image/png"};
|
|
||||||
// const char *BaseAPI::MIMETYPE_JPG{"image/jpeg"};
|
|
||||||
// const char *BaseAPI::MIMETYPE_ICO{"image/x-icon"};
|
|
||||||
const char* BaseAPI::MIMETYPE_JSON{"application/json"};
|
const char* BaseAPI::MIMETYPE_JSON{"application/json"};
|
||||||
|
|
||||||
BaseAPI::BaseAPI(ProjectConfig& projectConfig,
|
BaseAPI::BaseAPI(ProjectConfig& projectConfig,
|
||||||
@ -79,7 +71,7 @@ void BaseAPI::setWiFi(AsyncWebServerRequest* request) {
|
|||||||
|
|
||||||
log_d("Number of Params: %d", params);
|
log_d("Number of Params: %d", params);
|
||||||
for (int i = 0; i < params; i++) {
|
for (int i = 0; i < params; i++) {
|
||||||
AsyncWebParameter* param = request->getParam(i);
|
const AsyncWebParameter* param = request->getParam(i);
|
||||||
if (param->name() == "networkName") {
|
if (param->name() == "networkName") {
|
||||||
networkName.assign(param->value().c_str());
|
networkName.assign(param->value().c_str());
|
||||||
} else if (param->name() == "ssid") {
|
} else if (param->name() == "ssid") {
|
||||||
@ -102,17 +94,6 @@ void BaseAPI::setWiFi(AsyncWebServerRequest* request) {
|
|||||||
projectConfig.setWifiConfig(networkName, ssid, password, channel, power,
|
projectConfig.setWifiConfig(networkName, ssid, password, channel, power,
|
||||||
adhoc, true);
|
adhoc, true);
|
||||||
|
|
||||||
/* if (WiFiStateManager->getCurrentState() ==
|
|
||||||
WiFiState_e::WiFiState_ADHOC)
|
|
||||||
{
|
|
||||||
projectConfig.setAPWifiConfig(ssid, password, &channel, adhoc,
|
|
||||||
true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
} */
|
|
||||||
|
|
||||||
request->send(200, MIMETYPE_JSON,
|
request->send(200, MIMETYPE_JSON,
|
||||||
"{\"msg\":\"Done. Wifi Creds have been set.\"}");
|
"{\"msg\":\"Done. Wifi Creds have been set.\"}");
|
||||||
break;
|
break;
|
||||||
@ -178,7 +159,7 @@ void BaseAPI::setDeviceConfig(AsyncWebServerRequest* request) {
|
|||||||
int ota_port;
|
int ota_port;
|
||||||
|
|
||||||
for (int i = 0; i < params; i++) {
|
for (int i = 0; i < params; i++) {
|
||||||
AsyncWebParameter* param = request->getParam(i);
|
const AsyncWebParameter* param = request->getParam(i);
|
||||||
if (param->name() == "hostname") {
|
if (param->name() == "hostname") {
|
||||||
std::string result = param->value().c_str();
|
std::string result = param->value().c_str();
|
||||||
|
|
||||||
@ -216,7 +197,7 @@ void BaseAPI::setWiFiTXPower(AsyncWebServerRequest* request) {
|
|||||||
uint8_t txPower = 0;
|
uint8_t txPower = 0;
|
||||||
|
|
||||||
for (int i = 0; i < params; i++) {
|
for (int i = 0; i < params; i++) {
|
||||||
AsyncWebParameter* param = request->getParam(i);
|
const AsyncWebParameter* param = request->getParam(i);
|
||||||
if (param->name() == "txpower" || param->name() == "txPower") {
|
if (param->name() == "txpower" || param->name() == "txPower") {
|
||||||
txPower = atoi(param->value().c_str());
|
txPower = atoi(param->value().c_str());
|
||||||
}
|
}
|
||||||
@ -275,7 +256,7 @@ void BaseAPI::setCamera(AsyncWebServerRequest* request) {
|
|||||||
//! be set in a specific order This means the order of the URL params does
|
//! be set in a specific order This means the order of the URL params does
|
||||||
//! not matter
|
//! not matter
|
||||||
for (int i = 0; i < params; i++) {
|
for (int i = 0; i < params; i++) {
|
||||||
AsyncWebParameter* param = request->getParam(i);
|
const AsyncWebParameter* param = request->getParam(i);
|
||||||
if (param->name() == "framesize") {
|
if (param->name() == "framesize") {
|
||||||
temp_camera_framesize = (uint8_t)param->value().toInt();
|
temp_camera_framesize = (uint8_t)param->value().toInt();
|
||||||
} else if (param->name() == "vflip") {
|
} else if (param->name() == "vflip") {
|
||||||
@ -392,7 +373,6 @@ void BaseAPI::beginOTA() {
|
|||||||
"{\"id\": \"" + _id + "\", \"hardware\": \"ESP32\"}");
|
"{\"id\": \"" + _id + "\", \"hardware\": \"ESP32\"}");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Note: HTT_GET
|
|
||||||
server.on("/update", 0b00000001, [&](AsyncWebServerRequest* request) {
|
server.on("/update", 0b00000001, [&](AsyncWebServerRequest* request) {
|
||||||
log_d("[DEBUG] Free Heap: %d", ESP.getFreeHeap());
|
log_d("[DEBUG] Free Heap: %d", ESP.getFreeHeap());
|
||||||
checkAuthentication(request, login, password);
|
checkAuthentication(request, login, password);
|
||||||
@ -406,7 +386,8 @@ void BaseAPI::beginOTA() {
|
|||||||
response->addHeader("Content-Encoding", "gzip");
|
response->addHeader("Content-Encoding", "gzip");
|
||||||
request->send(response);
|
request->send(response);
|
||||||
});
|
});
|
||||||
// Note: HTT_POST
|
|
||||||
|
// HTTP_POST
|
||||||
server.on(
|
server.on(
|
||||||
"/update", 0b00000010,
|
"/update", 0b00000010,
|
||||||
[&](AsyncWebServerRequest* request) {
|
[&](AsyncWebServerRequest* request) {
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
//! Warning do not format this file with clang-format or it will break the code
|
//! Warning do not format this file with clang-format or it will break the code
|
||||||
|
|
||||||
#include <unordered_map>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
@ -11,16 +10,14 @@
|
|||||||
|
|
||||||
#define WEBSERVER_H
|
#define WEBSERVER_H
|
||||||
|
|
||||||
/* #define XHTTP_GET 0b00000001;
|
// hack, we have to include it JUST so the macro executes and defines HTTP_*
|
||||||
#define XHTTP_POST 0b00000010;
|
// methods cause it's beging included later in streamServer.hpp, but then the
|
||||||
#define XHTTP_DELETE 0b00000100;
|
// macro executes too late and tries to redefine the methods, failing. but if we
|
||||||
#define XHTTP_PUT 0b00001000;
|
// don't include it here, then ESPAsyncWebServer fails to compile due to
|
||||||
#define XHTTP_PATCH 0b00010000;
|
// WEBSERVER_H which has to be set because if it isn't, ESPAsyncWebServer will
|
||||||
#define XHTTP_HEAD 0b00100000;
|
// define the methods and thus the circus continues
|
||||||
#define XHTTP_OPTIONS 0b01000000;
|
#include <http_parser.h>
|
||||||
#define XHTTP_ANY 0b01111111; */
|
|
||||||
|
|
||||||
// constexpr int HTTP_GET = 0b00000001;
|
|
||||||
constexpr int HTTP_ANY = 0b01111111;
|
constexpr int HTTP_ANY = 0b01111111;
|
||||||
|
|
||||||
#include <Update.h>
|
#include <Update.h>
|
||||||
@ -28,18 +25,15 @@ constexpr int HTTP_ANY = 0b01111111;
|
|||||||
#include <esp_task_wdt.h>
|
#include <esp_task_wdt.h>
|
||||||
|
|
||||||
#include <AsyncTCP.h>
|
#include <AsyncTCP.h>
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
#include "Hash.h"
|
#include "Hash.h"
|
||||||
|
|
||||||
#include "data/utilities/network_utilities.hpp"
|
|
||||||
#include "tasks/tasks.hpp"
|
|
||||||
|
|
||||||
#include "data/StateManager/StateManager.hpp"
|
#include "data/StateManager/StateManager.hpp"
|
||||||
#include "data/config/project_config.hpp"
|
#include "data/config/project_config.hpp"
|
||||||
|
#include "data/utilities/network_utilities.hpp"
|
||||||
#include "elegantWebpage.h"
|
#include "elegantWebpage.h"
|
||||||
#include "io/camera/cameraHandler.hpp"
|
#include "io/camera/cameraHandler.hpp"
|
||||||
|
#include "tasks/tasks.hpp"
|
||||||
|
|
||||||
class BaseAPI {
|
class BaseAPI {
|
||||||
protected:
|
protected:
|
||||||
@ -47,11 +41,6 @@ class BaseAPI {
|
|||||||
bool _authRequired;
|
bool _authRequired;
|
||||||
|
|
||||||
static const char* MIMETYPE_HTML;
|
static const char* MIMETYPE_HTML;
|
||||||
/* static const char *MIMETYPE_CSS; */
|
|
||||||
/* static const char *MIMETYPE_JS; */
|
|
||||||
/* static const char *MIMETYPE_PNG; */
|
|
||||||
/* static const char *MIMETYPE_JPG; */
|
|
||||||
/* static const char *MIMETYPE_ICO; */
|
|
||||||
static const char* MIMETYPE_JSON;
|
static const char* MIMETYPE_JSON;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -100,33 +89,34 @@ class BaseAPI {
|
|||||||
typedef std::unordered_map<std::string, WebRequestMethodComposite>
|
typedef std::unordered_map<std::string, WebRequestMethodComposite>
|
||||||
networkMethodsMap_t;
|
networkMethodsMap_t;
|
||||||
|
|
||||||
ProjectConfig &projectConfig;
|
ProjectConfig& projectConfig;
|
||||||
/// @brief Local instance of the AsyncWebServer - so that we dont need to use new and delete
|
/// @brief Local instance of the AsyncWebServer - so that we dont need to use
|
||||||
AsyncWebServer server;
|
/// new and delete
|
||||||
|
AsyncWebServer server;
|
||||||
#ifndef SIM_ENABLED
|
#ifndef SIM_ENABLED
|
||||||
CameraHandler &camera;
|
CameraHandler& camera;
|
||||||
#endif // SIM_ENABLED
|
#endif // SIM_ENABLED
|
||||||
|
|
||||||
public :
|
public:
|
||||||
BaseAPI(ProjectConfig& projectConfig,
|
BaseAPI(ProjectConfig& projectConfig,
|
||||||
#ifndef SIM_ENABLED
|
#ifndef SIM_ENABLED
|
||||||
CameraHandler& camera,
|
CameraHandler& camera,
|
||||||
#endif // SIM_ENABLED
|
#endif // SIM_ENABLED
|
||||||
const std::string& api_url,
|
const std::string& api_url,
|
||||||
#ifndef SIM_ENABLED
|
#ifndef SIM_ENABLED
|
||||||
int port = 81
|
int port = 81
|
||||||
#else
|
#else
|
||||||
int port = 80
|
int port = 80
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual ~BaseAPI();
|
virtual ~BaseAPI();
|
||||||
virtual void begin();
|
virtual void begin();
|
||||||
void checkAuthentication(AsyncWebServerRequest* request,
|
void checkAuthentication(AsyncWebServerRequest* request,
|
||||||
const char* login,
|
const char* login,
|
||||||
const char* password);
|
const char* password);
|
||||||
void beginOTA();
|
void beginOTA();
|
||||||
void notFound(AsyncWebServerRequest* request) const;
|
void notFound(AsyncWebServerRequest* request) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BASEAPI_HPP
|
#endif // BASEAPI_HPP
|
||||||
|
|||||||
@ -14,7 +14,8 @@ LEDManager ledManager(LED_BUILTIN);
|
|||||||
|
|
||||||
#elif CONFIG_CAMERA_MODULE_SWROOM_BABBLE_S3
|
#elif CONFIG_CAMERA_MODULE_SWROOM_BABBLE_S3
|
||||||
LEDManager ledManager(38);
|
LEDManager ledManager(38);
|
||||||
|
#elif DCONFIG_CAMERA_MODULE_M5STACK_CAMERA_F
|
||||||
|
LEDManager ledManager(2);
|
||||||
#else
|
#else
|
||||||
LEDManager ledManager(33);
|
LEDManager ledManager(33);
|
||||||
#endif // ESP32S3_XIAO_SENSE
|
#endif // ESP32S3_XIAO_SENSE
|
||||||
@ -86,16 +87,17 @@ void setup() {
|
|||||||
Logo::printASCII();
|
Logo::printASCII();
|
||||||
ledManager.begin();
|
ledManager.begin();
|
||||||
|
|
||||||
#ifdef CONFIG_CAMERA_MODULE_SWROOM_BABBLE_S3 // Set IR emitter strength to 100%.
|
#ifdef CONFIG_CAMERA_MODULE_SWROOM_BABBLE_S3 // Set IR emitter strength to
|
||||||
const int ledPin = 1; // Replace this with a command endpoint eventually.
|
// 100%.
|
||||||
const int freq = 5000;
|
const int ledPin = 1; // Replace this with a command endpoint eventually.
|
||||||
const int ledChannel = 0;
|
const int freq = 5000;
|
||||||
const int resolution = 8;
|
const int ledChannel = 0;
|
||||||
const int dutyCycle = 255;
|
const int resolution = 8;
|
||||||
ledcSetup(ledChannel, freq, resolution);
|
const int dutyCycle = 255;
|
||||||
ledcAttachPin(1, ledChannel);
|
ledcSetup(ledChannel, freq, resolution);
|
||||||
ledcWrite(ledChannel, dutyCycle);
|
ledcAttachPin(1, ledChannel);
|
||||||
#endif
|
ledcWrite(ledChannel, dutyCycle);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef SIM_ENABLED
|
#ifndef SIM_ENABLED
|
||||||
deviceConfig.attach(cameraHandler);
|
deviceConfig.attach(cameraHandler);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user