Browse Source
Merge pull request #2335 from fizzyfuzzle/v4_adc_mult
Add Heltec V4 set adc.multiplier functionality
pull/2278/head
Liam Cottle
2 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
19 additions and
3 deletions
-
variants/heltec_v4/HeltecV4Board.cpp
-
variants/heltec_v4/HeltecV4Board.h
|
|
|
@ -73,7 +73,7 @@ void HeltecV4Board::begin() { |
|
|
|
|
|
|
|
digitalWrite(PIN_ADC_CTRL, LOW); |
|
|
|
|
|
|
|
return (5.42 * (3.3 / 1024.0) * raw) * 1000; |
|
|
|
return (adc_mult * (3.3 / 1024.0) * raw) * 1000; |
|
|
|
} |
|
|
|
|
|
|
|
const char* HeltecV4Board::getManufacturerName() const { |
|
|
|
|
|
|
|
@ -5,8 +5,16 @@ |
|
|
|
#include <helpers/ESP32Board.h> |
|
|
|
#include <driver/rtc_io.h> |
|
|
|
#include "LoRaFEMControl.h" |
|
|
|
|
|
|
|
#ifndef ADC_MULTIPLIER |
|
|
|
#define ADC_MULTIPLIER 5.42 |
|
|
|
#endif |
|
|
|
|
|
|
|
class HeltecV4Board : public ESP32Board { |
|
|
|
|
|
|
|
protected: |
|
|
|
float adc_mult = ADC_MULTIPLIER; |
|
|
|
|
|
|
|
public: |
|
|
|
RefCountedDigitalPin periph_power; |
|
|
|
LoRaFEMControl loRaFEMControl; |
|
|
|
@ -18,6 +26,14 @@ public: |
|
|
|
void enterDeepSleep(uint32_t secs, int pin_wake_btn = -1); |
|
|
|
void powerOff() override; |
|
|
|
uint16_t getBattMilliVolts() override; |
|
|
|
const char* getManufacturerName() const override ; |
|
|
|
|
|
|
|
bool setAdcMultiplier(float multiplier) override { |
|
|
|
if (multiplier == 0.0f) { |
|
|
|
adc_mult = ADC_MULTIPLIER; |
|
|
|
} else { |
|
|
|
adc_mult = multiplier; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
float getAdcMultiplier() const override { return adc_mult; } |
|
|
|
const char* getManufacturerName() const override; |
|
|
|
}; |
|
|
|
|