From 176579b8682ea674a33724d949f7c97e34162506 Mon Sep 17 00:00:00 2001 From: Erwin Ried <1091420+eried@users.noreply.github.com> Date: Tue, 5 May 2020 12:42:40 +0200 Subject: [PATCH] Small cleanup in tools --- firmware/tools/adsb_map.py | 44 ------------------- .../{adsb_db.py => generate_airlines.db.py} | 1 + ...world_map.py => generate_world_map.bin.py} | 2 +- 3 files changed, 2 insertions(+), 45 deletions(-) delete mode 100755 firmware/tools/adsb_map.py rename firmware/tools/{adsb_db.py => generate_airlines.db.py} (95%) mode change 100755 => 100644 rename firmware/tools/{world_map.py => generate_world_map.bin.py} (97%) diff --git a/firmware/tools/adsb_map.py b/firmware/tools/adsb_map.py deleted file mode 100755 index bb9b71b09..000000000 --- a/firmware/tools/adsb_map.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2017 Furrtek -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from __future__ import print_function -import sys -import struct -from PIL import Image - -Image.MAX_IMAGE_PIXELS = None - -outfile = open('../../sdcard/ADSB/world_map.bin', 'wb') - -im = Image.open("../../sdcard/ADSB/world_map.jpg") -pix = im.load() - -outfile.write(struct.pack('H', im.size[0])) -outfile.write(struct.pack('H', im.size[1])) - -for y in range (0, im.size[1]): - line = '' - for x in range (0, im.size[0]): - pixel_lcd = (pix[x, y][0] >> 3) << 11 - pixel_lcd |= (pix[x, y][1] >> 2) << 5 - pixel_lcd |= (pix[x, y][2] >> 3) - line += struct.pack('H', pixel_lcd) - outfile.write(line) - print(str(y) + '/' + str(im.size[1]) + '\r', end="") diff --git a/firmware/tools/adsb_db.py b/firmware/tools/generate_airlines.db.py old mode 100755 new mode 100644 similarity index 95% rename from firmware/tools/adsb_db.py rename to firmware/tools/generate_airlines.db.py index 29d4194ed..f0a0a4325 --- a/firmware/tools/adsb_db.py +++ b/firmware/tools/generate_airlines.db.py @@ -23,6 +23,7 @@ import struct outfile = open("airlines.db", "w") +# Download airlines.txt from http://xdeco.org/?page_id=30 lines = [line.rstrip('\n') for line in open('../../sdcard/ADSB/airlines.txt', 'r')] n = 0 diff --git a/firmware/tools/world_map.py b/firmware/tools/generate_world_map.bin.py similarity index 97% rename from firmware/tools/world_map.py rename to firmware/tools/generate_world_map.bin.py index bd8b5add3..68c10edc7 100644 --- a/firmware/tools/world_map.py +++ b/firmware/tools/generate_world_map.bin.py @@ -26,7 +26,7 @@ from PIL import Image outfile = open('../../sdcard/world_map.bin', 'wb') # Allow for bigger images -Image.MAX_IMAGE_PIXELS = 1933120000 +Image.MAX_IMAGE_PIXELS = None im = Image.open("../../sdcard/world_map.jpg") pix = im.load()