Compare commits

...

3 Commits

Author SHA1 Message Date
Erwin Ried 59088071eb Removing this examples
They do not work all the time because they have timestamps
2020-05-06 22:47:45 +02:00
Erwin Ried c76252b79c Replacing the linear "aproximated" way with a proper one (#14) 2020-05-06 16:28:38 +02:00
Erwin Ried 176579b868 Small cleanup in tools 2020-05-05 12:42:40 +02:00
8 changed files with 10 additions and 50 deletions
+8 -1
View File
@@ -30,6 +30,7 @@
using namespace portapack;
#include "string_format.hpp"
#include "complex.hpp"
namespace ui {
@@ -193,7 +194,13 @@ void GeoMap::move(const float lon, const float lat) {
// Using WGS 84/Pseudo-Mercator projection
x_pos = map_width * (lon_+180)/360 - (map_rect.width() / 2);
y_pos = (0.5-lat_/(340.1206913+-4.21807e-5*pow((double)abs(lat_),3.4198394))) * map_height -(map_rect.height() / 1) + 32;
// Latitude calculation based on https://stackoverflow.com/a/10401734/2278659
double map_bottom = sin(-85.05 * pi / 180); // Map bitmap only goes from about -85 to 85 lat
double lat_rad = sin(lat * pi / 180);
double map_world_lon = map_width / (2 * pi);
double map_offset = (map_world_lon / 2 * log((1 + map_bottom) / (1 - map_bottom)));
y_pos = map_height - ((map_world_lon / 2 * log((1 + lat_rad) / (1 - lat_rad))) - map_offset) - 128; // Offset added for the GUI
// Cap position
if (x_pos > (map_width - map_rect.width()))
-44
View File
@@ -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="")
+1
View File
@@ -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
@@ -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()
Binary file not shown.
-2
View File
@@ -1,2 +0,0 @@
sample_rate=2600000
center_frequency=1575420000
Binary file not shown.
-2
View File
@@ -1,2 +0,0 @@
sample_rate=2600000
center_frequency=1575420000