mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-25 19:29:55 +00:00
Made a GeoPos widget for lon/lat/alt entry and display (APRS...)
Cleaned up the GeoMap view, can be used as input
This commit is contained in:
@@ -161,7 +161,7 @@ int cpr_N(float lat, int is_odd) {
|
||||
// ... and ...
|
||||
// if (lon > 180) lon -= 360;
|
||||
|
||||
void encode_frame_pos(ADSBFrame& frame, const uint32_t ICAO_address, const uint32_t altitude,
|
||||
void encode_frame_pos(ADSBFrame& frame, const uint32_t ICAO_address, const int32_t altitude,
|
||||
const float latitude, const float longitude, const uint32_t time_parity) {
|
||||
|
||||
uint32_t altitude_coded;
|
||||
|
@@ -24,14 +24,13 @@
|
||||
#define __ADSB_H__
|
||||
|
||||
#include "adsb_frame.hpp"
|
||||
#include "ui.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
namespace adsb {
|
||||
|
||||
#define DEG_TO_RAD(d) (d * (2 * pi) / 360.0)
|
||||
|
||||
enum downlink_format {
|
||||
DF_ADSB = 17,
|
||||
DF_EHS_SQUAWK = 21
|
||||
@@ -70,7 +69,7 @@ const float adsb_lat_lut[58] = {
|
||||
|
||||
void make_frame_adsb(ADSBFrame& frame, const uint32_t ICAO_address);
|
||||
void encode_frame_id(ADSBFrame& frame, const uint32_t ICAO_address, const std::string& callsign);
|
||||
void encode_frame_pos(ADSBFrame& frame, const uint32_t ICAO_address, const uint32_t altitude,
|
||||
void encode_frame_pos(ADSBFrame& frame, const uint32_t ICAO_address, const int32_t altitude,
|
||||
const float latitude, const float longitude, const uint32_t time_parity);
|
||||
void encode_frame_velo(ADSBFrame& frame, const uint32_t ICAO_address, const uint32_t speed,
|
||||
const float angle, const int32_t v_rate);
|
||||
|
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "ui.hpp"
|
||||
#include "sine_table.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -69,4 +70,8 @@ Rect& Rect::operator-=(const Point& p) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
Point polar_to_point(float angle, uint32_t distance) {
|
||||
return Point(sin_f32(DEG_TO_RAD(angle) + (pi / 2)) * distance, -sin_f32(DEG_TO_RAD(angle)) * distance);
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
||||
|
@@ -26,6 +26,8 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
#define DEG_TO_RAD(d) (d * (2 * pi) / 360.0)
|
||||
|
||||
using Coord = int16_t;
|
||||
using Dim = int16_t;
|
||||
|
||||
@@ -326,6 +328,8 @@ struct TouchEvent {
|
||||
Type type;
|
||||
};
|
||||
|
||||
Point polar_to_point(float angle, uint32_t distance);
|
||||
|
||||
} /* namespace ui */
|
||||
|
||||
#endif/*__UI_H__*/
|
||||
|
Reference in New Issue
Block a user