From 215ac431262c476a4124230accc97e0fbb6fb861 Mon Sep 17 00:00:00 2001 From: furrtek Date: Sun, 30 Jul 2017 00:07:57 +0100 Subject: [PATCH] Fix std::array init --- firmware/application/ui_scanner.hpp | 2 +- firmware/tools/adsb_db.py | 41 +++++++++++++++++++++++++++++ firmware/tools/adsb_map.py | 41 +++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100755 firmware/tools/adsb_db.py create mode 100755 firmware/tools/adsb_map.py diff --git a/firmware/application/ui_scanner.hpp b/firmware/application/ui_scanner.hpp index c6c1ab0a5..c146ab626 100644 --- a/firmware/application/ui_scanner.hpp +++ b/firmware/application/ui_scanner.hpp @@ -114,7 +114,7 @@ private: uint32_t bin_skip_acc { 0 }, bin_skip_frac { }; uint32_t pixel_index { 0 }; - std::array spectrum_row { 0 }; + std::array spectrum_row = { 0 }; ChannelSpectrumFIFO* fifo { nullptr }; rf::Frequency f_min { 0 }, f_max { 0 }; uint8_t detect_timer { 0 }, release_timer { 0 }, timing_div { 0 }; diff --git a/firmware/tools/adsb_db.py b/firmware/tools/adsb_db.py new file mode 100755 index 000000000..29d4194ed --- /dev/null +++ b/firmware/tools/adsb_db.py @@ -0,0 +1,41 @@ +#!/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. +# + +import sys +import struct + +outfile = open("airlines.db", "w") + +lines = [line.rstrip('\n') for line in open('../../sdcard/ADSB/airlines.txt', 'r')] +n = 0 + +for line in lines: + if line: + nd = line.find('(') + if (nd == -1): + nd = None + else: + nd -= 1 + nline = line[4:7] + '\0' + line[10:nd] + '\0' + print nline + b = bytearray(nline) + pad_len = 32 - len(b) + b += "\0" * pad_len + outfile.write(b) diff --git a/firmware/tools/adsb_map.py b/firmware/tools/adsb_map.py new file mode 100755 index 000000000..fa63b45a3 --- /dev/null +++ b/firmware/tools/adsb_map.py @@ -0,0 +1,41 @@ +#!/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. +# + +import sys +import struct +from PIL import Image + +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',