|
@@ -1,6 +1,5 @@
|
|
|
#pragma once
|
|
#pragma once
|
|
|
|
|
|
|
|
-#include "ESP32Board.h"
|
|
|
|
|
#include <Arduino.h>
|
|
#include <Arduino.h>
|
|
|
|
|
|
|
|
// LoRa radio module pins for Heltec V3
|
|
// LoRa radio module pins for Heltec V3
|
|
@@ -19,6 +18,8 @@
|
|
|
#define PIN_ADC_CTRL_INACTIVE HIGH
|
|
#define PIN_ADC_CTRL_INACTIVE HIGH
|
|
|
#define PIN_LED_BUILTIN 35
|
|
#define PIN_LED_BUILTIN 35
|
|
|
|
|
|
|
|
|
|
+#include "ESP32Board.h"
|
|
|
|
|
+
|
|
|
#include <driver/rtc_io.h>
|
|
#include <driver/rtc_io.h>
|
|
|
|
|
|
|
|
class HeltecV3Board : public ESP32Board {
|
|
class HeltecV3Board : public ESP32Board {
|
|
@@ -26,6 +27,8 @@ public:
|
|
|
void begin() {
|
|
void begin() {
|
|
|
ESP32Board::begin();
|
|
ESP32Board::begin();
|
|
|
|
|
|
|
|
|
|
+ pinMode(PIN_ADC_CTRL, OUTPUT);
|
|
|
|
|
+
|
|
|
esp_reset_reason_t reason = esp_reset_reason();
|
|
esp_reset_reason_t reason = esp_reset_reason();
|
|
|
if (reason == ESP_RST_DEEPSLEEP) {
|
|
if (reason == ESP_RST_DEEPSLEEP) {
|
|
|
long wakeup_source = esp_sleep_get_ext1_wakeup_status();
|
|
long wakeup_source = esp_sleep_get_ext1_wakeup_status();
|
|
@@ -36,17 +39,6 @@ public:
|
|
|
rtc_gpio_hold_dis((gpio_num_t)P_LORA_NSS);
|
|
rtc_gpio_hold_dis((gpio_num_t)P_LORA_NSS);
|
|
|
rtc_gpio_deinit((gpio_num_t)P_LORA_DIO_1);
|
|
rtc_gpio_deinit((gpio_num_t)P_LORA_DIO_1);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // battery read support
|
|
|
|
|
- pinMode(PIN_VBAT_READ, INPUT);
|
|
|
|
|
- adcAttachPin(PIN_VBAT_READ);
|
|
|
|
|
- analogReadResolution(10);
|
|
|
|
|
- pinMode(PIN_ADC_CTRL, OUTPUT);
|
|
|
|
|
-
|
|
|
|
|
- #ifdef P_LORA_TX_LED
|
|
|
|
|
- pinMode(P_LORA_TX_LED, OUTPUT);
|
|
|
|
|
- digitalWrite(P_LORA_TX_LED, LOW);
|
|
|
|
|
- #endif
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void enterDeepSleep(uint32_t secs, int pin_wake_btn = -1) {
|
|
void enterDeepSleep(uint32_t secs, int pin_wake_btn = -1) {
|
|
@@ -72,16 +64,8 @@ public:
|
|
|
esp_deep_sleep_start(); // CPU halts here and never returns!
|
|
esp_deep_sleep_start(); // CPU halts here and never returns!
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#if defined(P_LORA_TX_LED)
|
|
|
|
|
- void onBeforeTransmit() override {
|
|
|
|
|
- digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
|
|
|
|
|
- }
|
|
|
|
|
- void onAfterTransmit() override {
|
|
|
|
|
- digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
|
|
|
|
|
- }
|
|
|
|
|
-#endif
|
|
|
|
|
-
|
|
|
|
|
uint16_t getBattMilliVolts() override {
|
|
uint16_t getBattMilliVolts() override {
|
|
|
|
|
+ analogReadResolution(10);
|
|
|
digitalWrite(PIN_ADC_CTRL, PIN_ADC_CTRL_ACTIVE);
|
|
digitalWrite(PIN_ADC_CTRL, PIN_ADC_CTRL_ACTIVE);
|
|
|
|
|
|
|
|
uint32_t raw = 0;
|
|
uint32_t raw = 0;
|