add boost and check battery
This commit is contained in:
@@ -305,6 +305,10 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, bool rtr, uint32_t data){
|
||||
* SUPPLY *
|
||||
**********/
|
||||
case 6:
|
||||
if(idMsg == 0x1) {
|
||||
eKart.batteryVoltage = data.full;
|
||||
}
|
||||
|
||||
if(idMsg == 0x4) {
|
||||
DRIVE_startBehaviour(drive());
|
||||
STEERING_startBehaviour(steering());
|
||||
|
||||
@@ -87,20 +87,8 @@ typedef struct {
|
||||
bool button;
|
||||
uint8_t speed; // 100m/h
|
||||
bool brake;
|
||||
uint8_t powerMode; // 0: eco - 1: normal - 2: race
|
||||
/*
|
||||
* 0 - ECO MODE
|
||||
* Eco mod limit to 1/2 of the maximal current.
|
||||
* Position is 1/2 of the maximal angle
|
||||
*
|
||||
* 1 - NORMAL MODE
|
||||
* Standard ramp for normal mode
|
||||
* Position is limited to 3/4 of the maximal
|
||||
*
|
||||
* 2 - RACE MODE
|
||||
*
|
||||
*
|
||||
*/
|
||||
uint8_t powerMode;
|
||||
uint16_t batteryVoltage;
|
||||
} KART_VAR_TYPE;
|
||||
KART_VAR_TYPE eKart;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @author R<>mi Heredero
|
||||
* @author R<>mi Heredero
|
||||
* @version. 0.0.0
|
||||
* @date August 2023
|
||||
* @file kartculator.c
|
||||
@@ -242,6 +242,11 @@ void calcTorque(uint8_t joy_pos) {
|
||||
calcTorque *= 1150;
|
||||
calcTorque /= 1000;
|
||||
}
|
||||
|
||||
if(eKart.batteryVoltage <= 18750) {
|
||||
calcTorque = 0;
|
||||
}
|
||||
|
||||
eKart.torque = (int16_t) calcTorque;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user