Skip to content

Commit

Permalink
Also allow F5/F6 buttons to show the next/previous card. Like the lef…
Browse files Browse the repository at this point in the history
…t rotary encoder.
  • Loading branch information
mhwlng committed Sep 27, 2020
1 parent 91ef92b commit cfa2db7
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 4 deletions.
78 changes: 76 additions & 2 deletions Elite/FipPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,38 @@ public void HandleJoystickButton(JoystickButton joystickButton, bool state, bool
}


private void HandleCardNavigationLeds()
{
var ledRight = false;
var ledLeft = false;

if (CurrentTab == LcdTab.POI || CurrentTab == LcdTab.Powers ||
CurrentTab == LcdTab.Materials || CurrentTab == LcdTab.Galaxy ||
CurrentTab == LcdTab.Ship || CurrentTab == LcdTab.Mining ||
CurrentTab == LcdTab.Navigation || CurrentTab == LcdTab.Engineer ||
CurrentTab == LcdTab.Galnet)
{
ledLeft = true;
ledRight = true;

if (CurrentTab == LcdTab.Galnet)
{
var currentCard = _currentCard[(int) CurrentTab];

var galNetCount = Galnet.GalnetList?.Count ?? 0;

ledLeft = currentCard > 0;

ledRight = currentCard < galNetCount - 1;
}

}

SetLed(5, ledRight);
SetLed(6, ledLeft);

}

private void SoftButtonCallback(IntPtr device, IntPtr buttons, IntPtr context)
{
if (device == FipDevicePointer & (uint) buttons != _prevButtons)
Expand Down Expand Up @@ -954,6 +986,39 @@ private void SoftButtonCallback(IntPtr device, IntPtr buttons, IntPtr context)

_lastTab = LcdTab.Init;

break;

case 512:

if (CurrentTab == LcdTab.POI || CurrentTab == LcdTab.Powers ||
CurrentTab == LcdTab.Materials || CurrentTab == LcdTab.Galaxy ||
CurrentTab == LcdTab.Ship || CurrentTab == LcdTab.Mining ||
CurrentTab == LcdTab.Navigation || CurrentTab == LcdTab.Engineer ||
CurrentTab == LcdTab.Galnet)
{
_currentCard[(int)CurrentTab]++;
_currentZoomLevel[(int)CurrentTab]++;
_currentLcdYOffset = 0;

mustRefresh = true;
}

break;
case 1024:

if (CurrentTab == LcdTab.POI || CurrentTab == LcdTab.Powers ||
CurrentTab == LcdTab.Materials || CurrentTab == LcdTab.Galaxy ||
CurrentTab == LcdTab.Ship || CurrentTab == LcdTab.Mining ||
CurrentTab == LcdTab.Navigation || CurrentTab == LcdTab.Engineer ||
CurrentTab == LcdTab.Galnet)
{
_currentCard[(int)CurrentTab]--;
_currentZoomLevel[(int)CurrentTab]--;
_currentLcdYOffset = 0;

mustRefresh = true;
}

break;
}
}
Expand Down Expand Up @@ -1696,16 +1761,20 @@ public void RefreshDevicePage(bool mustRender = true)
currentCard = _currentCard[(int) CurrentTab] = 0;
}

str =
lock (App.RefreshJsonLock)
{

str =
Engine.Razor.Run("galnet.cshtml", null, new
{
CurrentTab = CurrentTab,
CurrentPage = _currentPage,
CurrentCard = currentCard,

Galnet = Galnet.GalnetList.Skip(currentCard).FirstOrDefault().Value

});
}

break;

Expand Down Expand Up @@ -2157,6 +2226,9 @@ public void RefreshDevicePage(bool mustRender = true)
}

SetLed(1, true);

HandleCardNavigationLeds();

}
else if (tabPage != _currentPage)
{
Expand All @@ -2173,6 +2245,8 @@ public void RefreshDevicePage(bool mustRender = true)
else
{
SetLed(1, false);
SetLed(5, false);
SetLed(6, false);

if (CurrentTab > 0)
{
Expand Down
4 changes: 2 additions & 2 deletions Elite/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyVersion("1.5.1.0")]
[assembly: AssemblyFileVersion("1.5.1.0")]

[assembly: log4net.Config.XmlConfigurator(Watch = true)]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The menu area and each screen can be configured via razor (.cshtml) web page tem
Use the right rotary encoder to scroll vertically on all tabs.

Use the left rotary encoder to show another card on various tabs or zoom into the galaxy map.
Also, the S5 button shows the next card and the S6 button shows the previous card.

Press the S1 button to display the menu.

Expand Down

0 comments on commit cfa2db7

Please sign in to comment.