|
|
@ -94,6 +94,18 @@ void PlateCodeScanerModule::initialize(int32_t moduleid, hardware_config_t* hard |
|
|
|
adc_capture_buf = (int16_t*)calloc(2, MAX_POINT); |
|
|
|
ZASSERT(adc_capture_buf); |
|
|
|
|
|
|
|
m_t_laster_enable_io.setState(true); |
|
|
|
m_amp_negative_5v_gpio.setState(true); |
|
|
|
m_t_amp_sw_io.setState(true); |
|
|
|
m_f_amp_sw_io.setState(true); |
|
|
|
|
|
|
|
// while (true) {
|
|
|
|
// int32_t adcv;
|
|
|
|
// t_result_adc.get_adc_value(adcv);
|
|
|
|
// ZLOGI(TAG, "t:%d", adcv);
|
|
|
|
// osDelay(100);
|
|
|
|
// }
|
|
|
|
|
|
|
|
m_reg.laster_intensity = 10; |
|
|
|
m_reg.scan_gain = 1; |
|
|
|
m_reg.scan_velocity = 500; |
|
|
@ -367,9 +379,13 @@ int32_t PlateCodeScanerModule::read_adc_val() { |
|
|
|
int32_t val = 0; |
|
|
|
#define CAPTURE_NUM 3
|
|
|
|
|
|
|
|
int32_t cache[CAPTURE_NUM]; |
|
|
|
int32_t cache[CAPTURE_NUM] = {0}; |
|
|
|
for (int i = 0; i < CAPTURE_NUM; i++) { |
|
|
|
t_result_adc.get_adc_value(cache[i]); |
|
|
|
int32_t e = t_result_adc.get_adc_value(cache[i]); |
|
|
|
// ZLOGI(TAG, "read adc: %d", cache[i]);
|
|
|
|
if(e!=0){ |
|
|
|
ZLOGE(TAG, "read adc fail"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 先排序,取中间10个数的中值
|
|
|
|