Add files via upload

pull/106/head
SP6NYA 2023-09-09 18:59:35 +02:00 zatwierdzone przez GitHub
rodzic 4fa5001a67
commit bb7eebb40e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
12 zmienionych plików z 443 dodań i 150 usunięć

Wyświetl plik

@ -17,6 +17,7 @@ Search and install the following libaries:<br>
<li>AXP202X_Library</li>
<li>OneWire</li>
<li>DallasTemperature</li>
<li>XPowersLib<>
</ul>
<br>
<h3>2. Command Line Tool</h3>
@ -30,6 +31,7 @@ platformio lib install "AXP202X_Library"<br>
platformio lib install "Adafruit Unified Sensor"<br>
platformio lib install "OneWire"<br>
platformio lib install "DallasTemperature"<br>
platformio lib install "XPowersLib<br>
<br>
Check that the platformio.ini is available as it holds the board type for PlatformIO.<br>
After pressing the check mark the code will be compiled, after pressing the arrow it will be compiled and uploaded to a connected TTGO.<br>

Wyświetl plik

@ -12,10 +12,12 @@ After connection with APRX based DIGI it can be used as KISS-TNC
* KISS TNC Over Serial or Bluetooth: SQ5RWU
* Lora32 board support: DJ1AN
* Self-telemetry improvement: KB1GIM
* T-beam v1.2 board support: SP6NYA
## Supported boards
* TTGO T-beam v.0.7
* TTGO T-beam v.1.0
* TTGO T-beam v.1.0
* LILYGO/TTGO T-Beam v.1.2
* Lora32 board
## User key functions:
@ -116,3 +118,6 @@ This box allows firmware to be uploaded via OTA
## Default WiFi Password:
* Default WiFi Password is: xxxxxxxxxx
* that is, 10 times x
## Known bugs
* T-beam v1.2 batterry voltage issue

Wyświetl plik

@ -0,0 +1,16 @@
{
"folders": [
{
"path": "."
},
{
"name": "LoRa aprs",
"path": "../LoRa aprs"
}
],
"settings": {
"files.associations": {
"*.tpp": "cpp"
}
}
}

Wyświetl plik

@ -307,7 +307,7 @@
</section>
</div>
<footer>
<center><b>Contributors in order of appearance:</b><br> OE1ACM, OE3CJB, SQ9MDD, SQ5RWU, DJ1AN, M0IGA, SQ5WPR, DO2JMG, SP6VWX, SQ2WB, IU2FRL, DO3BOX, DL9SAU</center>
<center><b>Contributors in order of appearance:</b><br> OE1ACM, OE3CJB, SQ9MDD, SQ5RWU, DJ1AN, M0IGA, SQ5WPR, DO2JMG, SP6VWX, SQ2WB, IU2FRL, DO3BOX, DL9SAU, SP6NYA</center>
<center><b>Latest stable version:</b> <a href=https://github.com/SQ9MDD/TTGO-T-Beam-LoRa-APRS>https://github.com/SQ9MDD/TTGO-T-Beam-LoRa-APRS</a></center>
<center><b>Licensed under:</b> CC BY-NC-SA</center>
<center><!--VERSION--></center>

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

10
include/version.h 100644
Wyświetl plik

@ -0,0 +1,10 @@
#ifndef BUILD_NUMBER
#define BUILD_NUMBER "66"
#endif
#ifndef VERSION
#define VERSION "v0.3.66- - 2023-09-09 17:44:17.377051"
#endif
#ifndef VERSION_SHORT
#define VERSION_SHORT "v0.3.66-"
#endif

Wyświetl plik

@ -1,129 +1,227 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env]
framework = arduino
monitor_speed = 115200
board_build.partitions = partitions.csv
board_build.embed_files =
data_embed/index.html.out
data_embed/style.css.out
data_embed/js.js.out
extra_scripts =
pre:tools/buildscript_versioning.py
pre:tools/compress_assets.py
lib_deps =
RadioHead
TinyGPSPlus
Adafruit SSD1306
Adafruit GFX Library
Adafruit Unified Sensor
https://github.com/SQ9MDD/AXP202X_Library.git
SparkFun u-blox Arduino Library
bblanchon/ArduinoJson
build_flags =
-Wl,--gc-sections,--relax
-D 'KISS_PROTOCOL' ; leave enabled
-D 'CALLSIGN="N0CALL-0"' ; can be set from www interface
-D 'DIGI_PATH="WIDE1-1"' ; can be set from www interface
-D 'FIXED_BEACON_EN' ; can be set from www interface
-D 'LATIDUDE_PRESET="0000.00N"' ; can be set from www interface
-D 'LONGITUDE_PRESET="00000.00E"' ; can be set from www interface
-D 'APRS_SYMBOL_TABLE="/"' ; can be set from www interface
-D 'APRS_SYMBOL="["' ; can be set from www interface
-D 'MY_COMMENT="Lora Tracker"' ; can be set from www interface
-D 'SHOW_ALT' ; can be set from www interface
-D 'SHOW_BATT' ; can be set from www interface
-D 'SHOW_RX_PACKET' ; can be set from www interface
-D 'SHOW_RX_TIME=10000' ; can be set from www interface
-D 'TXFREQ=433.775' ; set operating frequency
-D 'SPEED_1200' ; comment out to set 300baud
-D 'TXdbmW=23' ; set power
-D 'ENABLE_OLED' ; can be set from www interface
-D 'ENABLE_LED_SIGNALING' ; can be set from www interface
-D 'NETWORK_TNC_PORT=8001' ; default KISS TCP port
-D 'MAX_TIME_TO_NEXT_TX=120000L' ; can be set from www interface
-D 'FIX_BEACON_INTERVAL=1800000L' ; can be set from www interface
-D 'NETWORK_GPS_PORT=10110' ; GPS NMEA Port
-D 'ENABLE_TNC_SELF_TELEMETRY' ; can be set from www interface
-D 'TNC_SELF_TELEMETRY_INTERVAL=3600L' ; can be set from www interface (seconds)
-D 'SHOW_OLED_TIME=15000' ; OLED Timeout
[env:ttgo-t-beam-v1.0]
platform = espressif32 @ 3.0.0
board = ttgo-t-beam
build_flags =
${env.build_flags}
-D T_BEAM_V1_0
-D ENABLE_WIFI
-D ENABLE_BLUETOOTH
[env:ttgo-t-beam-v0.7]
platform = espressif32 @ 3.0.0
board = ttgo-t-beam
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D T_BEAM_V0_7
[env:ttgo-lora32-v2.1]
platform = espressif32 @ 3.1.1
board = ttgo-lora32-v21
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D LORA32_21
[env:ttgo-lora32-v2]
platform = espressif32 @ 3.1.1
board = ttgo-lora32-v2
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D LORA32_2
[env:ttgo-lora32-v1]
platform = espressif32 @ 3.1.1
board = ttgo-lora32-v1
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D LORA32_1
[env:Heltec-WiFi-v1]
platform = espressif32 @ 3.1.1
board = heltec_wifi_kit_32
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D HELTEC_V1
[env:Heltec-WiFi-v2]
platform = espressif32 @ 3.1.1
board = heltec_wifi_kit_32_v2
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D HELTEC_V2
[env:ttgo-t-beam-v1.0-development]
platform = espressif32 @ 3.0.0
board = ttgo-t-beam
build_flags =
${env.build_flags}
-D T_BEAM_V1_0
-D ENABLE_WIFI
-D ENABLE_BLUETOOTH
-D ENABLE_SYSLOG
-D 'SYSLOG_IP="192.168.0.102"'
-D DEVELOPMENT_DEBUG
lib_deps =
${env.lib_deps}
arcao/Syslog
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env]
framework = arduino
monitor_speed = 115200
board_build.partitions = partitions.csv
board_build.embed_files =
data_embed/index.html.out
data_embed/style.css.out
data_embed/js.js.out
extra_scripts =
pre:tools/buildscript_versioning.py
pre:tools/compress_assets.py
lib_deps =
RadioHead
TinyGPSPlus
Adafruit SSD1306
Adafruit GFX Library
Adafruit Unified Sensor
https://github.com/SQ9MDD/AXP202X_Library.git
SparkFun u-blox Arduino Library
bblanchon/ArduinoJson
build_flags =
-Wl,--gc-sections,--relax
-D 'KISS_PROTOCOL'
-D 'CALLSIGN="N0CALL-0"'
-D 'DIGI_PATH="WIDE1-1"'
-D 'FIXED_BEACON_EN'
-D 'LATIDUDE_PRESET="0000.00N"'
-D 'LONGITUDE_PRESET="00000.00E"'
-D 'APRS_SYMBOL_TABLE="/"'
-D 'APRS_SYMBOL="["'
-D 'MY_COMMENT="Lora Tracker"'
-D 'SHOW_ALT'
-D 'SHOW_BATT'
-D 'SHOW_RX_PACKET'
-D 'SHOW_RX_TIME=10000'
-D 'TXFREQ=433.775'
-D 'SPEED_1200'
-D 'TXdbmW=23'
-D 'ENABLE_OLED'
-D 'ENABLE_LED_SIGNALING'
-D 'NETWORK_TNC_PORT=8001'
-D 'MAX_TIME_TO_NEXT_TX=120000L'
-D 'FIX_BEACON_INTERVAL=1800000L'
-D 'NETWORK_GPS_PORT=10110'
-D 'ENABLE_TNC_SELF_TELEMETRY'
-D 'TNC_SELF_TELEMETRY_INTERVAL=3600L'
-D 'SHOW_OLED_TIME=15000'
[env:ttgo-t-beam-v1_0]
platform = espressif32 @ 3.0.0
board = ttgo-t-beam
build_flags =
${env.build_flags}
-D T_BEAM_V1_0
-D ENABLE_WIFI
-D ENABLE_BLUETOOTH
lib_deps =
lewisxhe/XPowersLib@^0.1.8
mikem/RadioHead@^1.120
mikalhart/TinyGPSPlus@^1.0.3
adafruit/Adafruit SSD1306@^2.5.7
adafruit/Adafruit GFX Library@^1.11.7
lewisxhe/AXP202X_Library@^1.1.3
pau6.21.3lstoffregen/OneWire@^2.3.7
sparkfun/SparkFun u-blox Arduino Library@^1.8.11
bblanchon/ArduinoJson@^
[env:ttgo-t-beam-v1_2]
platform = espressif32 @ 3.0.0
board = ttgo-t-beam
build_flags =
${env.build_flags}
-D T_BEAM_V1_2
-D ENABLE_WIFI
-D ENABLE_BLUETOOTH
lib_deps =
lewisxhe/XPowersLib@^0.1.8
mikem/RadioHead@^1.120
mikalhart/TinyGPSPlus@^1.0.3
adafruit/Adafruit SSD1306@^2.5.7
adafruit/Adafruit GFX Library@^1.11.7
paulstoffregen/OneWire@^2.3.7
sparkfun/SparkFun u-blox Arduino Library@^1.8.11
lewisxhe/AXP202X_Library@^1.1.3
bblanchon/ArduinoJson@^6.21.3
[env:ttgo-t-beam-v0_7]
platform = espressif32 @ 3.0.0
board = ttgo-t-beam
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D T_BEAM_V0_7
lib_deps =
lewisxhe/XPowersLib@^0.1.8
mikem/RadioHead@^1.120
mikalhart/TinyGPSPlus@^1.0.3
adafruit/Adafruit SSD1306@^2.5.7
adafruit/Adafruit GFX Library@^1.11.7
lewisxhe/AXP202X_Library@^1.1.3
paulstoffregen/OneWire@^2.3.7
sparkfun/SparkFun u-blox Arduino Library@^1.8.11
bblanchon/ArduinoJson@^6.21.3
[env:ttgo-lora32-v2_1]
platform = espressif32 @ 3.1.1
board = ttgo-lora32-v21
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D LORA32_21
lib_deps =
lewisxhe/XPowersLib@^0.1.8
mikem/RadioHead@^1.120
mikalhart/TinyGPSPlus@^1.0.3
adafruit/Adafruit SSD1306@^2.5.7
adafruit/Adafruit GFX Library@^1.11.7
lewisxhe/AXP202X_Library@^1.1.3
paulstoffregen/OneWire@^2.3.7
sparkfun/SparkFun u-blox Arduino Library@^1.8.11
bblanchon/ArduinoJson@^6.21.3
[env:ttgo-lora32-v2]
platform = espressif32 @ 3.1.1
board = ttgo-lora32-v2
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D LORA32_2
lib_deps =
lewisxhe/XPowersLib@^0.1.8
mikem/RadioHead@^1.120
mikalhart/TinyGPSPlus@^1.0.3
adafruit/Adafruit SSD1306@^2.5.7
adafruit/Adafruit GFX Library@^1.11.7
lewisxhe/AXP202X_Library@^1.1.3
paulstoffregen/OneWire@^2.3.7
sparkfun/SparkFun u-blox Arduino Library@^1.8.11
bblanchon/ArduinoJson@^6.21.3
[env:ttgo-lora32-v1]
platform = espressif32 @ 3.1.1
board = ttgo-lora32-v1
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D LORA32_1
lib_deps =
lewisxhe/XPowersLib@^0.1.8
mikem/RadioHead@^1.120
mikalhart/TinyGPSPlus@^1.0.3
adafruit/Adafruit SSD1306@^2.5.7
adafruit/Adafruit GFX Library@^1.11.7
lewisxhe/AXP202X_Library@^1.1.3
paulstoffregen/OneWire@^2.3.7
sparkfun/SparkFun u-blox Arduino Library@^1.8.11
bblanchon/ArduinoJson@^6.21.3
[env:Heltec-WiFi-v1]
platform = espressif32 @ 3.1.1
board = heltec_wifi_kit_32
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D HELTEC_V1
lib_deps =
lewisxhe/XPowersLib@^0.1.8
mikem/RadioHead@^1.120
mikalhart/TinyGPSPlus@^1.0.3
adafruit/Adafruit SSD1306@^2.5.7
adafruit/Adafruit GFX Library@^1.11.7
lewisxhe/AXP202X_Library@^1.1.3
paulstoffregen/OneWire@^2.3.7
sparkfun/SparkFun u-blox Arduino Library@^1.8.11
bblanchon/ArduinoJson@^6.21.3
[env:Heltec-WiFi-v2]
platform = espressif32 @ 3.1.1
board = heltec_wifi_kit_32_v2
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D HELTEC_V2
lib_deps =
lewisxhe/XPowersLib@^0.1.8
mikem/RadioHead@^1.120
mikalhart/TinyGPSPlus@^1.0.3
adafruit/Adafruit SSD1306@^2.5.7
adafruit/Adafruit GFX Library@^1.11.7
lewisxhe/AXP202X_Library@^1.1.3
paulstoffregen/OneWire@^2.3.7
sparkfun/SparkFun u-blox Arduino Library@^1.8.11
bblanchon/ArduinoJson@^6.21.3
[env:ttgo-t-beam-v1_0-development]
platform = espressif32 @ 3.0.0
board = ttgo-t-beam
build_flags =
${env.build_flags}
-D T_BEAM_V1_0
-D ENABLE_WIFI
-D ENABLE_BLUETOOTH
-D ENABLE_SYSLOG
-D 'SYSLOG_IP="192.168.0.102"'
-D DEVELOPMENT_DEBUG
lib_deps =
${env.lib_deps}
arcao/Syslog
lewisxhe/XPowersLib@^0.1.8
mikem/RadioHead@^1.120
mikalhart/TinyGPSPlus@^1.0.3
adafruit/Adafruit SSD1306@^2.5.7
adafruit/Adafruit GFX Library@^1.11.7
lewisxhe/AXP202X_Library@^1.1.3
paulstoffregen/OneWire@^2.3.7
sparkfun/SparkFun u-blox Arduino Library@^1.8.11
bblanchon/ArduinoJson@^6.21.3

Wyświetl plik

@ -24,6 +24,7 @@
#include "version.h"
#include "preference_storage.h"
#include "syslog_log.h"
#include "XPowersLib.h"
#ifdef KISS_PROTOCOL
#include "taskTNC.h"
@ -42,7 +43,14 @@
#define SPI_ss 18
// IO config
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
#define XPOWERS_CHIP_AXP2101
#define I2C_SDA 21
#define I2C_SCL 22
#define BUTTON 38 //pin number for Button on TTGO T-Beam
#define BUZZER 15 // enter your buzzer pin gpio
const byte TXLED = 4;
#elif T_BEAM_V1_0
#define I2C_SDA 21
#define I2C_SCL 22
#define BUTTON 38 //pin number for Button on TTGO T-Beam
@ -216,7 +224,8 @@ uint oled_timeout = SHOW_OLED_TIME; // OLED Timeout
bool tempOled = true; // Turn ON OLED at first startup
ulong oled_timer;
// Variable to manually send beacon from html page
bool manBeacon = false;
// Variable to show AP settings on OLED
@ -240,6 +249,14 @@ static const adc_atten_t atten = ADC_ATTEN_DB_6;
static const adc_unit_t unit = ADC_UNIT_1;
#ifdef T_BEAM_V1_0
AXP20X_Class axp;
#elif T_BEAM_V1_2 //PMU TBEAM 1.2
bool pmu_flag = 0;
XPowersAXP2101 PMU;
void setFlag(void)
{
pmu_flag = true;
}
#endif
// checkRX
@ -409,7 +426,10 @@ void loraSend(byte lora_LTXPower, float lora_FREQ, const String &message) {
}
void batt_read(){
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_v1_2
BattVolts = PMU.getBattVoltage() / 1000;
InpVolts = PMU.getVbusVoltage() / 1000;
#elif T_BEAM_V1_0
BattVolts = axp.getBattVoltage()/1000;
InpVolts = axp.getVbusVoltage()/1000;
#elif T_BEAM_V0_7
@ -423,13 +443,21 @@ void batt_read(){
void writedisplaytext(String HeaderTxt, String Line1, String Line2, String Line3, String Line4, String Line5) {
batt_read();
if (BattVolts < 3.5 && BattVolts > 3.3){
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
#ifdef ENABLE_LED_SIGNALING
PMU.setChargingLedMode(XPOWERS_CHG_LED_BLINK_1HZ);
#endif
#elif T_BEAM_V1_0
# ifdef ENABLE_LED_SIGNALING
axp.setChgLEDMode(AXP20X_LED_BLINK_4HZ);
#endif
#endif
}else if(BattVolts <= 3.3){
#ifdef T_BEAM_V1_0
}
else if(BattVolts <= 3.3){
#ifdef T_BEAM_V1_2
PMU.setChargingLedMode(XPOWERS_CHG_LED_BLINK_4HZ);
//PMU.shutdown();
#elif T_BEAM_V1_0
axp.setChgLEDMode(AXP20X_LED_OFF);
//axp.shutdown(); <-we need fix this
#endif
@ -543,7 +571,66 @@ String prepareCallsign(const String& callsign){
#if defined(ENABLE_TNC_SELF_TELEMETRY) && defined(KISS_PROTOCOL)
void sendTelemetryFrame() {
if(enable_tel == true){
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
uint8_t b_volt = (PMU.getBattVoltage() - 3000) / 5.1;
uint8_t ac_volt = (PMU.getVbusVoltage() - 3000) / 28;
// Pad telemetry message address to 9 characters
char Tcall_message_char[9];
sprintf_P(Tcall_message_char, "%-9s", Tcall);
String Tcall_message = String(Tcall_message_char);
// Flash the light when telemetry is being sent
#ifdef ENABLE_LED_SIGNALING
digitalWrite(TXLED, LOW);
#endif
// Determine sequence number (or 'MIC')
String tel_sequence_str;
if(tel_mic == 1){
tel_sequence_str = "MIC";
}else{
// Get the current saved telemetry sequence
tel_sequence = preferences.getUInt(PREF_TNC_SELF_TELEMETRY_SEQ, 0);
// Pad to 3 digits
char tel_sequence_char[3];
sprintf_P(tel_sequence_char, "%03u", tel_sequence);
tel_sequence_str = String(tel_sequence_char);
}
// Format telemetry path
String tel_path_str;
if(tel_path == ""){
tel_path_str = tel_path;
}else{
tel_path_str = "," + tel_path;
}
String telemetryParamsNames = String(":") + Tcall_message + ":PARM.B Volt,AC V,";
String telemetryUnitNames = String(":") + Tcall_message + ":UNIT.mV,mV,";
String telemetryEquations = String(":") + Tcall_message + ":EQNS.0,5.1,3000,0,10,0,0,10,0,0,28,3000,0,10,0";
String telemetryData = String("T#") + tel_sequence_str + "," + String(b_volt) + "," + String(ac_volt) + ",00000000";
String telemetryBase = "";
telemetryBase += Tcall + ">APLO02" + tel_path_str + ":";
Serial.print(telemetryBase);
sendToTNC(telemetryBase + telemetryParamsNames);
sendToTNC(telemetryBase + telemetryUnitNames);
sendToTNC(telemetryBase + telemetryEquations);
sendToTNC(telemetryBase + telemetryData);
// Show when telemetry is being sent
writedisplaytext("((TEL TX))","","","","","");
// Flash the light when telemetry is being sent
#ifdef ENABLE_LED_SIGNALING
digitalWrite(TXLED, HIGH);
#endif
// Update the telemetry sequence number
if(tel_sequence >= 999){
tel_sequence = 0;
}else{
tel_sequence = tel_sequence + 1;
}
preferences.putUInt(PREF_TNC_SELF_TELEMETRY_SEQ, tel_sequence);
#elif T_BEAM_V1_0
uint8_t b_volt = (axp.getBattVoltage() - 3000) / 5.1;
uint8_t b_in_c = (axp.getBattChargeCurrent()) / 10;
uint8_t b_out_c = (axp.getBattDischargeCurrent()) / 10;
@ -612,7 +699,12 @@ String prepareCallsign(const String& callsign){
// + SETUP --------------------------------------------------------------+//
void setup(){
#ifdef T_BEAM_V0_7 /*
#ifdef T_BEAM_V1_2
//PMU.enableBattDetection();
PMU.enableVbusVoltageMeasure();
PMU.enableBattVoltageMeasure();
PMU.enableSystemVoltageMeasure();
#elif T_BEAM_V0_7 /*
adcAttachPin(35);
adcStart(35);
analogReadResolution(10);
@ -855,8 +947,10 @@ void setup(){
}
pinMode(TXLED, OUTPUT);
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
pinMode(BUTTON, INPUT);
#elif T_BEAM_V1_0
pinMode(BUTTON, INPUT);
#elif T_BEAM_V0_7
pinMode(BUTTON, INPUT);
#else
@ -866,7 +960,26 @@ void setup(){
Wire.begin(I2C_SDA, I2C_SCL);
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
if (! PMU.begin(Wire, AXP2101_SLAVE_ADDRESS, I2C_SDA, I2C_SCL)) {
}
//axp.setLowTemp(0xFF); //SP6VWX Set low charging temperature need to convert
PMU.setALDO2Voltage(3300);
PMU.enableALDO2(); // LoRa
if (gps_state){
PMU.enableALDO3(); // switch on GPS
} else {
PMU.disableALDO3(); // switch off GPS
}
PMU.enableDC2();
//axp.setPowerOutPut(AXP192_EXTEN, AXP202_ON); NC
PMU.setDC1Voltage(3300);
// Enable ADC to measure battery current, USB voltage etc.
//axp.adc1Enable(0xfe, true);
//axp.adc2Enable(0x80, true);
PMU.setChargingLedMode(XPOWERS_CHG_LED_OFF);
PMU.enableDC1(); // oled do not turn off
#elif T_BEAM_V1_0
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
}
axp.setLowTemp(0xFF); //SP6VWX Set low charging temperature
@ -1068,7 +1181,9 @@ void loop() {
t_lock = true;
if(gps_state){
gps_state = false;
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
PMU.disableALDO3(); //GPS OFF
#elif T_BEAM_V1_0
axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF); // GPS OFF
#endif
writedisplaytext("((GPSOFF))","","","","","");
@ -1078,7 +1193,9 @@ void loop() {
#endif
}else{
gps_state = true;
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_v1_2
PMU.enableALDO3(); // GPS ON
#elif T_BEAM_V1_0
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON);
#endif
writedisplaytext("((GPS ON))","","","","",""); // GPS ON
@ -1102,7 +1219,27 @@ void loop() {
}
}
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
if(shutdown_active){
if(InpVolts> 4){
shutdown_usb_status_bef = true;
shutdown_countdown_timer_enable = false;
}
if(InpVolts < 4 && shutdown_usb_status_bef == true){
shutdown_usb_status_bef = false;
shutdown_countdown_timer_enable = true;
shutdown_countdown_timer = millis() + shutdown_delay_time;
}
if(shutdown_countdown_timer_enable){
if(millis() >= shutdown_countdown_timer){
PMU.setChargingLedMode(XPOWERS_CHG_LED_OFF);
PMU.shutdown();
}
}
}
#elif T_BEAM_V1_0
if(shutdown_active){
if(InpVolts> 4){
shutdown_usb_status_bef = true;
@ -1138,7 +1275,11 @@ void loop() {
#endif
if (rf95.waitAvailableTimeout(100)) {
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
#ifdef ENABLE_LED_SIGNALING
PMU.setChargingLedMode(XPOWERS_CHG_LED_ON);
#endif
#elif T_BEAM_V1_0
#ifdef ENABLE_LED_SIGNALING
axp.setChgLEDMode(AXP20X_LED_LOW_LEVEL);
#endif
@ -1167,7 +1308,11 @@ void loop() {
syslog_log(LOG_INFO, String("Received LoRa: '") + loraReceivedFrameString + "', RSSI:" + rf95.lastRssi() + ", SNR: " + rf95.lastSNR());
}
#endif
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
#ifdef ENABLE_LED_SIGNALING
PMU.setChargingLedMode(XPOWERS_CHG_LED_OFF);
#endif
#elif T_BEAM_V1_0
#ifdef ENABLE_LED_SIGNALING
axp.setChgLEDMode(AXP20X_LED_OFF);
#endif
@ -1251,7 +1396,15 @@ void loop() {
if (millis() - last_debug_send_time > 1000*5) {
last_debug_send_time = millis();
String debug_message = "";
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
debug_message += "Bat V: " + String(PMU.getBattVoltage());
debug_message += ", ";
debug_message += "USB Plugged: " + String(PMU.isVbusInsertOnSource());
debug_message += ", ";
debug_message += "USB V: " + String(PMU.getVbusVoltage());
debug_message += ", ";
debug_message += "Temp C: " + String(PMU.getTemperature());
#elif T_BEAM_V1_0
debug_message += "Bat V: " + String(axp.getBattVoltage());
debug_message += ", ";
debug_message += "Bat IN A: " + String(axp.getBattChargeCurrent());

Wyświetl plik

@ -12,7 +12,9 @@ SFE_UBLOX_GPS myGPS;
#endif
// Pins for GPS
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
static const int RXPin = 12, TXPin = 34;
#elif T_BEAM_V1_0
static const int RXPin = 12, TXPin = 34;
#else
static const int RXPin = 15, TXPin = 12;

Wyświetl plik

@ -48,7 +48,10 @@ WiFiServer gpsServer(NETWORK_GPS_PORT);
Syslog syslog(udpClient, SYSLOG_PROTO_IETF);
#endif
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
#include <XPowersLib.h>
extern XPowersAXP2101 PMU;
#elif T_BEAM_V1_0
#include <axp20x.h>
extern AXP20X_Class axp;
#endif
@ -171,7 +174,11 @@ void handle_Beacon() {
}
void handle_Shutdown() {
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_2
server.send(200,"text/html", "Shutdown");
PMU.setChargingLedMode(XPOWERS_CHG_LED_OFF);
PMU.shutdown();
#elif T_BEAM_V1_0
server.send(200,"text/html", "Shutdown");
axp.setChgLEDMode(AXP20X_LED_OFF);
axp.shutdown();