public void ACTUALIZE_valueAndLogIt(ref C_Value val, byte add_L, byte add_H, e_regByteType type) { val.Hex = GET_2bytesFromReg(add_L, add_H, type); LOG_reg(string.Format( "[{0}]-{1} actualized form motor! \t[{1}]", reg.GET_name(add_L), type, val.ToString() )); }
public void LOG_SETUP_moveSpeed(byte INSTRUCTION_BYTE, C_Value _angle, C_Value _speed) { string prefix = "ODD_MOVE"; switch (INSTRUCTION_BYTE) { case (C_DynAdd.INS_WRITE): prefix = "ORDER_move"; break; case (C_DynAdd.INS_REG_WRITE): prefix = "REGISTER_move"; break; case (C_DynAdd.INS_READ): prefix = "READ_move"; break; } if (_speed.Dec != C_DynVal.SET_MOV_SPEED_NOCONTROL) { LOG(String.Format("{0}:[angle];[speed] =\t[{1}]; [{3}] =\t{2:0.00}°;\t{4:0.00}%, [angle-default]=\t{5:0.00}°", prefix, C_CONV.byteArray2strHex_space(_angle.Hex.Reverse().ToArray()), _angle.Dec, C_CONV.byteArray2strHex_space(_speed.Hex.Reverse().ToArray()), _speed.Dec, _angle.Dec_FromDefault )); } else { LOG(String.Format("{0}: [angle];[speed] = [{1}];[{3}] = {2}°; No speed control", prefix, C_CONV.byteArray2strHex_space(_angle.Hex.Reverse().ToArray()), _angle.Dec, C_CONV.byteArray2strHex_space(_speed.Hex.Reverse().ToArray()) )); } }
public C_Value(C_Value _val, double _decLimitMin, double _decLimitMax) { decLimitMin = _decLimitMin; decLimitMax = _decLimitMax; decMin = _val.decMin; decMax = _val.decMax; hexMin = _val.hexMin; hexMax = _val.hexMax; Dec = _val.Dec; decDefault = Dec; }
public C_Value(C_Value _val) // because of search motor { decDefault = _val.decDefault; decLimitMin = _val.decLimitMin; decLimitMax = _val.decLimitMax; decMin = _val.decMin; decMax = _val.decMax; hexMin = _val.hexMin; hexMax = _val.hexMax; Dec = _val.Dec; }
// move without speed control - does not change current speed in motor class instance public void ORDER_moveBrisk() { C_Value lastSpeed = speedWanted; speedWanted.Dec = C_DynVal.SET_MOV_SPEED_NOCONTROL; ORDER_move(); speedWanted = lastSpeed; //SEND_cmdInner(CREATE_cmdInner(new List<object> { // C_DynAdd.INS_WRITE, C_DynAdd.GOAL_POS_L, angle.Hex, C_DynVal.SET_MOV_SPEED_NOCONTROL //})); }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #region constructor //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% public C_Motor(byte _id) // because of search motor { id = 0; motorLog = e_LogMsgSource.mot; reg = new C_ByteRegister(); angleWanted = new C_Value(); //angleWanted.DecDefault = C_Value.angleFull.DecDefault; speedWanted = new C_Value(); C_Value.angleFull.DecDefault = angleWanted.DecDefault; C_Value.angleFull.Dec = angleWanted.Dec; angleSeen = new C_Value(C_Value.angleFull); speedSeen = new C_Value(C_Value.speedFull); angleSent = new C_Value(C_Value.angleFull); speedSent = new C_Value(C_Value.speedFull); }
public C_Motor(e_rot _rot, byte _id, C_Value _angle, C_Value _speed) { id = _id; reg = new C_ByteRegister(); angleWanted = _angle; speedWanted = _speed; C_Value.angleFull.DecDefault = angleWanted.DecDefault; C_Value.angleFull.Dec = angleWanted.Dec; angleSeen = new C_Value(C_Value.angleFull); speedSeen = new C_Value(C_Value.speedFull); angleSent = new C_Value(C_Value.angleFull); speedSent = new C_Value(C_Value.speedFull); rotMotor = _rot; switch (rotMotor) { case (e_rot.yaw): motorLog = e_LogMsgSource.mot_yaw; break; case (e_rot.pitch): motorLog = e_LogMsgSource.mot_pitch; break; case (e_rot.roll): motorLog = e_LogMsgSource.mot_roll; break; } //angleHex = new byte[2] { 0, 0 }; if (cmdinEx_initialized == false) { INIT_cmdinEx(); } }
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endregion examples // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #region Angle & Speed sliders //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% public void SET_sliderLimits(Slider sl, C_Value val) { sl.Maximum = val.DecMax; sl.Value = val.Dec; sl.Minimum = val.DecMin; }