add dead joystick
This commit is contained in:
		| @@ -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()); | ||||||
|   | |||||||
| @@ -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" | ||||||
|   | |||||||
| @@ -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 | ||||||
|   | |||||||
| @@ -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); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user