Skip to content

Commit

Permalink
Merge pull request #63 from rzeldent/develop
Browse files Browse the repository at this point in the history
Merge develop in main
  • Loading branch information
rzeldent authored Dec 20, 2023
2 parents 7fd5f3c + 671aa6f commit 35afe6c
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 63 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,30 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- name: Set up python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
architecture: 'x64'
python-version: "3.9"
- name: Generate image files
run: |
chmod +x ./generate_images.sh
./generate_images.sh
shell: bash
- name: Install PlatformIO
- name: Install PlatformIO Core
run: python -m pip install platformio
- name: Build firmware
run: platformio run
- name: Archive
uses: actions/upload-artifact@v2
- name: Archive firmwares
uses: actions/upload-artifact@v3
with:
name: firmware.bin
path: .pio/build/*/firmware.bin
name: firmwares.zip
path: .pio/build/*/*.bin
51 changes: 28 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,45 @@ Easy configuration through the web interface.

![FlightRadar](assets/20220909_221059.jpg)

Display flights in your area and display them on the screen of the ESP32 TTGO-Display module.
Display flights in your area and display them on the screen of the ESP32 TTGO-Display or LilyGo-T-Display-S3 module.
Under the hood it uses the API of [FlightRadar24.com](https://www.flightradar24.com/) but only for flight updates.
Internally there is a database with airport, aircraft and airline data with graphics to minimize the requests.

This application retrieves the current flights near a configured location and displays them sequentially on the display.

![Example2](assets/20220909_221101.jpg)
![Example3](assets/20220909_221104.jpg)
![Example1](assets/20220909_221101.jpg)
![Example2](assets/20220909_221104.jpg)

Example of layout on LilyGo-T-Display-S3
![Example3](assets/20231022_000000.jpeg)

## History
| | |
| --- | --- |
| Oct 25 2022 | Use LVGL for graphics |
| Oct 15 2022 | Filtering for airborne/grounded/gliders/vehicles |
| Oct 14 2022 | Added vertical speed |
| Oct 2 2022 | Bootstrap for HTML overview |
| Jun 16 2022 | Wifi manager for configuration |
| Jun 15 2022 | Use time zones |
| Apr 27 2022 | Import aircraft types |
| Dec 5 2021 | Compressing of RGB565 |
| Nov 21 2021 | Import airlines from Wiki page |
| Nov 8 2021 | New airline logos |
| Oct 31 2021 | Added heading, altitude and speed |
| Oct 6 2021 | Move images from SPIFF to code |
| May 25 2021 | GUI update |
| Dec 26 2019 | Initial version: The "birth" of the project |

| | |
| :---------- | :------------------------------------------------------------------- |
| Oct 21 2023 | Added configuration from LilyGo-T-Display-S3 with help from ulihuber |
| Oct 25 2022 | Use LVGL for graphics |
| Oct 15 2022 | Filtering for airborne/grounded/gliders/vehicles |
| Oct 14 2022 | Added vertical speed |
| Oct 2 2022 | Bootstrap for HTML overview |
| Jun 16 2022 | Wifi manager for configuration |
| Jun 15 2022 | Use time zones |
| Apr 27 2022 | Import aircraft types |
| Dec 5 2021 | Compressing of RGB565 |
| Nov 21 2021 | Import airlines from Wiki page |
| Nov 8 2021 | New airline logos |
| Oct 31 2021 | Added heading, altitude and speed |
| Oct 6 2021 | Move images from SPIFF to code |
| May 25 2021 | GUI update |
| Dec 26 2019 | Initial version: The "birth" of the project |

## Features

The FlightRadar firmware offers the following features:

- Lookup of airplane type and specifics (manufacturer, type, description, engine type and count)
- Lookup of carrier and (if available) display the logo
- Display GPS location, registration, altitude, heading, speed and vertical speed of the airplane
- Display GPS location, registration, altitude, heading, speed and vertical speed of the airplane
- Lookup of the full name for the from- and to airports name and region, lat/lon
- Lookup and display flag for the countries
- No account required, ony WiFi with internet connection!
Expand All @@ -66,7 +71,7 @@ Take the following steps to install platformIo. There is a lot of information on
- Install Visual Studio Code
- From the Extensions menu select PlatformIo
- Clone this repository, and open the folder in your workspace
- Compile and upload to the ESP32-TTGO-Display
- Compile and upload to the ESP32-TTGO-Display / LilyGo-T-Display-S3

## Status overview

Expand All @@ -78,7 +83,7 @@ Here details about the device, network and settings are shown.

The configuration can be changed using a web browser. Connecting to the flight radar can be done in two ways:

- During startup, connect to the access point ```FlightRadar``` and log in. In case the browser does not open the page immediately, the url is [http://192.168.4.1](http://192.168.4.1).
- During startup, connect to the access point `FlightRadar` and log in. In case the browser does not open the page immediately, the url is [http://192.168.4.1](http://192.168.4.1).
- Find the internal IP address of the FlightRadar (from your home router) and enter the url.
- When the password is lost, a fix is to completely erase the ESP32 using the pio run -t erase command.
This will reset the device including configuration.
Expand Down Expand Up @@ -115,7 +120,7 @@ Some tips:

## Case / Enclosure

Please take a look at the STL file to create a case for the FlightRadar to host the TTGO Display and a battery.
Please take a look at the STL file to create a case for the FlightRadar to host the TTGO-Display and a battery.
Thanks to Erwin Reid for creating the models.

Files can be found at [Thingverse](https://www.thingiverse.com/thing:5412296/files).
Expand Down
Binary file added assets/20231022_000000.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 0 additions & 25 deletions include/ttgo_display.h

This file was deleted.

93 changes: 92 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ monitor_filters = log2file, time, default
build_flags =
-O2
-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE
# GPIO of the buttons on the TTGO Display
-D GPIO_BUTTON_TOP=35
-D GPIO_BUTTON_BOTTOM=0
# SD Card definitions
-D SD_CARD_CS=33
-D SD_CARD_SCLK=25
-D SD_CARD_MISO=27
-D SD_CARD_MOSI=26
# ADC detection enable port and ADC GPIO
-D GPIO_ADC_EN=14
-D PIN_ADC=34
# TFT_eSPI settings
-D USER_SETUP_LOADED
-D ST7789_DRIVER
Expand Down Expand Up @@ -50,6 +61,87 @@ build_flags =
-D LV_CONF_PATH=${PROJECT_INCLUDE_DIR}/lv_conf.h
-D LV_HOR_RES_MAX=240
-D LV_VER_RES_MAX=135
lib_deps =
bodmer/TFT_eSPI@^2.5.33
lvgl/lvgl@^8.3.9
bblanchon/ArduinoJson@^6.21.3
prampec/IotWebConf@^3.2.1
rzeldent/micro-http-status@^1.0.2
rzeldent/micro-moustache@^1.0.0
rzeldent/micro-timezonedb@^1.0.4

board_build.embed_files =
html/bootstrap.min.css.gz

board_build.embed_txtfiles =
html/index.html

[env:lilygo-t-display-s3]
platform = espressif32
board = lilygo-t-display-s3
board_build.mcu = esp32s3
board_build.f_cpu = 240000000L
framework = arduino
board_build.partitions = partitions.csv
monitor_speed = 115200
upload_speed = 921600
monitor_filters = log2file, time, default
upload_port = COM7
upload_protocol = esptool

build_flags =
-O2
-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE
# GPIO of the buttons on the TTGO Display
-D GPIO_BUTTON_TOP=14
-D GPIO_BUTTON_BOTTOM=0
# TFT_eSPI settings
-D USER_SETUP_LOADED=1
-D ST7789_DRIVER
-D CGRAM_OFFSET
-D TFT_RGB_ORDER=TFT_BGR
-D TFT_INVERSION_ON
-D TFT_PARALLEL_8_BIT
-D TFT_WIDTH=170
-D TFT_HEIGHT=320
-D TFT_DC=7
-D TFT_RST=5
-D TFT_WR=8
-D TFT_RD=9
-D TFT_D0=39
-D TFT_D1=40
-D TFT_D2=41
-D TFT_D3=42
-D TFT_D4=45
-D TFT_D5=46
-D TFT_D6=47
-D TFT_D7=48
-D TFT_BL=38
-D TFT_BACKLIGHT_ON=HIGH
-D LOAD_GLCD
-D LOAD_FONT2
-D LOAD_FONT4
-D LOAD_FONT6
-D LOAD_FONT7
-D LOAD_FONT8
-D LOAD_GFXFF
-D SMOOTH_FONT
# -DLOAD_GLCD # Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
# -D LOAD_FONT2 # Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
# -D LOAD_FONT4 # Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
# -D LOAD_FONT6 # Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
# -D LOAD_FONT7 # Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
# -D LOAD_FONT8 # Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
# -D LOAD_FONT8N # Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
# -D LOAD_GFXFF # FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
# -D SMOOTH_FONT
-D SPI_FREQUENCY=40000000
-D SPI_READ_FREQUENCY=6000000
# LVGL settings
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_CONF_PATH=${PROJECT_INCLUDE_DIR}/lv_conf.h
-D LV_HOR_RES_MAX=320
-D LV_VER_RES_MAX=170

lib_deps =
bodmer/TFT_eSPI@^2.5.33
Expand All @@ -62,6 +154,5 @@ lib_deps =

board_build.embed_files =
html/bootstrap.min.css.gz

board_build.embed_txtfiles =
html/index.html
10 changes: 5 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <SPI.h>
#include <soc/rtc_cntl_reg.h>

#include <ttgo_display.h>

// Settings for the display are defined in platformio.ini
#include <TFT_eSPI.h>
#include <lvgl.h>
Expand Down Expand Up @@ -48,7 +46,7 @@ auto iotWebParamAirborne = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("
auto iotWebParamGrounded = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("ground").label("Include grounded").defaultValue(DEFAULT_GROUND).build();
auto iotWebParamGliders = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("gliders").label("Include gliders").defaultValue(DEFAULT_GLIDERS).build();
auto iotWebParamVehicles = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("vehicles").label("Include vehicles").defaultValue(DEFAULT_VEHICLES).build();
auto iotWebParamTimeZone = iotwebconf::Builder<iotwebconf::SelectTParameter<sizeof(posix_timezone_names[0])>>("timezone").label("Choose timezone").optionValues((const char *)&posix_timezone_names).optionNames((const char *)&posix_timezone_names).optionCount(sizeof(posix_timezone_names) / sizeof(posix_timezone_names[0])).nameLength(sizeof(posix_timezone_names[0])).defaultValue(DEFAULT_TIMEZONE).build();
auto iotWebParamTimeZone = iotwebconf::Builder<iotwebconf::SelectTParameter<sizeof(posix_timezone_tz_t)>>("timezone").label("Choose timezone").optionValues(posix_timezone_tzs->zone_name).optionNames(posix_timezone_tzs->zone_name).optionCount(sizeof(posix_timezone_tzs) / sizeof(posix_timezone_tzs[0])).nameLength(sizeof(timezone_name)).defaultValue(DEFAULT_TIMEZONE).build();
auto iotWebParamMetric = iotwebconf::Builder<iotwebconf::CheckboxTParameter>("metric").label("Use metric units").defaultValue(DEFAULT_METRIC).build();

// Variables for flight info
Expand Down Expand Up @@ -189,7 +187,8 @@ void tft_espi_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color
void button_read(_lv_indev_drv_t *drv, lv_indev_data_t *data)
{
static uint32_t last_key;
uint32_t key = digitalRead(GPIO_BUTTON_TOP) == LOW ? LV_KEY_NEXT : digitalRead(GPIO_BUTTON_BOTTOM) == LOW ? LV_KEY_ENTER : 0;
uint32_t key = digitalRead(GPIO_BUTTON_TOP) == LOW ? LV_KEY_NEXT : digitalRead(GPIO_BUTTON_BOTTOM) == LOW ? LV_KEY_ENTER
: 0;
if (key)
{
data->state = LV_INDEV_STATE_PR;
Expand All @@ -211,11 +210,13 @@ void setup()
// Disable brownout
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);

#ifdef GPIO_ADC_EN
// ADC_EN is the ADC detection enable port
// If the USB port is used for power supply, it is turned on by default.
// If it is powered by battery, it needs to be set to high level
pinMode(GPIO_ADC_EN, OUTPUT);
digitalWrite(GPIO_ADC_EN, HIGH);
#endif

log_i("CPU Freq = %d Mhz", getCpuFrequencyMhz());
log_i("Free heap: %d bytes", ESP.getFreeHeap());
Expand All @@ -229,7 +230,6 @@ void setup()
log_i("LVGL version: %d.%d.%d ", lv_version_major(), lv_version_minor(), lv_version_patch());
lv_init();
tft.begin();
tft.initDMA(true);
// Rotate 90 degrees to Landscape
tft.setRotation(1);
// Width and height are flipped because is rotated 90 degrees
Expand Down

0 comments on commit 35afe6c

Please sign in to comment.