Files

67 lines
2.7 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef CONFIG_H
#define CONFIG_H
// ----------- WiFi 配置 -----------
#define WIFI_SSID "YOUR_WIFI_SSID"
#define WIFI_PASSWORD "YOUR_WIFI_PASSWORD"
// ----------- MQTT Broker 配置 -----------
#define MQTT_BROKER_HOST "broker.emqx.io"
#define MQTT_BROKER_PORT 1883
#define MQTT_USERNAME "emqx" // 如果MQTT Broker需要认证请填写
#define MQTT_PASSWORD "public" // 如果MQTT Broker需要认证请填写
// ----------- 设备唯一标识符 -----------
// 这个ID必须与后端系统中注册的设备ID一致
#define DEVICE_UID "ESP32_ROBOT_001" // 请根据实际情况修改
// ----------- MQTT 主题动态部分 -----------
// 完整主题将在 mqtt_handler.cpp 中基于 DEVICE_UID 构建
#define MQTT_TOPIC_BASE "yupi_mqtt_power_project/robot"
// ----------- 硬件引脚定义 -----------
// --- 电机驱动 (例如使用 L298N 或类似模块) ---
#define MOTOR_LEFT_IN1_PIN 0 // 左轮电机正转控制引脚
#define MOTOR_LEFT_IN2_PIN 0 // 左轮电机反转控制引脚
#define MOTOR_LEFT_ENA_PIN 0 // 左轮电机PWM调速引脚
#define MOTOR_RIGHT_IN3_PIN 0 // 右轮电机正转控制引脚
#define MOTOR_RIGHT_IN4_PIN 0 // 右轮电机反转控制引脚
#define MOTOR_RIGHT_ENB_PIN 0 // 右轮电机PWM调速引脚
// --- 舵机控制 ---
#define SERVO_PIN 0 // 舵机信号引脚
// --- 超声波传感器 ---
#define ULTRASONIC_FRONT_TRIG_PIN 0 // 前方超声波 Trig 引脚
#define ULTRASONIC_FRONT_ECHO_PIN 0 // 前方超声波 Echo 引脚
#define ULTRASONIC_SIDE_TRIG_PIN 0 // 侧方超声波 Trig 引脚
#define ULTRASONIC_SIDE_ECHO_PIN 0 // 侧方超声波 Echo 引脚
// --- TCRT5000 循迹传感器 ---
#define TCRT5000_LEFT_PIN 0 // 左循迹传感器模拟/数字输出引脚
#define TCRT5000_RIGHT_PIN 0 // 右循迹传感器模拟/数字输出引脚
// (如果使用更多循迹传感器,继续添加定义)
// --- 继电器控制 ---
#define RELAY_PIN 0 // 控制充电继电器的引脚
// ----------- 业务逻辑参数 -----------
#define SIDE_ULTRASONIC_SPOT_THRESHOLD_CM 60 // 侧向超声波检测到充电桩的距离阈值 (cm)
#define NUM_CHARGING_SPOTS 3 // 系统中定义的充电桩数量
// 充电位置ID定义 (与后端协商或在此固定)
// 这些将用于 spot counting 和与 target_spot_uid 匹配
// 示例:如果后端发送 "001", "002", "003"
#define SPOT_ID_1 "001"
#define SPOT_ID_2 "002"
#define SPOT_ID_3 "003"
// ----------- 定时器与延时 -----------
#define STATUS_UPDATE_INTERVAL_MS 30000 // 状态上报间隔 (毫秒)
#define HEARTBEAT_INTERVAL_MS 60000 // 心跳间隔 (毫秒)
#define BATTERY_UPDATE_INTERVAL_MS 5000 // 电池模拟更新间隔 (毫秒)
#endif // CONFIG_H