两块 ESP32-S3-WROOM-1-N16R8 图传板(DVP 接口接 OV2640/OV3660/OV5640), 向队伍客户端与裁判终端推 UDP 图传。固件是跑在 ESP-IDF 上的 Rust,用官方 esp32-camera 组件采集;客户端是 Rust + Slint 桌面程序。 三个 crate 各自独立构建: . firmware,交叉编译到 Xtensa protocol/ 线路格式与帧重组,两端共用,无 ESP-IDF 依赖,有单元测试 client/ Slint 桌面客户端 视频走 UDP 而非 TCP:实测传感器产出 22 fps,TCP MJPEG 只送出 1.9 fps, 且只占用链路能力的 1%——链路是空的,帧堵在队头阻塞后面等一个实时画面 等不起的重传计时器。改为独立数据报、不重传、缺片丢整帧后达到 20.8 fps。 发现是双向的:板子每 2 秒广播 Hello,客户端广播 Subscribe,板子据此定向 推流。板子身份由 MAC 派生,重启不变,所以客户端可以把绑定存进配置。 裁判端同时收两块板子(每个发送方一个重组器),队伍端绑定其中一块并只显示 自己那一边的血量。装甲板接口已预留(ArmorSource trait + ARMOR_PORT), 当前无数据源,界面显示占位符。 vendor 了 esp32-camera 2.1.7:组件注册表的版本求解器找不到它,且需要打一处 补丁(见 components/esp32-camera/target/esp32s3/ll_cam.c)。 .gitignore 三条 target/ 都锚定在根目录,因为 protocol/ 与 client/ 各自也是 独立 crate;而 components/esp32-camera/target/ 是上游的按芯片分目录,里面是 源码,必须保留。
76 lines
2.0 KiB
C
76 lines
2.0 KiB
C
// Copyright 2010-2020 Espressif Systems (Shanghai) PTE LTD
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#pragma once
|
|
|
|
#include "esp_camera.h"
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief Uninitialize the lcd_cam module
|
|
*
|
|
* @param handle Provide handle pointer to release resources
|
|
*
|
|
* @return
|
|
* - ESP_OK Success
|
|
* - ESP_FAIL Uninitialize fail
|
|
*/
|
|
esp_err_t cam_deinit(void);
|
|
|
|
/**
|
|
* @brief Initialize the lcd_cam module
|
|
*
|
|
* @param config Configurations - see lcd_cam_config_t struct
|
|
*
|
|
* @return
|
|
* - ESP_OK Success
|
|
* - ESP_ERR_INVALID_ARG Parameter error
|
|
* - ESP_ERR_NO_MEM No memory to initialize lcd_cam
|
|
* - ESP_FAIL Initialize fail
|
|
*/
|
|
esp_err_t cam_init(const camera_config_t *config);
|
|
|
|
esp_err_t cam_config(const camera_config_t *config, framesize_t frame_size, uint16_t sensor_pid);
|
|
|
|
void cam_stop(void);
|
|
|
|
void cam_start(void);
|
|
|
|
camera_fb_t *cam_take(TickType_t timeout);
|
|
|
|
void cam_give(camera_fb_t *dma_buffer);
|
|
|
|
void cam_give_all(void);
|
|
|
|
bool cam_get_available_frames(void);
|
|
|
|
void cam_set_psram_mode(bool enable);
|
|
bool cam_get_psram_mode(void);
|
|
|
|
/* VSYNC polarity applied by the next `cam_init()`, and the XCLK frequency the
|
|
* driver was last given. Set the polarity before esp_camera_init() and read the
|
|
* clock back afterwards; see cam_hal.c for why the polarity is not fixed. */
|
|
void cam_set_vsync_invert(bool invert);
|
|
bool cam_get_vsync_invert(void);
|
|
void cam_set_xclk_hz(int hz);
|
|
int cam_get_xclk_hz(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|