完成CANFD通信调试
This commit is contained in:
@@ -7,7 +7,7 @@ constexpr float ERROR_ADC_VAL = 255.0f;
|
||||
constexpr float ADC_SCALE = 3.3f / 4096.0f;
|
||||
constexpr float TEMP_FACTOR = 1000.0f / 4.3f;
|
||||
constexpr float VCC_FACTOR = 11.0f;
|
||||
constexpr float CURRENT_FACTOR = 1.0f / 50.0f * 100.0f;
|
||||
constexpr float CURRENT_FACTOR = 1.0f / 50.0f * 100.0f * 1000.0f;
|
||||
constexpr float MAX_TEMP = 150.0f;
|
||||
constexpr float MIN_TEMP = -40.0f;
|
||||
constexpr float MAX_CURRENT = 50.0f;
|
||||
@@ -83,7 +83,7 @@ float get_current(char type) {
|
||||
return ERROR_ADC_VAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 检查电流读数是否在有效范围内
|
||||
if (current_latest < MIN_CURRENT || current_latest > MAX_CURRENT) {
|
||||
return ERROR_ADC_VAL;
|
||||
@@ -102,7 +102,7 @@ float get_vbus_voltage() {
|
||||
float vcc_latest = ERROR_ADC_VAL;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
// 获取电压值
|
||||
vcc_latest = adc_value[6] * ADC_SCALE * VCC_FACTOR;
|
||||
vcc_latest = adc_value[5] * ADC_SCALE * VCC_FACTOR;
|
||||
|
||||
// 检查电压读数是否在有效范围内
|
||||
if (vcc_latest > MAX_VCC || vcc_latest < MIN_VCC) {
|
||||
|
||||
Reference in New Issue
Block a user