diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-07-10 09:39:45 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-07-10 09:39:45 +0200 |
commit | e6e3f8ff2690fe8a05658d58a13288f14bd1f461 (patch) | |
tree | 2fb594d965cd4362d9a67a53c28dbfe4e8c3f37c /src/glutt-o-logique/analog_input.c | |
parent | 16367c2a9da68c6c813537ea905a227864aec30f (diff) | |
download | glutte-o-matic-e6e3f8ff2690fe8a05658d58a13288f14bd1f461.tar.gz glutte-o-matic-e6e3f8ff2690fe8a05658d58a13288f14bd1f461.tar.bz2 glutte-o-matic-e6e3f8ff2690fe8a05658d58a13288f14bd1f461.zip |
Add reflected power handling with fixed threshold
Diffstat (limited to 'src/glutt-o-logique/analog_input.c')
-rw-r--r-- | src/glutt-o-logique/analog_input.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/glutt-o-logique/analog_input.c b/src/glutt-o-logique/analog_input.c index 103d933..307eff1 100644 --- a/src/glutt-o-logique/analog_input.c +++ b/src/glutt-o-logique/analog_input.c @@ -98,16 +98,11 @@ float analog_measure_12v(void) } -int analog_measure_swr(uint16_t *forward, uint16_t* reflected) +int analog_measure_swr(int *forward_mv, int* reflected_mv) { const uint16_t raw_swr_fwd_value = analog_read_channel(ADC_CHANNEL_SWR_FWD); const uint16_t raw_swr_refl_value = analog_read_channel(ADC_CHANNEL_SWR_REFL); - *forward = raw_swr_fwd_value; - *reflected = raw_swr_refl_value; - - const int supply_decivolts = analog_measure_12v() * 10.0f; - const float adc_max_value = (1 << 12); const float v_ref = 2.965f; @@ -115,8 +110,10 @@ int analog_measure_swr(uint16_t *forward, uint16_t* reflected) const int swr_fwd = ((float)raw_swr_fwd_value*10.0f*v_ref/adc_max_value); const int swr_refl = ((float)raw_swr_refl_value*10.0f*v_ref/adc_max_value); - usart_debug("RAW Meas %d dV - %d mV - %d mV\r\n", - supply_decivolts, + *forward_mv = swr_fwd; + *reflected_mv = swr_refl; + + usart_debug("RAW Meas %d mV - %d mV\r\n", swr_fwd, swr_refl); |