Refactor and clean up codebase

- Removed unused constants and type aliases in app_spi_command_defs.h and temp_sensor.h.
- Simplified ISpiCommandHandler destructor to default.
- Eliminated redundant methods and comments in temp_sensor and usart0 files.
- Consolidated writeU32Le function to app_spi_command_defs.h for reuse.
- Updated comments for clarity and accuracy in task_manager.h and task_runner.cpp.
- Removed hardfault.h as it contained no declarations.
- Cleaned up CANFD and watchdog implementations by removing dead code and unnecessary comments.
- Updated version numbers in config.h to reflect recent changes.
- Enhanced error handling and diagnostics in hardfault handling.
This commit is contained in:
cbb
2026-07-15 02:49:37 +08:00
parent a52d94687b
commit 76da7a3dd6
37 changed files with 1401 additions and 1955 deletions
+7 -7
View File
@@ -19,11 +19,7 @@
constexpr size_t CONFIG_ETHERCAT_PDO_SIZE = 32U;
/** @brief EtherCAT AL 状态码(EtherCAT 协议定义,ESC AL Status 寄存器低 4 位)。 */
constexpr uint8_t AL_STATE_INIT = 0x01U; /**< INIT 状态。 */
constexpr uint8_t AL_STATE_PREOP = 0x02U; /**< PREOP 状态。 */
constexpr uint8_t AL_STATE_BOOT = 0x03U; /**< BOOT 状态。 */
constexpr uint8_t AL_STATE_SAFEOP = 0x04U; /**< SAFEOP 状态(SYNC0 可触发下限)。 */
constexpr uint8_t AL_STATE_OP = 0x08U; /**< OP 状态。 */
/**
* @brief PDO 数据缓冲(输入/输出共用结构)。
@@ -75,14 +71,16 @@ public:
* @brief 获取应用层输入 PDO 快照(主循环调用)。
* @return const PdoBuffer* 最近一次 process() 拷贝的输入快照只读指针。
* @note 返回的指针在下次 process() 调用前有效;应用层应在 process() 后立即读取。
*/
* @note TODO(app-layer): 应用层 PDO 字典映射 spec 启用前无外部调用方;
* 保留接口契约,待未来 spec 实现后由应用层调用。 */
static const PdoBuffer* getApplicationInputs();
/**
* @brief 设置应用层输出 PDO 快照(主循环调用)。
* @param[in] outputs 输出数据指针(内容会被拷贝到内部快照)。
* @note 下次 process() 调用时,内部快照通过 setOutputs() 推入三缓冲。
*/
* @note TODO(app-layer): 应用层 PDO 字典映射 spec 启用前无外部调用方;
* 保留接口契约,待未来 spec 实现后由应用层调用。 */
static void setApplicationOutputs(const PdoBuffer *outputs);
/**
@@ -107,7 +105,9 @@ public:
/** @brief 读取 ESC 芯片 ID(供诊断打印;未就绪时为上次读到的值)。 */
static uint32_t getChipId() { return s_chipId; }
/** @brief 读取 ESC AL 状态码(供诊断打印与 SSC 集成;未就绪时为上次读到的值)。 */
/** @brief 读取 ESC AL 状态码(供诊断打印与 SSC 集成;未就绪时为上次读到的值)。
* @note TODO(app-layer): 当前仅 init 内部用作 SAFEOP 守卫,外部诊断未启用;
* SSC 集成后由应用层查询。 */
static uint8_t getAlState() { return s_alState; }
private: