├── .gitattributes ├── .gitignore ├── ArduinoInterfaces ├── ArduinoInterfaces.csproj ├── ArduinoLink.cs ├── Constants.cs └── Properties │ └── AssemblyInfo.cs ├── License.txt ├── README.md ├── ShiftData ├── Properties │ └── AssemblyInfo.cs ├── ShiftData.csproj ├── ShiftDataSchema.cs ├── ShiftDataSchema.xsd └── ShiftLightData.xml ├── iRacingSdkWrapper ├── Bitfields │ ├── BitfieldBase.cs │ ├── CameraState.cs │ ├── EngineWarning.cs │ └── SessionFlag.cs ├── Drivers.cs ├── Enums.cs ├── Properties │ └── AssemblyInfo.cs ├── Readme.md ├── SdkWrapper.cs ├── TelemetryInfo.cs ├── TelemetryValue.cs ├── iRacingSdkWrapper.csproj ├── iracingvars.csv └── sessioninfo_example.txt ├── iRduino Development Guide v1.pdf ├── iRduino.sln ├── iRduino.sln.DotSettings ├── iRduino ├── App.config ├── App.xaml ├── App.xaml.cs ├── ArduinoTemplates │ ├── ArduinoSketchT4.cs │ ├── ArduinoSketchT4.tt │ ├── ArduinoSketchT4Code.cs │ └── SampleArduinoSketch.ino ├── Classes │ ├── AdvancedOptions.cs │ ├── ArduinoMessagesReceiving.cs │ ├── ArduinoMessagesSending.cs │ ├── ArduinoSketch.cs │ ├── ButtonFunctions.cs │ ├── Configuration.cs │ ├── ConfigurationOptions.cs │ ├── ControllerDevice.cs │ ├── DCVariables.cs │ ├── Dictionarys.cs │ ├── DisplayManager.cs │ ├── DisplayVariables.cs │ ├── ErrorReporting.cs │ ├── LEDs.cs │ ├── LapDisplays.cs │ ├── OptionPages.cs │ └── ShiftLightData.cs ├── Commands │ ├── CommandBase.cs │ └── ShowMainWindow.cs ├── MahApps.Metro │ ├── Entypo-license.txt │ ├── Information.txt │ ├── MahApps.Metro.dll │ └── System.Windows.Interactivity.dll ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Resources │ ├── Configuration-Settings-icon.png │ ├── Entypo.ttf │ ├── ErrorBig.png │ ├── Icons.xaml │ ├── Motorsport-Helmet.ico │ ├── MyControls.xaml │ ├── MyTabStyle.xaml │ ├── appbar.close32W.png │ ├── appbar.cog.png │ ├── appbar.control.play.png │ ├── appbar.control.stop.png │ ├── appbar.information.circle32W.png │ ├── appbar.lifesaver32W.png │ ├── appbar.minus32W.png │ ├── arduinoTemp.png │ ├── arrow_divide.png │ ├── arrow_inout.png │ ├── arrow_left.png │ ├── arrow_right.png │ ├── brick.png │ ├── brickBlue.png │ ├── bricks.png │ ├── controller.png │ ├── error.png │ ├── ftTemp.png │ ├── iRduino.png │ ├── iRduinoAbout.png │ ├── iRdunio-ICON.ico │ ├── iRdunio-Logo32.png │ ├── iRdunio-Logo64.png │ ├── joystick.png │ ├── layers.png │ ├── lightbulb.png │ ├── lightbulb_off.png │ ├── octobrite.png │ ├── page_gear.png │ ├── picture_empty.png │ ├── plugin.png │ ├── script_gear.png │ ├── simwind.png │ └── wrench_orange.png ├── Windows │ ├── AboutBox.xaml │ ├── AboutBox.xaml.cs │ ├── ErrorWindow.xaml │ ├── ErrorWindow.xaml.cs │ ├── GenerateArduinoWizard.xaml │ ├── GenerateArduinoWizard.xaml.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── OptionsWindow.xaml │ ├── OptionsWindow.xaml.cs │ ├── Pages │ │ ├── AdvancedOptions.xaml │ │ ├── AdvancedOptions.xaml.cs │ │ ├── Arduino.xaml │ │ ├── Arduino.xaml.cs │ │ ├── BlankPage.xaml │ │ ├── BlankPage.xaml.cs │ │ ├── ButtonsPage.xaml │ │ ├── ButtonsPage.xaml.cs │ │ ├── ConfigurationPage.xaml │ │ ├── ConfigurationPage.xaml.cs │ │ ├── CurrentConfiguration.xaml │ │ ├── CurrentConfiguration.xaml.cs │ │ ├── DigitalInputs.xaml │ │ ├── DigitalInputs.xaml.cs │ │ ├── DigitalOutputs.xaml │ │ ├── DigitalOutputs.xaml.cs │ │ ├── Expander.xaml │ │ ├── Expander.xaml.cs │ │ ├── FergoTech.xaml │ │ ├── FergoTech.xaml.cs │ │ ├── JoystickButtonsPage.xaml │ │ ├── JoystickButtonsPage.xaml.cs │ │ ├── LEDsPage.xaml │ │ ├── LEDsPage.xaml.cs │ │ ├── PageHelper.cs │ │ ├── ScreenPage.xaml │ │ ├── ScreenPage.xaml.cs │ │ ├── TM1640ScreenPage.xaml │ │ ├── TM1640ScreenPage.xaml.cs │ │ ├── TMUnits.xaml │ │ ├── TMUnits.xaml.cs │ │ ├── UnitPage.xaml │ │ └── UnitPage.xaml.cs │ ├── UploaderDialog.xaml │ └── UploaderDialog.xaml.cs └── iRduino.csproj ├── irsdkSharp ├── CVarBuf.cs ├── CVarHeader.cs ├── CiRSDKHeader.cs ├── Properties │ └── AssemblyInfo.cs ├── YamlParser.cs ├── iRSDKSharp.csproj ├── iRacingSDK.cs └── readme.md └── nicon ├── BalloonIcon.cs ├── Diagrams └── TaskbarIcon Overview.cd ├── Interop ├── BalloonFlags.cs ├── IconDataMembers.cs ├── IconState.cs ├── MouseEvent.cs ├── NotifyCommand.cs ├── NotifyIconData.cs ├── NotifyIconVersion.cs ├── Point.cs ├── TrayInfo.cs ├── WinApi.cs ├── WindowClass.cs └── WindowMessageSink.cs ├── NotifyIconWpf.csproj ├── PopupActivationMode.cs ├── Properties └── AssemblyInfo.cs ├── RoutedEventHelper.cs ├── TaskbarIcon.Declarations.cs ├── TaskbarIcon.cs └── Util.cs /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | ## Ignore Visual Studio temporary files, build results, and 9 | ## files generated by popular Visual Studio add-ons. 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.sln.docstates 15 | *.ide 16 | *.ide.* 17 | 18 | # Build results 19 | [Dd]ebug/ 20 | [Rr]elease/ 21 | x64/ 22 | *_i.c 23 | *_p.c 24 | *.ilk 25 | *.meta 26 | *.obj 27 | *.pch 28 | *.pdb 29 | *.pgc 30 | *.pgd 31 | *.rsp 32 | *.sbr 33 | *.tlb 34 | *.tli 35 | *.tlh 36 | *.tmp 37 | *.log 38 | *.vspscc 39 | *.vssscc 40 | .builds 41 | 42 | # Visual C++ cache files 43 | ipch/ 44 | *.aps 45 | *.ncb 46 | *.opensdf 47 | *.sdf 48 | 49 | # Visual Studio profiler 50 | *.psess 51 | *.vsp 52 | *.vspx 53 | 54 | # Guidance Automation Toolkit 55 | *.gpState 56 | 57 | # ReSharper is a .NET coding add-in 58 | _ReSharper* 59 | 60 | # NCrunch 61 | *.ncrunch* 62 | .*crunch*.local.xml 63 | 64 | # Installshield output folder 65 | [Ee]xpress 66 | 67 | # DocProject is a documentation generator add-in 68 | DocProject/buildhelp/ 69 | DocProject/Help/*.HxT 70 | DocProject/Help/*.HxC 71 | DocProject/Help/*.hhc 72 | DocProject/Help/*.hhk 73 | DocProject/Help/*.hhp 74 | DocProject/Help/Html2 75 | DocProject/Help/html 76 | 77 | # Click-Once directory 78 | publish 79 | 80 | # Publish Web Output 81 | *.Publish.xml 82 | 83 | # NuGet Packages Directory 84 | packages 85 | 86 | # Windows Azure Build Output 87 | csx 88 | *.build.csdef 89 | 90 | # Windows Store app package directory 91 | AppPackages/ 92 | 93 | # Others 94 | [Bb]in 95 | [Oo]bj 96 | sql 97 | TestResults 98 | [Tt]est[Rr]esult* 99 | *.Cache 100 | ClientBin 101 | [Ss]tyle[Cc]op.* 102 | ~$* 103 | *.dbmdl 104 | Generated_Code #added for RIA/Silverlight projects 105 | 106 | # Backup & report files from converting an old project file to a newer 107 | # Visual Studio version. Backup files are not needed, because we have git ;-) 108 | _UpgradeReport_Files/ 109 | Backup*/ 110 | UpgradeLog*.XML 111 | 112 | # ========================= 113 | # Windows detritus 114 | # ========================= 115 | 116 | # Windows image file caches 117 | Thumbs.db 118 | ehthumbs.db 119 | 120 | # Folder config file 121 | Desktop.ini 122 | 123 | # Recycle Bin used on file shares 124 | $RECYCLE.BIN/ 125 | 126 | # Mac crap 127 | .DS_Store 128 | -------------------------------------------------------------------------------- /ArduinoInterfaces/ArduinoInterfaces.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {00583770-D937-40CD-BDCC-B1692D74D392} 8 | Library 9 | Properties 10 | ArduinoInterfaces 11 | ArduinoInterfaces 12 | v4.0 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\packages\MahApps.Metro.0.10.0.0\lib\net40\MahApps.Metro.dll 36 | 37 | 38 | 39 | 40 | 41 | ..\packages\MahApps.Metro.0.10.0.0\lib\net40\System.Windows.Interactivity.dll 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 67 | -------------------------------------------------------------------------------- /ArduinoInterfaces/Constants.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | 5 | namespace ArduinoInterfaces 6 | { 7 | 8 | public class Constants 9 | { 10 | public const int MaxNumberTM1638Units = 6; 11 | 12 | public const int NumberButtonsOnTm1638 = 8; 13 | 14 | public const int NumberPinsArduinoBoard = 54; 15 | 16 | public const int MaxNumberTm1640Units = 3; 17 | 18 | public const int MaxNumberJoystickButtons = 32; 19 | 20 | public const byte MessageStartByte1 = 255; 21 | 22 | //public const byte MessageStartByte2 = 37; 23 | 24 | public const byte MessageEndByte = 180; 25 | 26 | public const int MaxIntensityTM = 7; 27 | 28 | public const int MaxDisplayLengthTM1638 = 8; 29 | 30 | public const int MaxDisplayLengthTM1640 = 16; 31 | 32 | public const int MaxNumberScreensPerUnit = 20; 33 | 34 | public const int MaxDCDisplayLength = 5; 35 | 36 | public const int MessageHeaderLength = 3; //start bytes and intensity 37 | 38 | public const int MessageFooterLength = 3; //checksum & end byte 39 | 40 | public const int TM1638MessageLength = 8; 41 | 42 | public const int TM1638LEDMessageLength = 2; 43 | 44 | public const int TM1640MessageLength = TM1638MessageLength + 8; 45 | 46 | // ReSharper disable InconsistentNaming 47 | public const byte MessageID_TMString = 37; 48 | 49 | public const byte MessageID_TMLED = 42; 50 | 51 | public const byte MessageID_Clear = 170; 52 | 53 | public const byte MessageID_TM1638Buttons = 55; 54 | 55 | // ReSharper restore InconsistentNaming 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /ArduinoInterfaces/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("ArduinoInterface")] 9 | [assembly: AssemblyDescription("Arduino Interface Class for iRduino")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Mark Silverwood")] 12 | [assembly: AssemblyProduct("ArduinoInterface")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("21d50e8e-d446-4e4b-b28d-1356793a9b6f")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("2.0.0.0")] 39 | [assembly: AssemblyFileVersion("2.0.0.0")] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iRduino 2 | 3 | Interfaces between the iRacing API and an Arduino board. Can control displays, LEDs, buttons and much more. Supports custom iRacing Arduino projects. 4 | 5 | ## License 6 | 7 | :scroll: License: [GNU General Public License version 3 (GPLv3)](http://www.gnu.org/licenses/gpl.html) 8 | 9 | ## Website 10 | 11 | :earth_africa: Link: [slicedsilver.github.com/iRduino](http://slicedsilver.github.com/iRduino)
:octocat: Hosted by: [GitHub Pages](http://pages.github.com) 12 | 13 | ## iRacing Foum Topic 14 | 15 | (requires iRacing subscription to read) 16 | :car: [Link to iRacing forum topic] (http://members.iracing.com/jforum/posts/list/1847021.page) 17 | 18 | ## Author 19 | 20 | :bust_in_silhouette: Created and Maintained by [Mark Silverwood](https://github.com/SlicedSilver). 21 | 22 | ## Increments 23 | :bust_in_silhouette: by [Alex Montoanelli](https://github.com/alexmontoanelli) 24 | 25 | ## ShiftData Updates 26 | 27 | :bust_in_silhouette: by Jody Moffett 28 | :bust_in_silhouette: by [Evan A. Matwijejko](https://github.com/MADJIHADx) 29 | -------------------------------------------------------------------------------- /ShiftData/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ShiftData")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ShiftData")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c2b85a39-4f2a-4806-a923-4499ae1205e7")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ShiftData/ShiftData.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E00EE3A4-6BAD-469B-9CA0-F829C37C3A2F} 8 | Library 9 | Properties 10 | ShiftData 11 | ShiftData 12 | v4.0 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | ShiftDataSchema.xsd 46 | 47 | 48 | 49 | 50 | Designer 51 | Always 52 | 53 | 54 | 55 | 56 | Designer 57 | 58 | 59 | 60 | 67 | -------------------------------------------------------------------------------- /ShiftData/ShiftDataSchema.xsd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /iRacingSdkWrapper/Bitfields/BitfieldBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace iRacingSdkWrapper.Bitfields 4 | { 5 | public abstract class BitfieldBase 6 | where T : struct, IConvertible, IComparable 7 | { 8 | protected BitfieldBase(int value) 9 | { 10 | _Value = (uint)value; 11 | } 12 | 13 | private readonly uint _Value; 14 | public uint Value { get { return _Value; } } 15 | 16 | public bool Contains(T bit) 17 | { 18 | var bitValue = (uint) Convert.ChangeType(bit, bit.GetTypeCode()); 19 | return (this.Value & bitValue) == bitValue; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iRacingSdkWrapper/Bitfields/CameraState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace iRacingSdkWrapper.Bitfields 4 | { 5 | public class CameraState : BitfieldBase 6 | { 7 | public CameraState(int value) : base(value) 8 | { 9 | } 10 | } 11 | 12 | [Flags] 13 | public enum CameraStates : uint 14 | { 15 | IsSessionScreen = 0x0001, // the camera tool can only be activated if viewing the session screen (out of car) 16 | IsScenicActive = 0x0002, // the scenic camera is active (no focus car) 17 | CamToolActive = 0x0004, 18 | UIHidden = 0x0008, 19 | UseAutoShotSelection = 0x0010, 20 | UseTemporaryEdits = 0x0020, 21 | UseKeyAcceleration = 0x0040, 22 | UseKey10xAcceleration = 0x0080, 23 | UseMouseAimMode = 0x0100 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iRacingSdkWrapper/Bitfields/EngineWarning.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace iRacingSdkWrapper.Bitfields 4 | { 5 | public class EngineWarning : BitfieldBase 6 | { 7 | public EngineWarning(int value) 8 | : base(value) 9 | { 10 | } 11 | } 12 | 13 | [Flags] 14 | public enum EngineWarnings : uint 15 | { 16 | WaterTemperatureWarning = 0x01, 17 | FuelPressureWarning = 0x02, 18 | OilPressureWarning = 0x04, 19 | EngineStalled = 0x08, 20 | PitSpeedLimiter = 0x10, 21 | RevLimiterActive = 0x20 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /iRacingSdkWrapper/Bitfields/SessionFlag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace iRacingSdkWrapper.Bitfields 4 | { 5 | public class SessionFlag : BitfieldBase 6 | { 7 | public SessionFlag(int value) : base(value) 8 | { 9 | } 10 | } 11 | 12 | [Flags] 13 | public enum SessionFlags : uint 14 | { 15 | Checkered = 0x00000001, 16 | White = 0x00000002, 17 | Green = 0x00000004, 18 | Yellow = 0x00000008, 19 | Red = 0x00000010, 20 | Blue = 0x00000020, 21 | Debris = 0x00000040, 22 | Crossed = 0x00000080, 23 | YellowWaving = 0x00000100, 24 | OneLapToGreen = 0x00000200, 25 | GreenHeld = 0x00000400, 26 | TenToGo = 0x00000800, 27 | FiveToGo = 0x00001000, 28 | RandomWaving = 0x00002000, 29 | Caution = 0x00004000, 30 | CautionWaving = 0x00008000, 31 | 32 | Black = 0x00010000, 33 | Disqualify = 0x00020000, 34 | Servicible = 0x00040000, // car is allowed service (not a flag) 35 | Furled = 0x00080000, 36 | Repair = 0x00100000, 37 | 38 | StartHidden = 0x10000000, 39 | StartReady = 0x20000000, 40 | StartSet = 0x40000000, 41 | StartGo = 0x80000000, 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /iRacingSdkWrapper/Drivers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using iRacingSdkWrapper; 7 | using iRacingSdkWrapper.Bitfields; 8 | 9 | namespace iRacingSdkWrapper 10 | { 11 | /// 12 | /// Represents a driver in the current session. 13 | /// 14 | public class Driver 15 | { 16 | public Driver() 17 | { 18 | } 19 | 20 | /// 21 | /// The identifier (CarIdx) of this driver (unique to this session) 22 | /// 23 | public int Id { get; set; } 24 | 25 | /// 26 | /// The current position of the driver 27 | /// 28 | public int Position { get; set; } 29 | 30 | /// 31 | /// The name of the driver 32 | /// 33 | public string Name { get; set; } 34 | 35 | /// 36 | /// The customer ID (custid) of the driver, used to identify GoT drivers. 37 | /// 38 | public int CustomerId { get; set; } 39 | 40 | /// 41 | /// The car number of this driver 42 | /// 43 | public string Number { get; set; } 44 | 45 | /// 46 | /// A unique identifier for the car class this driver is using 47 | /// 48 | public int ClassId { get; set; } 49 | 50 | /// 51 | /// The name of the car of this driver 52 | /// 53 | public string CarPath { get; set; } 54 | 55 | /// 56 | /// The relative speed of this class in a multiclass session 57 | /// 58 | public int CarClassRelSpeed { get; set; } 59 | 60 | /// 61 | /// Used to determine if a driver is in the pits, off or on track 62 | /// 63 | public TrackSurfaces TrackSurface { get; set; } 64 | 65 | /// 66 | /// Whether or not the driver is currently in or approaching the pit stall 67 | /// 68 | public bool IsInPits 69 | { 70 | get { return this.TrackSurface == TrackSurfaces.AproachingPits || this.TrackSurface == TrackSurfaces.InPitStall; } 71 | } 72 | 73 | /// 74 | /// The lap this driver is currently in 75 | /// 76 | public int Lap { get; set; } 77 | 78 | /// 79 | /// The distance along the current lap of this driver (in percentage) 80 | /// 81 | public float LapDistance { get; set; } 82 | 83 | /// 84 | /// The relative distance between you and this driver (in percentage). 85 | /// 86 | public float RelativeLapDistance { get; set; } 87 | 88 | /// 89 | /// The fastest lap time of this driver 90 | /// 91 | public float FastestLapTime { get; set; } 92 | 93 | /// 94 | /// The last lap time of this driver 95 | /// 96 | public float LastLapTime { get; set; } 97 | 98 | /// 99 | /// The iRating of this driver 100 | /// 101 | public int Rating { get; set; } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /iRacingSdkWrapper/Enums.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace iRacingSdkWrapper 7 | { 8 | public enum TrackSurfaces 9 | { 10 | NotInWorld = -1, 11 | OffTrack, 12 | InPitStall, 13 | AproachingPits, 14 | OnTrack 15 | } 16 | 17 | public enum SessionStates 18 | { 19 | Invalid, 20 | GetInCar, 21 | Warmup, 22 | ParadeLaps, 23 | Racing, 24 | Checkered, 25 | CoolDown 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /iRacingSdkWrapper/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("iRacingSdkWrapper")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("iRacingSdkWrapper")] 13 | [assembly: AssemblyCopyright("Copyright © 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("cd8abd82-04f7-4757-b479-7cd2d0f2572b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /iRacingSdkWrapper/Readme.md: -------------------------------------------------------------------------------- 1 | iRacingSdkWrapper 2 | ================= 3 | 4 | Created by Nick Thissen 5 | http://members.iracing.com/jforum/posts/list/1826390.page 6 | 7 | Modified by Mark Silverwood for the iRduino application. 8 | -------------------------------------------------------------------------------- /iRacingSdkWrapper/TelemetryValue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using iRSDKSharp; 6 | using iRacingSdkWrapper.Bitfields; 7 | 8 | namespace iRacingSdkWrapper 9 | { 10 | public abstract class TelemetryValue 11 | { 12 | protected TelemetryValue(iRSDKSharp.iRacingSDK sdk, string name) 13 | { 14 | if (sdk == null) throw new ArgumentNullException("sdk"); 15 | if (!sdk.VarHeaders.ContainsKey(name)) 16 | throw new ArgumentException("No telemetry value with the specified name exists."); 17 | 18 | 19 | var header = sdk.VarHeaders[name]; 20 | _Name = name; 21 | _Description = header.Desc; 22 | _Unit = header.Unit; 23 | } 24 | 25 | private readonly string _Name; 26 | /// 27 | /// The name of this telemetry value parameter. 28 | /// 29 | public string Name { get { return _Name; } } 30 | 31 | private readonly string _Description; 32 | /// 33 | /// The description of this parameter. 34 | /// 35 | public string Description { get { return _Description; } } 36 | 37 | private readonly string _Unit; 38 | /// 39 | /// The real world unit for this parameter. 40 | /// 41 | public string Unit { get { return _Unit; } } 42 | 43 | public abstract object GetValue(); 44 | } 45 | 46 | /// 47 | /// Represents a telemetry parameter of the specified type. 48 | /// 49 | /// The .NET type of this parameter (int, char, float, double, bool, or arrays) 50 | public sealed class TelemetryValue : TelemetryValue 51 | { 52 | public TelemetryValue(iRSDKSharp.iRacingSDK sdk, string name) 53 | : base(sdk, name) 54 | { 55 | this.GetData(sdk); 56 | } 57 | 58 | private void GetData(iRacingSDK sdk) 59 | { 60 | var data = sdk.GetData(this.Name); 61 | 62 | var type = typeof (T); 63 | if (type.BaseType != null && type.BaseType.IsGenericType && type.BaseType.GetGenericTypeDefinition() == typeof(BitfieldBase<>)) 64 | { 65 | _Value = (T) Activator.CreateInstance(type, new [] {data}); 66 | } 67 | else 68 | { 69 | _Value = (T) data; 70 | } 71 | } 72 | 73 | private T _Value; 74 | /// 75 | /// The value of this parameter. 76 | /// 77 | public T Value { get { return _Value; } } 78 | 79 | public override object GetValue() 80 | { 81 | return this.Value; 82 | } 83 | 84 | public override string ToString() 85 | { 86 | return string.Format("{0} {1}", this.Value, this.Unit); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /iRacingSdkWrapper/iRacingSdkWrapper.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {D6DB568B-35B3-49EB-8CB3-E4E5F1424247} 9 | Library 10 | Properties 11 | iRacingSdkWrapper 12 | iRacingSdkWrapper 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | ManagedMinimumRules.ruleset 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | {72631B85-EB9A-473E-9B4C-65B355A9000D} 59 | iRSDKSharp 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /iRacingSdkWrapper/iracingvars.csv: -------------------------------------------------------------------------------- 1 | Name,Desc,Unit,Type,Length 2 | SessionTime,Seconds since session start,s,double,1 3 | SessionNum,Session number,,int,1 4 | SessionState,Session state,irsdk_SessionState,int,1 5 | SessionUniqueID,Session ID,,int,1 6 | SessionFlags,Session flags,irsdk_Flags,bitfield,1 7 | DriverMarker,Driver activated flag,,bool,1 8 | IsReplayPlaying,0=replay not playing 1=replay playing,,bool,1 9 | ReplayFrameNum,Integer replay frame number (60 per second),,int,1 10 | CarIdxLap,Lap count by car index,,int,64 11 | CarIdxLapDistPct,Percentage distance around lap by car index,%,float,64 12 | CarIdxTrackSurface,Track surface type by car index,irsdk_TrkLoc,int,64 13 | CarIdxSteer,Steering wheel angle by car index,rad,float,64 14 | CarIdxRPM,Engine rpm by car index,revs/min,float,64 15 | CarIdxGear,-1=reverse 0=neutral 1..n=current gear by car index,,int,64 16 | SteeringWheelAngle,Steering wheel angle,rad,float,1 17 | Throttle,0=off throttle to 1=full throttle,%,float,1 18 | Brake,0=brake released to 1=max pedal force,%,float,1 19 | Clutch,0=disengaged to 1=fully engaged,%,float,1 20 | Gear,-1=reverse 0=neutral 1..n=current gear,,int,1 21 | RPM,Engine rpm,revs/min,float,1 22 | Lap,Lap count,,int,1 23 | LapDist,Meters traveled from S/F this lap,m,float,1 24 | LapDistPct,Percentage distance around lap,%,float,1 25 | RaceLaps,Laps completed in race,,int,1 26 | LongAccel,Longitudinal acceleration (including gravity),m/s^2,float,1 27 | LatAccel,Lateral acceleration (including gravity),m/s^2,float,1 28 | VertAccel,Vertical acceleration (including gravity),m/s^2,float,1 29 | RollRate,Roll rate,rad/s,float,1 30 | PitchRate,Pitch rate,rad/s,float,1 31 | YawRate,Yaw rate,rad/s,float,1 32 | Speed,GPS vehicle speed,m/s,float,1 33 | VelocityX,X velocity,m/s,float,1 34 | VelocityY,Y velocity,m/s,float,1 35 | VelocityZ,Z velocity,m/s,float,1 36 | Yaw,Yaw orientation,rad,float,1 37 | Pitch,Pitch orientation,rad,float,1 38 | Roll,Roll orientation,rad,float,1 39 | CamCarIdx,Active camera's focus car index,,int,1 40 | CamCameraNumber,Active camera number,,int,1 41 | CamGroupNumber,Active camera group number,,int,1 42 | CamCameraState,State of camera system,irsdk_CameraState,bitfield,1 43 | IsOnTrack,1=Car on track physics running,,bool,1 44 | IsInGarage,1=Car in garage physics running,,bool,1 45 | SteeringWheelTorque,Output torque on steering shaft,N*m,float,1 46 | SteeringWheelPctTorque,Force feedback % max torque on steering shaft,%,float,1 47 | ShiftIndicatorPct,Percent of shift indicator to light up,%,float,1 48 | EngineWarnings,Bitfield for warning lights,irsdk_EngineWarnings,bitfield,1 49 | FuelLevel,Liters of fuel remaining,l,float,1 50 | FuelLevelPct,Percent fuel remaining,%,float,1 51 | ReplayPlaySpeed,Replay playback speed,,int,1 52 | ReplayPlaySlowMotion,0=not slow motion 1=replay is in slow motion,,bool,1 53 | ReplaySessionTime,Seconds since replay session start,s,double,1 54 | ReplaySessionNum,Replay session number,,int,1 55 | WaterTemp,Engine coolant temp,C,float,1 56 | WaterLevel,Engine coolant level,l,float,1 57 | FuelPress,Engine fuel pressure,bar,float,1 58 | OilTemp,Engine oil temperature,C,float,1 59 | OilPress,Engine oil pressure,bar,float,1 60 | OilLevel,Engine oil level,l,float,1 61 | Voltage,Engine voltage,V,float,1 62 | -------------------------------------------------------------------------------- /iRacingSdkWrapper/sessioninfo_example.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRacingSdkWrapper/sessioninfo_example.txt -------------------------------------------------------------------------------- /iRduino Development Guide v1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino Development Guide v1.pdf -------------------------------------------------------------------------------- /iRduino.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArduinoInterfaces", "ArduinoInterfaces\ArduinoInterfaces.csproj", "{00583770-D937-40CD-BDCC-B1692D74D392}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iRacingSdkWrapper", "iRacingSdkWrapper\iRacingSdkWrapper.csproj", "{D6DB568B-35B3-49EB-8CB3-E4E5F1424247}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iRduino", "iRduino\iRduino.csproj", "{1EC172EA-586B-471D-B94A-C175F38C48C0}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iRSDKSharp", "irsdkSharp\iRSDKSharp.csproj", "{72631B85-EB9A-473E-9B4C-65B355A9000D}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftData", "ShiftData\ShiftData.csproj", "{E00EE3A4-6BAD-469B-9CA0-F829C37C3A2F}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyIconWpf", "nicon\NotifyIconWpf.csproj", "{7AC63864-7638-41C4-969C-D3197EF2BED9}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Any CPU = Debug|Any CPU 21 | Release|Any CPU = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {00583770-D937-40CD-BDCC-B1692D74D392}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {00583770-D937-40CD-BDCC-B1692D74D392}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {00583770-D937-40CD-BDCC-B1692D74D392}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {00583770-D937-40CD-BDCC-B1692D74D392}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {D6DB568B-35B3-49EB-8CB3-E4E5F1424247}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {D6DB568B-35B3-49EB-8CB3-E4E5F1424247}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {D6DB568B-35B3-49EB-8CB3-E4E5F1424247}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {D6DB568B-35B3-49EB-8CB3-E4E5F1424247}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {1EC172EA-586B-471D-B94A-C175F38C48C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {1EC172EA-586B-471D-B94A-C175F38C48C0}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {1EC172EA-586B-471D-B94A-C175F38C48C0}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {1EC172EA-586B-471D-B94A-C175F38C48C0}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {72631B85-EB9A-473E-9B4C-65B355A9000D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {72631B85-EB9A-473E-9B4C-65B355A9000D}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {72631B85-EB9A-473E-9B4C-65B355A9000D}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {72631B85-EB9A-473E-9B4C-65B355A9000D}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {E00EE3A4-6BAD-469B-9CA0-F829C37C3A2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {E00EE3A4-6BAD-469B-9CA0-F829C37C3A2F}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {E00EE3A4-6BAD-469B-9CA0-F829C37C3A2F}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {E00EE3A4-6BAD-469B-9CA0-F829C37C3A2F}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {7AC63864-7638-41C4-969C-D3197EF2BED9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {7AC63864-7638-41C4-969C-D3197EF2BED9}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {7AC63864-7638-41C4-969C-D3197EF2BED9}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {7AC63864-7638-41C4-969C-D3197EF2BED9}.Release|Any CPU.Build.0 = Release|Any CPU 48 | EndGlobalSection 49 | GlobalSection(SolutionProperties) = preSolution 50 | HideSolutionNode = FALSE 51 | EndGlobalSection 52 | EndGlobal 53 | -------------------------------------------------------------------------------- /iRduino/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /iRduino/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /iRduino/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace iRduino 4 | { 5 | /// 6 | /// Interaction logic for App.xaml 7 | /// 8 | public partial class App : Application 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /iRduino/ArduinoTemplates/ArduinoSketchT4Code.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | namespace iRduino.ArduinoTemplates 5 | { 6 | using iRduino.Classes; 7 | 8 | partial class ArduinoSketchT4 9 | { 10 | private readonly ConfigurationOptions configurationOptions; 11 | private readonly ArduinoPins pins; 12 | public ArduinoSketchT4(ConfigurationOptions configurationOptions, ArduinoPins pins) 13 | { 14 | this.configurationOptions = configurationOptions; 15 | this.pins = pins; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /iRduino/ArduinoTemplates/SampleArduinoSketch.ino: -------------------------------------------------------------------------------- 1 | /* 2 | iRduino - Arduino Sketch 3 | Author: Mark Silverwood 4 | 5 | Using TM1638 library from Ricardo Batista 6 | 7 | This Arduino Sketch interfaces to the iRduino windows application. 8 | This Sketch was generated on: 2/13/2013 9 | This Sketch is for a double (2) Display Unit Configuration 10 | 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | //////Setup Here 17 | #define dataPin 4 18 | #define clockPin 3 19 | #define strobePin1 2 20 | #define TM1640dataPin2 1 21 | #define TM1640clockPin2 0 22 | #define NumberUnits 2 23 | #define NumberTM1638Units 1 24 | //////Setup Finished 25 | 26 | #define startByte1 255 27 | #define startByte2 37 28 | #define endByte 180 29 | #define messageLength 33 30 | 31 | TM1638 module1(dataPin,clockPin,strobePin1,false,0); 32 | TM1640 module2(TM1640dataPin2,TM1640clockPin2,false,0); 33 | 34 | //// Variable Declarations 35 | word leds; 36 | byte segments[8], TM1640segments[16], redLeds, greenLeds, intensity, unit, sum, i, readCount, checkerPosition; 37 | byte buttons[NumberTM1638Units], oldbuttons[NumberTM1638Units], lastButtonSend[NumberTM1638Units]; 38 | long lastCheck, debounceDelay = 100; 39 | boolean sendButtons = false; 40 | byte messageHolder[messageLength], message[messageLength-4], messagePosition = -1; 41 | 42 | void setup() { 43 | Serial.begin(0); 44 | for(int u = 0; u < NumberTM1638Units; u++) 45 | { 46 | oldbuttons[u] = 0; 47 | } 48 | intensity = 0; 49 | lastCheck = millis(); 50 | } 51 | 52 | void loop() { 53 | buttonsCheck(); 54 | if (Serial.available() > 0){ 55 | messagePosition++; 56 | if(messagePosition == messageLength) messagePosition = 0; 57 | messageHolder[messagePosition] = Serial.read(); 58 | messageChecker(); 59 | } 60 | } 61 | 62 | void messageChecker() 63 | { 64 | checkerPosition = (messagePosition == 0) ? messageLength-1 : messagePosition - 1; 65 | if(messageHolder[checkerPosition] != endByte) return; //end byte 66 | checkerPosition = (messagePosition == messageLength -1) ? 0 : messagePosition + 1; 67 | if(messageHolder[checkerPosition]!= startByte1) return; //start byte1 68 | checkerPosition = (checkerPosition == messageLength - 1) ? 0 : checkerPosition+1; 69 | if(messageHolder[checkerPosition]!= startByte2) return; // start byte 2 70 | checkerPosition++; 71 | readCount = 0; 72 | sum = 0; 73 | while (readCount < messageLength-4) 74 | { 75 | if(checkerPosition == messageLength) checkerPosition = 0; 76 | message[readCount] = messageHolder[checkerPosition]; 77 | sum += messageHolder[checkerPosition]; 78 | readCount++; 79 | checkerPosition++; 80 | } 81 | if(sum == messageHolder[messagePosition]) messageRead(message); 82 | } 83 | 84 | void messageRead(byte _message[]){ 85 | i = 0; 86 | intensity = _message[i++]; 87 | for(int u = 1; u <= NumberUnits; u++) 88 | { 89 | unit = _message[i++]; 90 | if(u==2) 91 | { 92 | for(int x = 0;x<16;x++){ 93 | TM1640segments[x] = _message[i++]; 94 | } 95 | updateDisplay(unit,word(0,0),TM1640segments,intensity); 96 | } 97 | else 98 | { 99 | greenLeds = _message[i++]; 100 | redLeds = _message[i++]; 101 | for(int x = 0;x<8;x++){ 102 | segments[x] = _message[i++]; 103 | } 104 | updateDisplay(unit,word(greenLeds,redLeds),segments,intensity); 105 | } 106 | } 107 | } 108 | 109 | void buttonsCheck(){ 110 | if ((millis() - lastCheck) SerialSpeeds = new List {9600, 14400, 19200, 28800, 38400, 57600, 115200 }; 13 | 14 | internal static List RefreshRates = new List { 30, 15, 10, 5, 1 }; 15 | 16 | public static int ParseSerialSpeedString(string input) 17 | { 18 | int temp; 19 | int.TryParse(input, out temp); 20 | foreach (var speed in SerialSpeeds) 21 | { 22 | if (speed == temp) 23 | { 24 | return speed; 25 | } 26 | } 27 | return SerialSpeeds[SerialSpeeds.Count - 1]; 28 | } 29 | 30 | public static int ParseRefreshRatesString(string input) 31 | { 32 | int temp; 33 | int.TryParse(input, out temp); 34 | foreach (var refresh in RefreshRates) 35 | { 36 | if (refresh == temp) 37 | { 38 | return refresh; 39 | } 40 | } 41 | return RefreshRates[0]; 42 | } 43 | 44 | public static int CalculateRecommendSerialSpeed(int displayRefreshRate, int ledRefreshRate, int numberTM1638, int numberTM1640) 45 | { 46 | //calculate message length 47 | var messageBytes = displayRefreshRate 48 | * ((Constants.MessageFooterLength + Constants.MessageHeaderLength 49 | + Constants.TM1638MessageLength) * numberTM1638 50 | + (Constants.MessageFooterLength + Constants.MessageHeaderLength 51 | + Constants.TM1640MessageLength) * numberTM1640) + ledRefreshRate * ((Constants.MessageFooterLength + Constants.MessageHeaderLength 52 | + Constants.TM1638LEDMessageLength) * numberTM1638); 53 | //calculate mininum speed required 54 | double minSpeedDouble = messageBytes * 1.2f * 8 * 2f; //100% extra overhead 55 | var minSpeed = Convert.ToInt32(minSpeedDouble); 56 | //select from SerialSpeeds 57 | foreach (var speed in SerialSpeeds) 58 | { 59 | if (speed >= minSpeed) 60 | { 61 | return speed; 62 | } 63 | } 64 | return SerialSpeeds[SerialSpeeds.Count - 1]; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /iRduino/Classes/ArduinoMessagesReceiving.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace iRduino.Classes 5 | { 6 | using System.Collections; 7 | 8 | using ArduinoInterfaces; 9 | 10 | public class ArduinoMessagesReceiving 11 | { 12 | private BitArray buttons; 13 | private int buttonsRead; 14 | private int numberUnits = 1; 15 | private readonly byte[] butByte = new byte[1]; 16 | private List tm1640Units; 17 | 18 | public event ButtonPressEventHandler ButtonPress; 19 | public delegate void ButtonPressEventHandler(int unit, int button); 20 | 21 | public void UpdateInternalVariables(List tm1640UnitsIn, int numberUnitsIn) 22 | { 23 | if (tm1640UnitsIn != null) 24 | { 25 | this.tm1640Units = tm1640UnitsIn; 26 | } 27 | this.numberUnits = numberUnitsIn; 28 | } 29 | 30 | public void SerialMessageReceiver(int[] message) 31 | { 32 | switch (message[0]) 33 | { 34 | case 55: TM1638ButtonsMessageReader(message); 35 | break; 36 | } 37 | } 38 | 39 | private void TM1638ButtonsMessageReader(IList messageData) 40 | { 41 | int readPos = 1; 42 | for (int u = 1; u <= this.numberUnits; u++) 43 | { 44 | if (this.tm1640Units[u - 1]) 45 | { 46 | continue; 47 | } 48 | this.buttonsRead = messageData[readPos++]; 49 | if (this.buttonsRead != -1) 50 | { 51 | this.butByte[0] = Convert.ToByte(this.buttonsRead); 52 | this.buttons = new BitArray(this.butByte); 53 | for (var i = 0; i < Constants.NumberButtonsOnTm1638; i++) 54 | { 55 | if (this.buttons[i]) 56 | { 57 | if (this.ButtonPress == null) throw new ArgumentNullException(); 58 | ButtonPressEventHandler temp = this.ButtonPress; 59 | if (temp != null) 60 | { 61 | temp(u, i+1); 62 | } 63 | } 64 | } 65 | } 66 | } 67 | } 68 | 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /iRduino/Classes/ArduinoSketch.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | namespace iRduino.Classes 5 | { 6 | using System.IO; 7 | using System.Windows; 8 | using System; 9 | using System.Collections.Generic; 10 | using Microsoft.Win32; 11 | 12 | using iRduino.ArduinoTemplates; 13 | 14 | public class ArduinoPins 15 | { 16 | public int DataPin; 17 | 18 | public int ClockPin; 19 | 20 | public List UnitStrobePins; 21 | 22 | public List TM1640DataPins; 23 | 24 | public List TM1640ClockPins; 25 | } 26 | 27 | public class ArduinoSketch 28 | { 29 | 30 | public static void GenerateSketch(ConfigurationOptions configurationOptions, ArduinoPins pins) 31 | { 32 | string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) 33 | + "\\iRduino\\"; 34 | // Configure save file dialog box 35 | var dlg = new SaveFileDialog 36 | { 37 | FileName = configurationOptions.Name, 38 | DefaultExt = ".ino", 39 | InitialDirectory = documentsPath, 40 | Filter = "Arduino Sketch (.ino)|*.ino" 41 | }; 42 | 43 | // Show save file dialog box 44 | bool? result = dlg.ShowDialog(); 45 | 46 | // Process save file dialog box results 47 | if (result != true) return; 48 | // Save document 49 | string fileLocation = dlg.FileName; 50 | int startOfName = fileLocation.LastIndexOf("\\", StringComparison.Ordinal); 51 | int startOfExtension = fileLocation.LastIndexOf('.'); 52 | if (startOfName < startOfExtension) 53 | { 54 | string name = fileLocation.Substring(startOfName+1,startOfExtension-startOfName-1); 55 | if (name.Length < startOfName - 1) 56 | { 57 | if (fileLocation.Substring(startOfName - name.Length, name.Length) != name) 58 | { 59 | //directory not valid 60 | fileLocation = fileLocation.Insert(startOfName + 1, String.Format("{0}\\",name)); 61 | } 62 | 63 | } 64 | } 65 | 66 | FileInfo file = new FileInfo(fileLocation); 67 | if (file.Directory != null) 68 | { 69 | file.Directory.Create(); // If the directory already exists, this method does nothing. 70 | } 71 | 72 | ArduinoSketchT4 sketch = new ArduinoSketchT4(configurationOptions, pins); 73 | String sketchContent = sketch.TransformText(); 74 | File.WriteAllText(fileLocation, sketchContent); 75 | 76 | MessageBox.Show("Finished Saving Arduino Sketch"); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /iRduino/Classes/ControllerDevice.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | 5 | namespace iRduino.Classes 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Windows.Forms; 11 | using SlimDX; 12 | using SlimDX.DirectInput; 13 | 14 | public class ControllerDevice : IDisposable 15 | { 16 | public int ButtonCount; 17 | public Guid Guid; 18 | public string Name; 19 | public Joystick Pad; 20 | public JoystickState State; 21 | 22 | public void Dispose() 23 | { 24 | Dispose(true); 25 | GC.SuppressFinalize(this); 26 | } 27 | protected virtual void Dispose(bool disposing) 28 | { 29 | if (disposing) 30 | if (Pad != null) 31 | { 32 | Pad.Dispose(); 33 | Pad = null; 34 | } 35 | } 36 | ~ControllerDevice() 37 | { 38 | Dispose(false); 39 | } 40 | public void Acquire(Form parent) 41 | { 42 | var dinput = new DirectInput(); 43 | 44 | Pad = new Joystick(dinput, Guid); 45 | foreach (DeviceObjectInstance doi in Pad.GetObjects(ObjectDeviceType.Axis)) 46 | { 47 | Pad.GetObjectPropertiesById((int) doi.ObjectType).SetRange(-5000, 5000); 48 | } 49 | 50 | Pad.Properties.AxisMode = DeviceAxisMode.Absolute; 51 | Pad.SetCooperativeLevel(parent, (CooperativeLevel.Nonexclusive | CooperativeLevel.Background)); 52 | ButtonCount = Pad.Capabilities.ButtonCount; 53 | Pad.Acquire(); 54 | } 55 | 56 | public List GetButtons() 57 | { 58 | if (Pad.Acquire().IsFailure) 59 | return null; 60 | 61 | if (Pad.Poll().IsFailure) 62 | return null; 63 | 64 | State = Pad.GetCurrentState(); 65 | if (Result.Last.IsFailure) 66 | return null; 67 | 68 | var answer = new List(); 69 | 70 | bool[] buttons = State.GetButtons(); 71 | for (int b = 0; b < buttons.Length; b++) 72 | { 73 | if (buttons[b]) 74 | answer.Add(b); 75 | } 76 | return answer; 77 | } 78 | 79 | public static IList Available() 80 | { 81 | var dinput = new DirectInput(); 82 | return 83 | dinput.GetDevices(DeviceClass.GameController, DeviceEnumerationFlags.AttachedOnly) 84 | .Select(di => new ControllerDevice {Guid = di.InstanceGuid, Name = di.InstanceName}) 85 | .ToList(); 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /iRduino/Classes/Dictionarys.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | 5 | namespace iRduino.Classes 6 | { 7 | using System.Collections.Generic; 8 | 9 | /// 10 | /// Container class for all the Dictionaries used in the Application 11 | /// 12 | public class Dictionarys 13 | { 14 | public Dictionary ButtonFunctions; 15 | 16 | public Dictionary ComPorts = new Dictionary 17 | { 18 | {0, "COM1"}, 19 | {1, "COM2"}, 20 | {2, "COM3"}, 21 | {3, "COM4"}, 22 | {4, "COM5"}, 23 | {5, "COM6"}, 24 | {6, "COM7"}, 25 | {7, "COM8"}, 26 | {8, "COM9"}, 27 | {9, "COM10"}, 28 | {10, "COM11"}, 29 | {11, "COM12"}, 30 | {12, "COM13"}, 31 | {13, "COM14"}, 32 | {14, "COM15"}, 33 | {15, "COM16"}, 34 | {16, "COM17"}, 35 | {17, "COM18"}, 36 | {18, "COM19"}, 37 | {19, "COM20"}, 38 | {20, "COM21"}, 39 | {21, "COM22"}, 40 | {22, "COM23"}, 41 | {23, "COM24"}, 42 | {24, "COM25"}, 43 | {25, "COM26"}, 44 | {26, "COM27"}, 45 | {27, "COM28"}, 46 | {28, "COM29"}, 47 | {29, "COM30"}, 48 | {30, "COM31"}, 49 | {31, "COM32"} 50 | }; 51 | 52 | public Dictionary WarningTypes = new Dictionary 53 | { 54 | {"Text Only",WarningTypesEnum.Text}, 55 | {"Lights Only",WarningTypesEnum.Lights}, 56 | {"Both Lights and Text",WarningTypesEnum.Both} 57 | }; 58 | 59 | public Dictionary DisplayVariables; 60 | public Dictionary LapDisplayStyles; 61 | public Dictionary PitFlashSpeeds; 62 | public Dictionary PitFlashStyles; 63 | public Dictionary PitStyles; 64 | public Dictionary RPMStyles; 65 | public Dictionary RevFlashStyles; 66 | public Dictionary RevLimStyles; 67 | public Dictionary ShiftStyles; 68 | public Dictionary MatchCarShiftOptions; 69 | public Dictionary DeltaLightsPositionOptions; 70 | 71 | public Dictionarys() 72 | { 73 | this.ButtonFunctions = ButtonFunctionsClass.FillButtonFunctions(); 74 | this.DisplayVariables = DisplayVariablesClass.FillDisplayVariables(); 75 | LEDs.LEDUserInterfaceNames(out this.ShiftStyles, out this.PitFlashStyles, out this.RevFlashStyles, out this.PitFlashSpeeds, out this.MatchCarShiftOptions, out this.DeltaLightsPositionOptions); 76 | this.RPMStyles = LEDs.FillRPMStyles(); 77 | this.PitStyles = LEDs.FillPitStyles(); 78 | this.RevLimStyles = LEDs.FillRevLimStyles(); 79 | this.LapDisplayStyles = LapDisplays.LapDisplayStylesFill(); 80 | } 81 | 82 | } 83 | } -------------------------------------------------------------------------------- /iRduino/Classes/ErrorReporting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace iRduino.Classes 4 | { 5 | using iRduino.Windows; 6 | 7 | class ErrorReporting 8 | { 9 | public static void MyHandler(object sender, UnhandledExceptionEventArgs args) 10 | { 11 | Exception e = (Exception)args.ExceptionObject; 12 | if (e.Source != "iRacingSdkWrapper") 13 | { 14 | #if !DEBUG 15 | string error = 16 | String.Format( 17 | "{0}\n{1}\n{2}\n{3}", 18 | e.Message, 19 | e.Source, 20 | e.TargetSite, 21 | e.StackTrace); 22 | ErrorWindow window = new ErrorWindow(error); 23 | window.ShowDialog(); 24 | #endif 25 | } 26 | } 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iRduino/Classes/OptionPages.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | 5 | namespace iRduino.Classes 6 | { 7 | using System; 8 | using System.Globalization; 9 | using System.Reflection; 10 | using System.Xml; 11 | 12 | public enum PageTypes 13 | { 14 | Configuration, 15 | CurrentConfiguration, 16 | AdvancedOptions, 17 | TMUnits, 18 | Unit, 19 | Buttons, 20 | LEDs, 21 | Screen, 22 | TM1640Screen, 23 | JoystickButtons, 24 | Arduino, 25 | FergoTech, 26 | DigitalInputs, 27 | DigitalOutputs, 28 | Expander, 29 | Blank, 30 | None 31 | } 32 | 33 | class OptionPages 34 | { 35 | public static Version GetPublishedVersion() 36 | { 37 | XmlDocument xmlDoc = new XmlDocument(); 38 | Assembly asmCurrent = Assembly.GetExecutingAssembly(); 39 | string executePath = new Uri(asmCurrent.GetName().CodeBase).LocalPath; 40 | 41 | xmlDoc.Load(executePath + ".manifest"); 42 | string retval = string.Empty; 43 | if (xmlDoc.HasChildNodes) 44 | { 45 | var attributes = xmlDoc.ChildNodes[1].ChildNodes[0].Attributes; 46 | if (attributes != null) 47 | { 48 | retval = attributes.GetNamedItem("version").Value.ToString(CultureInfo.InvariantCulture); 49 | } 50 | } 51 | return new Version(retval); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /iRduino/Classes/ShiftLightData.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | 5 | namespace iRduino.Classes 6 | { 7 | using System.IO; 8 | using System.Xml.Serialization; 9 | 10 | public class ShiftLightData 11 | { 12 | public static ShiftData LoadShiftData(string path) 13 | { 14 | var xRoot = new XmlRootAttribute { ElementName = "ShiftData", IsNullable = true }; 15 | var ser = new XmlSerializer(typeof(ShiftData),xRoot); 16 | return ser.Deserialize(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) as ShiftData; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /iRduino/Commands/ShowMainWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using System.Windows; 7 | using System.Windows.Input; 8 | 9 | namespace iRduino.Commands 10 | { 11 | 12 | public class ShowMainWindow : CommandBase 13 | { 14 | public override void Execute(object parameter) 15 | { 16 | GetTaskbarWindow(parameter).Show(); 17 | GetTaskbarWindow(parameter).WindowState = WindowState.Normal; 18 | CommandManager.InvalidateRequerySuggested(); 19 | } 20 | 21 | 22 | public override bool CanExecute(object parameter) 23 | { 24 | 25 | return true; 26 | //Window win = GetTaskbarWindow(parameter); 27 | //return win != null && !win.IsVisible; 28 | 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /iRduino/MahApps.Metro/Entypo-license.txt: -------------------------------------------------------------------------------- 1 | Entypo (http://www.entypo.com/) is created by Daniel Bruce and released under the Creative Commons, Share Alike/Attribution license. 2 | 3 | http://creativecommons.org/licenses/by-sa/3.0/ -------------------------------------------------------------------------------- /iRduino/MahApps.Metro/Information.txt: -------------------------------------------------------------------------------- 1 | http://mahapps.com/MahApps.Metro/ 2 | https://github.com/MahApps/MahApps.Metro -------------------------------------------------------------------------------- /iRduino/MahApps.Metro/MahApps.Metro.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/MahApps.Metro/MahApps.Metro.dll -------------------------------------------------------------------------------- /iRduino/MahApps.Metro/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/MahApps.Metro/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /iRduino/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | using System.Resources; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | 10 | [assembly: AssemblyTitle("iRduino")] 11 | [assembly: 12 | AssemblyDescription( 13 | "An application for interfacing with iRacing's API to an Arduino board.")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("Mark Silverwood")] 16 | [assembly: AssemblyProduct("iRduino")] 17 | [assembly: AssemblyCopyright("Copyright © 2013")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // Setting ComVisible to false makes the types in this assembly not visible 22 | // to COM components. If you need to access a type in this assembly from 23 | // COM, set the ComVisible attribute to true on that type. 24 | 25 | [assembly: ComVisible(false)] 26 | 27 | //In order to begin building localizable applications, set 28 | //CultureYouAreCodingWith in your .csproj file 29 | //inside a . For example, if you are using US english 30 | //in your source files, set the to en-US. Then uncomment 31 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 32 | //the line below to match the UICulture setting in the project file. 33 | 34 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 35 | 36 | 37 | [assembly: ThemeInfo( 38 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 39 | //(used if a resource is not found in the page, 40 | // or application resource dictionaries) 41 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 42 | //(used if a resource is not found in the page, 43 | // app, or any theme specific resource dictionaries) 44 | )] 45 | 46 | 47 | // Version information for an assembly consists of the following four values: 48 | // 49 | // Major Version 50 | // Minor Version 51 | // Build Number 52 | // Revision 53 | // 54 | // You can specify all the values or you can default the Build and Revision Numbers 55 | // by using the '*' as shown below: 56 | // [assembly: AssemblyVersion("1.0.*")] 57 | 58 | [assembly: AssemblyVersion("1.8.5.1")] 59 | [assembly: AssemblyFileVersion("1.8.5.1")] 60 | [assembly: NeutralResourcesLanguageAttribute("en-GB")] -------------------------------------------------------------------------------- /iRduino/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17929 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace iRduino.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /iRduino/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iRduino/Resources/Configuration-Settings-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/Configuration-Settings-icon.png -------------------------------------------------------------------------------- /iRduino/Resources/Entypo.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/Entypo.ttf -------------------------------------------------------------------------------- /iRduino/Resources/ErrorBig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/ErrorBig.png -------------------------------------------------------------------------------- /iRduino/Resources/Motorsport-Helmet.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/Motorsport-Helmet.ico -------------------------------------------------------------------------------- /iRduino/Resources/MyTabStyle.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 61 | -------------------------------------------------------------------------------- /iRduino/Resources/appbar.close32W.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/appbar.close32W.png -------------------------------------------------------------------------------- /iRduino/Resources/appbar.cog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/appbar.cog.png -------------------------------------------------------------------------------- /iRduino/Resources/appbar.control.play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/appbar.control.play.png -------------------------------------------------------------------------------- /iRduino/Resources/appbar.control.stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/appbar.control.stop.png -------------------------------------------------------------------------------- /iRduino/Resources/appbar.information.circle32W.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/appbar.information.circle32W.png -------------------------------------------------------------------------------- /iRduino/Resources/appbar.lifesaver32W.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/appbar.lifesaver32W.png -------------------------------------------------------------------------------- /iRduino/Resources/appbar.minus32W.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/appbar.minus32W.png -------------------------------------------------------------------------------- /iRduino/Resources/arduinoTemp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/arduinoTemp.png -------------------------------------------------------------------------------- /iRduino/Resources/arrow_divide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/arrow_divide.png -------------------------------------------------------------------------------- /iRduino/Resources/arrow_inout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/arrow_inout.png -------------------------------------------------------------------------------- /iRduino/Resources/arrow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/arrow_left.png -------------------------------------------------------------------------------- /iRduino/Resources/arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/arrow_right.png -------------------------------------------------------------------------------- /iRduino/Resources/brick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/brick.png -------------------------------------------------------------------------------- /iRduino/Resources/brickBlue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/brickBlue.png -------------------------------------------------------------------------------- /iRduino/Resources/bricks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/bricks.png -------------------------------------------------------------------------------- /iRduino/Resources/controller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/controller.png -------------------------------------------------------------------------------- /iRduino/Resources/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/error.png -------------------------------------------------------------------------------- /iRduino/Resources/ftTemp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/ftTemp.png -------------------------------------------------------------------------------- /iRduino/Resources/iRduino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/iRduino.png -------------------------------------------------------------------------------- /iRduino/Resources/iRduinoAbout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/iRduinoAbout.png -------------------------------------------------------------------------------- /iRduino/Resources/iRdunio-ICON.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/iRdunio-ICON.ico -------------------------------------------------------------------------------- /iRduino/Resources/iRdunio-Logo32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/iRdunio-Logo32.png -------------------------------------------------------------------------------- /iRduino/Resources/iRdunio-Logo64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/iRdunio-Logo64.png -------------------------------------------------------------------------------- /iRduino/Resources/joystick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/joystick.png -------------------------------------------------------------------------------- /iRduino/Resources/layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/layers.png -------------------------------------------------------------------------------- /iRduino/Resources/lightbulb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/lightbulb.png -------------------------------------------------------------------------------- /iRduino/Resources/lightbulb_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/lightbulb_off.png -------------------------------------------------------------------------------- /iRduino/Resources/octobrite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/octobrite.png -------------------------------------------------------------------------------- /iRduino/Resources/page_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/page_gear.png -------------------------------------------------------------------------------- /iRduino/Resources/picture_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/picture_empty.png -------------------------------------------------------------------------------- /iRduino/Resources/plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/plugin.png -------------------------------------------------------------------------------- /iRduino/Resources/script_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/script_gear.png -------------------------------------------------------------------------------- /iRduino/Resources/simwind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/simwind.png -------------------------------------------------------------------------------- /iRduino/Resources/wrench_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlicedSilver/iRduino/4607dadb57546fdf93d0befc7c2734e3700df400/iRduino/Resources/wrench_orange.png -------------------------------------------------------------------------------- /iRduino/Windows/AboutBox.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 32 | 33 | -------------------------------------------------------------------------------- /iRduino/Windows/AboutBox.xaml.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | 5 | namespace iRduino.Windows 6 | { 7 | using System.Reflection; 8 | using System; 9 | 10 | /// 11 | /// Interaction logic for AboutBox.xaml 12 | /// 13 | public partial class AboutBox 14 | { 15 | public AboutBox() 16 | { 17 | InitializeComponent(); 18 | VersionNumberLabel.Content = AssemblyVersion; 19 | BuildDateLabel.Content = RetrieveLinkerTimestamp().ToLongDateString(); 20 | } 21 | 22 | public string AssemblyVersion 23 | { 24 | get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); } 25 | } 26 | 27 | private static DateTime RetrieveLinkerTimestamp() 28 | { 29 | string filePath = Assembly.GetCallingAssembly().Location; 30 | const int CPeHeaderOffset = 60; 31 | const int CLinkerTimestampOffset = 8; 32 | var b = new byte[2048]; 33 | System.IO.Stream s = null; 34 | 35 | try 36 | { 37 | s = new System.IO.FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read); 38 | s.Read(b, 0, 2048); 39 | } 40 | finally 41 | { 42 | if (s != null) 43 | { 44 | s.Close(); 45 | } 46 | } 47 | 48 | int i = BitConverter.ToInt32(b, CPeHeaderOffset); 49 | int secondsSince1970 = BitConverter.ToInt32(b, i + CLinkerTimestampOffset); 50 | var dt = new DateTime(1970, 1, 1, 0, 0, 0); 51 | dt = dt.AddSeconds(secondsSince1970); 52 | dt = dt.AddHours(TimeZone.CurrentTimeZone.GetUtcOffset(dt).Hours); 53 | return dt; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /iRduino/Windows/ErrorWindow.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /iRduino/Windows/ErrorWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | 5 | namespace iRduino.Windows 6 | { 7 | /// 8 | /// Interaction logic for ErrorWindow.xaml 9 | /// 10 | public partial class ErrorWindow 11 | { 12 | public ErrorWindow(string errorText) 13 | { 14 | InitializeComponent(); 15 | ErrorTextBox.Text = errorText; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /iRduino/Windows/OptionsWindow.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 85 | -------------------------------------------------------------------------------- /iRduino/Windows/Pages/ConfigurationPage.xaml.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | 5 | namespace iRduino.Windows.Pages 6 | { 7 | /// 8 | /// Interaction logic for ConfigurationPage.xaml 9 | /// 10 | public partial class ConfigurationPage 11 | { 12 | public ConfigurationPage() 13 | { 14 | this.InitializeComponent(); 15 | } 16 | 17 | } 18 | } -------------------------------------------------------------------------------- /iRduino/Windows/Pages/CurrentConfiguration.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 39 | -------------------------------------------------------------------------------- /iRduino/Windows/Pages/CurrentConfiguration.xaml.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | 5 | namespace iRduino.Windows.Pages 6 | { 7 | using ArduinoInterfaces; 8 | 9 | using iRduino.Classes; 10 | 11 | using System.Globalization; 12 | using System.Windows; 13 | using System.Windows.Controls; 14 | using System.Windows.Controls.Primitives; 15 | using System.Windows.Data; 16 | 17 | /// 18 | /// Interaction logic for CurrentConfiguration.xaml 19 | /// 20 | public partial class CurrentConfiguration 21 | { 22 | private bool startingUp = true; 23 | 24 | public CurrentConfiguration() 25 | { 26 | this.InitializeComponent(); 27 | } 28 | 29 | private void PageLoaded1(object sender, RoutedEventArgs e) 30 | { 31 | this.NumberControllersLabel.IsEnabled = false; 32 | for (int i = 0; i <= Constants.MaxIntensityTM; i++) 33 | { 34 | this.ControllerNumCBox.Items.Add(i.ToString(CultureInfo.InvariantCulture)); 35 | } 36 | var temp = (ConfigurationOptions) this.DataContext; 37 | foreach (var com in temp.Dictionarys.ComPorts) 38 | { 39 | this.PrefComPortCBox.Items.Add(com.Value); 40 | } 41 | this.UseDXUnitsCheck.IsChecked = temp.DisplayUnitConfigurations.Count != 0; 42 | this.UseArduinoIOCheck.IsChecked = temp.ArduinoIOConfiguration.UseArduinoIO; 43 | this.UseFergoTechCheck.IsChecked = temp.FergoTechConfiguration.UseFergoTechComponents; 44 | //Setup Data Binding 45 | var nameBinding = new Binding("Name") {Mode = BindingMode.TwoWay}; 46 | BindingOperations.SetBinding(this.NameTextBox, TextBox.TextProperty, nameBinding); 47 | var prefComBinding = new Binding("PreferredComPort") {Mode = BindingMode.TwoWay}; 48 | BindingOperations.SetBinding(this.PrefComPortCBox, Selector.SelectedIndexProperty, prefComBinding); 49 | var contNumBinding = new Binding("NumberControllers") {Mode = BindingMode.TwoWay}; 50 | BindingOperations.SetBinding(this.ControllerNumCBox, Selector.SelectedIndexProperty, contNumBinding); 51 | this.UseControllersCheck.IsChecked = this.ControllerNumCBox.SelectedIndex > 0; 52 | this.startingUp = false; 53 | } 54 | 55 | private void UseDxUnitsCheckChecked(object sender, RoutedEventArgs e) 56 | { 57 | if (this.startingUp) //prevents event from travelling further 58 | { 59 | e.Handled = true; 60 | } 61 | } 62 | 63 | private void UseDxUnitsCheckUnchecked(object sender, RoutedEventArgs e) 64 | { 65 | if (this.startingUp) 66 | { 67 | e.Handled = true; 68 | } 69 | } 70 | 71 | private void UseControllersCheckUnchecked(object sender, RoutedEventArgs e) 72 | { 73 | if (!this.startingUp) 74 | { 75 | this.ControllerNumCBox.SelectedIndex = 0; 76 | //e.Handled = true; 77 | } 78 | this.ControllerNumCBox.IsEnabled = false; 79 | this.NumberControllersLabel.IsEnabled = false; 80 | } 81 | 82 | private void UseControllersCheckChecked(object sender, RoutedEventArgs e) 83 | { 84 | this.ControllerNumCBox.IsEnabled = true; 85 | this.NumberControllersLabel.IsEnabled = true; 86 | if (!this.startingUp) 87 | { 88 | this.ControllerNumCBox.SelectedIndex = 0; 89 | //e.Handled = true; 90 | } 91 | } 92 | 93 | private void ControllerNumCBoxSelectionChanged(object sender, SelectionChangedEventArgs e) 94 | { 95 | if (this.startingUp) 96 | { 97 | e.Handled = true; 98 | } 99 | } 100 | 101 | private void UseArduinoIOChecked(object sender, RoutedEventArgs e) 102 | { 103 | if (this.startingUp) 104 | { 105 | e.Handled = true; 106 | } 107 | } 108 | 109 | private void UseArduinoIOUnChecked(object sender, RoutedEventArgs e) 110 | { 111 | if (this.startingUp) 112 | { 113 | e.Handled = true; 114 | } 115 | } 116 | 117 | private void UseFergoTechUnChecked(object sender, RoutedEventArgs e) 118 | { 119 | if (this.startingUp) 120 | { 121 | e.Handled = true; 122 | } 123 | } 124 | 125 | private void UseFergoTechChecked(object sender, RoutedEventArgs e) 126 | { 127 | if (this.startingUp) 128 | { 129 | e.Handled = true; 130 | } 131 | } 132 | 133 | } 134 | } -------------------------------------------------------------------------------- /iRduino/Windows/Pages/DigitalInputs.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /iRduino/Windows/Pages/DigitalInputs.xaml.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | namespace iRduino.Windows.Pages 5 | { 6 | /// 7 | /// Interaction logic for Inputs.xaml 8 | /// 9 | public partial class DigitalInputs 10 | { 11 | public DigitalInputs() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iRduino/Windows/Pages/DigitalOutputs.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 27 | -------------------------------------------------------------------------------- /iRduino/Windows/Pages/DigitalOutputs.xaml.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | namespace iRduino.Windows.Pages 5 | { 6 | /// 7 | /// Interaction logic for Outputs.xaml 8 | /// 9 | public partial class DigitalOutputs 10 | { 11 | public DigitalOutputs() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iRduino/Windows/Pages/Expander.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /iRduino/Windows/Pages/Expander.xaml.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | namespace iRduino.Windows.Pages 5 | { 6 | /// 7 | /// Interaction logic for Inputs.xaml 8 | /// 9 | public partial class Expander 10 | { 11 | public Expander() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iRduino/Windows/Pages/FergoTech.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /iRduino/Windows/Pages/FergoTech.xaml.cs: -------------------------------------------------------------------------------- 1 | //========================================// 2 | // iRduino - Created by Mark Silverwood // 3 | //======================================// 4 | namespace iRduino.Windows.Pages 5 | { 6 | /// 7 | /// Interaction logic for FergoTech.xaml 8 | /// 9 | public partial class FergoTech 10 | { 11 | public FergoTech() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iRduino/Windows/Pages/PageHelper.cs: -------------------------------------------------------------------------------- 1 | using iRduino.Classes; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Windows.Controls; 6 | 7 | namespace iRduino.Windows.Pages 8 | { 9 | public class PageHelper 10 | { 11 | public static void StartLoading1(List scv, ref int screen, DisplayUnitConfiguration temp, CheckBox useCustomHeaderCheck, TextBox headerTextBox, ref bool firstLoad) 12 | { 13 | foreach (ComboBox cbox in scv) 14 | { 15 | cbox.SelectedIndex = -1; 16 | cbox.IsEnabled = false; 17 | } 18 | scv[0].IsEnabled = true; 19 | screen = temp.ScreenToEdit; 20 | if (temp.Screens[screen].Variables.Count > 0) 21 | { 22 | for (int i = 0; i < temp.Screens[screen].Variables.Count; i++) 23 | { 24 | scv[i].IsEnabled = true; 25 | DisplayVarsEnum temp222; 26 | if (Enum.TryParse(temp.Screens[screen].Variables[i], out temp222)) 27 | { 28 | scv[i].SelectedItem = temp.HostApp.DisplayMngr.Dictionarys.DisplayVariables[temp222].Name; 29 | } 30 | else 31 | { 32 | scv[i].SelectedIndex = -1; 33 | } 34 | } 35 | } 36 | else 37 | { 38 | scv[0].IsEnabled = true; 39 | scv[0].SelectedIndex = -1; 40 | } 41 | useCustomHeaderCheck.IsChecked = temp.Screens[screen].UseCustomHeader; 42 | headerTextBox.Text = temp.Screens[screen].CustomHeader; 43 | firstLoad = false; 44 | } 45 | 46 | public static void ScreenVariablesUpdatedExtracted(int maxDisplayLengthTM1638, string format, int param, List scvIn, DisplayUnitConfiguration temp, Label spaceUsedLabel, bool firstLoadIn) 47 | { 48 | int count = 0; 49 | int i = 0; 50 | int stop = 0; 51 | while (count < maxDisplayLengthTM1638 && i < scvIn.Count) 52 | { 53 | stop = i + 1; 54 | if (scvIn[i].SelectedIndex >= 0) 55 | { 56 | count += temp.HostApp.DisplayMngr.Dictionarys.DisplayVariables.Where(item => item.Value.Name == scvIn[i].SelectedItem.ToString()).Sum(item => item.Value.Length); 57 | spaceUsedLabel.Content = String.Format(format, count); 58 | if (count > maxDisplayLengthTM1638) 59 | { 60 | stop = i; 61 | i = scvIn.Count; 62 | } 63 | i++; 64 | } 65 | else 66 | { 67 | scvIn[i].IsEnabled = true; 68 | scvIn[i].Items.Clear(); 69 | foreach (var variable in temp.HostApp.DisplayMngr.Dictionarys.DisplayVariables) 70 | { 71 | if (variable.Value.Length <= maxDisplayLengthTM1638 - count) 72 | { 73 | scvIn[i].Items.Add(variable.Value.Name); 74 | } 75 | } 76 | i = scvIn.Count; 77 | } 78 | } 79 | for (int j = stop; j < scvIn.Count; j++) 80 | { 81 | scvIn[j].Items.Clear(); 82 | scvIn[j].SelectedIndex = -1; 83 | scvIn[j].IsEnabled = false; 84 | } 85 | //save to config 86 | if (!firstLoadIn) 87 | { 88 | for (int p = 0; p < param; p++) 89 | { 90 | if (scvIn[p].SelectedValue != null) 91 | { 92 | string tempV = scvIn[p].SelectedValue.ToString(); 93 | var temp2 = new DisplayVarsEnum(); 94 | bool found = false; 95 | foreach (var disVar in temp.HostApp.DisplayMngr.Dictionarys.DisplayVariables) 96 | { 97 | if (disVar.Value.Name == tempV) 98 | { 99 | temp2 = disVar.Key; 100 | found = true; 101 | } 102 | } 103 | if (found) 104 | { 105 | if (temp.Screens[temp.ScreenToEdit].Variables.Count - 1 < p) 106 | { 107 | temp.Screens[temp.ScreenToEdit].Variables.Add(""); 108 | } 109 | temp.Screens[temp.ScreenToEdit].Variables[p] = temp2.ToString(); 110 | } 111 | } 112 | } 113 | } 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /iRduino/Windows/Pages/ScreenPage.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |