private void tbtActiveReadPresentPosition_Click(object sender, RoutedEventArgs e) { if (C_State.FURTHER(e_stateProg.initialized)) { timMotorDataRead.IsEnabled = (bool)tbtActiveReadPresentPosition.IsChecked; } }
private void slActiveReadingTimerInterval_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { if (C_State.FURTHER(e_stateProg.initialized)) { timMotorDataRead.Interval = new TimeSpan(0, 0, 0, 0, (int)slActiveReadingTimerInterval.Value); } }
public void KILL_allNotNeededGui() { if (C_State.FURTHER(e_stateWebCam.ready)) { timCam.Stop(); } timMotorDataRead.Stop(); timSim.Stop(); // unload Basler camera gui elements not to interfere with the telepresence ones //guiImageViewer.Visibility = System.Windows.Visibility.Hidden; //guiImageViewer.IsEnabled = false; //guiStreamController.Visibility = System.Windows.Visibility.Hidden; //guiStreamController.IsEnabled = false; if (guiCameraLister.Camera != null) { guiCameraLister.Camera.Close(); } //if (camTry != null) //{ // camTry.StopGrabbing(); // camTry.CloseCamera(); //} }
//private void UPDATE_motorsFromSliders() //{ // //foreach(e_rot //} private void UPDATE_motorFromSlider(e_rot rot) //nn { if (C_State.FURTHER(e_stateMotor.ready)) { Ms[rot].angleWanted.Dec = GET_slAngle(rot).Value; Ms[rot].speedWanted.Dec = GET_slSpeed(rot).Value; } }
private void UPDATE_slidersFromMotor(e_rot rot) //nn { if (C_State.FURTHER(e_stateMotor.ready)) { GET_slSpeed(rot).Value = Ms[rot].speedWanted.Dec; GET_slAngle(rot).Value = Ms[rot].angleWanted.Dec; //LOG_logger(string.Format("{0} = angle[{1}], speed[{2}]", rot, M(rot).angle.Dec, M(rot).speed.Dec)); } }
public void DISPOSE_cameraData() { if (C_State.FURTHER(e_stateProg.initialized)) { if (Cs.Count > 0) { foreach (C_WebCamera cam in Cs) { cam.ReleaseData(); } } } }
private void cbLogSetMaximum_ValueChanged(object sender, RoutedEventArgs e) { if (C_State.FURTHER(e_stateProg.initialized)) { if (cbLogSetMaximum.IsChecked == true) { C_Logger.Instance.START_trimming(Convert.ToInt64(txLogBufferCount.Text)); } else { C_Logger.Instance.TrimMsgBuffer = false; } } }
private void tcMain_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (C_State.FURTHER(e_stateProg.initialized)) { if (tiBaslerCamera.IsSelected == true) { dpBaslerCamera.Visibility = Visibility.Visible; } else { dpBaslerCamera.Visibility = Visibility.Hidden; } } }
private void txRawBytes_TextChanged(object sender, TextChangedEventArgs e) { if (C_State.FURTHER(e_stateProg.initialized)) { try { raw = new C_Packet(C_CONV.strHex2byteArray(txRawBytes.Text, " ")); } finally { btnSendRawBytes.IsEnabled = raw.IsConsistent; } } }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endregion Initialization //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #region Open close //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% public static bool OPEN_connection() { lock (spiSent_locker) { //UPDATE_SPI_Settings(); //UPDATE_baudRate(); if (UPDATE_portName() == false) { return(false); } /* * if (C_State.FURTHER(e_stateSPI.notConnected)) * else */ if (C_State.FURTHER(e_stateSPI.connected)) { // we need to close it first CLOSE_connection(); } C_State.Spi = e_stateSPI.connecting; try { timeWaitBeforeRtsEnable_ms = REFRESH_timeWaitBeforeRtsEnable_ms(); spi.Open(); //SET_state(E_GUI_MainState.error); } catch (Exception ex) { LOG("Port could not be opened"); LOG(GET_exInfo(ex)); //SET_state(E_GUI_MainState.error); C_State.Spi = e_stateSPI.disconnected; return(false); } C_State.Spi = e_stateSPI.connected; LOG(String.Format("Port {0} opened successfuly with {1} bps", spi.PortName, spi.BaudRate.ToString()) ); if (spi.IsOpen == true) { spi.DiscardInBuffer(); spi.DiscardOutBuffer(); } } return(spi.IsOpen); }
private void slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { if (C_State.FURTHER(e_stateMotor.ready)) { Slider sl = sender as Slider; if (sl != null) { sl.Value = Math.Round(e.NewValue, 2); e_rot rot = GET_rot(sl); UPDATE_motorFromSlider(rot); UPDATE_slidersFromMotor(rot); ORDER_moveIfChecked(rot); } REFRESH_motorData(); } }
private void READ_selectedData() { if (C_State.FURTHER(e_stateProg.initialized)) { foreach (int index in lsReadPresentPositionMotors.SelectedItems) { if (lsiWholeRegister.IsSelected == true) { Ms[index].READ_wholeRegister(); } if (lsiActualPostionEtc.IsSelected == true) { Ms[index].READ_positionSpeedLoadVoltageTemperatureRegisteredInstructionMoving(); } } } }
private void cbSetValues_ValueChanged(object sender, RoutedEventArgs e) { if (C_State.FURTHER(e_stateMotor.ready)) { CheckBox cb = sender as CheckBox; if (cb == cbSendValuesToMotorYaw) { ORDER_moveIfChecked(e_rot.yaw); } else if (cb == cbSendValuesToMotorPitch) { ORDER_moveIfChecked(e_rot.pitch); } else if (cb == cbSendValuesToMotorRoll) { ORDER_moveIfChecked(e_rot.roll); } } }
void timCam_Tick(object sender, EventArgs e) { if (tbtActivePreviewList.IsChecked == true) { PLOT_listPreviewImages(); } if (tbtActivePreviewActual.IsChecked == true) { PLOT_activePreviewImage(); } if (C_State.FURTHER(e_stateProg.closing)) { timCam.Stop(); DISPOSE_cameraData(); } if (tbtActivePreviewList.IsChecked == false && tbtActivePreviewActual.IsChecked == false) { timCam.Stop(); DISPOSE_cameraData(); } }
//private void OnWindowKeyUp(object source, KeyEventArgs e) //{ // if (e.Key == Key.T && (Keyboard.Modifiers & Key.LeftCtrl) == Key.LeftCtrl) // { // } // //Do whatever you like with e.Key and Keyboard.Modifiers //} // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #region prog status // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { C_State.CLOSE_program(); }