kopia lustrzana https://github.com/OpenRTX/OpenRTX
GPS: using 16-bit integers for course over ground
rodzic
a17ad80f10
commit
70f0ce45d3
|
@ -52,8 +52,8 @@ typedef struct
|
|||
int32_t longitude; // Longitude coordinates
|
||||
int16_t altitude; // Antenna altitude above mean sea level (geoid) in m
|
||||
uint16_t speed; // Ground speed in km/h
|
||||
float tmg_mag; // Course over ground, degrees, magnetic
|
||||
float tmg_true; // Course over ground, degrees, true
|
||||
int16_t tmg_mag; // Course over ground, degrees, magnetic
|
||||
int16_t tmg_true; // Course over ground, degrees, true
|
||||
}
|
||||
gps_t;
|
||||
|
||||
|
|
|
@ -167,8 +167,8 @@ void gps_task()
|
|||
if (minmea_parse_vtg(&frame, sentence))
|
||||
{
|
||||
gps_data.speed = minmea_toint(&frame.speed_kph);
|
||||
gps_data.tmg_mag = minmea_tofloat(&frame.magnetic_track_degrees);
|
||||
gps_data.tmg_true = minmea_tofloat(&frame.true_track_degrees);
|
||||
gps_data.tmg_mag = minmea_toint(&frame.magnetic_track_degrees);
|
||||
gps_data.tmg_true = minmea_toint(&frame.true_track_degrees);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -550,7 +550,7 @@ void vp_announceM17Info(const channel_t* channel, bool isEditing,
|
|||
|
||||
static bool IsCompassCloseEnoughToCardinalPoint()
|
||||
{
|
||||
float tmg_true = state.gps_data.tmg_true;
|
||||
int16_t tmg_true = state.gps_data.tmg_true;
|
||||
|
||||
return (tmg_true < (0 + margin) || tmg_true > (360 - margin)) || // north
|
||||
(tmg_true > (90 - margin) && tmg_true < (90 + margin)) || // east
|
||||
|
@ -638,7 +638,7 @@ void vp_announceGPSInfo(vpGPSInfoFlags_t gpsInfoFlags)
|
|||
vp_queuePrompt(PROMPT_COMPASS);
|
||||
if (!IsCompassCloseEnoughToCardinalPoint())
|
||||
{
|
||||
sniprintf(buffer, 16, "%3.1f", state.gps_data.tmg_true);
|
||||
sniprintf(buffer, 16, "%d", state.gps_data.tmg_true);
|
||||
vp_queueString(buffer, vpAnnounceCommonSymbols);
|
||||
vp_queuePrompt(PROMPT_DEGREES);
|
||||
}
|
||||
|
|
|
@ -1272,7 +1272,7 @@ void ui_saveState()
|
|||
#ifdef CONFIG_GPS
|
||||
static uint16_t priorGPSSpeed = 0;
|
||||
static int16_t priorGPSAltitude = 0;
|
||||
static float priorGPSDirection = 500; // impossible value init.
|
||||
static int16_t priorGPSDirection = 500; // impossible value init.
|
||||
static uint8_t priorGPSFixQuality= 0;
|
||||
static uint8_t priorGPSFixType = 0;
|
||||
static uint8_t priorSatellitesInView = 0;
|
||||
|
@ -1313,8 +1313,7 @@ static vpGPSInfoFlags_t GetGPSDirectionOrSpeedChanged()
|
|||
priorGPSAltitude = state.gps_data.altitude;
|
||||
}
|
||||
|
||||
float degreeDiff = fabs(state.gps_data.tmg_true - priorGPSDirection);
|
||||
if (degreeDiff >= 1)
|
||||
if (state.gps_data.tmg_true != priorGPSDirection)
|
||||
{
|
||||
whatChanged |= vpGPSDirection;
|
||||
priorGPSDirection = state.gps_data.tmg_true;
|
||||
|
|
Ładowanie…
Reference in New Issue