mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-09 02:05:21 -04:00
Added more precise function to calculate NL (based on cmath lib).
Created constants for some of the values scattered in the code.
This commit is contained in:
parent
8afd83a4e1
commit
2ceb49e4f2
4 changed files with 51 additions and 12 deletions
|
@ -205,7 +205,7 @@ void ADSBRxView::on_frame(const ADSBFrameMessage * message) {
|
|||
auto frame = message->frame;
|
||||
uint32_t ICAO_address = frame.get_ICAO_address();
|
||||
|
||||
if (frame.check_CRC() && frame.get_ICAO_address()) {
|
||||
if (frame.check_CRC() && ICAO_address) {
|
||||
rtcGetTime(&RTCD1, &datetime);
|
||||
auto& entry = ::on_packet(recent, ICAO_address);
|
||||
frame.set_rx_timestamp(datetime.minute() * 60 + datetime.second());
|
||||
|
@ -222,11 +222,14 @@ void ADSBRxView::on_frame(const ADSBFrameMessage * message) {
|
|||
uint8_t msg_sub = frame.get_msg_sub();
|
||||
uint8_t * raw_data = frame.get_raw_data();
|
||||
|
||||
if ((msg_type >= 1) && (msg_type <= 4)) {
|
||||
if ((msg_type >= AIRCRAFT_ID_L) && (msg_type <= AIRCRAFT_ID_H)) {
|
||||
callsign = decode_frame_id(frame);
|
||||
entry.set_callsign(callsign);
|
||||
logentry+=callsign+" ";
|
||||
} else if (((msg_type >= 9) && (msg_type <= 18)) || ((msg_type >= 20) && (msg_type <= 22))) {
|
||||
}
|
||||
//
|
||||
else if (((msg_type >= AIRBORNE_POS_BARO_L) && (msg_type <= AIRBORNE_POS_BARO_H)) ||
|
||||
((msg_type >= AIRBORNE_POS_GPS_L) && (msg_type <= AIRBORNE_POS_GPS_H))) {
|
||||
entry.set_frame_pos(frame, raw_data[6] & 4);
|
||||
|
||||
if (entry.pos.valid) {
|
||||
|
@ -242,7 +245,7 @@ void ADSBRxView::on_frame(const ADSBFrameMessage * message) {
|
|||
if (send_updates)
|
||||
details_view->update(entry);
|
||||
}
|
||||
} else if(msg_type == 19 && msg_sub >= 1 && msg_sub <= 4){
|
||||
} else if(msg_type == AIRBORNE_VEL && msg_sub >= VEL_GND_SUBSONIC && msg_sub <= VEL_AIR_SUPERSONIC){
|
||||
entry.set_frame_velo(frame);
|
||||
logentry += "Type:" + to_string_dec_uint(msg_sub) +
|
||||
" Hdg:" + to_string_dec_uint(entry.velo.heading) +
|
||||
|
|
|
@ -36,9 +36,33 @@ using namespace adsb;
|
|||
|
||||
namespace ui {
|
||||
|
||||
#define ADSB_DECAY_A 10 // In seconds
|
||||
#define ADSB_DECAY_B 30
|
||||
#define ADSB_DECAY_C 60 // Can be used for removing old entries, RecentEntries already caps to 64
|
||||
#define ADSB_DECAY_A 10 // In seconds
|
||||
#define ADSB_DECAY_B 30
|
||||
#define ADSB_DECAY_C 60 // Can be used for removing old entries, RecentEntries already caps to 64
|
||||
|
||||
#define AIRCRAFT_ID_L 1 // aircraft ID message type (lowest type id)
|
||||
#define AIRCRAFT_ID_H 4 // aircraft ID message type (highest type id)
|
||||
|
||||
#define SURFACE_POS_L 5 // surface position (lowest type id)
|
||||
#define SURFACE_POS_H 8 // surface position (highest type id)
|
||||
|
||||
#define AIRBORNE_POS_BARO_L 9 // airborne position (lowest type id)
|
||||
#define AIRBORNE_POS_BARO_H 18 // airborne position (highest type id)
|
||||
|
||||
#define AIRBORNE_VEL 19 // airborne velocities
|
||||
|
||||
#define AIRBORNE_POS_GPS_L 20 // airborne position (lowest type id)
|
||||
#define AIRBORNE_POS_GPS_H 22 // airborne position (highest type id)
|
||||
|
||||
#define RESERVED_L 23 // reserved for other uses
|
||||
#define RESERVED_H 31 // reserved for other uses
|
||||
|
||||
#define VEL_GND_SUBSONIC 1
|
||||
#define VEL_GND_SUPERSONIC 2
|
||||
#define VEL_AIR_SUBSONIC 3
|
||||
#define VEL_AIR_SUPERSONIC 4
|
||||
|
||||
#define O_E_FRAME_TIMEOUT 20 // timeout between odd and even frames
|
||||
|
||||
struct AircraftRecentEntry {
|
||||
using Key = uint32_t;
|
||||
|
@ -82,7 +106,7 @@ struct AircraftRecentEntry {
|
|||
frame_pos_odd = frame;
|
||||
|
||||
if (!frame_pos_even.empty() && !frame_pos_odd.empty()) {
|
||||
if (abs(frame_pos_even.get_rx_timestamp() - frame_pos_odd.get_rx_timestamp()) < 20)
|
||||
if (abs(frame_pos_even.get_rx_timestamp() - frame_pos_odd.get_rx_timestamp()) < O_E_FRAME_TIMEOUT)
|
||||
pos = decode_frame_pos(frame_pos_even, frame_pos_odd);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue