code cleaning in power_utils
This commit is contained in:
parent
d744f0a0f0
commit
04a7f89891
|
|
@ -66,27 +66,11 @@ String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seven
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
#ifdef BATTERY_PIN
|
|
||||||
pinMode(BATTERY_PIN, INPUT);
|
|
||||||
#endif
|
|
||||||
#ifdef INTERNAL_LED_PIN
|
|
||||||
pinMode(INTERNAL_LED_PIN, OUTPUT);
|
|
||||||
#endif
|
|
||||||
if (Config.externalVoltageMeasurement) {
|
|
||||||
pinMode(Config.externalVoltagePin, INPUT);
|
|
||||||
}
|
|
||||||
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(HELTEC_V3)
|
|
||||||
POWER_Utils::setup();
|
POWER_Utils::setup();
|
||||||
#endif
|
|
||||||
delay(1000);
|
|
||||||
Utils::setupDisplay();
|
Utils::setupDisplay();
|
||||||
|
|
||||||
Config.check();
|
Config.check();
|
||||||
|
|
||||||
LoRa_Utils::setup();
|
LoRa_Utils::setup();
|
||||||
Utils::validateFreqs();
|
Utils::validateFreqs();
|
||||||
|
|
||||||
iGateBeaconPacket = GPS_Utils::generateBeacon();
|
iGateBeaconPacket = GPS_Utils::generateBeacon();
|
||||||
iGateLoRaBeaconPacket = GPS_Utils::generateiGateLoRaBeacon();
|
iGateLoRaBeaconPacket = GPS_Utils::generateiGateLoRaBeacon();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@
|
||||||
#if defined(HELTEC_V3)
|
#if defined(HELTEC_V3)
|
||||||
#define INTERNAL_LED_PIN 35
|
#define INTERNAL_LED_PIN 35
|
||||||
#define BATTERY_PIN 1
|
#define BATTERY_PIN 1
|
||||||
#define VExt_CTRL 36
|
#define VEXT_CTRL 36
|
||||||
#define ADC_CTRL 37
|
#define ADC_CTRL 37
|
||||||
#endif
|
#endif
|
||||||
#if defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa)
|
#if defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa)
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,6 @@ namespace POWER_Utils {
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Wire.end();
|
|
||||||
#ifdef HAS_AXP192
|
#ifdef HAS_AXP192
|
||||||
Wire.begin(SDA, SCL);
|
Wire.begin(SDA, SCL);
|
||||||
if (begin(Wire)) {
|
if (begin(Wire)) {
|
||||||
|
|
@ -126,11 +125,27 @@ namespace POWER_Utils {
|
||||||
PMU.setSysPowerDownVoltage(2600);
|
PMU.setSysPowerDownVoltage(2600);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HELTEC_V3)
|
#ifdef BATTERY_PIN
|
||||||
pinMode(VExt_CTRL,OUTPUT); // this is for GPS and TFT screen on Wireless_Tracker and only for Oled in Heltec V3
|
pinMode(BATTERY_PIN, INPUT);
|
||||||
digitalWrite(VExt_CTRL, HIGH);
|
#endif
|
||||||
|
|
||||||
|
#ifdef INTERNAL_LED_PIN
|
||||||
|
pinMode(INTERNAL_LED_PIN, OUTPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (Config.externalVoltageMeasurement) {
|
||||||
|
pinMode(Config.externalVoltagePin, INPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(VEXT_CTRL)
|
||||||
|
pinMode(VEXT_CTRL,OUTPUT); // this is for GPS and TFT screen on Wireless_Tracker and only for Oled in Heltec V3
|
||||||
|
digitalWrite(VEXT_CTRL, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ADC_CTRL)
|
||||||
pinMode(ADC_CTRL, OUTPUT);
|
pinMode(ADC_CTRL, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -115,7 +115,7 @@ namespace Utils {
|
||||||
beaconPacket += Config.beacon.comment;
|
beaconPacket += Config.beacon.comment;
|
||||||
secondaryBeaconPacket += Config.beacon.comment;
|
secondaryBeaconPacket += Config.beacon.comment;
|
||||||
|
|
||||||
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_HTCT62) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa_A7670) || defined(TTGO_T_LORA32_V2_1_915)
|
#ifdef BATTERY_PIN
|
||||||
if (Config.sendBatteryVoltage) {
|
if (Config.sendBatteryVoltage) {
|
||||||
beaconPacket += " Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V";
|
beaconPacket += " Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V";
|
||||||
secondaryBeaconPacket += " Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V";
|
secondaryBeaconPacket += " Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue