public void Prepare(DatFile datFile, CalibrItem calibrItem) { if (this.calibrItem != null) { this.calibrItem.PropertyChanged -= CalibrItemOnPropertyChanged; if (this.calibrItem.Table != null) { this.calibrItem.Table.PropertyChanged -= CalibrItemOnPropertyChanged; } } this.datFile = datFile; this.calibrItem = calibrItem; calibrLabel.Text = String.Format("{0} ({1}), {2}", calibrItem.Description, calibrItem.Name, calibrItem.Unit); calibrItem.PropertyChanged += CalibrItemOnPropertyChanged; if (calibrItem.Table != null) { calibrItem.Table.PropertyChanged += CalibrItemOnPropertyChanged; } FillPalette(); LoadData(); }
public static void SyncCalibr(this CalibrItem calibrItem) { switch (calibrItem.ItemInfo.ItemType) { case ItemTypes.Const: case ItemTypes.Var: { var requestIndex = 0; calibrItem.RawValue = GetRawValue(calibrItem, ref requestIndex); break; } case ItemTypes.Table: case ItemTypes.Teach: { var count = calibrItem.Table.Count; var requestIndex = 0; for (int i = 0; i < count; i++) { calibrItem.Table.Cell(i).Source = GetRawValue(calibrItem, ref requestIndex); } calibrItem.Table.FillValues(); calibrItem.Table.DoTableChanged(); break; } } }
internal void Prepare(CalibrItem calibrItem) { FillLables(calibrName, calibrValue, calibrItem); FillLables(xAxisName, xAxisValue, calibrItem.AxisXCalibrItem); FillLables(yAxisName, yAxisValue, calibrItem.AxisYCalibrItem); FillLables(value1Name, value1Value, calibrItem.VisualCalibr1); FillLables(value2Name, value2Value, calibrItem.VisualCalibr2); }
private void calibrationsBS_CurrentChanged(object sender, EventArgs e) { currentCalibr = GetCurrentCalibr(); if (currentCalibr == null) { return; } calibrControl.Prepare(dispatcher.DatFile, currentCalibr); }
public static void WriteCalibr(this EcuCommunication ecu, CalibrItem calibrItem) { var requests = calibrItem.CreateWriteRequest(true); foreach (var request in requests) { ecu.WriteRequests.Add(request); } }
private void AddGraphControl(CalibrItem calibr) { var graph = new GraphControl(); graph.SetValue(calibr); graphControls.Add(calibr.Name, graph); graph.Dock = DockStyle.Left; graphsPanel.Controls.Add(graph); graph.BringToFront(); PlaceGraphs(); }
private void AddValueControl(CalibrItem calibr) { var value = new ValueControl(); value.SetValue(calibr); valueControls.Add(calibr.Name, value); value.Dock = DockStyle.Top; valuesPanel.Controls.Add(value); value.BringToFront(); PlaceValueControl(); }
private static void FillLables(Label nameLable, Label valueLable, CalibrItem calibrItem) { nameLable.Visible = valueLable.Visible = calibrItem != null; if (calibrItem == null) { return; } nameLable.Text = String.Format("{0} ({1}), {2}", calibrItem.Description, calibrItem.Name, calibrItem.Unit); valueLable.Text = calibrItem.ValueStr; }
private bool ReadCalibrItem(CalibrItem calibrItem) { ExecuteRequests(calibrItem.readRequests); var changed = false; for (var i = 0; i < calibrItem.readRequests.Length; i++) { var request = calibrItem.readRequests[i]; changed |= request.IsChanged; request.IsChanged = false; calibrItem.readRequests[i] = request; } return(changed); }
private int CalcAxisLabel(int i, CalibrItem axisCalibr, int count) { int value = 0; switch (axisCalibr.ItemInfo.ItemType) { case ItemTypes.Table: value = (int)Math.Round(axisCalibr.Table.GetValue(i)); break; case ItemTypes.Var: value = (int)Math.Round(axisCalibr.CalcValueByIndex(i, count), MidpointRounding.AwayFromZero); break; } return(value); }
private static int GetRawValue(CalibrItem calibrItem, ref int requestIndex) { var rawValue = 0; switch (calibrItem.ItemInfo.SizeType) { case SizeTypes.Int: case SizeTypes.UInt: { int value = 0; for (int i = 0; i < 2; i++) { var request = calibrItem.readRequests[requestIndex++]; value += request.RawValue << (1 - i) * 8; } if (calibrItem.ItemInfo.SizeType == SizeTypes.Int) { rawValue = (short)value; } else { rawValue = (ushort)value; } break; } case SizeTypes.Char: { rawValue = (sbyte)calibrItem.readRequests[requestIndex++].RawValue; break; } case SizeTypes.UChar: case SizeTypes.Bit: { rawValue = calibrItem.readRequests[requestIndex++].RawValue; break; } } return(rawValue); }
private void DeleteValueControl(CalibrItem calibr) { valueControls.Remove(calibr.Name); valuesPanel.Controls.RemoveByKey(calibr.Name); PlaceValueControl(); }
private void DeleteGraphControl(CalibrItem calibr) { graphControls.Remove(calibr.Name); graphsPanel.Controls.RemoveByKey(calibr.Name); PlaceGraphs(); }