mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 11:17:58 +00:00
Fixed the mixing of aircraft coordinates in the details view, by
checking if the ICAO address of the frame and the current item in the details view match. Slight refactor by placing the decimal to string conversion function into the string_format module. Added fix in the scope of issue #365 FrequencyStepView field in TransmitterView class FrequencyStepView field in TransmitterView class Update ui_transmitter.hpp Update credits Fixed left padding of the decimal part of the numbers.
This commit is contained in:
@@ -160,7 +160,9 @@ int cpr_NL_approx(float lat) {
|
||||
int cpr_NL(float lat) {
|
||||
// TODO prove that the approximate function is good
|
||||
// enough for the precision we need. Uncomment if
|
||||
// that is true:
|
||||
// that is true. No performance penalty was noticed
|
||||
// from testing, but if you find it might be an issue,
|
||||
// switch to cpr_NL_approx() instead:
|
||||
|
||||
//return cpr_NL_approx(lat);
|
||||
|
||||
@@ -199,18 +201,18 @@ void encode_frame_pos(ADSBFrame& frame, const uint32_t ICAO_address, const int32
|
||||
// CPR encoding
|
||||
// Info from: http://antena.fe.uni-lj.si/literatura/Razno/Avionika/modes/CPRencoding.pdf
|
||||
|
||||
delta_lat = 360.0 / ((4.0 * 15.0) - time_parity); // NZ = 15
|
||||
yz = floor(131072.0 * (cpr_mod(latitude, delta_lat) / delta_lat) + 0.5);
|
||||
rlat = delta_lat * ((yz / 131072.0) + floor(latitude / delta_lat));
|
||||
delta_lat = 360.0 / ((4.0 * NZ) - time_parity); // NZ = 15
|
||||
yz = floor(CPR_MAX_VALUE * (cpr_mod(latitude, delta_lat) / delta_lat) + 0.5);
|
||||
rlat = delta_lat * ((yz / CPR_MAX_VALUE) + floor(latitude / delta_lat));
|
||||
|
||||
if ((cpr_NL(rlat) - time_parity) > 0)
|
||||
delta_lon = 360.0 / cpr_N(rlat, time_parity);
|
||||
else
|
||||
delta_lon = 360.0;
|
||||
xz = floor(131072.0 * (cpr_mod(longitude, delta_lon) / delta_lon) + 0.5);
|
||||
xz = floor(CPR_MAX_VALUE * (cpr_mod(longitude, delta_lon) / delta_lon) + 0.5);
|
||||
|
||||
lat = cpr_mod(yz, 131072.0);
|
||||
lon = cpr_mod(xz, 131072.0);
|
||||
lat = cpr_mod(yz, CPR_MAX_VALUE);
|
||||
lon = cpr_mod(xz, CPR_MAX_VALUE);
|
||||
|
||||
frame.push_byte((altitude_coded << 4) | ((uint32_t)time_parity << 2) | (lat >> 15)); // T = 0
|
||||
frame.push_byte(lat >> 7);
|
||||
|
Reference in New Issue
Block a user