add dead joystick

This commit is contained in:
Rémi Heredero 2023-09-05 20:02:25 +02:00
parent abbeda177d
commit 0329c762a0
4 changed files with 7 additions and 1 deletions

View File

@ -59,7 +59,7 @@ void Factory_build() {
ALIVE_onSetup(ALjoy(), CM_JOY_SETUP, NULL); ALIVE_onSetup(ALjoy(), CM_JOY_SETUP, NULL);
ALIVE_setAliveTime(ALjoy(), KART_CST.JOYSTICK_ALIVE_TIME); ALIVE_setAliveTime(ALjoy(), KART_CST.JOYSTICK_ALIVE_TIME);
//ALIVE_onBorn(ALjoy(), LED_on, l1()); //ALIVE_onBorn(ALjoy(), LED_on, l1());
//ALIVE_onDead(ALjoy(), LED_off, l1()); ALIVE_onDead(ALjoy(), deadJoystick, NULL);
//DRIVE_onRun(drive(), LED_on, l2()); //DRIVE_onRun(drive(), LED_on, l2());
//DRIVE_onDead(drive(), LED_off, l2()); //DRIVE_onDead(drive(), LED_off, l2());

View File

@ -17,6 +17,7 @@
#include "../eeprom.h" #include "../eeprom.h"
#include "../drive.h" #include "../drive.h"
#include "../steering.h" #include "../steering.h"
#include "../kartculator.h"
#include "../../board/led/led.h" #include "../../board/led/led.h"
#include "../../board/button/button.h" #include "../../board/button/button.h"
#include "../../middleware/alive.h" #include "../../middleware/alive.h"

View File

@ -7,6 +7,10 @@
#include "kartculator.h" #include "kartculator.h"
void deadJoystick(void* p){
eKart.torque = 0;
eKart.position = eKart.center;
}
void calcTorque(uint8_t joy_pos) { void calcTorque(uint8_t joy_pos) {
int32_t calcTorque; int32_t calcTorque;
calcTorque = (int8_t) joy_pos; // joystick position calcTorque = (int8_t) joy_pos; // joystick position

View File

@ -13,6 +13,7 @@
#include "../mcc_generated_files/mcc.h" #include "../mcc_generated_files/mcc.h"
#include "car.h" #include "car.h"
void deadJoystick(void* p);
void calcTorque(uint8_t joy_pos); void calcTorque(uint8_t joy_pos);
void calcPosition(uint8_t joy_pos); void calcPosition(uint8_t joy_pos);
void calcSpeed(int32_t rpm); void calcSpeed(int32_t rpm);