Files
Motor_v2/Robot_V2/device/test.cpp
T

33 lines
1.1 KiB
C++
Raw Normal View History

2025-10-14 00:49:58 +08:00
#include "adc.h"
#include "config.h"
2025-10-14 00:49:58 +08:00
#include <cstdio>
// TEST 调试宏定义
#if TEST_DEBUG
#define TEST_DEBUG_PRINT(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#define TEST_DEBUG_PRINT(fmt, ...) ((void)0)
#endif
2025-10-14 00:49:58 +08:00
constexpr int status_print = 0;
extern sampler sampler;
2025-10-14 00:49:58 +08:00
void test_1111() {
// 初始化 CAN 回环测试
2025-10-14 00:49:58 +08:00
// 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());
2025-10-14 00:49:58 +08:00
TEST_DEBUG_PRINT("\n----------------------------------------------------\n");
2025-10-14 00:49:58 +08:00
}
// can_loopback_test();
}