add boost and check battery

This commit is contained in:
Rémi Heredero 2023-09-13 12:58:27 +02:00
parent 09fb1d10da
commit 73b5594786
6 changed files with 20 additions and 23 deletions

View File

@ -305,6 +305,10 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, bool rtr, uint32_t data){
* SUPPLY * * SUPPLY *
**********/ **********/
case 6: case 6:
if(idMsg == 0x1) {
eKart.batteryVoltage = data.full;
}
if(idMsg == 0x4) { if(idMsg == 0x4) {
DRIVE_startBehaviour(drive()); DRIVE_startBehaviour(drive());
STEERING_startBehaviour(steering()); STEERING_startBehaviour(steering());

View File

@ -87,20 +87,8 @@ typedef struct {
bool button; bool button;
uint8_t speed; // 100m/h uint8_t speed; // 100m/h
bool brake; bool brake;
uint8_t powerMode; // 0: eco - 1: normal - 2: race uint8_t powerMode;
/* uint16_t batteryVoltage;
* 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
*
*
*/
} KART_VAR_TYPE; } KART_VAR_TYPE;
KART_VAR_TYPE eKart; KART_VAR_TYPE eKart;

View File

@ -1,5 +1,5 @@
/** /**
* @author Rémi Heredero * @author R<EFBFBD>mi Heredero
* @version. 0.0.0 * @version. 0.0.0
* @date August 2023 * @date August 2023
* @file kartculator.c * @file kartculator.c
@ -242,6 +242,11 @@ void calcTorque(uint8_t joy_pos) {
calcTorque *= 1150; calcTorque *= 1150;
calcTorque /= 1000; calcTorque /= 1000;
} }
if(eKart.batteryVoltage <= 18750) {
calcTorque = 0;
}
eKart.torque = (int16_t) calcTorque; eKart.torque = (int16_t) calcTorque;
} }

View File

@ -124,8 +124,8 @@ void ECAN_Initialize(void)
// filter 1 is message for controller // filter 1 is message for controller
convertCANid2Reg(0x010, dSTANDARD_CAN_MSG_ID_2_0B, &RXF1EIDH, &RXF1EIDL, &RXF1SIDH, &RXF1SIDL); convertCANid2Reg(0x010, dSTANDARD_CAN_MSG_ID_2_0B, &RXF1EIDH, &RXF1EIDL, &RXF1SIDH, &RXF1SIDL);
// filter 2 is message for recipient n°7, not yet defined // filter 2 is message for display (yes i want the message from the display)
convertCANid2Reg(0x070, dSTANDARD_CAN_MSG_ID_2_0B, &RXF2EIDH, &RXF2EIDL, &RXF2SIDH, &RXF2SIDL); convertCANid2Reg(0x060, dSTANDARD_CAN_MSG_ID_2_0B, &RXF2EIDH, &RXF2EIDL, &RXF2SIDH, &RXF2SIDL);
/* /*
* ENABLE FILTERS * ENABLE FILTERS

View File

@ -454,7 +454,7 @@ endif
# Enable dependency checking # Enable dependency checking
.dep.inc: .depcheck-impl .dep.inc: .depcheck-impl
DEPFILES=$(wildcard ${POSSIBLE_DEPFILES}) DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES})
ifneq (${DEPFILES},) ifneq (${DEPFILES},)
include ${DEPFILES} include ${DEPFILES}
endif endif

View File

@ -15,11 +15,11 @@
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...
# #
SHELL=cmd.exe SHELL=cmd.exe
PATH_TO_IDE_BIN=C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/ PATH_TO_IDE_BIN=C:/Program Files/Microchip/MPLABX/v6.05/mplab_platform/platform/../mplab_ide/modules/../../bin/
# Adding MPLAB X bin directory to path. # Adding MPLAB X bin directory to path.
PATH:=C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) PATH:=C:/Program Files/Microchip/MPLABX/v6.05/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
# Path to java used to run MPLAB X when this makefile was created # Path to java used to run MPLAB X when this makefile was created
MP_JAVA_PATH="C:\Program Files\Microchip\MPLABX\v6.15\sys\java\zulu8.64.0.19-ca-fx-jre8.0.345-win_x64/bin/" MP_JAVA_PATH="C:\Program Files\Microchip\MPLABX\v6.05\sys\java\zulu8.64.0.19-ca-fx-jre8.0.345-win_x64/bin/"
OS_CURRENT="$(shell uname -s)" OS_CURRENT="$(shell uname -s)"
MP_CC="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe" MP_CC="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe"
# MP_CPPC is not defined # MP_CPPC is not defined
@ -27,11 +27,11 @@ MP_CC="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe"
MP_AS="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe" MP_AS="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe"
MP_LD="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe" MP_LD="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe"
MP_AR="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-ar.exe" MP_AR="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-ar.exe"
DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files/Microchip/MPLABX/v6.05/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="C:\Program Files\Microchip\xc8\v2.41\bin" MP_CC_DIR="C:\Program Files\Microchip\xc8\v2.41\bin"
# MP_CPPC_DIR is not defined # MP_CPPC_DIR is not defined
# MP_BC_DIR is not defined # MP_BC_DIR is not defined
MP_AS_DIR="C:\Program Files\Microchip\xc8\v2.41\bin" MP_AS_DIR="C:\Program Files\Microchip\xc8\v2.41\bin"
MP_LD_DIR="C:\Program Files\Microchip\xc8\v2.41\bin" MP_LD_DIR="C:\Program Files\Microchip\xc8\v2.41\bin"
MP_AR_DIR="C:\Program Files\Microchip\xc8\v2.41\bin" MP_AR_DIR="C:\Program Files\Microchip\xc8\v2.41\bin"
DFP_DIR=C:/Program Files/Microchip/MPLABX/v6.15/packs/Microchip/PIC18F-K_DFP/1.11.281 DFP_DIR=C:/Users/remi/.mchp_packs/Microchip/PIC18F-K_DFP/1.11.281