예제 #1
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            prog.StartupCode.Add(0x30, _DataIndex);

            if (lnkDisable.LinkedTo != null)
            {
                context.ModelCode.Add(0x31,
                                      lnkThrottleIn.LinkedTo.DataMapIdx,
                                      lnkEnableSwitch.LinkedTo.DataMapIdx,
                                      lnkDisable.LinkedTo.DataMapIdx,
                                      _DataIndex
                                      );
            }
            else
            {
                context.ModelCode.Add(0x32,
                                      lnkThrottleIn.LinkedTo.DataMapIdx,
                                      lnkEnableSwitch.LinkedTo.DataMapIdx,
                                      _DataIndex
                                      );
            }


            base.GenerateSTMCode(context, prog);
        }
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            prog.CommonCode.Commands.Add(new STMCommand(
                                             0x05, (short)context.CurrentModel.Index, lnkClick.LinkedTo.DataMapIdx));

            base.GenerateSTMCode(context, prog);
        }
예제 #3
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            var VarDataIndex = (ushort)(_DataIndex + 1);

            var variableIdx = prog.Variables.Add(
                VarDataIndex,
                (ushort)(cbEEPROM.Checked ? _Addr : 0),
                Title,
                context.CurrentModel.Index,
                1, -10, 10, short.Parse(tbExp.Text)
                );

            if (cbEEPROM.Checked)
            {
                prog.StartupCode.Add(0x0F, variableIdx, short.Parse(tbExp.Text));
            }
            else
            {
                prog.StartupCode.Add(0x0D, VarDataIndex, short.Parse(tbExp.Text));
            }

            if (Centered)
            {
                context.ModelCode.Add(0x2A, lnkIn.LinkedTo.DataMapIdx, VarDataIndex, _DataIndex);
            }
            else
            {
                context.ModelCode.Add(0x2B, lnkIn.LinkedTo.DataMapIdx, VarDataIndex, _DataIndex);
            }

            prog.Blocks.Add(new STMBlockInfo(this, context.CurrentModel, GetLinks(), new[] { prog.Variables[variableIdx] }));
        }
예제 #4
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            var VarDataIndex = (ushort)(_DataIndex + 1);

            var variableIdx = prog.Variables.Add(
                VarDataIndex,
                (ushort)(cbFramEnabled.Checked ? _Addr : 0),
                Title, context.CurrentModel.Index,
                short.Parse(tbStep.Text), -500, 500,
                short.Parse(tbInitVal.Text)
                );

            if (cbFramEnabled.Checked)
            {
                prog.StartupCode.Add(0x0F, variableIdx, short.Parse(tbInitVal.Text));
            }
            else
            {
                prog.StartupCode.Add(0x0D, VarDataIndex, short.Parse(tbInitVal.Text));
            }

            context.ModelCode.Add(0x0E,
                                  lnkInc.LinkedTo.DataMapIdx,
                                  lnkDec.LinkedTo.DataMapIdx,
                                  short.Parse(tbStep.Text),
                                  lnkReset.LinkedTo != null ? lnkReset.LinkedTo.DataMapIdx : 0,
                                  short.Parse(tbInitVal.Text),
                                  variableIdx
                                  );

            context.ModelCode.Add(0x11, lnkAxis.LinkedTo.DataMapIdx, _DataIndex + 1, _DataIndex);
            context.ModelCode.Add(0x2D, VarDataIndex, cbTrimmerType.SelectedIndex);

            prog.Blocks.Add(new STMBlockInfo(this, context.CurrentModel, GetLinks(), new[] { prog.Variables[variableIdx] }));
        }
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            var VarDataIndex = (ushort)(_DataIndex + 1);

            var variableIdx = prog.Variables.Add(
                VarDataIndex,
                (ushort)(cbFramEnabled.Checked ? _Addr : 0),
                tbCName.Text, context.CurrentModel.Index,
                short.Parse(tbStep.Text), -500, 500
                );

            if (cbFramEnabled.Checked)
            {
                prog.StartupCode.Add(0x0F, variableIdx, short.Parse(tbInitVal.Text));
            }
            else
            {
                prog.StartupCode.Add(0x0D, VarDataIndex, short.Parse(tbInitVal.Text));
            }

            context.ModelCode.Add(0x0E,
                                  lnkInc.LinkedTo.DataMapIdx,
                                  lnkDec.LinkedTo.DataMapIdx,
                                  short.Parse(tbStep.Text),
                                  lnkReset.LinkedTo != null ? lnkReset.LinkedTo.DataMapIdx : 0,
                                  short.Parse(tbInitVal.Text),
                                  variableIdx
                                  );

            context.ModelCode.Add(0x11, lnkAxis.LinkedTo.DataMapIdx, _DataIndex + 1, _DataIndex);
        }
예제 #6
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            var VarDataIndex = (ushort)(_DataIndex + 1);

            var variableIdx = prog.Variables.Add(
                VarDataIndex,
                (ushort)(cbEEPROM.Checked ? _Addr : 0),
                Title + " eff",
                context.CurrentModel.Index,
                5, -95, 95, short.Parse(tbAilQuef.Text)
                );

            if (cbEEPROM.Checked)
            {
                prog.StartupCode.Add(0x0F, variableIdx, short.Parse(tbAilQuef.Text));
            }
            else
            {
                prog.StartupCode.Add(0x0D, VarDataIndex, short.Parse(tbAilQuef.Text));
            }

            context.ModelCode.Add(0x25, lnkRudder.LinkedTo.DataMapIdx, lnkAileron.LinkedTo.DataMapIdx,
                                  VarDataIndex, _DataIndex);

            prog.Blocks.Add(new STMBlockInfo(this, context.CurrentModel, GetLinks(), new[] { prog.Variables[variableIdx] }));
        }
예제 #7
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            context.ModelCode.Add(0x18, lnkAileron.LinkedTo.DataMapIdx, lnkElev.LinkedTo.DataMapIdx,
                                  short.Parse(tbAilQuef.Text), _DataIndex);

            base.GenerateSTMCode(context, prog);
        }
예제 #8
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            var VarDataIndex = (ushort)(_DataIndex + 1);

            var variableIdx = prog.Variables.Add(
                VarDataIndex,
                (ushort)(cbEEPROM.Checked ? _Addr : 0),
                Title + " eff",
                context.CurrentModel.Index,
                5, -95, 95, short.Parse(tbRudQuef.Text)
                );

            if (cbEEPROM.Checked)
            {
                prog.StartupCode.Add(0x0F, variableIdx, short.Parse(tbRudQuef.Text));
            }
            else
            {
                prog.StartupCode.Add(0x0D, VarDataIndex, short.Parse(tbRudQuef.Text));
            }

            context.ModelCode.Add(0x29, lnkRudder.LinkedTo.DataMapIdx, lnkElev.LinkedTo.DataMapIdx,
                                  VarDataIndex, _DataIndex);

            base.GenerateSTMCode(context, prog);
        }
예제 #9
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            base.GenerateSTMCode(context, prog);

            if (cbEEPRom.Checked)
            {
                var variableIdx = prog.Variables.Add(
                    (ushort)_DataIndex,
                    (ushort)_Addr,
                    tbName.Text,
                    context.CurrentModel.Index,
                    short.Parse(tbChangeStep.Text),
                    -1000, 1000
                    );


                prog.StartupCode.Add(0x0F, variableIdx, short.Parse(tbValue.Text));
            }
            else
            {
                prog.Variables.Add((ushort)_DataIndex, 0, tbName.Text, context.CurrentModel.Index,
                                   short.Parse(tbChangeStep.Text), -1000, 1000);

                prog.StartupCode.Add(0x0D, _DataIndex, short.Parse(tbValue.Text));
            }
        }
예제 #10
0
 public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
 {
     foreach (var panel in _Panels)
     {
         panel.GenerageSMTCode(context, prog);
     }
 }
예제 #11
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            base.GenerateSTMCode(context, prog);

            var variableIdx = prog.Variables.Add(
                (ushort)_DataIndex,
                (ushort)(cbEEPRom.Checked ? _Addr : 0),
                Title,
                context.CurrentModel.Index,
                10,
                -1000, 1000,
                short.Parse(tbValue.Text)
                );


            if (cbEEPRom.Checked)
            {
                prog.StartupCode.Add(0x0F, variableIdx, short.Parse(tbValue.Text));
            }
            else
            {
                prog.StartupCode.Add(0x0D, _DataIndex, short.Parse(tbValue.Text));
            }

            //prog.Blocks.Add(new STMBlockInfo(this, context.CurrentModel, null, new []{prog.Variables[variableIdx]}));
        }
예제 #12
0
        public void GenerageSMTCode(CodeGeneratorContext context, STMProgram prog)
        {
            if (EEPStore)
            {
                var names = Names;

                var vmin = prog.Variables.Add((ushort)(_DataIndex + 1), _MinEAddr, names[0],
                                              context.CurrentModel.Index, 10, 0, 1000);

                var vcnt = prog.Variables.Add((ushort)(_DataIndex + 2), _CenterEAddr, names[1],
                                              context.CurrentModel.Index, 10, 0, 1000);

                var vmax = prog.Variables.Add((ushort)(_DataIndex + 3), _MaxEAddr, names[2],
                                              context.CurrentModel.Index, 10, 0, 1000);

                prog.StartupCode.Add(0x0F, vmin, int.Parse(tbMin.Text));
                prog.StartupCode.Add(0x0F, vcnt, int.Parse(tbMiddle.Text));
                prog.StartupCode.Add(0x0F, vmax, int.Parse(tbMax.Text));

                context.ModelCode.Add(0x1F, lnkIn.LinkedTo.DataMapIdx,
                                      vmin, vcnt, vmax, _DataIndex);
            }
            else
            {
                context.ModelCode.Add(0x1E,
                                      lnkIn.LinkedTo.DataMapIdx,
                                      ushort.Parse(tbMin.Text),
                                      ushort.Parse(tbMiddle.Text),
                                      ushort.Parse(tbMax.Text),
                                      _DataIndex
                                      );
            }
        }
예제 #13
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            context.ModelCode.Add(0x17, lnkThrottle.LinkedTo.DataMapIdx, lnkElevator.LinkedTo.DataMapIdx,
                                  short.Parse(tbThQuef.Text), _DataIndex);

            base.GenerateSTMCode(context, prog);
        }
예제 #14
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            var variableIdx = prog.Variables.Add(
                (ushort)_DataIndex,
                ushort.Parse(tbAddr.Text),
                Title,
                context.CurrentModel.Index,
                short.Parse(tbStep.Text),
                -1000, 1000,
                short.Parse(tbInitVal.Text)
                );

            prog.StartupCode.Add(0x0F, variableIdx, short.Parse(tbInitVal.Text));

            context.ModelCode.Add(0x0E,
                                  lnkInc.LinkedTo.DataMapIdx,
                                  lnkDec.LinkedTo.DataMapIdx,
                                  short.Parse(tbStep.Text),
                                  lnkReset.LinkedTo != null ? lnkReset.LinkedTo.DataMapIdx : 0,
                                  short.Parse(tbInitVal.Text),
                                  variableIdx
                                  );

            //prog.Blocks.Add(new STMBlockInfo(this, context.CurrentModel, null, new[] { prog.Variables[variableIdx] }));
        }
예제 #15
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            foreach (ButtonToValuePanel panel in __Panels)
            {
                panel.GenerateSTMCode(context, prog, _DataIndex);
            }

            base.GenerateSTMCode(context, prog);
        }
예제 #16
0
 public void GenerateSTMCode(STMProgram prg, STMCodeBlock codeBlock, ref ushort BlockStart)
 {
     for (var i = 0; i < ButtonsCount; i++)
     {
         // extract each button with separate command
         codeBlock.Add(0x02, (short)(BlockStart), (short)(_DataIndex + i));
         BlockStart += (ushort)ButtonsStateBits;
     }
 }
예제 #17
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            var vcollector = new List <STMVariable>();

            foreach (var panel in _Panels)
            {
                panel.GenerageSMTCode(context, prog, vcollector);
            }

            prog.Blocks.Add(new STMBlockInfo(this, context.CurrentModel, _Panels.SelectMany(pnl => pnl.GetLinks()), vcollector));
        }
예제 #18
0
 public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
 {
     if (Centered)
     {
         context.ModelCode.Add(0x12, lnkIn.LinkedTo.DataMapIdx, short.Parse(tbExp.Text), _DataIndex);
     }
     else
     {
         context.ModelCode.Add(0x13, lnkIn.LinkedTo.DataMapIdx, short.Parse(tbExp.Text), _DataIndex);
     }
 }
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            prog.StartupCode.Add(0x24, _DataIndex);

            context.ModelCode.Add(0x23,
                                  lnkSet.LinkedTo.DataMapIdx,
                                  lnkReset.LinkedTo.DataMapIdx,
                                  lnkAxis.LinkedTo.DataMapIdx,
                                  _DataIndex
                                  );
        }
예제 #20
0
        public void GenerateSTMCode(STMProgram prg)
        {
            ushort BitsCounter = 0;

            foreach (var control in __Controls)
            {
                control.GenerateSTMCode(prg, ref BitsCounter);
            }

            prg.JoyReportLength = (byte)Bytes();
        }
예제 #21
0
 public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
 {
     context.ModelCode.Add(0x1C,
                           lnkNextSection.LinkedTo.DataMapIdx,
                           lnkPrevSection.LinkedTo.DataMapIdx,
                           lnkNextSelection.LinkedTo.DataMapIdx,
                           lnkPrevSelection.LinkedTo.DataMapIdx,
                           lnkIncValue.LinkedTo.DataMapIdx,
                           lnkDecValue.LinkedTo.DataMapIdx,
                           lnkExecute.LinkedTo.DataMapIdx);
 }
예제 #22
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            var pIdx = short.Parse(tbPressed.Text);
            var rIdx = short.Parse(tbReleased.Text);

            var pBtnIdx = lnkIn.LinkedTo.DataMapIdx;

            context.ModelCode.Commands.Add(new STMCommand(
                                               0x08, pBtnIdx, pIdx, rIdx, (short)_DataIndex
                                               ));
        }
예제 #23
0
        public void Remap(ref uint Pointer)
        {
            if (string.IsNullOrEmpty(Text))
            {
                return;
            }

            Addr = Pointer;

            Pointer += (uint)Text.Length;
            Pointer++;

            STMProgram.Align32Bits(ref Pointer);
        }
예제 #24
0
        public void GenerateSTMCode(STMProgram prg, STMCodeBlock codeBlock, ref ushort BlockStart)
        {
            // Extract joystick axis
            codeBlock.Add(
                0x01, (short)BlockStart, (short)Length, (short)_DataIndex
                );

            BlockStart += (ushort)Length;

            // map joy axis value to internal
            codeBlock.Add(
                0x04, (short)_DataIndex, (short)MinValue, (short)MaxValue, (short)(_DataIndex + 1)
                );
        }
예제 #25
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            prog.StartupCode.Add(0x0D, _DataIndex, short.Parse(tbInitVal.Text));

            context.ModelCode.Add(0x0E,
                                  lnkInc.LinkedTo.DataMapIdx,
                                  lnkDec.LinkedTo.DataMapIdx,
                                  short.Parse(tbStep.Text),
                                  lnkReset.LinkedTo != null ? lnkReset.LinkedTo.DataMapIdx : 0,
                                  short.Parse(tbInitVal.Text),
                                  prog.Variables.Add((ushort)_DataIndex, 0, tbCName.Text, context.CurrentModel.Index,
                                                     short.Parse(tbStep.Text), -1000, 1000)
                                  );
        }
예제 #26
0
        public void Remap(ref uint Pointer)
        {
            if (String.IsNullOrWhiteSpace(Name))
            {
                NameAddr = 0;
                return;
            }

            NameAddr = Pointer;
            Pointer += (uint)Name.Length;
            Pointer++;

            STMProgram.Align32Bits(ref Pointer);
        }
예제 #27
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            for (short i = 0; i < __Panels.Count; i++)
            {
                var panel = __Panels[i];
                if (panel.LinkIn.LinkedTo == null)
                {
                    continue;
                }

                context.ModelCode.Add(
                    0x07, panel.LinkIn.LinkedTo.DataMapIdx, i
                    );
            }
        }
예제 #28
0
        public void Generate(STMProgram prg)
        {
            prg.MEMORYBASE = __boardType == enBoardType.STM32F407VG ? 0x080E0000U : 0x08060000U;
            prg.Settins    = STMProgramSettings.NONE;

            if (_lcdEnabled)
            {
                prg.Settins |= STMProgramSettings.LCD_ON;

                if (LCD_BlackLight)
                {
                    prg.Settins |= STMProgramSettings.LCDBL_ON;
                }

                prg.LCD_I2C_Addr = (byte)(LCD_8080 ? 0 : _lcdAddr);
            }
            else
            {
                prg.LCD_I2C_Addr = 0;
            }

            if (_romEnabled)
            {
                prg.Settins        |= STMProgramSettings.EEPROM_ON;
                prg.EEPROM_I2C_ADDR = _romAddr;
                prg.EEP_ADDR_STYLE  = (EEPRomADDRStype)_romAddrStyle;
            }

            if (_debugEnabled)
            {
                prg.Settins |= STMProgramSettings.UART_ON;
            }

            if (_ppmGenEnabled)
            {
                prg.Settins |= STMProgramSettings.PPM_ON;
            }

            if (_xBeeEnabled)
            {
                prg.Settins |= STMProgramSettings.XBEE_ON;
            }

            if (_nrfEnabled)
            {
                prg.Settins |= STMProgramSettings.NRF_ON;
            }
        }
예제 #29
0
        public void GenerateSTMCode(STMProgram prg, STMCodeBlock codeBlock)
        {
            ushort BitsCounter = 0;

            if (ProductID != 0 && VendorID != 0)
            {
                codeBlock.Add(0x34, VendorID, ProductID);
            }

            foreach (var control in __Controls)
            {
                control.GenerateSTMCode(prg, codeBlock, ref BitsCounter);
            }

            prg.JoyReportLength = (byte)Bytes();
        }
예제 #30
0
        public override void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
            var args = new List <IConvertible>
            {
                lnkIn.LinkedTo.DataMapIdx,
                __Panels.Count
            };

            foreach (var panel in __Panels)
            {
                args.Add(panel.Case);
                args.Add(panel.DataIndex);
            }

            context.ModelCode.Add(0x1D, args.ToArray());
        }