add TNC mode
This commit is contained in:
parent
8154a037a8
commit
ef115e1ad4
|
|
@ -57,7 +57,7 @@ build_flags = -Werror -Wall -DTTGO_T_Beam_V1_0_SX1268
|
||||||
board = ttgo-t-beam
|
board = ttgo-t-beam
|
||||||
build_flags = -Werror -Wall -DTTGO_T_Beam_V1_2
|
build_flags = -Werror -Wall -DTTGO_T_Beam_V1_2
|
||||||
|
|
||||||
[env:ttgo-t-lora-v2_1]
|
[env:ttgo-t-lora-v2_1_TNC]
|
||||||
board = ttgo-lora32-v21
|
board = ttgo-lora32-v21
|
||||||
build_flags = -Werror -Wall -DTTGO_T_LORA_V2_1_TNC
|
build_flags = -Werror -Wall -DTTGO_T_LORA_V2_1_TNC
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ extern logging::Logger logger;
|
||||||
|
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
bool PowerManagement::begin(TwoWire &port) {
|
bool PowerManagement::begin(TwoWire &port) {
|
||||||
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1)
|
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1_TNC)
|
||||||
return true; // Currently there is no init for V0.7 boards(they only measure battery voltage).
|
return true; // Currently there is no init for V0.7 boards(they only measure battery voltage).
|
||||||
#endif
|
#endif
|
||||||
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268)
|
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268)
|
||||||
|
|
@ -133,7 +133,7 @@ void PowerManagement::deactivateMeasurement() {
|
||||||
|
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
double PowerManagement::getBatteryVoltage() {
|
double PowerManagement::getBatteryVoltage() {
|
||||||
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1)
|
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1_TNC)
|
||||||
// the battery voltage is divided by 2 with two 100kOhm resistors and connected to ADC1 Channel 7 -> pin 35
|
// the battery voltage is divided by 2 with two 100kOhm resistors and connected to ADC1 Channel 7 -> pin 35
|
||||||
// the measured voltage is inaccurate du to known nonlinearity and ~100mV offset of the ESP32 A/D converter
|
// the measured voltage is inaccurate du to known nonlinearity and ~100mV offset of the ESP32 A/D converter
|
||||||
int adc_value;
|
int adc_value;
|
||||||
|
|
@ -155,7 +155,7 @@ double PowerManagement::getBatteryVoltage() {
|
||||||
|
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
double PowerManagement::getBatteryChargeDischargeCurrent() {
|
double PowerManagement::getBatteryChargeDischargeCurrent() {
|
||||||
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1)
|
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1_TNC)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268)
|
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268)
|
||||||
|
|
@ -170,7 +170,7 @@ double PowerManagement::getBatteryChargeDischargeCurrent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PowerManagement::isBatteryConnected() {
|
bool PowerManagement::isBatteryConnected() {
|
||||||
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1)
|
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1_TNC)
|
||||||
if(getBatteryVoltage() > 1.0) {
|
if(getBatteryVoltage() > 1.0) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -186,7 +186,7 @@ bool PowerManagement::isBatteryConnected() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PowerManagement::isChargeing() {
|
bool PowerManagement::isChargeing() {
|
||||||
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1)
|
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1_TNC)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268)
|
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268)
|
||||||
|
|
@ -239,7 +239,7 @@ void PowerManagement::setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerManagement::lowerCpuFrequency() {
|
void PowerManagement::lowerCpuFrequency() {
|
||||||
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1)
|
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1_TNC)
|
||||||
if (setCpuFrequencyMhz(80)) {
|
if (setCpuFrequencyMhz(80)) {
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "CPU frequency set to 80MHz");
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "CPU frequency set to 80MHz");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -261,7 +261,7 @@ void PowerManagement::obtainBatteryInfo() {
|
||||||
if (!(rate_limit_check_battery++ % 60))
|
if (!(rate_limit_check_battery++ % 60))
|
||||||
BatteryIsConnected = isBatteryConnected();
|
BatteryIsConnected = isBatteryConnected();
|
||||||
if (BatteryIsConnected) {
|
if (BatteryIsConnected) {
|
||||||
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268)
|
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA_V2_1_GPS) || defined(TTGO_T_LORA_V2_1_TNC) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268)
|
||||||
batteryVoltage = String(getBatteryVoltage(), 2);
|
batteryVoltage = String(getBatteryVoltage(), 2);
|
||||||
#endif
|
#endif
|
||||||
#ifdef TTGO_T_Beam_V1_2
|
#ifdef TTGO_T_Beam_V1_2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue