- 添加CAN调试宏定义,支持条件编译调试信息输出 - 实现节点ID相关功能,包括构建CAN ID、消息过滤、获取/设置节点ID - 支持Flash存储节点ID,提供加载和保存功能 - 实现节点ID设置和查询命令处理 - 更新CANFD发送函数使用节点ID构建发送ID - 添加消息过滤逻辑,只处理目标节点的消息 - 重构DMA中断服务程序,优化数据传输处理 - 替换printf为调试宏,便于生产环境控制调试输出
33 lines
1.1 KiB
C++
33 lines
1.1 KiB
C++
#include "adc.h"
|
|
#include "config.h"
|
|
#include <cstdio>
|
|
|
|
// TEST 调试宏定义
|
|
#if TEST_DEBUG
|
|
#define TEST_DEBUG_PRINT(fmt, ...) printf(fmt, ##__VA_ARGS__)
|
|
#else
|
|
#define TEST_DEBUG_PRINT(fmt, ...) ((void)0)
|
|
#endif
|
|
|
|
constexpr int status_print = 0;
|
|
extern sampler sampler;
|
|
void test_1111() {
|
|
// 初始化 CAN 回环测试
|
|
// can_loopback_init();
|
|
// can_config();
|
|
if (status_print) {
|
|
/* value print */
|
|
TEST_DEBUG_PRINT(" the temperature data is %2.2f degrees Celsius\r\n",
|
|
sampler.get_mcu_temp());
|
|
TEST_DEBUG_PRINT(" the drv_temperature data is %2.2f degrees Celsius\r\n",
|
|
sampler.get_drv_temp());
|
|
TEST_DEBUG_PRINT(" the U current data is %2.2f mA\r\n", sampler.get_current('U'));
|
|
TEST_DEBUG_PRINT(" the V current data is %2.2f mA\r\n", sampler.get_current('V'));
|
|
TEST_DEBUG_PRINT(" the W current data is %2.2f mA\r\n", sampler.get_current('W'));
|
|
TEST_DEBUG_PRINT(" the VBUS is %2.2f V\r\n", sampler.get_vbus_voltage());
|
|
// TEST_DEBUG_PRINT(" the angle is %2.2f\r\n", tle5012b_read());
|
|
|
|
TEST_DEBUG_PRINT("\n----------------------------------------------------\n");
|
|
}
|
|
// can_loopback_test();
|
|
} |