Now read speed, altitude and direction changes on the GPS screen automatically with a forced minimum of 10 seconds between readings to avoid a bit of hysterisis .
Can still get full summary on long hold f1.
This commit is contained in:
parent
3ba094f633
commit
5829df6dd3
|
|
@ -155,7 +155,7 @@ void vp_announceM17Info(const channel_t* channel, const vpQueueFlags_t flags);
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifdef GPS_PRESENT
|
#ifdef GPS_PRESENT
|
||||||
void vp_announceGPSInfo();
|
void vp_announceGPSInfo(vpGPSInfoFlags_t gpsInfoFlags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,22 @@ typedef enum
|
||||||
}
|
}
|
||||||
vpSummaryInfoFlags_t;
|
vpSummaryInfoFlags_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
vpGPSNone=0,
|
||||||
|
vpGPSIntro=0x01,
|
||||||
|
vpGPSFixQuality = 0x02,
|
||||||
|
vpGPSFixType = 0x04,
|
||||||
|
vpGPSLatitude = 0x08,
|
||||||
|
vpGPSLongitude = 0x10,
|
||||||
|
vpGPSSpeed = 0x20,
|
||||||
|
vpGPSAltitude = 0x40,
|
||||||
|
vpGPSDirection = 0x80,
|
||||||
|
vpGPSSatCount = 0x100,
|
||||||
|
vpGPSAll = 0xff,
|
||||||
|
}
|
||||||
|
vpGPSInfoFlags_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint16_t freq;
|
uint16_t freq;
|
||||||
|
|
|
||||||
|
|
@ -527,104 +527,131 @@ void vp_announceM17Info(const channel_t* channel, const vpQueueFlags_t flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GPS_PRESENT
|
#ifdef GPS_PRESENT
|
||||||
void vp_announceGPSInfo()
|
void vp_announceGPSInfo(vpGPSInfoFlags_t gpsInfoFlags)
|
||||||
{
|
{
|
||||||
vp_flush();
|
vp_flush();
|
||||||
vpQueueFlags_t flags = vpqIncludeDescriptions
|
vpQueueFlags_t flags = vpqIncludeDescriptions
|
||||||
| vpqAddSeparatingSilence;
|
| vpqAddSeparatingSilence;
|
||||||
|
|
||||||
vp_queueStringTableEntry(¤tLanguage->gps);
|
if (gpsInfoFlags & vpGPSIntro)
|
||||||
if (!state.settings.gps_enabled)
|
|
||||||
{
|
{
|
||||||
vp_queueStringTableEntry(¤tLanguage->off);
|
vp_queueStringTableEntry(¤tLanguage->gps);
|
||||||
vp_play();
|
if (!state.settings.gps_enabled)
|
||||||
|
{
|
||||||
return;
|
vp_queueStringTableEntry(¤tLanguage->off);
|
||||||
}
|
|
||||||
|
|
||||||
switch (state.gps_data.fix_quality)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
vp_queueStringTableEntry(¤tLanguage->noFix);
|
|
||||||
vp_play();
|
vp_play();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case 1:
|
}
|
||||||
vp_queueString("SPS", vpAnnounceCommonSymbols);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
vp_queueString("DGPS", vpAnnounceCommonSymbols);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
vp_queueString("PPS", vpAnnounceCommonSymbols);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 6:
|
|
||||||
vp_queueStringTableEntry(¤tLanguage->fixLost);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
vp_queueStringTableEntry(¤tLanguage->error);
|
|
||||||
|
|
||||||
vp_play();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addSilenceIfNeeded(flags);
|
if (gpsInfoFlags & vpGPSFixQuality)
|
||||||
|
|
||||||
switch (state.gps_data.fix_type)
|
|
||||||
{
|
{
|
||||||
case 2:
|
switch (state.gps_data.fix_quality)
|
||||||
vp_queueString("2D", vpAnnounceCommonSymbols);
|
{
|
||||||
break;
|
case 0:
|
||||||
|
vp_queueStringTableEntry(¤tLanguage->noFix);
|
||||||
|
vp_play();
|
||||||
|
return;
|
||||||
|
case 1:
|
||||||
|
vp_queueString("SPS", vpAnnounceCommonSymbols);
|
||||||
|
break;
|
||||||
|
|
||||||
case 3:
|
case 2:
|
||||||
vp_queueString("3D", vpAnnounceCommonSymbols);
|
vp_queueString("DGPS", vpAnnounceCommonSymbols);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
vp_queueString("PPS", vpAnnounceCommonSymbols);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
vp_queueStringTableEntry(¤tLanguage->fixLost);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
vp_queueStringTableEntry(¤tLanguage->error);
|
||||||
|
|
||||||
|
vp_play();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
addSilenceIfNeeded(flags);
|
||||||
|
}
|
||||||
|
if (gpsInfoFlags & vpGPSFixType)
|
||||||
|
{
|
||||||
|
switch (state.gps_data.fix_type)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
vp_queueString("2D", vpAnnounceCommonSymbols);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
vp_queueString("3D", vpAnnounceCommonSymbols);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
addSilenceIfNeeded(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
addSilenceIfNeeded(flags);
|
|
||||||
|
|
||||||
// lat/long
|
|
||||||
char buffer[16] = "\0";
|
char buffer[16] = "\0";
|
||||||
snprintf(buffer, 16, "%8.6f", state.gps_data.latitude);
|
|
||||||
removeUnnecessaryZerosFromVoicePrompts(buffer);
|
if (gpsInfoFlags & vpGPSLatitude)
|
||||||
vp_queuePrompt(PROMPT_LATITUDE);
|
{
|
||||||
vp_queueString(buffer, vpAnnounceCommonSymbols);
|
// lat/long
|
||||||
vp_queuePrompt(PROMPT_NORTH);
|
snprintf(buffer, 16, "%8.6f", state.gps_data.latitude);
|
||||||
|
removeUnnecessaryZerosFromVoicePrompts(buffer);
|
||||||
|
vp_queuePrompt(PROMPT_LATITUDE);
|
||||||
|
vp_queueString(buffer, vpAnnounceCommonSymbols);
|
||||||
|
vp_queuePrompt(PROMPT_NORTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpsInfoFlags & vpGPSLongitude)
|
||||||
|
{
|
||||||
|
float longitude = state.gps_data.longitude;
|
||||||
|
voicePrompt_t direction = (longitude < 0) ? PROMPT_WEST : PROMPT_EAST;
|
||||||
|
longitude = (longitude < 0) ? -longitude : longitude;
|
||||||
|
snprintf(buffer, 16, "%8.6f", longitude);
|
||||||
|
removeUnnecessaryZerosFromVoicePrompts(buffer);
|
||||||
|
|
||||||
float longitude = state.gps_data.longitude;
|
vp_queuePrompt(PROMPT_LONGITUDE);
|
||||||
voicePrompt_t direction = (longitude < 0) ? PROMPT_WEST : PROMPT_EAST;
|
vp_queueString(buffer, vpAnnounceCommonSymbols);
|
||||||
longitude = (longitude < 0) ? -longitude : longitude;
|
vp_queuePrompt(direction);
|
||||||
snprintf(buffer, 16, "%8.6f", longitude);
|
addSilenceIfNeeded(flags);
|
||||||
removeUnnecessaryZerosFromVoicePrompts(buffer);
|
}
|
||||||
|
|
||||||
vp_queuePrompt(PROMPT_LONGITUDE);
|
if (gpsInfoFlags & vpGPSSpeed)
|
||||||
vp_queueString(buffer, vpAnnounceCommonSymbols);
|
{
|
||||||
vp_queuePrompt(direction);
|
// speed/altitude:
|
||||||
addSilenceIfNeeded(flags);
|
snprintf(buffer, 16, "%4.1fkm/h", state.gps_data.speed);
|
||||||
|
vp_queuePrompt(PROMPT_SPEED);
|
||||||
// speed/altitude:
|
vp_queueString(buffer, vpAnnounceCommonSymbols);
|
||||||
snprintf(buffer, 16, "%4.1fkm/h", state.gps_data.speed);
|
}
|
||||||
vp_queuePrompt(PROMPT_SPEED);
|
|
||||||
vp_queueString(buffer, vpAnnounceCommonSymbols);
|
if (gpsInfoFlags & vpGPSAltitude)
|
||||||
vp_queuePrompt(PROMPT_ALTITUDE);
|
{
|
||||||
|
vp_queuePrompt(PROMPT_ALTITUDE);
|
||||||
snprintf(buffer, 16, "%4.1fm", state.gps_data.altitude);
|
|
||||||
vp_queueString(buffer, vpAnnounceCommonSymbols);
|
|
||||||
addSilenceIfNeeded(flags);
|
|
||||||
|
|
||||||
snprintf(buffer, 16, "%3.1f", state.gps_data.tmg_true);
|
|
||||||
vp_queuePrompt(PROMPT_COMPASS);
|
|
||||||
vp_queueString(buffer, vpAnnounceCommonSymbols);
|
|
||||||
vp_queuePrompt(PROMPT_DEGREES);
|
|
||||||
addSilenceIfNeeded(flags);
|
|
||||||
|
|
||||||
vp_queuePrompt(PROMPT_SATELLITES);
|
|
||||||
vp_queueInteger(state.gps_data.satellites_in_view);
|
|
||||||
|
|
||||||
|
snprintf(buffer, 16, "%4.1fm", state.gps_data.altitude);
|
||||||
|
vp_queueString(buffer, vpAnnounceCommonSymbols);
|
||||||
|
addSilenceIfNeeded(flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpsInfoFlags & vpGPSDirection)
|
||||||
|
{
|
||||||
|
snprintf(buffer, 16, "%3.1f", state.gps_data.tmg_true);
|
||||||
|
vp_queuePrompt(PROMPT_COMPASS);
|
||||||
|
vp_queueString(buffer, vpAnnounceCommonSymbols);
|
||||||
|
vp_queuePrompt(PROMPT_DEGREES);
|
||||||
|
addSilenceIfNeeded(flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpsInfoFlags & vpGPSSatCount)
|
||||||
|
{
|
||||||
|
vp_queuePrompt(PROMPT_SATELLITES);
|
||||||
|
vp_queueInteger(state.gps_data.satellites_in_view);
|
||||||
|
}
|
||||||
vp_play();
|
vp_play();
|
||||||
}
|
}
|
||||||
#endif // GPS_PRESENT
|
#endif // GPS_PRESENT
|
||||||
|
|
@ -769,7 +796,7 @@ void vp_announceScreen(uint8_t ui_screen)
|
||||||
break;
|
break;
|
||||||
#ifdef GPS_PRESENT
|
#ifdef GPS_PRESENT
|
||||||
case MENU_GPS:
|
case MENU_GPS:
|
||||||
vp_announceGPSInfo();
|
vp_announceGPSInfo(vpGPSAll);
|
||||||
break;
|
break;
|
||||||
#endif // GPS_PRESENT
|
#endif // GPS_PRESENT
|
||||||
case MENU_BACKUP:
|
case MENU_BACKUP:
|
||||||
|
|
|
||||||
|
|
@ -1132,6 +1132,42 @@ void ui_saveState()
|
||||||
last_state = state;
|
last_state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GPS_PRESENT
|
||||||
|
static float priorGPSSpeed = 0;
|
||||||
|
static float priorGPSAltitude = 0;
|
||||||
|
static float priorGPSDirection = 0;
|
||||||
|
static uint32_t vpGPSLastUpdate = 0;
|
||||||
|
|
||||||
|
static vpGPSInfoFlags_t GetGPSDirectionOrSpeedChanged()
|
||||||
|
{
|
||||||
|
uint32_t now = getTick();
|
||||||
|
if (now - vpGPSLastUpdate < 10000)
|
||||||
|
return vpGPSNone;
|
||||||
|
vpGPSLastUpdate=now;
|
||||||
|
|
||||||
|
if (!state.settings.gps_enabled)
|
||||||
|
return vpGPSNone;
|
||||||
|
if (state.gps_data.fix_quality == 0 || state.gps_data.fix_quality >= 6)
|
||||||
|
return vpGPSNone;
|
||||||
|
|
||||||
|
vpGPSInfoFlags_t whatChanged= vpGPSNone;
|
||||||
|
if (state.gps_data.speed != priorGPSSpeed)
|
||||||
|
whatChanged |= vpGPSSpeed;
|
||||||
|
|
||||||
|
if (state.gps_data.altitude != priorGPSAltitude)
|
||||||
|
whatChanged |= vpGPSAltitude;
|
||||||
|
|
||||||
|
if (state.gps_data.tmg_true != priorGPSDirection)
|
||||||
|
whatChanged |= vpGPSDirection;
|
||||||
|
|
||||||
|
priorGPSSpeed = state.gps_data.speed;
|
||||||
|
priorGPSAltitude = state.gps_data.altitude;
|
||||||
|
priorGPSDirection = state.gps_data.tmg_true;
|
||||||
|
|
||||||
|
return whatChanged;
|
||||||
|
}
|
||||||
|
#endif // GPS_PRESENT
|
||||||
|
|
||||||
void ui_updateFSM(bool *sync_rtx)
|
void ui_updateFSM(bool *sync_rtx)
|
||||||
{
|
{
|
||||||
// Check for events
|
// Check for events
|
||||||
|
|
@ -1591,7 +1627,7 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
if ((msg.keys & KEY_F1) && (state.settings.vpLevel > vpBeep))
|
if ((msg.keys & KEY_F1) && (state.settings.vpLevel > vpBeep))
|
||||||
{// quick press repeat vp, long press summary.
|
{// quick press repeat vp, long press summary.
|
||||||
if (msg.long_press)
|
if (msg.long_press)
|
||||||
vp_announceGPSInfo();
|
vp_announceGPSInfo(vpGPSAll);
|
||||||
else
|
else
|
||||||
vp_replayLastPrompt();
|
vp_replayLastPrompt();
|
||||||
f1Handled = true;
|
f1Handled = true;
|
||||||
|
|
@ -1980,6 +2016,16 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
else if(event.type == EVENT_STATUS)
|
else if(event.type == EVENT_STATUS)
|
||||||
{
|
{
|
||||||
ReleaseFunctionLatchIfNeeded();
|
ReleaseFunctionLatchIfNeeded();
|
||||||
|
#ifdef GPS_PRESENT
|
||||||
|
if ((state.ui_screen == MENU_GPS) &&
|
||||||
|
(!txOngoing && !rtx_rxSquelchOpen()) &&
|
||||||
|
(state.settings.vpLevel > vpLow))
|
||||||
|
{// automatically read speed and direction changes only!
|
||||||
|
vpGPSInfoFlags_t whatChanged = GetGPSDirectionOrSpeedChanged();
|
||||||
|
if (whatChanged != vpGPSNone)
|
||||||
|
vp_announceGPSInfo(whatChanged);
|
||||||
|
}
|
||||||
|
#endif // GPS_PRESENT
|
||||||
|
|
||||||
if (txOngoing || rtx_rxSquelchOpen())
|
if (txOngoing || rtx_rxSquelchOpen())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue