Fix some bugs, add description, platformio.ini
This commit is contained in:
parent
1ed30cb3ff
commit
6d60e8a7ab
13 changed files with 119 additions and 101 deletions
11
.gitignore
vendored
11
.gitignore
vendored
|
|
@ -1,2 +1,9 @@
|
|||
build
|
||||
.vscode
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
.vscode
|
||||
test
|
||||
.gitignore
|
||||
.travis.yml
|
||||
12
.gitmodules
vendored
12
.gitmodules
vendored
|
|
@ -1,12 +0,0 @@
|
|||
[submodule "libraries/TinyGPSPlus"]
|
||||
path = libraries/TinyGPSPlus
|
||||
url = https://github.com/mikalhart/TinyGPSPlus.git
|
||||
[submodule "libraries/AXP202X_Library"]
|
||||
path = libraries/AXP202X_Library
|
||||
url = https://github.com/lewisxhe/AXP202X_Library.git
|
||||
[submodule "libraries/Button2"]
|
||||
path = libraries/Button2
|
||||
url = https://github.com/lewisxhe/Button2.git
|
||||
[submodule "libraries/esp8266-oled-ssd1306"]
|
||||
path = libraries/esp8266-oled-ssd1306
|
||||
url = https://github.com/ThingPulse/esp8266-oled-ssd1306.git
|
||||
18
README.MD
18
README.MD
|
|
@ -2,7 +2,7 @@ TTGO-T-Beam
|
|||
=====================
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
## PinOut
|
||||
|
|
@ -43,13 +43,11 @@ TTGO-T-Beam
|
|||
- The boot will scan the I2C device. If the OLED is found, all log information will be displayed in the OLED. If not, it will be printed on the serial port.
|
||||
|
||||
## How to use
|
||||
- The repository depends on other library files, please recursively clone the repository
|
||||
```
|
||||
git clone --recursive https://github.com/Xinyuan-LilyGO/TTGO-T-Beam.git
|
||||
```
|
||||
- For dependencies on other files please see `platformio.ini`
|
||||
- Regarding the board, you can modify the board version and lora frequency in `board_def.h`
|
||||
- If you use the Arduino IDE for compilation, please store `board_def.h` and `LilyGO-T-Beam.ino` in the same directory, and the directory folder name must be the same as ino
|
||||
|
||||
- Then move the library files in the `libraries` directory to
|
||||
```
|
||||
C:\Users\<UserName>\Documents\Arduino\libraries
|
||||
```
|
||||
- In the Arduino board select `T-Beam`
|
||||
## Deepsleep
|
||||
- Regarding deep sleep, except for DCDC3, power off all channels of AXP192, the current consumption is about 0.9mA
|
||||
|
||||

|
||||
BIN
images/1.png
BIN
images/1.png
Binary file not shown.
|
Before Width: | Height: | Size: 513 KiB |
BIN
images/deepsleep.jpg
Normal file
BIN
images/deepsleep.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
BIN
images/product.jpg
Normal file
BIN
images/product.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 31933cb5ce47607922697668fd6c0573709c3e35
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit fed9e73972c8c3436dde5fe56d98ac7b7e7e9d41
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit b4c8e29d1def35806fb1fc75fe0013036843d643
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit cb294b0d5e938864ba935a8e917082e5496399ca
|
||||
33
platformio.ini
Normal file
33
platformio.ini
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
; 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:esp32dev]
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
framework = arduino
|
||||
|
||||
upload_port = COM11
|
||||
monitor_port = COM11
|
||||
; upload_port = COM8
|
||||
; monitor_port = COM8
|
||||
|
||||
monitor_speed = 115200
|
||||
upload_speed = 2000000
|
||||
|
||||
lib_deps =
|
||||
https://github.com/lewisxhe/Button2.git
|
||||
AXP202X_Library ;https://github.com/lewisxhe/AXP202X_Library
|
||||
TinyGPSPlus ;https://github.com/mikalhart/TinyGPSPlus
|
||||
ESP8266_SSD1306 ;https://github.com/ThingPulse/esp8266-oled-ssd1306
|
||||
LoRa ;https://github.com/dragino/Lora
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -13,7 +13,6 @@ SSD1306_OBJECT();
|
|||
UBLOX_GPS_OBJECT();
|
||||
|
||||
AXP20X_Class axp;
|
||||
static String recv = "";
|
||||
uint8_t program = 0;
|
||||
bool ssd1306_found = false;
|
||||
bool axp192_found = false;
|
||||
|
|
@ -33,6 +32,9 @@ uint8_t g_btns[] = BUTTONS_MAP;
|
|||
|
||||
Ticker btnTick;
|
||||
|
||||
String baChStatus = "No charging";
|
||||
String recv = "";
|
||||
|
||||
/************************************
|
||||
* BUTTON
|
||||
* *********************************/
|
||||
|
|
@ -84,10 +86,6 @@ void button_init()
|
|||
});
|
||||
}
|
||||
|
||||
/************************************
|
||||
* SCREEN
|
||||
* *********************************/
|
||||
String baChStatus = "No charging";
|
||||
void msOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
||||
{
|
||||
static char volbuffer[128];
|
||||
|
|
@ -99,21 +97,20 @@ void msOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
|||
if (axp.isBatteryConnect()) {
|
||||
snprintf(volbuffer, sizeof(volbuffer), "%.2fV/%.2fmA", axp.getBattVoltage() / 1000.0, axp.isChargeing() ? axp.getBattChargeCurrent() : axp.getBattDischargeCurrent());
|
||||
display->drawString(62, 0, volbuffer);
|
||||
} else {
|
||||
multi_heap_info_t info;
|
||||
heap_caps_get_info(&info, MALLOC_CAP_INTERNAL);
|
||||
snprintf(volbuffer, sizeof(volbuffer), "%u/%uKB", info.total_allocated_bytes / 1024, info.total_free_bytes / 1024);
|
||||
display->drawString(75, 0, volbuffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void drawFrame1(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
|
||||
display->setFont(ArialMT_Plain_10);
|
||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
|
||||
|
||||
if (!gps.location.isValid()) {
|
||||
display->drawString(64 + x, 11 + y, buff[0]);
|
||||
display->drawString(64 + x, 22 + y, buff[1]);
|
||||
|
|
@ -187,6 +184,45 @@ void ssd1306_init()
|
|||
}
|
||||
|
||||
|
||||
|
||||
void scanI2Cdevice(void)
|
||||
{
|
||||
byte err, addr;
|
||||
int nDevices = 0;
|
||||
for (addr = 1; addr < 127; addr++) {
|
||||
Wire.beginTransmission(addr);
|
||||
err = Wire.endTransmission();
|
||||
if (err == 0) {
|
||||
Serial.print("I2C device found at address 0x");
|
||||
if (addr < 16)
|
||||
Serial.print("0");
|
||||
Serial.print(addr, HEX);
|
||||
Serial.println(" !");
|
||||
nDevices++;
|
||||
|
||||
if (addr == SSD1306_ADDRESS) {
|
||||
ssd1306_found = true;
|
||||
Serial.println("ssd1306 display found");
|
||||
}
|
||||
if (addr == AXP192_SLAVE_ADDRESS) {
|
||||
axp192_found = true;
|
||||
Serial.println("axp192 PMU found");
|
||||
}
|
||||
} else if (err == 4) {
|
||||
Serial.print("Unknow error at address 0x");
|
||||
if (addr < 16)
|
||||
Serial.print("0");
|
||||
Serial.println(addr, HEX);
|
||||
}
|
||||
}
|
||||
if (nDevices == 0)
|
||||
Serial.println("No I2C devices found\n");
|
||||
else
|
||||
Serial.println("done\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void playSound()
|
||||
{
|
||||
#ifdef ENABLE_BUZZER
|
||||
|
|
@ -196,6 +232,22 @@ void playSound()
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void lora_init()
|
||||
{
|
||||
#ifdef ENABLE_LOAR
|
||||
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_SS);
|
||||
LoRa.setPins(LORA_SS, LORA_RST, LORA_DI0);
|
||||
if (!LoRa.begin(BAND))
|
||||
Serial.println("LORA Begin FAIL");
|
||||
else {
|
||||
loraBeginOK = true;
|
||||
Serial.println("LORA Begin PASS");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
|
|
@ -281,25 +333,10 @@ void setup()
|
|||
}
|
||||
|
||||
|
||||
void lora_init()
|
||||
{
|
||||
#ifdef ENABLE_LOAR
|
||||
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_SS);
|
||||
LoRa.setPins(LORA_SS, LORA_RST, LORA_DI0);
|
||||
if (!LoRa.begin(BAND))
|
||||
Serial.println("LORA Begin FAIL");
|
||||
else {
|
||||
loraBeginOK = true;
|
||||
Serial.println("LORA Begin PASS");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
static uint32_t sendCount = 0;
|
||||
static uint64_t loraMap = 0;
|
||||
static uint32_t loraMap = 0;
|
||||
static uint64_t gpsMap = 0;
|
||||
|
||||
if (axp192_found && pmu_irq) {
|
||||
|
|
@ -331,6 +368,7 @@ void loop()
|
|||
}
|
||||
if (!gps.location.isValid()) {
|
||||
if (millis() - gpsMap > 1000) {
|
||||
snprintf(buff[0], sizeof(buff[0]), "T-Beam GPS");
|
||||
snprintf(buff[1], sizeof(buff[1]), "Positioning(%llu)", gpsSec++);
|
||||
if (!ssd1306_found) {
|
||||
Serial.println(buff[1]);
|
||||
|
|
@ -367,10 +405,9 @@ void loop()
|
|||
if (millis() - loraMap > 3000) {
|
||||
LoRa.beginPacket();
|
||||
LoRa.print("lora: ");
|
||||
LoRa.print(sendCount);
|
||||
LoRa.print(loraMap);
|
||||
LoRa.endPacket();
|
||||
++sendCount;
|
||||
snprintf(buff[1], sizeof(buff[1]), "Send %u", sendCount);
|
||||
snprintf(buff[1], sizeof(buff[1]), "Send %u", loraMap);
|
||||
loraMap = millis();
|
||||
if (!ssd1306_found) {
|
||||
Serial.println(buff[1]);
|
||||
|
|
@ -417,40 +454,3 @@ void loop()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void scanI2Cdevice(void)
|
||||
{
|
||||
byte err, addr;
|
||||
int nDevices = 0;
|
||||
for (addr = 1; addr < 127; addr++) {
|
||||
Wire.beginTransmission(addr);
|
||||
err = Wire.endTransmission();
|
||||
if (err == 0) {
|
||||
Serial.print("I2C device found at address 0x");
|
||||
if (addr < 16)
|
||||
Serial.print("0");
|
||||
Serial.print(addr, HEX);
|
||||
Serial.println(" !");
|
||||
nDevices++;
|
||||
|
||||
if (addr == SSD1306_ADDRESS) {
|
||||
ssd1306_found = true;
|
||||
Serial.println("ssd1306 display found");
|
||||
}
|
||||
if (addr == AXP192_SLAVE_ADDRESS) {
|
||||
axp192_found = true;
|
||||
Serial.println("axp192 PMU found");
|
||||
}
|
||||
} else if (err == 4) {
|
||||
Serial.print("Unknow error at address 0x");
|
||||
if (addr < 16)
|
||||
Serial.print("0");
|
||||
Serial.println(addr, HEX);
|
||||
}
|
||||
}
|
||||
if (nDevices == 0)
|
||||
Serial.println("No I2C devices found\n");
|
||||
else
|
||||
Serial.println("done\n");
|
||||
}
|
||||
|
||||
|
|
@ -1,15 +1,14 @@
|
|||
#ifndef BOARD_DEF_H
|
||||
#define BOARD_DEF_H
|
||||
|
||||
#define T_BEAM_V07
|
||||
// #define T_BEAM_V10
|
||||
// #define T_BEAM_V07
|
||||
#define T_BEAM_V10
|
||||
|
||||
#define ENABLE_SSD1306
|
||||
#define ENABLE_GPS
|
||||
#define ENABLE_LOAR
|
||||
|
||||
|
||||
//ssd1306 oled显示屏
|
||||
#define SSD1306_ADDRESS 0x3c
|
||||
#ifdef ENABLE_SSD1306
|
||||
#include "SSD1306.h"
|
||||
|
|
@ -20,7 +19,6 @@
|
|||
#define SSD1306_OBJECT()
|
||||
#endif
|
||||
|
||||
//lora模块
|
||||
#ifdef ENABLE_LOAR
|
||||
#include <LoRa.h>
|
||||
|
||||
|
|
@ -33,8 +31,6 @@
|
|||
#define LORA_DI0 26
|
||||
#define LORA_RST 23
|
||||
|
||||
//设置为1则设定为lora 发送, 0 则为接收
|
||||
#define LORA_SENDER 1
|
||||
#endif
|
||||
|
||||
//GPS模块
|
||||
Loading…
Add table
Add a link
Reference in a new issue