1
0
Fork 0

Default GPS handling of DISCON waypoints

When a DISCON is sequencing, revert to OSB mode at the current heading.
Also fix heading capture when reverting to OBS mode in various other
places.
This commit is contained in:
James Turner 2020-04-19 17:05:29 +01:00
parent fc50680694
commit d1998f27ff

View file

@ -159,6 +159,12 @@ var DefaultGPSDeleagte = {
} }
}, },
_captureCurrentCourse: func
{
var crs = getprop(GPSPath ~ "/desired-course-deg");
setprop(GPSPath ~ "/selected-course-deg", crs);
},
_selectOBSMode: func _selectOBSMode: func
{ {
setprop(GPSPath ~ "/command", "obs"); setprop(GPSPath ~ "/command", "obs");
@ -186,6 +192,7 @@ var DefaultGPSDeleagte = {
{ {
if (me._modeProp.getValue() == 'leg') { if (me._modeProp.getValue() == 'leg') {
logprint(LOG_INFO, 'flightplan deactivated, default GPS to OBS mode'); logprint(LOG_INFO, 'flightplan deactivated, default GPS to OBS mode');
me._captureCurrentCourse();
me._selectOBSMode(); me._selectOBSMode();
} }
}, },
@ -194,6 +201,7 @@ var DefaultGPSDeleagte = {
{ {
if (me._modeProp.getValue() == 'leg') { if (me._modeProp.getValue() == 'leg') {
logprint(LOG_INFO, 'end of flight-plan, switching GPS to OBS mode'); logprint(LOG_INFO, 'end of flight-plan, switching GPS to OBS mode');
me._captureCurrentCourse();
me._selectOBSMode(); me._selectOBSMode();
} }
}, },
@ -205,6 +213,7 @@ var DefaultGPSDeleagte = {
if (me._modeProp.getValue() == 'leg') { if (me._modeProp.getValue() == 'leg') {
logprint(LOG_INFO, 'flight-plan cleared, switching GPS to OBS mode'); logprint(LOG_INFO, 'flight-plan cleared, switching GPS to OBS mode');
me._captureCurrentCourse();
me._selectOBSMode(); me._selectOBSMode();
} }
}, },
@ -227,6 +236,7 @@ var DefaultGPSDeleagte = {
# revert to OBS mode # revert to OBS mode
logprint(LOG_INFO, "default GPS reached Direct-To, resuming to OBS"); logprint(LOG_INFO, "default GPS reached Direct-To, resuming to OBS");
me._captureCurrentCourse();
me._selectOBSMode(); me._selectOBSMode();
} }
} else if (mode == 'leg') { } else if (mode == 'leg') {
@ -235,6 +245,11 @@ var DefaultGPSDeleagte = {
if (nextIndex >= me.flightplan.numWaypoints()) { if (nextIndex >= me.flightplan.numWaypoints()) {
logprint(LOG_INFO, "default GPS sequencing, finishing flightplan"); logprint(LOG_INFO, "default GPS sequencing, finishing flightplan");
me.flightplan.finish(); me.flightplan.finish();
} elsif (me.flightplan.nextWP().wp_type == 'discontinuity') {
logprint(LOG_INFO, "default GPS sequencing DISCONTINUITY in flightplan, switching to OBS mode");
me._captureCurrentCourse();
me._selectOBSMode();
} else { } else {
logprint(LOG_INFO, "default GPS sequencing to next WP"); logprint(LOG_INFO, "default GPS sequencing to next WP");
me.flightplan.current = nextIndex; me.flightplan.current = nextIndex;