diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-07-05 11:20:36 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-07-05 11:20:36 +0200 |
commit | 4dd1d7a7e668afae97ac41513e53e4772234befa (patch) | |
tree | 14e3c17ec4a9c86e87541e95619f55bcafdc4f74 | |
parent | cc0301784156543c7c9bec36b6f42df1d2adba28 (diff) | |
download | glutte-o-matic-4dd1d7a7e668afae97ac41513e53e4772234befa.tar.gz glutte-o-matic-4dd1d7a7e668afae97ac41513e53e4772234befa.tar.bz2 glutte-o-matic-4dd1d7a7e668afae97ac41513e53e4772234befa.zip |
Adapt QRP QRO voltage thresholds
-rw-r--r-- | src/common/GPIO/analog.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/GPIO/analog.c b/src/common/GPIO/analog.c index b6f75a6..f52fb3a 100644 --- a/src/common/GPIO/analog.c +++ b/src/common/GPIO/analog.c @@ -26,6 +26,10 @@ #define SUPPLY_HISTORY_LEN 10 +// Hysteresis: +#define SUPPLY_QRP 12.1f +#define SUPPLY_QRO 12.5f + static float supply_history[SUPPLY_HISTORY_LEN]; static int supply_history_ix = 0; static int supply_history_ready = 0; @@ -34,10 +38,6 @@ static int last_qrp = 0; // Return 1 if analog supply is too low int analog_supply_too_low(void) { - - // Hysteresis: - // Lower voltage 12.5V - // High voltage 13V const float measure = analog_measure_12v(); supply_history[supply_history_ix] = measure; @@ -52,8 +52,8 @@ int analog_supply_too_low(void) for (int i = 0; i < SUPPLY_HISTORY_LEN; i++) { sum += supply_history[i]; } - int above_lower_limit = (sum > 12.5f * SUPPLY_HISTORY_LEN); - int above_upper_limit = (sum > 13.0f * SUPPLY_HISTORY_LEN); + int above_lower_limit = (sum > SUPPLY_QRP * SUPPLY_HISTORY_LEN); + int above_upper_limit = (sum > SUPPLY_QRO * SUPPLY_HISTORY_LEN); if (!above_lower_limit) { last_qrp = 1; |