refactor(device): 重构角度传感器模块并优化ADC电压计算 - 将 tle5012b 角度传感器相关文件重命名为 ang_sensor,统一接口命名 - 修正母线电压采样计算公式,增加 VCC_FACTOR 校正系数 - 移除 main.cpp 中重复和未使用的头文件引用 - 删除对旧角度传感器初始化函数的调用,改用新接口读取角度 ```
34 lines
1.0 KiB
C++
34 lines
1.0 KiB
C++
#include "Can.h"
|
|
#include "Filter.h"
|
|
#include "Timer.h"
|
|
#include "adc.h"
|
|
#include "core_cm4.h"
|
|
#include "initial.h"
|
|
#include "main.h"
|
|
#include "sys/initial.h"
|
|
#include "systick.h"
|
|
#include <cinttypes>
|
|
#include <cstdio>
|
|
|
|
constexpr int status_print = 0;
|
|
extern sampler sampler;
|
|
void test_1111() {
|
|
// 初始化CAN回环测试
|
|
// can_loopback_init();
|
|
// can_config();
|
|
if (status_print) {
|
|
/* value print */
|
|
printf(" the temperature data is %2.2f degrees Celsius\r\n",
|
|
sampler.get_mcu_temp());
|
|
printf(" the drv_temperature data is %2.2f degrees Celsius\r\n",
|
|
sampler.get_drv_temp());
|
|
printf(" the U current data is %2.2f mA\r\n", sampler.get_current('U'));
|
|
printf(" the V current data is %2.2f mA\r\n", sampler.get_current('V'));
|
|
printf(" the W current data is %2.2f mA\r\n", sampler.get_current('W'));
|
|
printf(" the VBUS is %2.2f V\r\n", sampler.get_vbus_voltage());
|
|
// printf(" the angle is %2.2f\r\n", tle5012b_read());
|
|
|
|
printf("\n----------------------------------------------------\n");
|
|
}
|
|
// can_loopback_test();
|
|
} |