The Code Repository for the REV0 Steering Wheel.
Dependencies: CANBuffer KS0108_fork mbed-rtos mbed CAN Addresses
Fork of REVO_Updated_Steering by
Revision 47:5d3c6f85fa29, committed 2015-05-30
- Comitter:
- jayf
- Date:
- Sat May 30 02:26:23 2015 +0000
- Parent:
- 42:701df58e923a
- Commit message:
- Fixed all known steering wheel issues
Changed in this revision
diff -r 701df58e923a -r 5d3c6f85fa29 CAN-Addresses.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CAN-Addresses.lib Sat May 30 02:26:23 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/Penn-Electric-Racing/code/CAN-Addresses/#9016aa7b1888
diff -r 701df58e923a -r 5d3c6f85fa29 CAN_Address.h --- a/CAN_Address.h Mon Mar 23 19:36:37 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -#define TX_BASE 0x300 // TX IDs start at 0x300 -#define TX_DUMP_OFFSET 0x100 // Bulk data dumps start at ID 0x300+0x100 = 0x400 for dumping current RAM and freezeFrames - -// Home Screen Addresses -#define SOC_TX_ID TX_BASE + 0x0B -#define SYS_GLV_SOC_ID 0x513 -#define PCM_FRPM_ID 0x222 -#define TEMP_MMA_TX_ID_BASE TX_BASE + 0x18 -#define TEMP_MMA_TX_ID_BASE2 TX_BASE + 0x19 -#define MOC_MOTEMP_ID 0x212 - -// Battery Screen Addresses -#define VOLTAGE_TX_ID TX_BASE + 0x08 -#define POWER_TX_ID TX_BASE + 0x14 -#define CURRENT_TX_ID TX_BASE + 0x06 -#define CELLV_MMA_TX_ID_BASE TX_BASE + 0x16 -#define CELLV_MMA_TX_ID_BASE2 TX_BASE + 0x17 -#define BOARDTEMP_TX_ID TX_BASE + 0x0E - -// Motor Screen Addresses -#define MOC_AIRTEMP_ID 0x213 -#define MOC_IGBTTEMP_ID 0x214 -#define MOC_RPM_ID 0x211 -#define PCM_TORQUERQ_ID 0x231 - -// System Management Addresses -#define SYS_GLV_CURRENT_ID 0x510 -#define SYS_SWITCHES_ID 0x560 -#define SYS_PWM_FAN_ID 0x530 -#define SYS_PWM_PUMP_ID 0x531 -#define SYS_DCDC_STATUS_ID 0x521 -#define SYS_IMD_RESIST_ID 0x541 - -// Charger Addresses -#define CHARGECURR_TX_ID TX_BASE + 0x07 - -// Faults, Flags, & Errors (CURRENTLY BEING FILTERED) -#define PCM_FLAGS_ID 0x202 -#define MOC_FAULTS_ID 0x210 -#define PCM_FAULTS_ID 0x221 -#define FAULTCODE_TX_ID TX_BASE + 0x00 -#define CELLFLAGS_TX_ID_BASE TX_BASE + 0x47 -#define TEMPFLAGS_TX_ID_BASE TX_BASE + 0x5B -#define DIETEMPFLAGS_TX_ID_BASE TX_BASE + 0x74 - - -// Filtered Addresses -#define SIGNALS_TX_ID TX_BASE + 0x03 -#define PROFILE_TX_ID TX_BASE + 0x04 -#define PACKERRS_TX_ID TX_BASE + 0x05 -#define AH_TX_ID TX_BASE + 0x0C -#define SUPPLY_TX_ID TX_BASE + 0x0D -#define VMISMATCH_TX_ID TX_BASE + 0x0F -#define FANSPEED_TX_ID TX_BASE + 0x10 -#define STACK_OPDATA_TX_ID TX_BASE + 0x15 -#define INTREF_MMA_TX_ID_BASE TX_BASE + 0x1A -#define DIETEMP_MMA_TX_ID_BASE TX_BASE + 0x1C -#define VA_MMA_TX_ID_BASE TX_BASE + 0x1C -#define VDD_MMA_TX_ID_BASE TX_BASE + 0x20 -#define SOC_MMA_TX_ID_BASE TX_BASE + 0x22 -#define CELLV_TX_ID_BASE TX_BASE + 0x23 -#define TEMP_TX_ID_BASE TX_BASE + 0x4B -#define IC_REF_SOC_TX_ID_BASE TX_BASE + 0x5C -#define IC_VA_VDD_TX_ID_BASE TX_BASE + 0x64 -#define IC_DIETEMP_TX_ID_BASE TX_BASE + 0x6C -#define IC_OPDATA_TX_ID_BASE TX_BASE + 0x7C -#define PCM_ERROR_ID 0x200 -#define PCM_MODE_ID 0x201 -#define LEFT_MOC_TXID 0x205 -#define RIGHT_MOC_TXID 0x206 -#define MOC_CURRENT_ID 0x215 -#define MOC_VBUS_ID 0x216 -#define PCM_DIGIOUT_ID 0x230 -#define SYSMGMT_PUMPCMD_ID 0x580 -#define SYSMGMT_FANCMD_ID 0x581 -#define SYS_ERROR_ID 0x500 -#define SYS_XBEE1_ID 0x501 -#define SYS_XBEE2_ID 0x502 -#define SYS_TEMP_ID 0x503 -#define SYS_GLV_CAPACITY_ID 0x511 -#define SYS_GLV_AH_ID 0x512 -#define SYS_DCDC_CURRENT_ID 0x520 -#define SYS_IMD_STATUS_ID 0x521 -#define SYS_IMD_LATCH_ID 0x550 -#define SYS_AMS_LATCH_ID 0x551 - - -// Other Addresses -#define MODE_TX_ID TX_BASE + 0x01 -#define PCM_PEDALS_ID 0x220 //MOSTLY USED FOR TESTING PROGRAM SPEED \ No newline at end of file
diff -r 701df58e923a -r 5d3c6f85fa29 CAN_Filter_LUT.h --- a/CAN_Filter_LUT.h Mon Mar 23 19:36:37 2015 +0000 +++ b/CAN_Filter_LUT.h Sat May 30 02:26:23 2015 +0000 @@ -11,7 +11,9 @@ #ifndef _FILE_CAN_FILTER_LUT_H #define _FILE_CAN_FILTER_LUT_H -#include "CAN_Address.h" +#include "PCM_CAN_IDs.h" +#include "AMS_CAN_IDs.h" +#include "SYS_MGMT_CAN_IDs.h" #define STDMASK 0x7FF #define EXTMASK 0x1FFFFFFF @@ -28,13 +30,13 @@ // STANDARD EXPLICIT IDs - CAN CONTROLLER 1 //( 0xID & STDMASK), -( MOC_RPM_ID & STDMASK), // 0x211 +( PCM_RPM_ID & STDMASK), // 0x211 -( MOC_MOTEMP_ID & STDMASK), // 0x212 +( PCM_MOTEMP_ID & STDMASK), // 0x212 -( MOC_AIRTEMP_ID & STDMASK), // 0x213 +( PCM_AIRTEMP_ID & STDMASK), // 0x213 -( MOC_IGBTTEMP_ID & STDMASK), // 0x214 +( PCM_IGBTTEMP_ID & STDMASK), // 0x214 ( PCM_PEDALS_ID & STDMASK), // 0x220 @@ -42,41 +44,41 @@ ( PCM_TORQUERQ_ID & STDMASK), // 0x231 -( FAULTCODE_TX_ID & STDMASK), // 0x300 +( AMS_FAULTCODE_ID & STDMASK), // 0x300 -( MODE_TX_ID & STDMASK), // 0x301 +( AMS_MODE_ID & STDMASK), // 0x301 -( CURRENT_TX_ID & STDMASK), // 0x306 +( AMS_CURRENT_ID & STDMASK), // 0x306 -( CHARGECURR_TX_ID & STDMASK), // 0x307 +( AMS_CHARGECURR_ID & STDMASK), // 0x307 -( VOLTAGE_TX_ID & STDMASK), // 0x308 +( AMS_VOLTAGE_ID & STDMASK), // 0x308 -( SOC_TX_ID & STDMASK), // 0x30B +( AMS_SOC_ID & STDMASK), // 0x30B -( BOARDTEMP_TX_ID & STDMASK), // 0x30E +( AMS_BOARDTEMP_ID & STDMASK), // 0x30E -( CELLV_MMA_TX_ID_BASE & STDMASK), // 0x316 +( AMS_CELLV_MMA_ID_BASE & STDMASK), // 0x316 -( CELLV_MMA_TX_ID_BASE2 & STDMASK), // 0x317 +//( CELLV_MMA_ID_BASE2 & STDMASK), // 0x317 -( TEMP_MMA_TX_ID_BASE & STDMASK), // 0x318 +( AMS_TEMP_MMA_ID_BASE & STDMASK), // 0x318 -( TEMP_MMA_TX_ID_BASE2 & STDMASK), // 0x319 +//( TEMP_MMA_TX_ID_BASE2 & STDMASK), // 0x319 -( SYS_GLV_CURRENT_ID & STDMASK), // 0x510 +( SYS_MGMT_GLV_CURRENT_ID & STDMASK), // 0x510 -( SYS_GLV_SOC_ID & STDMASK), // 0x513 +( SYS_MGMT_GLV_SOC_ID & STDMASK), // 0x513 -( SYS_DCDC_STATUS_ID & STDMASK), // 0x521 +( SYS_MGMT_DCDC_STATUS_ID & STDMASK), // 0x521 -( SYS_PWM_FAN_ID & STDMASK), // 0x530 +( SYS_MGMT_PWM_FAN_ID & STDMASK), // 0x530 -( SYS_PWM_PUMP_ID & STDMASK), // 0x531 +( SYS_MGMT_PWM_PUMP_ID & STDMASK), // 0x531 -( SYS_IMD_RESIST_ID & STDMASK), // 0x541 +( SYS_MGMT_IMD_RESIST_ID & STDMASK), // 0x541 -( SYS_SWITCHES_ID & STDMASK) // 0x560 +( SYS_MGMT_SWITCHES_ID & STDMASK) // 0x560 // STANDARD EXPLICIT IDs - CAN CONTROLLER 2 //( 0xID & STDMASK),
diff -r 701df58e923a -r 5d3c6f85fa29 Screens.h --- a/Screens.h Mon Mar 23 19:36:37 2015 +0000 +++ b/Screens.h Sat May 30 02:26:23 2015 +0000 @@ -173,6 +173,7 @@ } PrevScreen = CurrScreen; } + Thread::yield(); } } \ No newline at end of file
diff -r 701df58e923a -r 5d3c6f85fa29 Steering.cpp --- a/Steering.cpp Mon Mar 23 19:36:37 2015 +0000 +++ b/Steering.cpp Sat May 30 02:26:23 2015 +0000 @@ -1,5 +1,4 @@ #include "Steering.h" - // To-Do: // Look at SYS management CAN translations: shutdown switches, DCDC status, & IMD (this is a resistance, in ohms) // Figure out screen/variable updating options (hardware filter), NVIC_SetPriority(CAN_IRQn,####)LPC17xx.h @@ -17,7 +16,6 @@ float CANFloat; float CANFloat2; - Ticker StatusMsg; int main() @@ -33,6 +31,8 @@ if (SteeringCANPort.rxRead(Rxmsg)) { ProcessCANMsg(Rxmsg); } + else + Thread::yield(); } } @@ -102,14 +102,14 @@ // Printing CAN message data: // printf("Message ID: 0x%x len: %d hex: 0x%x float: %f\r\n", Rxmsg.id, Rxmsg.len, *((int*)((void*)(&Rxmsg.data[0]))), *((float*)((void*)(&Rxmsg.data[0])))); // for (int i=0; i < Rxmsg.len; i++) printf("D[%d]: %x ", i, Rxmsg.data[i]); - if (Rxmsg.id == MODE_TX_ID) { + if (Rxmsg.id == AMS_MODE_ID) { if(Rxmsg.data[0] != (1<<3)) DriveStatusRequestBuffer=1; else DriveStatusRequestBuffer=0; } - if (Rxmsg.id == POWER_TX_ID) { + if (Rxmsg.id == AMS_POWER_ID) { CANFloat = GetFloat; LEDBar = (CANFloat/85.0)*(2.6/3.3); } @@ -133,53 +133,51 @@ } break;*/ - case SOC_TX_ID: + case AMS_SOC_ID: CANFloat = GetFloat; - if (abs(CANFloat*100 - *BigBatLifeBuffer) >= 1) { + //if (abs(CANFloat*100 - *BigBatLifeBuffer) >= 1) { sprintf(BigBatLifeBuffer,"%3.2d", int(CANFloat*100)); // Big battery life percentage display.PutString(1,40,BigBatLifeBuffer); - } + //} break; - case SYS_GLV_SOC_ID: + case SYS_MGMT_GLV_SOC_ID: CANFloat = GetFloat; - if (abs(CANFloat*100 - *SmallBatLifeBuffer) >= 1) { + //if (abs(CANFloat*100 - *SmallBatLifeBuffer) >= 1) { sprintf(SmallBatLifeBuffer,"%3.2d", int(CANFloat*100)); // Small battery life percentage display.PutString(1,60,SmallBatLifeBuffer); - } + //} break; case PCM_FRPM_ID: CANFloat = GetFloat; CANFloat2 = GetFloat4; - if (abs((CANFloat+CANFloat2)*WheelCircumference*30 - *CarSpdBuffer) >= 1) { + //if (abs((CANFloat+CANFloat2)*WheelCircumference*30 - *CarSpdBuffer) >= 1) { sprintf(CarSpdBuffer,"%3.2d", int((CANFloat+CANFloat2)*WheelCircumference*30)); // Miles per hour display.PutString(1,108,CarSpdBuffer); - } + //} break; - case TEMP_MMA_TX_ID_BASE2: - CANFloat = GetFloat; - if (abs((CANFloat*9.0/5.0)+32 - *AvgBatTBuffer) >=1) { + case AMS_TEMP_MMA_ID_BASE: + CANFloat2 = GetFloat4; + //if (abs((CANFloat2*9.0/5.0)+32 - *MaxBatTBuffer) >=1) { + sprintf(MaxBatTBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32)); + display.PutString(3,103,MaxBatTBuffer); + //} + CANFloat = GetFloat8; + //if (abs((CANFloat*9.0/5.0)+32 - *AvgBatTBuffer) >=1) { sprintf(AvgBatTBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32)); // Degrees F display.PutString(3,39,AvgBatTBuffer); - } + //} break; - case TEMP_MMA_TX_ID_BASE: - CANFloat2 = GetFloat4; - if (abs((CANFloat2*9.0/5.0)+32 - *MaxBatTBuffer) >=1) { - sprintf(MaxBatTBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32)); - display.PutString(3,103,MaxBatTBuffer); - } - break; - case MOC_MOTEMP_ID: + case PCM_MOTEMP_ID: CANFloat = GetFloat; - if (abs((CANFloat*9.0/5.0)+32 - *LMtrTmpBuffer) >= 1) { + //if (abs((CANFloat*9.0/5.0)+32 - *LMtrTmpBuffer) >= 1) { sprintf(LMtrTmpBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32)); display.PutString(5,34,LMtrTmpBuffer); - } + //} CANFloat2 = GetFloat4; - if (abs((CANFloat2*9.0/5.0)+32 - *RMtrTmpBuffer) >= 1) { + //if (abs((CANFloat2*9.0/5.0)+32 - *RMtrTmpBuffer) >= 1) { sprintf(RMtrTmpBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32)); display.PutString(5,34,RMtrTmpBuffer); - } + //} break; default: break; @@ -188,72 +186,68 @@ // BATTERY SCREEN*********************************************************************************** case BATTERY_SCREEN: switch (Rxmsg.id) { - case VOLTAGE_TX_ID: + case AMS_VOLTAGE_ID: CANFloat = GetFloat; - if (abs(CANFloat - *BigBatVoltBuffer) >= 0.1) { + //if (abs(CANFloat - *BigBatVoltBuffer) >= 0.1) { sprintf(BigBatVoltBuffer,"%3.2d", int(CANFloat)); // Volts display.PutString(1,10,BigBatVoltBuffer); - } + //} break; - case POWER_TX_ID: + case AMS_POWER_ID: CANFloat = GetFloat; LEDBar = (CANFloat/85.0)*(2.6/3.3); - if (abs(CANFloat - *BigBatPowerBuffer) >= 1) { + //if (abs(CANFloat - *BigBatPowerBuffer) >= 1) { sprintf(BigBatPowerBuffer,"%3.2d", int(CANFloat)); // Watts display.PutString(1,55,BigBatPowerBuffer); - } + //} break; - case CURRENT_TX_ID: + case AMS_CURRENT_ID: CANFloat = GetFloat; - if (abs(CANFloat - *BigBatCurrentBuffer) >= 0.2) { + //if (abs(CANFloat - *BigBatCurrentBuffer) >= 0.2) { sprintf(BigBatCurrentBuffer,"%3.2d", int(CANFloat)); // Amps display.PutString(1,100,BigBatCurrentBuffer); - } + //} break; - case CELLV_MMA_TX_ID_BASE: + case AMS_CELLV_MMA_ID_BASE: CANFloat2 = GetFloat4; - if (abs(CANFloat2 - *VmaxBuffer) >= 0.1) { + //if (abs(CANFloat2 - *VmaxBuffer) >= 0.1) { sprintf(VmaxBuffer,"%3.2d", int(CANFloat2)); display.PutString(3,20,VmaxBuffer); - } + //} CANFloat = GetFloat; - if (abs(CANFloat - *VminBuffer) >= 0.1) { + //if (abs(CANFloat - *VminBuffer) >= 0.1) { sprintf(VminBuffer,"%3.2d", int(CANFloat)); display.PutString(3,67,VminBuffer); - } - break; - case CELLV_MMA_TX_ID_BASE2: - CANFloat = GetFloat; - if (abs(CANFloat - *VavgBuffer) >= 0.1) { + //} + CANFloat = GetFloat8; + //if (abs(CANFloat - *VavgBuffer) >= 0.1) { sprintf(VavgBuffer,"%3.2d", int(CANFloat)); // Volts display.PutString(3,108,VavgBuffer); - } + // break; - case TEMP_MMA_TX_ID_BASE: + case AMS_TEMP_MMA_ID_BASE: CANFloat = GetFloat; - if (abs((CANFloat*9.0/5.0)+32 - *MinBatTBuffer) >= 1) { + //if (abs((CANFloat*9.0/5.0)+32 - *MinBatTBuffer) >= 1) { sprintf(MinBatTBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32)); display.PutString(5,67,MinBatTBuffer); - } + //} CANFloat2 = GetFloat4; - if (abs((CANFloat2*9.0/5.0)+32 - *MaxBatTBuffer) >=1) { + //if (abs((CANFloat2*9.0/5.0)+32 - *MaxBatTBuffer) >=1) { sprintf(MaxBatTBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32)); display.PutString(5,20,MaxBatTBuffer); - } - break; - case TEMP_MMA_TX_ID_BASE2: - CANFloat = GetFloat; - if (abs((CANFloat*9.0/5.0)+32 - *AvgBatTBuffer) >=1) { + //} + CANFloat = GetFloat8; + //if (abs((CANFloat*9.0/5.0)+32 - *AvgBatTBuffer) >=1) { sprintf(AvgBatTBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32)); // Degrees F display.PutString(5,108,AvgBatTBuffer); - } + //} break; - case BOARDTEMP_TX_ID: + case AMS_BOARDTEMP_ID: CANFloat = GetFloat; - if (abs((CANFloat*9.0/5.0)+32 - *BoardTempBuffer) >= 1) { + //if (abs((CANFloat*9.0/5.0)+32 - *BoardTempBuffer) >= 1) { sprintf(BoardTempBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32)); // Degrees F display.PutString(7,87,BoardTempBuffer); - } + //} break; default: break; @@ -262,65 +256,65 @@ // MOTOR SCREEN***************************************************************** case MOTOR_SCREEN: switch (Rxmsg.id) { - case MOC_MOTEMP_ID: + case PCM_MOTEMP_ID: CANFloat = GetFloat; - if (abs((CANFloat*9.0/5.0)+32 - *LMtrTmpBuffer) >= 1) { + //if (abs((CANFloat*9.0/5.0)+32 - *LMtrTmpBuffer) >= 1) { sprintf(LMtrTmpBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32)); display.PutString(1,34,LMtrTmpBuffer); - } + //} CANFloat2 = GetFloat4; - if (abs((CANFloat2*9.0/5.0)+32 - *RMtrTmpBuffer) >= 1) { + //if (abs((CANFloat2*9.0/5.0)+32 - *RMtrTmpBuffer) >= 1) { sprintf(RMtrTmpBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32)); display.PutString(1,98,LMtrTmpBuffer); - } + //} break; - case MOC_AIRTEMP_ID: + case PCM_AIRTEMP_ID: CANFloat = GetFloat; - if (abs((CANFloat*9.0/5.0)+32 - *LAirTmpBuffer) >= 1) { + //if (abs((CANFloat*9.0/5.0)+32 - *LAirTmpBuffer) >= 1) { sprintf(LAirTmpBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32)); display.PutString(2,34,LAirTmpBuffer); - } + //} CANFloat2 = GetFloat4; - if (abs((CANFloat2*9.0/5.0)+32 - *RAirTmpBuffer) >= 1) { + //if (abs((CANFloat2*9.0/5.0)+32 - *RAirTmpBuffer) >= 1) { sprintf(RAirTmpBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32)); // Degrees F display.PutString(2,98,RAirTmpBuffer); - } + //} break; - case MOC_IGBTTEMP_ID: + case PCM_IGBTTEMP_ID: CANFloat = GetFloat; - if (abs((CANFloat*9.0/5.0)+32 - *LIGBTmpBuffer) >= 1) { + //if (abs((CANFloat*9.0/5.0)+32 - *LIGBTmpBuffer) >= 1) { sprintf(LIGBTmpBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32)); display.PutString(3,34,LIGBTmpBuffer); - } + //} CANFloat2 = GetFloat4; - if (abs((CANFloat2*9.0/5.0)+32 - *RIGBTmpBuffer) >= 1) { + //if (abs((CANFloat2*9.0/5.0)+32 - *RIGBTmpBuffer) >= 1) { sprintf(RIGBTmpBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32)); // Degrees F display.PutString(3,98,RIGBTmpBuffer); - } + //} break; - case MOC_RPM_ID: + case PCM_RPM_ID: CANFloat = GetFloat; - if (abs(CANFloat - *Rpm_LBuffer) >= 1) { + //if (abs(CANFloat - *Rpm_LBuffer) >= 1) { sprintf(Rpm_LBuffer,"%3.2d", int(CANFloat)); display.PutString(5,30,Rpm_LBuffer); - } + //} CANFloat2 = GetFloat4; - if (abs(CANFloat2 - *Rpm_RBuffer) >= 1) { + //if (abs(CANFloat2 - *Rpm_RBuffer) >= 1) { sprintf(Rpm_RBuffer,"%3.2d", int(CANFloat2)); display.PutString(5,107,Rpm_RBuffer); - } + //} break; case PCM_TORQUERQ_ID: CANFloat = GetFloat; - if (abs(CANFloat*100 - *TRequestBufferL) >= 1) { + //if (abs(CANFloat*100 - *TRequestBufferL) >= 1) { sprintf(TRequestBufferL,"%3.2d", int(CANFloat*100)); // Percentage display.PutString(7,89,TRequestBufferL); - } + //} CANFloat2 = GetFloat4; - if (abs(CANFloat2*100 - *TRequestBufferR) >= 1) { + //if (abs(CANFloat2*100 - *TRequestBufferR) >= 1) { sprintf(TRequestBufferR,"%3.2d", int(CANFloat2*100)); // Percentage display.PutString(7,89,TRequestBufferR); - } + //} break; default: break; @@ -330,53 +324,53 @@ // SYSTEM MANAGEMENT SCREEN*************************************************** case SYS_MGMT_SCREEN: switch (Rxmsg.id) { - case SYS_GLV_CURRENT_ID: + case SYS_MGMT_GLV_CURRENT_ID: CANFloat = GetFloat; - if (abs(CANFloat - *SmallBatCurrentBuffer) >= 0.2) { + //if (abs(CANFloat - *SmallBatCurrentBuffer) >= 0.2) { sprintf(SmallBatCurrentBuffer,"%3.2d", int(CANFloat)); // Amps display.PutString(1,30,SmallBatCurrentBuffer); - } + //} break; - case SYS_SWITCHES_ID: + case SYS_MGMT_SWITCHES_ID: CANFloat = GetFloat; sprintf(ShtdSwtchBuffer,"%3.2d", int(CANFloat)); // How the heck are we interpreting this data display.PutString(1,108,ShtdSwtchBuffer); break; - case SYS_PWM_FAN_ID: + case SYS_MGMT_PWM_FAN_ID: CANFloat = GetFloat; - if (abs(CANFloat*100 - *Fan1Buffer) >= 1) { + //if (abs(CANFloat*100 - *Fan1Buffer) >= 1) { sprintf(Fan1Buffer,"%3.2d", int(CANFloat*100)); display.PutString(3,30,Fan1Buffer); - } + //} CANFloat2 = GetFloat4; - if (abs(CANFloat2*100 - *Fan1Buffer) >= 1) { + //if (abs(CANFloat2*100 - *Fan1Buffer) >= 1) { sprintf(Fan2Buffer,"%3.2d", int(CANFloat2*100)); display.PutString(3,107,Fan2Buffer); - } + //} break; - case SYS_PWM_PUMP_ID: + case SYS_MGMT_PWM_PUMP_ID: CANFloat = GetFloat; - if (abs(CANFloat*100 - *Pump1Buffer) >= 1) { + //if (abs(CANFloat*100 - *Pump1Buffer) >= 1) { sprintf(Pump1Buffer,"%3.2d", int(CANFloat*100)); display.PutString(5,30,Pump1Buffer); - } + //} CANFloat2 = GetFloat4; - if (abs(CANFloat2*100 - *Pump2Buffer) >= 1) { + //if (abs(CANFloat2*100 - *Pump2Buffer) >= 1) { sprintf(Pump2Buffer,"%3.2d", int(CANFloat2*100)); display.PutString(5,107,Pump2Buffer); - } + //} break; - case SYS_DCDC_STATUS_ID: + case SYS_MGMT_DCDC_STATUS_ID: CANFloat = GetFloat; sprintf(DCDCBuffer,"%3.2d", int(CANFloat)); // How the heck are we interpreting this data display.PutString(7,30,DCDCBuffer); break; - case SYS_IMD_RESIST_ID: + case SYS_MGMT_IMD_RESIST_ID: CANFloat = GetFloat; - if (abs(CANFloat - *IMDRBuffer) >= 1) { + //if (abs(CANFloat - *IMDRBuffer) >= 1) { sprintf(IMDRBuffer,"%3.2d", int(CANFloat)); display.PutString(7,82,IMDRBuffer); - } + //} break; default: break; @@ -386,19 +380,19 @@ // CHARGE SCREEN ************************************************************* case CHARGE_SCREEN: switch (Rxmsg.id) { - case CHARGECURR_TX_ID: + case CHARGER_CHARGING_CURRENT_ID: CANFloat = GetFloat; - if (abs(CANFloat - *ChargeCurrBuffer) >= 0.1) { + //if (abs(CANFloat - *ChargeCurrBuffer) >= 0.1) { sprintf(ChargeCurrBuffer,"%3.2d", int(CANFloat)); // Amps display.PutString(3,94,ChargeCurrBuffer); - } + //} break; - case VOLTAGE_TX_ID: + case CHARGER_CHARGING_VOLTAGE_ID: CANFloat = GetFloat; - if (abs(CANFloat - *BigBatVoltBuffer) >= 0.1) { + //if (abs(CANFloat - *BigBatVoltBuffer) >= 0.1) { sprintf(BigBatVoltBuffer,"%3.2d", int(CANFloat)); // Volts display.PutString(3,94,BigBatVoltBuffer); - } + //} break; default: break; @@ -412,14 +406,14 @@ void ConnectedStatusCANMsg() { - CANMessage ConnectedStatus(0x600, &ConnectedStatusBuffer,1); + CANMessage ConnectedStatus(STEERING_WHEEL_STATUS_ID, &ConnectedStatusBuffer,1); SteeringCANPort.txWrite(ConnectedStatus); } void RequestStatusChange() { - CANMessage TxDriveStatusRequest(0x601, &DriveStatusRequestBuffer,1); + CANMessage TxDriveStatusRequest(STEERING_WHEEL_DRIVE_STATUS_REQUEST_ID , &DriveStatusRequestBuffer,1); for (int j=0; j<10; j++) { SteeringCANPort.txWrite(TxDriveStatusRequest); } @@ -437,7 +431,7 @@ void ResetCar() { - CANMessage TxCarReset(0x602,&TxResetBuffer,1); + CANMessage TxCarReset(STEERING_WHEEL_CAR_RESET_ID,&TxResetBuffer,1); for (int k=0; k<10; k++) { SteeringCANPort.txWriteDirect(TxCarReset); }
diff -r 701df58e923a -r 5d3c6f85fa29 Steering.h --- a/Steering.h Mon Mar 23 19:36:37 2015 +0000 +++ b/Steering.h Sat May 30 02:26:23 2015 +0000 @@ -9,9 +9,15 @@ #include "Screens.h" #include "CANQueue.h" #include "CANBuffer.h" +#include "PCM_CAN_IDs.h" +#include "AMS_CAN_IDs.h" +#include "SYS_MGMT_CAN_IDs.h" +#include "Charger_CAN_IDs.h" +#include "Steering_Wheel_CAN_IDs.h" #define GetFloat *(float*)((void*)(&Rxmsg.data[0])) #define GetFloat4 *(float*)((void*)(&Rxmsg.data[4])) +#define GetFloat8 *(float*)((void*)(&Rxmsg.data[8])) #define BLButtonGreen DigitalOut l3(P1_24,1); DigitalOut l4(P0_24,0); // SW6, SW8 respectively #define BLButtonRed DigitalOut l3(P1_24,0); DigitalOut l4(P0_24,1);