diff --git a/App/Inc/anemometer_dev.h b/App/Inc/anemometer_dev.h index dd40f8f..13107e5 100644 --- a/App/Inc/anemometer_dev.h +++ b/App/Inc/anemometer_dev.h @@ -20,6 +20,8 @@ +#define ADC_GAIN_ENABLE 190 +#define ADC_GAIN_DISABLE 1900 #define K_128 0xA12EE1FE // 延时REV_MUTE_DELAY us启动ADC采集数据 diff --git a/App/Src/anemometer_dev.c b/App/Src/anemometer_dev.c index bc0ea98..ea43e7d 100644 --- a/App/Src/anemometer_dev.c +++ b/App/Src/anemometer_dev.c @@ -93,30 +93,30 @@ void config_adc_gain(uint8_t channel, uint16_t max_val) switch(channel) { case 0x01: - if(max_val <= 180) + if(max_val <= ADC_GAIN_ENABLE) gain_status.gain_status_s = 1; - else if(max_val >= 1900) + else if(max_val >= ADC_GAIN_DISABLE) gain_status.gain_status_s = 0; break; case 0x02: - if(max_val <= 180) + if(max_val <= ADC_GAIN_ENABLE) gain_status.gain_status_n = 1; - else if(max_val >= 1900) + else if(max_val >= ADC_GAIN_DISABLE) gain_status.gain_status_n = 0; break; case 0x03: - if(max_val <= 180) + if(max_val <= ADC_GAIN_ENABLE) gain_status.gain_status_e = 1; - else if(max_val >= 1900) + else if(max_val >= ADC_GAIN_DISABLE) gain_status.gain_status_e = 0; break; case 0x04: - if(max_val <= 180) + if(max_val <= ADC_GAIN_ENABLE) gain_status.gain_status_w = 1; - else if(max_val >= 1900) + else if(max_val >= ADC_GAIN_DISABLE) gain_status.gain_status_w = 0; break;