From cfa2db769059aef2f6008ea256416a93e15ebd3a Mon Sep 17 00:00:00 2001 From: mhwlng Date: Sun, 27 Sep 2020 08:14:38 +0200 Subject: [PATCH] Also allow F5/F6 buttons to show the next/previous card. Like the left rotary encoder. --- Elite/FipPanel.cs | 78 +++++++++++++++++++++++++++++++- Elite/Properties/AssemblyInfo.cs | 4 +- README.md | 1 + 3 files changed, 79 insertions(+), 4 deletions(-) diff --git a/Elite/FipPanel.cs b/Elite/FipPanel.cs index 05f2d49..e65a507 100644 --- a/Elite/FipPanel.cs +++ b/Elite/FipPanel.cs @@ -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) @@ -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; } } @@ -1696,7 +1761,10 @@ 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, @@ -1704,8 +1772,9 @@ public void RefreshDevicePage(bool mustRender = true) CurrentCard = currentCard, Galnet = Galnet.GalnetList.Skip(currentCard).FirstOrDefault().Value - + }); + } break; @@ -2157,6 +2226,9 @@ public void RefreshDevicePage(bool mustRender = true) } SetLed(1, true); + + HandleCardNavigationLeds(); + } else if (tabPage != _currentPage) { @@ -2173,6 +2245,8 @@ public void RefreshDevicePage(bool mustRender = true) else { SetLed(1, false); + SetLed(5, false); + SetLed(6, false); if (CurrentTab > 0) { diff --git a/Elite/Properties/AssemblyInfo.cs b/Elite/Properties/AssemblyInfo.cs index 5d8a9cf..7b804c8 100644 --- a/Elite/Properties/AssemblyInfo.cs +++ b/Elite/Properties/AssemblyInfo.cs @@ -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)] \ No newline at end of file diff --git a/README.md b/README.md index eaed614..73623b2 100644 --- a/README.md +++ b/README.md @@ -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.