Fix battery level values when 9600 baud is selected.

kf7r_9600_experimental
Rob Riggs 2020-02-23 16:32:47 -06:00
rodzic 5503b329e8
commit 240f7b0413
3 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -198,9 +198,9 @@ uint32_t Afsk1200Demodulator::readBatteryLevel()
// Order of operations is important to avoid underflow.
vbat *= 6600;
vbat /= (vrefint + 1);
vbat /= (VREF + 1);
uint32_t vref = (vrefint * 3300) + (VREF / 2) / VREF;
uint32_t vref = ((vrefint * 3300) + (VREF / 2)) / VREF;
INFO("Vref = %lumV", vref)
INFO("Vbat = %lumV", vbat);

Wyświetl plik

@ -158,9 +158,9 @@ uint32_t Fsk9600Demodulator::readBatteryLevel()
// Order of operations is important to avoid underflow.
vbat *= 6600;
vbat /= (vrefint + 1);
vbat /= (VREF + 1);
uint32_t vref = (vrefint * 3300) + (VREF / 2) / VREF;
uint32_t vref = ((vrefint * 3300) + (VREF / 2)) / VREF;
INFO("Vref = %lumV", vref)
INFO("Vbat = %lumV", vbat);

Wyświetl plik

@ -32,7 +32,7 @@ struct Fsk9600Demodulator : IDemodulator
static_assert(audio::ADC_BUFFER_SIZE >= ADC_BLOCK_SIZE);
static constexpr uint32_t SAMPLE_RATE = 192000;
static constexpr uint16_t VREF = 16383;
static constexpr uint16_t VREF = 4095;
using bpf_coeffs_type = std::array<int16_t, FILTER_TAP_NUM>;
using bpf_bank_type = std::array<bpf_coeffs_type, 13>;