The Code Repository for the REV0 Steering Wheel.

Dependencies:   CANBuffer KS0108_fork mbed-rtos mbed CAN Addresses

Fork of REVO_Updated_Steering by Penn Electric

Revision:
41:7c5ea411fad2
Parent:
40:92f08fdc32df
Child:
42:701df58e923a
diff -r 92f08fdc32df -r 7c5ea411fad2 Steering.cpp
--- a/Steering.cpp	Sun Feb 08 08:48:17 2015 +0000
+++ b/Steering.cpp	Sun Feb 08 08:53:44 2015 +0000
@@ -113,39 +113,44 @@
             }
         }
 
+        if (Rxmsg.id == POWER_TX_ID) {
+            CANFloat = GetFloat;
+            LEDBar = (CANFloat/85.0)*(2.6/3.3);
+        }
+
         switch (CurrScreen) {
             case HOME_SCREEN:
                 switch (Rxmsg.id) {
 
                         // HOME SCREEN *******************************************************************************************
                         // Pedal Test
-                    /*case PCM_PEDALS_ID:
+                        /*case PCM_PEDALS_ID:
+                            CANFloat = GetFloat;
+                            if (abs(CANFloat*100 - float (*AccPedalBuffer)) >= 1) {
+                                sprintf(AccPedalBuffer,"%3.2d", int(CANFloat*100));
+                                display.PutString(1,40,AccPedalBuffer);
+                            }
+                            CANFloat2 = GetFloat4;
+                            if (abs(CANFloat2*100 - float (*BrkPedalBuffer)) >= 1) {
+                                sprintf(BrkPedalBuffer,"%3.2d", int(CANFloat2*100));
+                                display.PutString(1,60,BrkPedalBuffer);
+                            }
+                            break;*/
+
+                    case SOC_TX_ID:
                         CANFloat = GetFloat;
-                        if (abs(CANFloat*100 - float (*AccPedalBuffer)) >= 1) {
-                            sprintf(AccPedalBuffer,"%3.2d", int(CANFloat*100));
-                            display.PutString(1,40,AccPedalBuffer);
-                        }
-                        CANFloat2 = GetFloat4;
-                        if (abs(CANFloat2*100 - float (*BrkPedalBuffer)) >= 1) {
-                            sprintf(BrkPedalBuffer,"%3.2d", int(CANFloat2*100));
-                            display.PutString(1,60,BrkPedalBuffer);
+                        if (abs(CANFloat*100 - *BigBatLifeBuffer) >= 1) {
+                            sprintf(BigBatLifeBuffer,"%3.2d", int(CANFloat*100));                   // Big battery life percentage
+                            display.PutString(1,40,BigBatLifeBuffer);
                         }
-                        break;*/
-                        
-                        case SOC_TX_ID:
-                            CANFloat = GetFloat;
-                            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:
-                            CANFloat = GetFloat;
-                            if (abs(CANFloat*100 - *SmallBatLifeBuffer) >= 1) {
-                                sprintf(SmallBatLifeBuffer,"%3.2d", int(CANFloat*100));                 // Small battery life percentage
-                                display.PutString(1,60,SmallBatLifeBuffer);
-                            }
-                            break;
+                        break;
+                    case SYS_GLV_SOC_ID:
+                        CANFloat = GetFloat;
+                        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;
@@ -164,19 +169,19 @@
                     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));     
+                            sprintf(MaxBatTBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32));
                             display.PutString(3,103,MaxBatTBuffer);
                         }
                         break;
                     case MOC_MOTEMP_ID:
                         CANFloat = GetFloat;
                         if (abs((CANFloat*9.0/5.0)+32 - *LMtrTmpBuffer) >= 1) {
-                            sprintf(LMtrTmpBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32));          
+                            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) {
-                            sprintf(RMtrTmpBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32));          
+                            sprintf(RMtrTmpBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32));
                             display.PutString(5,34,RMtrTmpBuffer);
                         }
                         break;
@@ -212,7 +217,7 @@
                     case CELLV_MMA_TX_ID_BASE:
                         CANFloat2 = GetFloat4;
                         if (abs(CANFloat2 - *VmaxBuffer) >= 0.1) {
-                            sprintf(VmaxBuffer,"%3.2d", int(CANFloat2));                                 
+                            sprintf(VmaxBuffer,"%3.2d", int(CANFloat2));
                             display.PutString(3,20,VmaxBuffer);
                         }
                         CANFloat = GetFloat;
@@ -236,7 +241,7 @@
                         }
                         CANFloat2 = GetFloat4;
                         if (abs((CANFloat2*9.0/5.0)+32 - *MaxBatTBuffer) >=1) {
-                            sprintf(MaxBatTBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32));          
+                            sprintf(MaxBatTBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32));
                             display.PutString(5,20,MaxBatTBuffer);
                         }
                         break;
@@ -264,19 +269,19 @@
                     case MOC_MOTEMP_ID:
                         CANFloat = GetFloat;
                         if (abs((CANFloat*9.0/5.0)+32 - *LMtrTmpBuffer) >= 1) {
-                            sprintf(LMtrTmpBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32));          
+                            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) {
-                            sprintf(RMtrTmpBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32));          
+                            sprintf(RMtrTmpBuffer,"%3.2d", int((CANFloat2*9.0/5.0)+32));
                             display.PutString(1,98,LMtrTmpBuffer);
                         }
                         break;
                     case MOC_AIRTEMP_ID:
                         CANFloat = GetFloat;
                         if (abs((CANFloat*9.0/5.0)+32 - *LAirTmpBuffer) >= 1) {
-                            sprintf(LAirTmpBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32));                   
+                            sprintf(LAirTmpBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32));
                             display.PutString(2,34,LAirTmpBuffer);
                         }
                         CANFloat2 = GetFloat4;
@@ -288,7 +293,7 @@
                     case MOC_IGBTTEMP_ID:
                         CANFloat = GetFloat;
                         if (abs((CANFloat*9.0/5.0)+32 - *LIGBTmpBuffer) >= 1) {
-                            sprintf(LIGBTmpBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32));                   
+                            sprintf(LIGBTmpBuffer,"%3.2d", int((CANFloat*9.0/5.0)+32));
                             display.PutString(3,34,LIGBTmpBuffer);
                         }
                         CANFloat2 = GetFloat4;
@@ -300,7 +305,7 @@
                     case MOC_RPM_ID:
                         CANFloat = GetFloat;
                         if (abs(CANFloat - *Rpm_LBuffer) >= 1) {
-                            sprintf(Rpm_LBuffer,"%3.2d", int(CANFloat));                   
+                            sprintf(Rpm_LBuffer,"%3.2d", int(CANFloat));
                             display.PutString(5,30,Rpm_LBuffer);
                         }
                         CANFloat2 = GetFloat4;
@@ -344,7 +349,7 @@
                     case SYS_PWM_FAN_ID:
                         CANFloat = GetFloat;
                         if (abs(CANFloat*100 - *Fan1Buffer) >= 1) {
-                            sprintf(Fan1Buffer,"%3.2d", int(CANFloat*100));                   
+                            sprintf(Fan1Buffer,"%3.2d", int(CANFloat*100));
                             display.PutString(3,30,Fan1Buffer);
                         }
                         CANFloat2 = GetFloat4;
@@ -356,7 +361,7 @@
                     case SYS_PWM_PUMP_ID:
                         CANFloat = GetFloat;
                         if (abs(CANFloat*100 - *Pump1Buffer) >= 1) {
-                            sprintf(Pump1Buffer,"%3.2d", int(CANFloat*100));                   
+                            sprintf(Pump1Buffer,"%3.2d", int(CANFloat*100));
                             display.PutString(5,30,Pump1Buffer);
                         }
                         CANFloat2 = GetFloat4;