add boost by button

This commit is contained in:
Rémi Heredero 2023-09-11 17:35:15 +02:00
parent 4d10355dd4
commit 1fa34dea8a
4 changed files with 2993 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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;
}

File diff suppressed because it is too large Load Diff