forked from Bodmer/esp8266-plane-spotter-color
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlaneSpotter.h
96 lines (68 loc) · 3.15 KB
/
PlaneSpotter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**The MIT License (MIT)
Copyright (c) 2015 by Daniel Eichhorn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
See more at https://blog.squix.org
*/
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
#pragma once
// Call up the SPIFFS FLASH filing system this is part of the ESP Core
#define FS_NO_GLOBALS
#include <FS.h>
// JPEG decoder library
#include <JPEGDecoder.h>
// Call up the TFT library
#include <TFT_ILI9341_ESP.h> // Hardware-specific library
#include "AdsbExchangeClient.h"
///#include "ILI9341.h"
#include "GeoMap.h"
#define TFT_BLACK 0x0000
#define TFT_BLUE 0x001F
#define TFT_RED 0xF800
#define TFT_GREEN 0x07E0
#define TFT_CYAN 0x07FF
#define TFT_MAGENTA 0xF81F
#define TFT_YELLOW 0xFFE0
#define TFT_WHITE 0xFFFF
enum TextAlignment {
LEFT, CENTER, RIGHT
};
class PlaneSpotter {
public:
PlaneSpotter(TFT_ILI9341_ESP* tft, GeoMap* geoMap);
void copyProgmemToSpiffs(const uint8_t *data, unsigned int length, String filename);
void drawSPIFFSJpeg(String filename, int xpos, int ypos);
void renderJPEG(int xpos, int ypos);
void drawPlane(Aircraft aircraft, boolean isSpecial);
String drawInfoBox(Aircraft closestAircraft);
void drawAircraftHistory(Aircraft aircraft, AircraftHistory history);
void jpegInfo(void);
private:
TFT_ILI9341_ESP* tft_;
GeoMap* geoMap_;
// Shape of the plane
// The points are defined as degree on a circle, the first array are the degrees,
// the second the radius of the circle
int planeDeg_[5] = {0, 130, 180, 230, 0};
int planeRadius_[5] = {10, 10, 3, 10, 10};
//const uint16_t heightPalette_[40] = {0x081F, 0x00FF, 0x027F, 0x029F, 0x037F, 0x041F, 0x047F, 0x0E5F, 0x0F5F, 0x07DF, 0x0FFC, 0x0FF8, 0x07D2, 0x07CD, 0x0FCA, 0x07C7, 0x07C3, 0x1FA2, 0x27C1, 0x57A1,
// 0x87A1, 0x9FA2, 0xBFA2, 0xEF82, 0xF763, 0xF6A3, 0xF5C3, 0xF4E3, 0xF3E3, 0xF324, 0xF243, 0xF123, 0xF803, 0xF807, 0xF80D, 0xF810, 0xF815, 0xF81A, 0xF81E, 0xF81F};
const uint16_t heightPalette_[10] = {0x30FE, 0x00BF, 0x041F, 0x063F, 0x07EC, 0xD7C1, 0xF401, 0xF084, 0xF0B4, 0xF0DD};
int planeDots_ = 5;
TextAlignment alignment_ = LEFT;
uint16_t textColor_;
uint16_t backgroundColor_;
};