add boost by button
This commit is contained in:
		| @@ -196,8 +196,10 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, bool rtr, uint32_t data){ | ||||
|                 //  posX    posY    button  - | ||||
|                 calcTorque(incomeData.separate.byte1); | ||||
|                 calcPosition(incomeData.separate.byte0); | ||||
|                 eKart.button = (bool) incomeData.separate.byte2; | ||||
|                 STEERING_emitPollDir(steering()); | ||||
|                  | ||||
|                  | ||||
|             } | ||||
|              | ||||
|             if(idMsg == 0xF) { // JOY_ALIVE | ||||
|   | ||||
| @@ -84,6 +84,7 @@ typedef struct { | ||||
|     int16_t torque;     //  | ||||
|     uint32_t center;    //  | ||||
|     uint32_t position;  //  | ||||
|     bool button; | ||||
|     uint8_t speed;      // 100m/h | ||||
|     bool brake; | ||||
|     uint8_t powerMode; // 0: eco - 1: normal - 2: race | ||||
|   | ||||
| @@ -237,6 +237,11 @@ void calcTorque(uint8_t joy_pos) { | ||||
|      | ||||
|     calcTorque *= KART_CST.CONTROL_POWER_FACTOR;    // convert by power factor | ||||
|     calcTorque /= 1000;                             // torque define by joystick | ||||
|      | ||||
|     if(eKart.button) { | ||||
|         calcTorque *= 1150; | ||||
|         calcTorque /= 1000; | ||||
|     } | ||||
|     eKart.torque = (int16_t) calcTorque; | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										2985
									
								
								binary_files/v1_3_0-boost_by_pb.hex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2985
									
								
								binary_files/v1_3_0-boost_by_pb.hex
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user