diff --git a/306-controller_interface.X/app/can_message.c b/306-controller_interface.X/app/can_message.c index c611f4e..59af78e 100644 --- a/306-controller_interface.X/app/can_message.c +++ b/306-controller_interface.X/app/can_message.c @@ -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()); diff --git a/306-controller_interface.X/app/car.h b/306-controller_interface.X/app/car.h index 28137ab..7747af4 100644 --- a/306-controller_interface.X/app/car.h +++ b/306-controller_interface.X/app/car.h @@ -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; diff --git a/306-controller_interface.X/app/kartculator.c b/306-controller_interface.X/app/kartculator.c index f13314d..97e9f91 100644 --- a/306-controller_interface.X/app/kartculator.c +++ b/306-controller_interface.X/app/kartculator.c @@ -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; } diff --git a/306-controller_interface.X/mcc_generated_files/ecan.c b/306-controller_interface.X/mcc_generated_files/ecan.c index e1bfd4d..749f12b 100644 --- a/306-controller_interface.X/mcc_generated_files/ecan.c +++ b/306-controller_interface.X/mcc_generated_files/ecan.c @@ -124,8 +124,8 @@ void ECAN_Initialize(void) // filter 1 is message for controller convertCANid2Reg(0x010, dSTANDARD_CAN_MSG_ID_2_0B, &RXF1EIDH, &RXF1EIDL, &RXF1SIDH, &RXF1SIDL); - // filter 2 is message for recipient n°7, not yet defined - convertCANid2Reg(0x070, dSTANDARD_CAN_MSG_ID_2_0B, &RXF2EIDH, &RXF2EIDL, &RXF2SIDH, &RXF2SIDL); + // filter 2 is message for display (yes i want the message from the display) + convertCANid2Reg(0x060, dSTANDARD_CAN_MSG_ID_2_0B, &RXF2EIDH, &RXF2EIDL, &RXF2SIDH, &RXF2SIDL); /* * ENABLE FILTERS diff --git a/306-controller_interface.X/nbproject/Makefile-default.mk b/306-controller_interface.X/nbproject/Makefile-default.mk index 3fc7372..b0530ed 100644 --- a/306-controller_interface.X/nbproject/Makefile-default.mk +++ b/306-controller_interface.X/nbproject/Makefile-default.mk @@ -454,7 +454,7 @@ endif # Enable dependency checking .dep.inc: .depcheck-impl -DEPFILES=$(wildcard ${POSSIBLE_DEPFILES}) +DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif diff --git a/306-controller_interface.X/nbproject/Makefile-local-default.mk b/306-controller_interface.X/nbproject/Makefile-local-default.mk index 2cda7d4..c770036 100644 --- a/306-controller_interface.X/nbproject/Makefile-local-default.mk +++ b/306-controller_interface.X/nbproject/Makefile-local-default.mk @@ -15,11 +15,11 @@ # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # 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. -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 -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)" MP_CC="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe" # 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_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" -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_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_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" -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