2018.07.26
Dependencies: EthernetInterface TextLCD USBDevice USBHost3 mbed
Fork of USBHostHub_HelloWorld by
Diff: 0_main.cpp
- Revision:
- 12:3e6b6fcf540b
- Parent:
- 11:ff06edc0219c
- Child:
- 13:2c70c772fe24
--- a/0_main.cpp Tue Feb 16 16:34:12 2016 +0000 +++ b/0_main.cpp Fri Feb 19 07:02:35 2016 +0000 @@ -518,13 +518,13 @@ tmpSpeed = ( setValue.crawlerCtrl.sv_LBCM_dzc+1 - btnStatus_LJSFwdRvs ) * 100 / setValue.crawlerCtrl.sv_LBCM_dzc * setValue.crawlerCtrl.sv_LBCM_sli_F / 100; // Speed I2C_cmd[7] = (char)tmpSpeed; DEBUG_PRINT_L3( "Bd0> Dual Mode: L-Fwd (Speed=%d)\r\n", tmpSpeed); - i2c.write(i2c_addr_crawler, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x40<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 1: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 1: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + // read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 1: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 1: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); flg_exp_status |= 0x00400000; flg_ButtonOn = false; @@ -536,13 +536,13 @@ tmpSpeed = ( btnStatus_LJSFwdRvs - setValue.crawlerCtrl.sv_LBCM_dzc ) * 100 / setValue.crawlerCtrl.sv_LBCM_dzc+1 * setValue.crawlerCtrl.sv_LBCM_sli_F / 100; // Speed I2C_cmd[5] = (char)tmpSpeed; I2C_cmd[7] = (char)tmpSpeed; DEBUG_PRINT_L3( "Bd0> Dual Mode: L-Rvs (Speed=%d)\r\n", tmpSpeed); - i2c.write(i2c_addr_crawler, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x40<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 2: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 2: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + // read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 2: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 2: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); flg_exp_status |= 0x00800000; flg_ButtonOn = false; @@ -551,7 +551,7 @@ I2C_cmd[6] = MOTOR_STP; // Stop I2C_cmd[7] = 0; // Speed=0 flg_exp_status &= 0xFF3F000F; - i2c.write(i2c_addr_crawler, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x40<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. } if( btnStatus_RJSFwdRvs < setValue.crawlerCtrl.sv_RFCM_dzc - setValue.crawlerCtrl.sv_RFCM_dzl ){ @@ -561,13 +561,13 @@ tmpSpeed = (( 128 - btnStatus_RJSFwdRvs ) * 100 / 127 ) * setValue.crawlerCtrl.sv_RFCM_sli_R / 100; I2C_cmd[3] = (char)tmpSpeed; DEBUG_PRINT_L3( "Bd0> Dual Mode: R-Fwd (Speed=%d)\r\n", tmpSpeed); - i2c.write(i2c_addr_crawler, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x40<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + // read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); flg_exp_status |= 0x00100000; flg_ButtonOn = false; @@ -579,13 +579,13 @@ tmpSpeed = ( btnStatus_RJSFwdRvs - setValue.crawlerCtrl.sv_RFCM_dzc ) * 100 / setValue.crawlerCtrl.sv_RFCM_dzc+1 * setValue.crawlerCtrl.sv_RFCM_sli_R / 100; // Speed I2C_cmd[3] = (char)tmpSpeed; DEBUG_PRINT_L3( "Bd0> Dual Mode: R-Rvs (Speed=%d)\r\n", tmpSpeed); - i2c.write(i2c_addr_crawler, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x40<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + // read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); flg_exp_status |= 0x00200000; flg_ButtonOn = false; @@ -594,7 +594,7 @@ I2C_cmd[2] = MOTOR_STP; // Stop I2C_cmd[3] = 0; // Speed=0 flg_exp_status &= 0xFFCFFFFF; - i2c.write(i2c_addr_crawler, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x40<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. } led3 = 0; } @@ -629,19 +629,20 @@ I2C_cmd[3] = ( setValue.crawlerCtrl.sv_RFCM_dzc+1 - btnStatus_RJSFwdRvs ) * 100 / setValue.crawlerCtrl.sv_RFCM_dzc * setValue.crawlerCtrl.sv_RFCM_sli_F / 100; // Speed I2C_cmd[6] = MOTOR_FWD; // Motor2 Fwd I2C_cmd[7] = ( setValue.crawlerCtrl.sv_RFCM_dzc+1 - btnStatus_RJSFwdRvs ) * 100 / setValue.crawlerCtrl.sv_RFCM_dzc * setValue.crawlerCtrl.sv_RFCM_sli_R / 100; // Speed - DEBUG_PRINT_L4( "Bd0> Single Mode: Dir1 (Speed: %d, %d)\r\n", I2C_cmd[5], I2C_cmd[7]); + DEBUG_PRINT_L3( "Bd0> Single Mode: Dir1 (Speed: %d, %d)\r\n", I2C_cmd[5], I2C_cmd[7]); flg_exp_status |= 0x00100000; flg_exp_status |= 0x00400000; // 0x00500000 I2C_cmd[4] = setValue.crawlerCtrl.sv_RFCM_ith_F; I2C_cmd[5] = setValue.crawlerCtrl.sv_RFCM_ith_R; I2C_cmd[8] = setValue.crawlerCtrl.sv_LBCM_ith_F; I2C_cmd[9] = setValue.crawlerCtrl.sv_LBCM_ith_R; - i2c.write(i2c_addr_crawler, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); flg_ButtonOn = false; + i2c.write(0x40<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + // read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + flg_ButtonOn = false; } else if(( btnStatus_RJSLftRgt > setValue.crawlerCtrl.sv_RFCM_dzc+setValue.crawlerCtrl.sv_RFCM_dzu ) && ( btnStatus_RJSFwdRvs < setValue.crawlerCtrl.sv_RFCM_dzc+setValue.crawlerCtrl.sv_RFCM_dzu) && ( btnStatus_RJSFwdRvs > setValue.crawlerCtrl.sv_RFCM_dzc-setValue.crawlerCtrl.sv_RFCM_dzl)){ flg_ButtonOn = true; @@ -656,19 +657,19 @@ } I2C_cmd[3] = ( btnStatus_RJSLftRgt - setValue.crawlerCtrl.sv_RFCM_dzc ) * 100 / setValue.crawlerCtrl.sv_RFCM_dzc * setValue.crawlerCtrl.sv_RFCM_sli_F / 100; // Speed I2C_cmd[7] = ( btnStatus_RJSLftRgt - setValue.crawlerCtrl.sv_RFCM_dzc ) * 100 / setValue.crawlerCtrl.sv_RFCM_dzc * setValue.crawlerCtrl.sv_RFCM_sli_R / 100; // Speed - DEBUG_PRINT_L4( "Bd0> Single Mode: Dir2 (Speed: %d, %d)\r\n", I2C_cmd[5], I2C_cmd[7]); + DEBUG_PRINT_L3( "Bd0> Single Mode: Dir2 (Speed: %d, %d)\r\n", I2C_cmd[5], I2C_cmd[7]); flg_exp_status |= 0x00200000; flg_exp_status |= 0x00400000; // 0x00600000 I2C_cmd[4] = setValue.crawlerCtrl.sv_RFCM_ith_F; I2C_cmd[5] = setValue.crawlerCtrl.sv_RFCM_ith_R; I2C_cmd[8] = setValue.crawlerCtrl.sv_LBCM_ith_F; I2C_cmd[9] = setValue.crawlerCtrl.sv_LBCM_ith_R; - i2c.write(i2c_addr_crawler, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + i2c.write(0x40<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + // read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); flg_ButtonOn = false; } else if(( btnStatus_RJSFwdRvs > setValue.crawlerCtrl.sv_RFCM_dzc+setValue.crawlerCtrl.sv_RFCM_dzu ) && ( btnStatus_RJSLftRgt < setValue.crawlerCtrl.sv_RFCM_dzc+setValue.crawlerCtrl.sv_RFCM_dzu) && ( btnStatus_RJSLftRgt > setValue.crawlerCtrl.sv_RFCM_dzc-setValue.crawlerCtrl.sv_RFCM_dzl)){ @@ -683,19 +684,19 @@ I2C_cmd[6] = MOTOR_RVS; // Motor2 Rvs I2C_cmd[3] = ( btnStatus_RJSFwdRvs - setValue.crawlerCtrl.sv_RFCM_dzc ) * 100 / setValue.crawlerCtrl.sv_RFCM_dzc * setValue.crawlerCtrl.sv_RFCM_sli_F / 100; // Speed I2C_cmd[7] = ( btnStatus_RJSFwdRvs - setValue.crawlerCtrl.sv_RFCM_dzc ) * 100 / setValue.crawlerCtrl.sv_RFCM_dzc * setValue.crawlerCtrl.sv_RFCM_sli_R / 100; // Speed - DEBUG_PRINT_L4( "Bd0> Single Mode: Dir3 (Speed: %d, %d)\r\n", I2C_cmd[5], I2C_cmd[7]); + DEBUG_PRINT_L3( "Bd0> Single Mode: Dir3 (Speed: %d, %d)\r\n", I2C_cmd[5], I2C_cmd[7]); flg_exp_status |= 0x00200000; flg_exp_status |= 0x00800000; // 0x00A00000 I2C_cmd[4] = setValue.crawlerCtrl.sv_RFCM_ith_F; I2C_cmd[5] = setValue.crawlerCtrl.sv_RFCM_ith_R; I2C_cmd[8] = setValue.crawlerCtrl.sv_LBCM_ith_F; I2C_cmd[9] = setValue.crawlerCtrl.sv_LBCM_ith_R; - i2c.write(i2c_addr_crawler, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + i2c.write(0x40<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + // read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); flg_ButtonOn = false; } else if(( btnStatus_RJSLftRgt < setValue.crawlerCtrl.sv_RFCM_dzc-setValue.crawlerCtrl.sv_RFCM_dzu ) && ( btnStatus_RJSFwdRvs < setValue.crawlerCtrl.sv_RFCM_dzc+setValue.crawlerCtrl.sv_RFCM_dzu) && ( btnStatus_RJSFwdRvs > setValue.crawlerCtrl.sv_RFCM_dzc-setValue.crawlerCtrl.sv_RFCM_dzl)){ @@ -711,19 +712,19 @@ } I2C_cmd[3] = ( setValue.crawlerCtrl.sv_RFCM_dzc+1 - btnStatus_RJSLftRgt ) * 100 / setValue.crawlerCtrl.sv_RFCM_dzc * setValue.crawlerCtrl.sv_RFCM_sli_F / 100; // Speed I2C_cmd[7] = ( setValue.crawlerCtrl.sv_RFCM_dzc+1 - btnStatus_RJSLftRgt ) * 100 / setValue.crawlerCtrl.sv_RFCM_dzc * setValue.crawlerCtrl.sv_RFCM_sli_R / 100; // Speed - DEBUG_PRINT_L4( "Bd0> Single Mode: Dir4 (Speed: %d, %d)\r\n", I2C_cmd[5], I2C_cmd[7]); + DEBUG_PRINT_L3( "Bd0> Single Mode: Dir4 (Speed: %d, %d)\r\n", I2C_cmd[5], I2C_cmd[7]); flg_exp_status |= 0x00100000; flg_exp_status |= 0x00800000; // 0x00900000 I2C_cmd[4] = setValue.crawlerCtrl.sv_RFCM_ith_F; I2C_cmd[5] = setValue.crawlerCtrl.sv_RFCM_ith_R; I2C_cmd[8] = setValue.crawlerCtrl.sv_LBCM_ith_F; I2C_cmd[9] = setValue.crawlerCtrl.sv_LBCM_ith_R; - i2c.write(i2c_addr_crawler, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + i2c.write(0x40<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + // read_motorCurrent( i2c_addr_crawler, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); flg_ButtonOn = false; } // ==================================== @@ -743,8 +744,7 @@ I2C_cmd[5] = setValue.crawlerCtrl.sv_RFCM_ith_R; I2C_cmd[8] = setValue.crawlerCtrl.sv_LBCM_ith_F; I2C_cmd[9] = setValue.crawlerCtrl.sv_LBCM_ith_R; - i2c.write(i2c_addr_crawler, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - i2c.write(i2c_addr_crawler, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x40<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. } } @@ -778,15 +778,13 @@ I2C_cmd[5] = setValue.winchCtrl.sv_WDM_ith_R; I2C_cmd[8] = setValue.winchCtrl.sv_WRM_ith_F; I2C_cmd[9] = setValue.winchCtrl.sv_WRM_ith_R; - i2c.write(i2c_addr_winch, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - i2c.write(i2c_addr_winch, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x70<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_winch, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); - i2c.write(i2c_addr_winch, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + // read_motorCurrent( i2c_addr_winch, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); flg_ButtonOn = false; } @@ -811,14 +809,14 @@ I2C_cmd[5] = setValue.winchCtrl.sv_WDM_ith_R; I2C_cmd[8] = setValue.winchCtrl.sv_WRM_ith_F; I2C_cmd[9] = setValue.winchCtrl.sv_WRM_ith_R; - i2c.write(i2c_addr_winch, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x70<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_winch, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); - i2c.write(i2c_addr_winch, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + // read_motorCurrent( i2c_addr_winch, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + i2c.write(0x70<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. flg_ButtonOn = false; } @@ -839,8 +837,8 @@ I2C_cmd[5] = setValue.winchCtrl.sv_WDM_ith_R; I2C_cmd[8] = setValue.winchCtrl.sv_WRM_ith_F; I2C_cmd[9] = setValue.winchCtrl.sv_WRM_ith_R; - i2c.write(i2c_addr_winch, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - i2c.write(i2c_addr_winch, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x70<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x70<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. } //// Are these part necessary ?? //// ////winchCurrentPosition = ReadWinchCurrentPosition(i2c_addr_resolver); @@ -871,13 +869,13 @@ I2C_cmd[5] = setValue.tfmCtrl.sv_RFTM_ith_R; I2C_cmd[8] = setValue.tfmCtrl.sv_LBTM_ith_F; I2C_cmd[9] = setValue.tfmCtrl.sv_LBTM_ith_R; - i2c.write(i2c_addr_transform, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_transform, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); - i2c.write(i2c_addr_transform, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x30<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + // read_motorCurrent( i2c_addr_transform, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + i2c.write(0x30<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. flg_ButtonOn = false; } else if ( btnStatus_RFI == btnID_RFI ) { // RF I @@ -892,13 +890,13 @@ I2C_cmd[5] = setValue.tfmCtrl.sv_RFTM_ith_R; I2C_cmd[8] = setValue.tfmCtrl.sv_LBTM_ith_F; I2C_cmd[9] = setValue.tfmCtrl.sv_LBTM_ith_R; - i2c.write(i2c_addr_transform, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_transform, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); - i2c.write(i2c_addr_transform, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x30<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + // read_motorCurrent( i2c_addr_transform, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + i2c.write(0x30<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. flg_ButtonOn = false; } else if ( btnStatus_LBK == btnID_LBK ) { // LB KO @@ -915,13 +913,13 @@ I2C_cmd[5] = setValue.tfmCtrl.sv_RFTM_ith_R; I2C_cmd[8] = setValue.tfmCtrl.sv_LBTM_ith_F; I2C_cmd[9] = setValue.tfmCtrl.sv_LBTM_ith_R; - i2c.write(i2c_addr_transform, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_transform, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); - i2c.write(i2c_addr_transform, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x30<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + // read_motorCurrent( i2c_addr_transform, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + i2c.write(0x30<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. flg_ButtonOn = false; } else if ( btnStatus_LBI == btnID_LBI ) { // LB I @@ -938,13 +936,13 @@ I2C_cmd[5] = setValue.tfmCtrl.sv_RFTM_ith_R; I2C_cmd[8] = setValue.tfmCtrl.sv_LBTM_ith_F; I2C_cmd[9] = setValue.tfmCtrl.sv_LBTM_ith_R; - i2c.write(i2c_addr_transform, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - read_motorCurrent( i2c_addr_transform, I2C_readcmd, I2C_res, 3 ); - motor1_current_pct = I2C_res[0]; - motor2_current_pct = I2C_res[1]; - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); - DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); - i2c.write(i2c_addr_transform, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x30<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + // read_motorCurrent( i2c_addr_transform, I2C_readcmd, I2C_res, 3 ); + // motor1_current_pct = I2C_res[0]; + // motor2_current_pct = I2C_res[1]; + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent1 (%d)%\r\n", motor1_current_pct ); + // DEBUG_PRINT_L2( "Bd0> 3: ReadMotorCurrent2 (%d)%\r\n", motor2_current_pct ); + i2c.write(0x30<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. flg_ButtonOn = false; } // ==================================== @@ -964,8 +962,8 @@ I2C_cmd[5] = setValue.tfmCtrl.sv_RFTM_ith_R; I2C_cmd[8] = setValue.tfmCtrl.sv_LBTM_ith_F; I2C_cmd[9] = setValue.tfmCtrl.sv_LBTM_ith_R; - i2c.write(i2c_addr_transform, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. - i2c.write(i2c_addr_transform, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x30<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. + i2c.write(0x30<<1, I2C_cmd, NumberOfI2CCommand); // Send command to motor control board. } } @@ -1800,6 +1798,7 @@ DEBUG_PRINT_L0("Check the target controler\r\n"); DEBUG_PRINT_L0("--------------------------\r\n"); +/* try_cnt = TARGET_CHECK_COUNT; while(1){ // ********************************************************************** @@ -1843,6 +1842,7 @@ } } DEBUG_PRINT_L0("Bd0> Target system found\r\n"); +*/ /* **************************************************