2018.07.26
Dependencies: EthernetInterface TextLCD USBDevice USBHost3 mbed
Fork of USBHostHub_HelloWorld by
common.h@16:1adb3f1e867d, 2018-07-26 (annotated)
- Committer:
- sayzyas
- Date:
- Thu Jul 26 04:21:06 2018 +0000
- Revision:
- 16:1adb3f1e867d
- Parent:
- 15:01680ed6b799
2018.07.26
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sayzyas | 10:a2bd7d07c7f8 | 1 | /* |
sayzyas | 10:a2bd7d07c7f8 | 2 | DEBUG PRINT MACRO |
sayzyas | 10:a2bd7d07c7f8 | 3 | http://qiita.com/saltheads/items/e1b0ab54d3d6029c9593 |
sayzyas | 10:a2bd7d07c7f8 | 4 | http://tricky-code.net/nicecode/code10.php |
sayzyas | 10:a2bd7d07c7f8 | 5 | */ |
sayzyas | 10:a2bd7d07c7f8 | 6 | /* Information */ |
sayzyas | 15:01680ed6b799 | 7 | #define LatestUpDate "2016.11.04" |
sayzyas | 15:01680ed6b799 | 8 | #define ProgramRevision "Rev 2.40" |
sayzyas | 15:01680ed6b799 | 9 | #define Author "ZisNotRevast" |
sayzyas | 11:ff06edc0219c | 10 | #define Company "Revast Co.,Ltd." |
sayzyas | 10:a2bd7d07c7f8 | 11 | |
sayzyas | 14:3a5ae61ab1f4 | 12 | //#define __CREATE_SETTING_FILE__ |
sayzyas | 14:3a5ae61ab1f4 | 13 | //#define __TARGET_BOARD_CHECK__ |
sayzyas | 14:3a5ae61ab1f4 | 14 | |
sayzyas | 15:01680ed6b799 | 15 | |
sayzyas | 15:01680ed6b799 | 16 | //#define __WInchDebug__ // For debugging |
sayzyas | 15:01680ed6b799 | 17 | |
sayzyas | 15:01680ed6b799 | 18 | |
sayzyas | 15:01680ed6b799 | 19 | // Comment out if net setting is FIX. |
sayzyas | 15:01680ed6b799 | 20 | // #define __NET_SETTING_FROM_LFS__ |
sayzyas | 15:01680ed6b799 | 21 | |
sayzyas | 15:01680ed6b799 | 22 | |
sayzyas | 13:2c70c772fe24 | 23 | // Read motor current |
sayzyas | 13:2c70c772fe24 | 24 | #define __READ_TFM_MOTOR_CURRENT__ |
sayzyas | 13:2c70c772fe24 | 25 | |
sayzyas | 13:2c70c772fe24 | 26 | #define __IIC_COMAMND_SEND__ |
sayzyas | 13:2c70c772fe24 | 27 | |
sayzyas | 15:01680ed6b799 | 28 | #define __SET_WINCH_MOTOR_SPEED_BY_VOLUME__ |
sayzyas | 15:01680ed6b799 | 29 | |
sayzyas | 14:3a5ae61ab1f4 | 30 | // ====================================================================== |
sayzyas | 14:3a5ae61ab1f4 | 31 | // For Debugging |
sayzyas | 14:3a5ae61ab1f4 | 32 | // ====================================================================== |
sayzyas | 14:3a5ae61ab1f4 | 33 | //#define __DEBUG_PRINT_SW__ // Display SW Status to console |
sayzyas | 10:a2bd7d07c7f8 | 34 | #define __DEBUG_L0__ |
sayzyas | 14:3a5ae61ab1f4 | 35 | //#define __DEBUG_L1__ |
sayzyas | 13:2c70c772fe24 | 36 | //#define __DEBUG_L2__ |
sayzyas | 15:01680ed6b799 | 37 | //#define __DEBUG_L3__ |
sayzyas | 10:a2bd7d07c7f8 | 38 | //#define __DEBUG_L4__ |
sayzyas | 10:a2bd7d07c7f8 | 39 | //#define __DEBUG_L5__ |
sayzyas | 9:fdc87108d36f | 40 | |
sayzyas | 15:01680ed6b799 | 41 | #define __DEBUG_WINCH_DATA__ |
sayzyas | 15:01680ed6b799 | 42 | |
sayzyas | 15:01680ed6b799 | 43 | |
sayzyas | 15:01680ed6b799 | 44 | #ifdef __DEBUG_WINCH_DATA__ |
sayzyas | 15:01680ed6b799 | 45 | #define DEBUG_PRINT_WINCH_DATA(...) pc.printf(__VA_ARGS__) |
sayzyas | 15:01680ed6b799 | 46 | #else |
sayzyas | 15:01680ed6b799 | 47 | #define DEBUG_PRINT_WINCH_DATA(...) |
sayzyas | 15:01680ed6b799 | 48 | #endif |
sayzyas | 15:01680ed6b799 | 49 | |
sayzyas | 14:3a5ae61ab1f4 | 50 | #ifdef __DEBUG_PRINT_SW__ |
sayzyas | 14:3a5ae61ab1f4 | 51 | #define DEBUG_PRINT_SW(...) pc.printf(__VA_ARGS__) |
sayzyas | 14:3a5ae61ab1f4 | 52 | #else |
sayzyas | 14:3a5ae61ab1f4 | 53 | #define DEBUG_PRINT_SW(...) |
sayzyas | 14:3a5ae61ab1f4 | 54 | #endif |
sayzyas | 14:3a5ae61ab1f4 | 55 | |
sayzyas | 10:a2bd7d07c7f8 | 56 | #ifdef __DEBUG_L0__ |
sayzyas | 10:a2bd7d07c7f8 | 57 | #define DEBUG_PRINT_L0(...) pc.printf(__VA_ARGS__) |
sayzyas | 10:a2bd7d07c7f8 | 58 | #else |
sayzyas | 10:a2bd7d07c7f8 | 59 | #define DEBUG_PRINT_L0(...) |
sayzyas | 10:a2bd7d07c7f8 | 60 | #endif |
sayzyas | 10:a2bd7d07c7f8 | 61 | #ifdef __DEBUG_L1__ |
sayzyas | 10:a2bd7d07c7f8 | 62 | #define DEBUG_PRINT_L1(...) pc.printf(__VA_ARGS__) |
sayzyas | 10:a2bd7d07c7f8 | 63 | #else |
sayzyas | 10:a2bd7d07c7f8 | 64 | #define DEBUG_PRINT_L1(...) |
sayzyas | 10:a2bd7d07c7f8 | 65 | #endif |
sayzyas | 10:a2bd7d07c7f8 | 66 | #ifdef __DEBUG_L2__ |
sayzyas | 10:a2bd7d07c7f8 | 67 | #define DEBUG_PRINT_L2(...) pc.printf(__VA_ARGS__) |
sayzyas | 10:a2bd7d07c7f8 | 68 | #else |
sayzyas | 10:a2bd7d07c7f8 | 69 | #define DEBUG_PRINT_L2(...) |
sayzyas | 10:a2bd7d07c7f8 | 70 | #endif |
sayzyas | 10:a2bd7d07c7f8 | 71 | #ifdef __DEBUG_L3__ |
sayzyas | 10:a2bd7d07c7f8 | 72 | #define DEBUG_PRINT_L3(...) pc.printf(__VA_ARGS__) |
sayzyas | 10:a2bd7d07c7f8 | 73 | #else |
sayzyas | 10:a2bd7d07c7f8 | 74 | #define DEBUG_PRINT_L3(...) |
sayzyas | 10:a2bd7d07c7f8 | 75 | #endif |
sayzyas | 10:a2bd7d07c7f8 | 76 | #ifdef __DEBUG_L4__ |
sayzyas | 10:a2bd7d07c7f8 | 77 | #define DEBUG_PRINT_L4(...) pc.printf(__VA_ARGS__) |
sayzyas | 10:a2bd7d07c7f8 | 78 | #else |
sayzyas | 10:a2bd7d07c7f8 | 79 | #define DEBUG_PRINT_L4(...) |
sayzyas | 10:a2bd7d07c7f8 | 80 | #endif |
sayzyas | 10:a2bd7d07c7f8 | 81 | #ifdef __DEBUG_L5__ |
sayzyas | 10:a2bd7d07c7f8 | 82 | #define DEBUG_PRINT_L5(...) pc.printf(__VA_ARGS__) |
sayzyas | 10:a2bd7d07c7f8 | 83 | #else |
sayzyas | 10:a2bd7d07c7f8 | 84 | #define DEBUG_PRINT_L5(...) |
sayzyas | 10:a2bd7d07c7f8 | 85 | #endif |
sayzyas | 14:3a5ae61ab1f4 | 86 | |
sayzyas | 10:a2bd7d07c7f8 | 87 | /* Above is still under construction ..... */ |
sayzyas | 9:fdc87108d36f | 88 | |
sayzyas | 10:a2bd7d07c7f8 | 89 | #define __DISP_GAMAPAD_STATUS_ALL__ |
sayzyas | 10:a2bd7d07c7f8 | 90 | #define __DISP_WRITE_VALUE__ |
sayzyas | 10:a2bd7d07c7f8 | 91 | |
sayzyas | 13:2c70c772fe24 | 92 | #define I2C_ADDRESS_HANDY 0x20 |
sayzyas | 13:2c70c772fe24 | 93 | #define I2C_ADDRESS_WINCH 0x10 |
sayzyas | 13:2c70c772fe24 | 94 | #define I2C_ADDRESS_TRANSFORM 0x08 |
sayzyas | 13:2c70c772fe24 | 95 | #define I2C_ADDRESS_CRAWLER 0x04 |
sayzyas | 13:2c70c772fe24 | 96 | #define I2C_ADDRESS_RESOLVER 0x02 |
sayzyas | 9:fdc87108d36f | 97 | |
sayzyas | 9:fdc87108d36f | 98 | |
sayzyas | 10:a2bd7d07c7f8 | 99 | #define _OK_ 1 |
sayzyas | 10:a2bd7d07c7f8 | 100 | #define _NG_ 0 |
sayzyas | 10:a2bd7d07c7f8 | 101 | #define _FAIL_ 0 |
sayzyas | 10:a2bd7d07c7f8 | 102 | |
sayzyas | 10:a2bd7d07c7f8 | 103 | #define ON 1 |
sayzyas | 10:a2bd7d07c7f8 | 104 | #define OFF 0 |
sayzyas | 10:a2bd7d07c7f8 | 105 | |
sayzyas | 10:a2bd7d07c7f8 | 106 | #define LFS_READ_COUNT 3 |
sayzyas | 10:a2bd7d07c7f8 | 107 | #define TARGET_CHECK_COUNT 10 |
sayzyas | 10:a2bd7d07c7f8 | 108 | |
sayzyas | 10:a2bd7d07c7f8 | 109 | //#define __DSP_MOTOR_CURRENT_ |
sayzyas | 10:a2bd7d07c7f8 | 110 | |
sayzyas | 10:a2bd7d07c7f8 | 111 | /* Usually this should be comment out */ |
sayzyas | 10:a2bd7d07c7f8 | 112 | //#define _COMMUNCATE_PC_BY_SERIAL_ |
sayzyas | 10:a2bd7d07c7f8 | 113 | |
sayzyas | 10:a2bd7d07c7f8 | 114 | // Should validate this definition when you use DHCP. |
sayzyas | 10:a2bd7d07c7f8 | 115 | //#define __ETERNET_DHCP__ |
sayzyas | 10:a2bd7d07c7f8 | 116 | |
sayzyas | 10:a2bd7d07c7f8 | 117 | #define NumberOfPcCommand 11 |
sayzyas | 14:3a5ae61ab1f4 | 118 | #define NumberOfI2CCommand 14 |
sayzyas | 14:3a5ae61ab1f4 | 119 | |
sayzyas | 14:3a5ae61ab1f4 | 120 | /* I2C Command packet to motor controller */ |
sayzyas | 14:3a5ae61ab1f4 | 121 | /* For motor controller */ |
sayzyas | 14:3a5ae61ab1f4 | 122 | enum{ |
sayzyas | 14:3a5ae61ab1f4 | 123 | I2C_CP_PREAMBLE, // Preamble of command packet |
sayzyas | 14:3a5ae61ab1f4 | 124 | I2C_CP_COMMAND, // instruction command |
sayzyas | 14:3a5ae61ab1f4 | 125 | I2C_CP_M1_DIR, // motor1 rotation direction |
sayzyas | 14:3a5ae61ab1f4 | 126 | I2C_CP_M1_SPEED, // motor1 rotation speed |
sayzyas | 14:3a5ae61ab1f4 | 127 | I2C_CP_M1_FWD_CNTTH_U, // motor1 current limit detection threshold upper byte |
sayzyas | 14:3a5ae61ab1f4 | 128 | I2C_CP_M1_FWD_CNTTH_L, // motor1 current limit detection threshold lower byte |
sayzyas | 14:3a5ae61ab1f4 | 129 | I2C_CP_M1_RVS_CNTTH_U, // motor1 current limit detection threshold upper byte |
sayzyas | 14:3a5ae61ab1f4 | 130 | I2C_CP_M1_RVS_CNTTH_L, // motor1 current limit detection threshold lower byte |
sayzyas | 14:3a5ae61ab1f4 | 131 | I2C_CP_M2_DIR, // motor2 rotation direction |
sayzyas | 14:3a5ae61ab1f4 | 132 | I2C_CP_M2_SPEED, // motor2 rotation speed |
sayzyas | 14:3a5ae61ab1f4 | 133 | I2C_CP_M2_FWD_CNTTH_U, // motor2 current limit detection threshold upper byte |
sayzyas | 14:3a5ae61ab1f4 | 134 | I2C_CP_M2_FWD_CNTTH_L, // motor2 current limit detection threshold lower byte |
sayzyas | 14:3a5ae61ab1f4 | 135 | I2C_CP_M2_RVS_CNTTH_U, // motor2 current limit detection threshold upper byte |
sayzyas | 14:3a5ae61ab1f4 | 136 | I2C_CP_M2_RVS_CNTTH_L, // motor2 current limit detection threshold lower byte |
sayzyas | 14:3a5ae61ab1f4 | 137 | }; |
sayzyas | 14:3a5ae61ab1f4 | 138 | /* For resolver reader controller */ |
sayzyas | 14:3a5ae61ab1f4 | 139 | enum{ |
sayzyas | 15:01680ed6b799 | 140 | I2C_CP_PREAMBLE_R, // Sub command |
sayzyas | 14:3a5ae61ab1f4 | 141 | I2C_CP_COMMAND_R, // instruction command |
sayzyas | 14:3a5ae61ab1f4 | 142 | I2C_CP_WDRAM_DIA_UPPER, // motor1 rotation direction |
sayzyas | 14:3a5ae61ab1f4 | 143 | I2C_CP_WDRAM_DIA_LOWER, // motor1 rotation speed |
sayzyas | 14:3a5ae61ab1f4 | 144 | I2C_CP_CCABLE_DIA_UPPER, // motor1 current limit detection threshold upper byte |
sayzyas | 14:3a5ae61ab1f4 | 145 | I2C_CP_CCABLE_DIA_LOWER, // motor1 current limit detection threshold lower byte |
sayzyas | 14:3a5ae61ab1f4 | 146 | I2C_CP_RESOLVER_RESO, // motor1 current limit detection threshold upper byte |
sayzyas | 15:01680ed6b799 | 147 | I2C_CP_PRESET_CPOS_UPPER, // reserved |
sayzyas | 15:01680ed6b799 | 148 | I2C_CP_PRESET_CPOS_LOWER, // reserved |
sayzyas | 14:3a5ae61ab1f4 | 149 | I2C_CP_RES3, // reserved |
sayzyas | 14:3a5ae61ab1f4 | 150 | I2C_CP_RES4, // reserved |
sayzyas | 14:3a5ae61ab1f4 | 151 | I2C_CP_RES5, // reserved |
sayzyas | 14:3a5ae61ab1f4 | 152 | I2C_CP_RES6, // reserved |
sayzyas | 14:3a5ae61ab1f4 | 153 | I2C_CP_RES7, // reserved |
sayzyas | 14:3a5ae61ab1f4 | 154 | }; |
sayzyas | 14:3a5ae61ab1f4 | 155 | |
sayzyas | 14:3a5ae61ab1f4 | 156 | |
sayzyas | 10:a2bd7d07c7f8 | 157 | |
sayzyas | 10:a2bd7d07c7f8 | 158 | /* Winch Operating mode */ |
sayzyas | 10:a2bd7d07c7f8 | 159 | enum{ |
sayzyas | 10:a2bd7d07c7f8 | 160 | WINCH_POSITION_CLEAR, |
sayzyas | 15:01680ed6b799 | 161 | WINCH_PRESET_BASEDATA, |
sayzyas | 10:a2bd7d07c7f8 | 162 | WINCH_MMODE_RELATIVE, |
sayzyas | 10:a2bd7d07c7f8 | 163 | WINCH_MMODE_ABSOLUTE, |
sayzyas | 10:a2bd7d07c7f8 | 164 | WINCH_STEPDOWN_BTN_ON, |
sayzyas | 10:a2bd7d07c7f8 | 165 | WINCH_STEPDOWN_BTN_OFF, |
sayzyas | 10:a2bd7d07c7f8 | 166 | WINCH_STEPUP_BTN_ON, |
sayzyas | 10:a2bd7d07c7f8 | 167 | WINCH_STEPUP_BTN_OFF, |
sayzyas | 10:a2bd7d07c7f8 | 168 | WINCH_U_STEPDOWN_BTN_ON, |
sayzyas | 10:a2bd7d07c7f8 | 169 | WINCH_U_STEPDOWN_BTN_OFF, |
sayzyas | 10:a2bd7d07c7f8 | 170 | WINCH_U_STEPUP_BTN_ON, |
sayzyas | 10:a2bd7d07c7f8 | 171 | WINCH_U_STEPUP_BTN_OFF, |
sayzyas | 15:01680ed6b799 | 172 | WINCH_PRESET_POSITION, |
sayzyas | 10:a2bd7d07c7f8 | 173 | }; |
sayzyas | 10:a2bd7d07c7f8 | 174 | |
sayzyas | 10:a2bd7d07c7f8 | 175 | /* Game Pad defnition */ |
sayzyas | 10:a2bd7d07c7f8 | 176 | #define GAMEPAD_VID_LOGICOOL 0x046d |
sayzyas | 10:a2bd7d07c7f8 | 177 | #define GAMEPAD_PID_LOGICOOL_F710 0xc219 |
sayzyas | 10:a2bd7d07c7f8 | 178 | #define GAMEPAD_PID_LOGICOOL_F310 0xc216 |
sayzyas | 10:a2bd7d07c7f8 | 179 | |
sayzyas | 10:a2bd7d07c7f8 | 180 | #define GAMEPAD_VID_SANWA 0x12bd |
sayzyas | 10:a2bd7d07c7f8 | 181 | #define GAMEPAD_PID_SANWA_JYP70US 0xc003 |
sayzyas | 10:a2bd7d07c7f8 | 182 | |
sayzyas | 10:a2bd7d07c7f8 | 183 | #define GAMEPAD_VID_ELECOM 0x056e |
sayzyas | 10:a2bd7d07c7f8 | 184 | #define GAMEPAD_PID_ELECOM_JCU3613M 0x2003 |
sayzyas | 10:a2bd7d07c7f8 | 185 | |
sayzyas | 10:a2bd7d07c7f8 | 186 | #define GAMEPAD_VID_RSTHANDY 0x1234 |
sayzyas | 10:a2bd7d07c7f8 | 187 | #define GAMEPAD_PID_RSTHANDY 0x0006 |
sayzyas | 9:fdc87108d36f | 188 | |
sayzyas | 9:fdc87108d36f | 189 | |
sayzyas | 10:a2bd7d07c7f8 | 190 | /* Ether net */ |
sayzyas | 10:a2bd7d07c7f8 | 191 | #define TCP_SERVER_PORT 10002 |
sayzyas | 10:a2bd7d07c7f8 | 192 | #define UDP_SERVER_PORT 10000 |
sayzyas | 10:a2bd7d07c7f8 | 193 | //#define ECHO_SERVER_PORT 7 |
sayzyas | 10:a2bd7d07c7f8 | 194 | |
sayzyas | 10:a2bd7d07c7f8 | 195 | #define MOTOR_FWD 'F' /* Forward Rotation */ |
sayzyas | 10:a2bd7d07c7f8 | 196 | #define MOTOR_RVS 'R' /* Reverse Rotation */ |
sayzyas | 10:a2bd7d07c7f8 | 197 | #define MOTOR_STP 'S' /* Stop */ |
sayzyas | 10:a2bd7d07c7f8 | 198 | |
sayzyas | 10:a2bd7d07c7f8 | 199 | // ========================================================= |
sayzyas | 10:a2bd7d07c7f8 | 200 | // Setting Values |
sayzyas | 10:a2bd7d07c7f8 | 201 | // ========================================================= |
sayzyas | 10:a2bd7d07c7f8 | 202 | typedef struct { |
sayzyas | 10:a2bd7d07c7f8 | 203 | int8_t sv_JS_ShapeMode; // JS Shape: 0=I, 1=KO |
sayzyas | 10:a2bd7d07c7f8 | 204 | int8_t sv_JS_OpeMode; // JS Operation: 0=single, 1=dual |
sayzyas | 13:2c70c772fe24 | 205 | int8_t sv_WinchValid; // Winch function valid or not: 0=Tfm, Crawler valid, 1=Winch valid |
sayzyas | 13:2c70c772fe24 | 206 | int8_t res; |
sayzyas | 13:2c70c772fe24 | 207 | } basic_operation_t; |
sayzyas | 10:a2bd7d07c7f8 | 208 | |
sayzyas | 10:a2bd7d07c7f8 | 209 | typedef struct { |
sayzyas | 14:3a5ae61ab1f4 | 210 | uint16_t sv_WDM_ith_F; // 2 Current Threshold Winch Dram Motor Fwd rotation. |
sayzyas | 14:3a5ae61ab1f4 | 211 | uint16_t sv_WDM_ith_R; // 2 Current Threshold Winch Dram Motor Rvs rotation. |
sayzyas | 14:3a5ae61ab1f4 | 212 | uint16_t sv_WRM_ith_F; // 2 Current Threshold Winch .... Motor Fwd rotation. |
sayzyas | 14:3a5ae61ab1f4 | 213 | uint16_t sv_WRM_ith_R; // 2 Current Threshold Winch .... Motor Rvs rotation. |
sayzyas | 14:3a5ae61ab1f4 | 214 | uint8_t sv_WDM_hsrto_F; // 1 Winch Dram Motor high speed ratio Fwd |
sayzyas | 14:3a5ae61ab1f4 | 215 | uint8_t sv_WDM_hsrto_R; // 1 Winch Dram Motor high speed ratio Rvs |
sayzyas | 14:3a5ae61ab1f4 | 216 | uint8_t sv_WDM_lsrto_F; // 1 Winch Dram Motor low speed ratio Fwd |
sayzyas | 14:3a5ae61ab1f4 | 217 | uint8_t sv_WDM_lsrto_R; // 1 Winch Dram Motor low speed ratio Rvs |
sayzyas | 14:3a5ae61ab1f4 | 218 | uint8_t sv_WRM_hsrto_F; // 1 Winch .... Motor high speed limit Fwd |
sayzyas | 14:3a5ae61ab1f4 | 219 | uint8_t sv_WRM_hsrto_R; // 1 Winch .... Motor high speed limit Rvs |
sayzyas | 14:3a5ae61ab1f4 | 220 | uint8_t sv_WRM_lsrto_F; // 1 Winch .... Motor low speed ratio Fwd |
sayzyas | 14:3a5ae61ab1f4 | 221 | uint8_t sv_WRM_lsrto_R; // 1 Winch .... Motor low speed ratio Rvs |
sayzyas | 14:3a5ae61ab1f4 | 222 | uint16_t sv_WRS_DramDmrx100; // 2 Winch Dram diameter x 100; |
sayzyas | 14:3a5ae61ab1f4 | 223 | uint16_t sv_WRS_CCableDmrx100; // 2 Winch CCable diameter x 100 |
sayzyas | 14:3a5ae61ab1f4 | 224 | uint8_t sv_WRS_RResolution; // 1 Winch Resolver resolution (bit) |
sayzyas | 14:3a5ae61ab1f4 | 225 | uint8_t reserved; // 1 reserved for future use |
sayzyas | 14:3a5ae61ab1f4 | 226 | } winch_SetValue_t; // 22 byte |
sayzyas | 7:7a258ef5670d | 227 | |
sayzyas | 10:a2bd7d07c7f8 | 228 | typedef struct { |
sayzyas | 14:3a5ae61ab1f4 | 229 | uint16_t sv_RFTM_ith_F; // 2 RF transform motor Fwd roration current threshold |
sayzyas | 14:3a5ae61ab1f4 | 230 | uint16_t sv_RFTM_ith_R; // 2 RF transform motor Rvs roration current threshold |
sayzyas | 14:3a5ae61ab1f4 | 231 | uint16_t sv_LBTM_ith_F; // 2 LB transform motor Fwd roration current threshold |
sayzyas | 14:3a5ae61ab1f4 | 232 | uint16_t sv_LBTM_ith_R; // 2 LB transform motor Rvs roration current threshold |
sayzyas | 14:3a5ae61ab1f4 | 233 | uint8_t sv_RFTM_srto_F; // 1 RF transform motor Fwd rotation speed ratio |
sayzyas | 14:3a5ae61ab1f4 | 234 | uint8_t sv_RFTM_srto_R; // 1 RF transform motor Rvs rotation speed ratio |
sayzyas | 15:01680ed6b799 | 235 | uint8_t sv_LBTM_srto_F; // 1 LB transform motor Fwd rotation speed ratio |
sayzyas | 15:01680ed6b799 | 236 | uint8_t sv_LBTM_srto_R; // 1 LB transform motor Rvs rotation speed ratio |
sayzyas | 14:3a5ae61ab1f4 | 237 | } tfm_SetValue_t; // 12 byte |
sayzyas | 10:a2bd7d07c7f8 | 238 | |
sayzyas | 10:a2bd7d07c7f8 | 239 | typedef struct { |
sayzyas | 14:3a5ae61ab1f4 | 240 | uint16_t sv_RFCM_ith_F; // 2 RF Crawler motor Fwd rotation current threshold |
sayzyas | 14:3a5ae61ab1f4 | 241 | uint16_t sv_RFCM_ith_R; // 2 RF Crawler motor Rvs rotation current threshold |
sayzyas | 14:3a5ae61ab1f4 | 242 | uint16_t sv_LBCM_ith_F; // 2 LB Crawler motor Fwd rotation current threshold |
sayzyas | 14:3a5ae61ab1f4 | 243 | uint16_t sv_LBCM_ith_R; // 2 LB Crawler motor Rvs rotation current threshold |
sayzyas | 14:3a5ae61ab1f4 | 244 | uint8_t sv_RFCM_srto_F; // 1 RF Crawler motor Fwd rotation speed limnit |
sayzyas | 14:3a5ae61ab1f4 | 245 | uint8_t sv_RFCM_srto_R; // 1 RF Crawler motor Rvs rotation speed limnit |
sayzyas | 14:3a5ae61ab1f4 | 246 | uint8_t sv_LBCM_srto_F; // 1 LB Crawler motor Fwd rotation speed limnit |
sayzyas | 14:3a5ae61ab1f4 | 247 | uint8_t sv_LBCM_srto_R; // 1 LB Crawler motor Rvs rotation speed limnit |
sayzyas | 14:3a5ae61ab1f4 | 248 | uint8_t sv_RFCM_dzu; // 1 R-Joystick upper dead zone width |
sayzyas | 14:3a5ae61ab1f4 | 249 | uint8_t sv_RFCM_dzc; // 1 R-Joystick center value |
sayzyas | 14:3a5ae61ab1f4 | 250 | uint8_t sv_RFCM_dzl; // 1 R-Joystick lower dead zone width |
sayzyas | 14:3a5ae61ab1f4 | 251 | uint8_t sv_LBCM_dzu; // 1 L-Joystick upper dead zone width |
sayzyas | 14:3a5ae61ab1f4 | 252 | uint8_t sv_LBCM_dzc; // 1 L-Joystick center value |
sayzyas | 14:3a5ae61ab1f4 | 253 | uint8_t sv_LBCM_dzl; // 1 L-Joystick lower dead zone width |
sayzyas | 14:3a5ae61ab1f4 | 254 | uint8_t reserved1; // 1 |
sayzyas | 14:3a5ae61ab1f4 | 255 | uint8_t reserved2; // 1 |
sayzyas | 14:3a5ae61ab1f4 | 256 | } crawler_SetValue_t; // 20 byte |
sayzyas | 10:a2bd7d07c7f8 | 257 | |
sayzyas | 10:a2bd7d07c7f8 | 258 | typedef struct { |
sayzyas | 10:a2bd7d07c7f8 | 259 | uint8_t sv_centerValue; |
sayzyas | 10:a2bd7d07c7f8 | 260 | uint8_t sv_nsenseBand_s; |
sayzyas | 10:a2bd7d07c7f8 | 261 | uint8_t sv_nsenseBand_w; |
sayzyas | 10:a2bd7d07c7f8 | 262 | } js_SetValue_t; |
sayzyas | 10:a2bd7d07c7f8 | 263 | |
sayzyas | 10:a2bd7d07c7f8 | 264 | typedef struct SetValue { |
sayzyas | 13:2c70c772fe24 | 265 | // operation_t operation; |
sayzyas | 14:3a5ae61ab1f4 | 266 | winch_SetValue_t winchCtrl; |
sayzyas | 10:a2bd7d07c7f8 | 267 | tfm_SetValue_t tfmCtrl; |
sayzyas | 10:a2bd7d07c7f8 | 268 | crawler_SetValue_t crawlerCtrl; |
sayzyas | 10:a2bd7d07c7f8 | 269 | // js_SetValue_t jsCtrl; |
sayzyas | 10:a2bd7d07c7f8 | 270 | } setValue_t; |
sayzyas | 7:7a258ef5670d | 271 | |
sayzyas | 7:7a258ef5670d | 272 | |
sayzyas | 9:fdc87108d36f | 273 | |
sayzyas | 9:fdc87108d36f | 274 | |
sayzyas | 15:01680ed6b799 | 275 | #define SLOWDOWN_DISTANCE 23 // <--10 2016.06.01 |
sayzyas | 13:2c70c772fe24 | 276 | #define SLOWDOWN_NEAR_DISTANCE 3 |
sayzyas | 10:a2bd7d07c7f8 | 277 | /* |
sayzyas | 10:a2bd7d07c7f8 | 278 | typedef struct { |
sayzyas | 10:a2bd7d07c7f8 | 279 | int16_t dt_WinchCntPosition; // Current winch posittion |
sayzyas | 10:a2bd7d07c7f8 | 280 | int16_t dt_WinchRtvValue; // Winch Moving distance |
sayzyas | 10:a2bd7d07c7f8 | 281 | int16_t dt_WinchDstPosition; // Destination Position |
sayzyas | 10:a2bd7d07c7f8 | 282 | char operation; |
sayzyas | 10:a2bd7d07c7f8 | 283 | int8_t dt_WinchMotorCurrent; // Winch motor current |
sayzyas | 10:a2bd7d07c7f8 | 284 | } winchData_t; |
sayzyas | 10:a2bd7d07c7f8 | 285 | */ |
sayzyas | 10:a2bd7d07c7f8 | 286 | |
sayzyas | 10:a2bd7d07c7f8 | 287 | typedef struct { |
sayzyas | 10:a2bd7d07c7f8 | 288 | int16_t dt_WinchCntPosition; // Current winch posittion |
sayzyas | 10:a2bd7d07c7f8 | 289 | int16_t dt_WinchRtvValue; // Winch Moving distance |
sayzyas | 10:a2bd7d07c7f8 | 290 | int16_t dt_WinchDstPosition; // Destination Position |
sayzyas | 10:a2bd7d07c7f8 | 291 | uint8_t operation; |
sayzyas | 10:a2bd7d07c7f8 | 292 | uint8_t dt_WinchMotor1Current; // Winch motor 1 current |
sayzyas | 10:a2bd7d07c7f8 | 293 | uint8_t dt_WinchMotor2Current; // Winch motor 2 current |
sayzyas | 10:a2bd7d07c7f8 | 294 | uint8_t res; |
sayzyas | 10:a2bd7d07c7f8 | 295 | } winchData_t; |
sayzyas | 10:a2bd7d07c7f8 | 296 | |
sayzyas | 10:a2bd7d07c7f8 | 297 | |
sayzyas | 10:a2bd7d07c7f8 | 298 | #define ROTATE_PER_RESOLUTION 24 |
sayzyas | 10:a2bd7d07c7f8 | 299 | |
sayzyas | 10:a2bd7d07c7f8 | 300 | #define __READ_CURRENT_AT_CIF_TASK__ |
sayzyas | 10:a2bd7d07c7f8 | 301 | |
sayzyas | 10:a2bd7d07c7f8 | 302 | //mv_WinchMvData |