aa
Dependencies: mbed LCD_DISCO_F469NIa SD_DISCO_F469NI BSP_DISCO_F469NIa EEPROM_DISCO_F469NI
Revision 6:d6e001d7cf16, committed 2020-02-12
- Comitter:
- formulas
- Date:
- Wed Feb 12 18:49:12 2020 +0000
- Parent:
- 5:4b63e6845a8e
- Commit message:
- aaa
Changed in this revision
diff -r 4b63e6845a8e -r d6e001d7cf16 CAN_library.cpp --- a/CAN_library.cpp Wed Nov 28 12:01:20 2018 +0000 +++ b/CAN_library.cpp Wed Feb 12 18:49:12 2020 +0000 @@ -10,8 +10,8 @@ extern uint8_t distance_flag; extern uint8_t lvdtref; -extern uint16_t Rpm0, Speed0, Gear0, Water_Temp0, Oil_Temp0, TPS0, Brakes0, MAP0, Air_Temp0, Lambda0, Volts0; -extern uint16_t Rpm, Speed, Gear, Water_Temp, Oil_Temp, TPS, Brakes, MAP, Air_Temp, Lambda, Volts; +extern uint16_t Capacity0,HV_Voltage0, Rpm0, Speed0, Gear0, Water_Temp0, Bat_Temp0, TPS0, Brakes0, MAP0, Air_Temp0, Lambda0, Volts0; +extern uint16_t Capacity,HV_Voltage, Rpm, Speed, Gear, Water_Temp, Bat_Temp, TPS, Brakes, MAP, Air_Temp, Lambda, Volts; extern int FL_LVDT0, FR_LVDT0, RL_LVDT0, RR_LVDT0, FL_LVDT, FR_LVDT, RL_LVDT, RR_LVDT; extern int FL_LVDT_Ref,FR_LVDT_Ref,RL_LVDT_Ref,RR_LVDT_Ref; int LVDT_Max=1024; @@ -28,29 +28,29 @@ if (can.read(tmpMsg)) { //Detect message //pc.printf("%x\n",tmpMsg.id); switch(tmpMsg.id){ //Find which DTA message is received - case(0x2000): + case(0x0 | 0x2000): rx_flag|=(1<<0); msgDTA1=tmpMsg; //pc.printf("%x\n", tmpMsg.id); break; - case(0x2001): + case(0x1 | 0x2001): rx_flag|=(1<<1); msgDTA2=tmpMsg; //pc.printf("rx_flag=%x\n",rx_flag); break; - case(0x2002): + case(0x2 | 0x2002): rx_flag|=(1<<2); msgDTA3=tmpMsg; break; - case(0x2003): + case(0x3 | 0x2003): rx_flag|=(1<<3); msgDTA4=tmpMsg; break; - case(0x2004): + case(0x4 | 0x2004): rx_flag|=(1<<4); msgDTA5=tmpMsg; break; - case(0x2005): + case(0x5 | 0x2005): rx_flag|=(1<<5); msgDTA6=tmpMsg; break; @@ -199,8 +199,8 @@ void UpdateInfoDTA3(uint16_t newData[4]){ //Update values for DTA3 message if (newData[1]>0 && newData[1]<200){ - Oil_Temp0=Oil_Temp; - Oil_Temp=newData[1]; + Bat_Temp0=Bat_Temp; + Bat_Temp=newData[1]; }; if (newData[2]>0 && newData[2]<200){ Volts0=Volts;
diff -r 4b63e6845a8e -r d6e001d7cf16 draw_print_library.cpp --- a/draw_print_library.cpp Wed Nov 28 12:01:20 2018 +0000 +++ b/draw_print_library.cpp Wed Feb 12 18:49:12 2020 +0000 @@ -9,6 +9,7 @@ extern uint8_t lvdtref; extern int FL_LVDT_Ref,FR_LVDT_Ref,RL_LVDT_Ref,RR_LVDT_Ref; +extern uint8_t Acc_Temperature[],Acc_Temperature0[]; //Gears GEAR Idle{'0',256,384,idleBitmap}; @@ -18,6 +19,7 @@ GEAR Gear4{'4',256,384,gear4Bitmap}; GEAR Gear5{'5',256,384,gear5Bitmap}; GEAR Gear6{'6',256,384,gear6Bitmap}; +CHAR LogoSmallEA{'logosmallea',174,64,logosmallea}; GEAR *Gears[7]={&Idle,&Gear1,&Gear2,&Gear3,&Gear4,&Gear5,&Gear6}; //Gears array IMAGE LogoBig{800,480,LOGOBIG_START_ADDR}; //Big Logo IMAGE LogoSmall{160,64,LOGOSMALL_START_ADDR}; //Small Logo @@ -373,6 +375,23 @@ }; }; +int UpdateCapBar(int H, int H0, uint16_t StartXPos, uint16_t StartYPos){ + uint16_t BarWidth = 200, BarHeight = 300; + int YPos = StartYPos + BarHeight; + int percent = 3; + int dH = abs(H-H0); + int Hmax = 100; + + if(dH > 0){ + lcd.SetTextColor(LCD_COLOR_GREEN); + lcd.FillRect(StartXPos,StartYPos + (Hmax-H)*percent,BarWidth,dH*percent); + }else{ + lcd.SetTextColor(LCD_COLOR_WHITE); + lcd.FillRect(StartXPos,StartYPos + (Hmax-H0)*percent,BarWidth,dH*percent); + }; + lcd.SetTextColor(LCD_COLOR_BLACK); +}; + int UpdateLVDTScale(int H,int H0, uint16_t StartXPos, uint16_t StartYPos){ uint16_t BarWidth=80,BarHeight=8; int YPos; @@ -438,4 +457,241 @@ wait(0.1); //pc.printf("%d",k); }; +}; + +void DrawBatTempMap(){ + + uint8_t segment_num = 5; + uint8_t segment_distance = 20; + uint8_t StartXPos = 20, StartYPos = 20; + uint8_t column_num = 2; + uint8_t row_num = 7; + uint8_t cell_width = 60; + uint8_t cell_height = 50; + uint16_t x1,y1,x2,y2; + uint32_t color; + uint16_t R,G,B; + uint16_t BarXPos = 720, BarYPos = 20, ColorBar_width = 20, ColorBar_height = 6; + + lcd.SetTextColor(LCD_COLOR_BLACK); + PrintString("S1",50,50,380,LCD_COLOR_BLACK); + PrintString("S2",50,190,380,LCD_COLOR_BLACK); + PrintString("S3",50,330,380,LCD_COLOR_BLACK); + PrintString("S4",50,470,380,LCD_COLOR_BLACK); + PrintString("S5",50,610,380,LCD_COLOR_BLACK); + + for (uint8_t p = 0 ; p < segment_num ; p++){ + x1 = StartXPos+p*(segment_distance+2*cell_width); + y1 = StartYPos; + x2 = x1; + y2 = StartYPos+row_num*cell_height; + lcd.DrawLine(x1,y1,x2,y2); + x1 = x1 + cell_width; + x2 = x1; + lcd.DrawLine(x1,y1,x2,y2); + x1 = x1 + cell_width; + x2 = x1; + lcd.DrawLine(x1,y1,x2,y2); + x1 = StartXPos+p*(segment_distance+2*cell_width); + x2 = x1 + 2*cell_width; + y1 = StartYPos; + y2 = y1; + + for(uint8_t q = 0 ; q <= row_num ; q++){ + y1 = StartYPos + q*cell_height; + y2 = y1; + lcd.DrawLine(x1,y1,x2,y2); + }; + }; + + for(uint8_t temp = 10 ; temp <=70; temp++){ + lcd.SetTextColor(TempColor(temp)); + x1 = BarXPos; + y1 = BarYPos + 360 - (temp-10)*ColorBar_height; + lcd.FillRect(x1,y1,ColorBar_width,ColorBar_height); + //pc.printf("%d %d %d %d\n",x1,y1,x2,y2); + }; + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(BarXPos+25,BarYPos,(uint8_t*)"70",LEFT_MODE); + lcd.DisplayStringAt(BarXPos+25,BarYPos+60,(uint8_t*)"60",LEFT_MODE); + lcd.DisplayStringAt(BarXPos+25,BarYPos+120,(uint8_t*)"50",LEFT_MODE); + lcd.DisplayStringAt(BarXPos+25,BarYPos+180,(uint8_t*)"40",LEFT_MODE); + lcd.DisplayStringAt(BarXPos+25,BarYPos+240,(uint8_t*)"30",LEFT_MODE); + lcd.DisplayStringAt(BarXPos+25,BarYPos+300,(uint8_t*)"20",LEFT_MODE); + lcd.DisplayStringAt(BarXPos+25,BarYPos+360,(uint8_t*)"10",LEFT_MODE); + +}; + +void UpdateBatTempMap(){ + uint8_t column,row; + + for (uint8_t cell = 1 ; cell <= 70 ; cell++ ){ + if (Acc_Temperature[cell] != Acc_Temperature0[cell]){ + column = cell/7 + 1; + row = cell%7; + if (row == 0){ + column = column - 1; + row = 7; + }; + pc.printf("column %d row %d \n",column,row); + UpdateCellTemp(column,row,Acc_Temperature[cell]); + Acc_Temperature0[cell] = Acc_Temperature[cell]; + }; + }; +}; + +uint32_t TempColor(uint8_t temperature){ + //tmin = 10 tmax = 70 + uint8_t tmin = 10, tmax = 70; + uint32_t k = temperature - 10; + uint32_t R,G,B; + uint32_t color; + + if (k < 20){ + R = 0; + G = 0xFF; + B = 0xFF*k/20; + if (k< 0){ + B = 0; + }; + } + else if(k < 40){ + R = 0xFF*(k-20)/20; + G = 0xFF*(40-k)/20; + B = 0xFF; + } + else if(k<60){ + R = 0xFF; + G = 0; + B = 0xFF*(60-k)/20; + } + else{ + R = 0xFF; + G = 0; + B = 0; + }; + color = (0xFF << 24) + (R << 16) + (G << 8) + B; + //color = 0xFF000000 + R*65536 + G*256 + B; + return color; +}; + +void UpdateCellTemp(uint8_t column, uint8_t row, uint8_t temp){ + uint8_t segment_num = 5; + uint8_t segment_distance = 20; + uint8_t StartXPos = 20, StartYPos = 20; + uint8_t column_num = 2; + uint8_t row_num = 7; + uint8_t cell_width = 60; + uint8_t cell_height = 50; + uint16_t x,y; + + switch(column){ + case (1): + x = StartXPos; + break; + case (2): + x = StartXPos + cell_width; + break; + case (3): + x = StartXPos + 2*cell_width + segment_distance; + break; + case (4): + x = StartXPos + 3*cell_width + segment_distance; + break; + case (5): + x = StartXPos + 4*cell_width + 2*segment_distance; + break; + case (6): + x = StartXPos + 5*cell_width + 2*segment_distance; + break; + case (7): + x = StartXPos + 6*cell_width + 3*segment_distance; + break; + case (8): + x = StartXPos + 7*cell_width + 3*segment_distance; + break; + case (9): + x = StartXPos + 8*cell_width + 4*segment_distance; + break; + case (10): + x = StartXPos + 9*cell_width + 4*segment_distance; + break; + }; + y = StartYPos + (row - 1)*cell_height; + lcd.SetTextColor(TempColor(temp)); + lcd.FillRect(x+1, y+1, cell_width - 2, cell_height - 2); +}; + +void SetFixedAccTemp(){ + Acc_Temperature[1] = 28; + Acc_Temperature[2] = 28; + Acc_Temperature[3] = 29; + Acc_Temperature[4] = 28; + Acc_Temperature[5] = 29; + Acc_Temperature[6] = 30; + Acc_Temperature[7] = 28; + Acc_Temperature[8] = 28; + Acc_Temperature[9] = 29; + Acc_Temperature[10] = 30; + Acc_Temperature[11] = 30; + Acc_Temperature[12] = 32; + Acc_Temperature[13] = 30; + Acc_Temperature[14] = 29; + Acc_Temperature[15] = 29; + Acc_Temperature[16] = 31; + Acc_Temperature[17] = 30; + Acc_Temperature[18] = 31; + Acc_Temperature[19] = 30; + Acc_Temperature[20] = 33; + Acc_Temperature[21] = 30; + Acc_Temperature[22] = 31; + Acc_Temperature[23] = 32; + Acc_Temperature[24] = 33; + Acc_Temperature[25] = 33; + Acc_Temperature[26] = 35; + Acc_Temperature[27] = 34; + Acc_Temperature[28] = 34; + Acc_Temperature[29] = 32; + Acc_Temperature[30] = 33; + Acc_Temperature[31] = 33; + Acc_Temperature[32] = 35; + Acc_Temperature[33] = 34; + Acc_Temperature[34] = 32; + Acc_Temperature[35] = 33; + Acc_Temperature[36] = 36; + Acc_Temperature[37] = 36; + Acc_Temperature[38] = 38; + Acc_Temperature[39] = 39; + Acc_Temperature[40] = 39; + Acc_Temperature[41] = 38; + Acc_Temperature[42] = 37; + Acc_Temperature[43] = 33; + Acc_Temperature[44] = 34; + Acc_Temperature[45] = 33; + Acc_Temperature[46] = 33; + Acc_Temperature[47] = 32; + Acc_Temperature[48] = 33; + Acc_Temperature[49] = 34; + Acc_Temperature[50] = 34; + Acc_Temperature[51] = 35; + Acc_Temperature[52] = 33; + Acc_Temperature[53] = 34; + Acc_Temperature[54] = 34; + Acc_Temperature[55] = 35; + Acc_Temperature[56] = 35; + Acc_Temperature[57] = 33; + Acc_Temperature[58] = 33; + Acc_Temperature[59] = 37; + Acc_Temperature[60] = 32; + Acc_Temperature[61] = 34; + Acc_Temperature[62] = 34; + Acc_Temperature[63] = 33; + Acc_Temperature[64] = 34; + Acc_Temperature[65] = 36; + Acc_Temperature[66] = 35; + Acc_Temperature[67] = 35; + Acc_Temperature[68] = 35; + Acc_Temperature[69] = 34; + Acc_Temperature[70] = 34; + }; \ No newline at end of file
diff -r 4b63e6845a8e -r d6e001d7cf16 draw_print_library.h --- a/draw_print_library.h Wed Nov 28 12:01:20 2018 +0000 +++ b/draw_print_library.h Wed Feb 12 18:49:12 2020 +0000 @@ -24,11 +24,13 @@ //Positions of Informations on screen const uint16_t GearXPos=272,GearYPos=95; //Gear in Main -const uint16_t OilTempXPos=15,OilTempYPos=200; //Oil Temperature in Main -const uint16_t LogoSmallXPos=635,LogoSmallYPos=5; //Small Logo, all three screens +const uint16_t CapXPos = 300, CapYPos = 140; +const uint16_t BatTempXPos=15,BatTempYPos=200; //Bat Temperature in Main +const uint16_t LogoSmallXPos=625,LogoSmallYPos=5; //Small Logo, all three screens const uint16_t WaterTempXPos=15,WaterTempYPos=350; //Water Temperature in Main const uint16_t TPSXPos=569,TPSYPos=200; //TPS in Main -const uint16_t RpmXPos=330,RpmYPos=30; //Oil Pressure in First Auxiliary +const uint16_t HVVXPos=569,HVVYPos=350; +const uint16_t RpmXPos=330,RpmYPos=30; //Bat Pressure in First Auxiliary const uint16_t MAPXPos=330,MAPYPos=90; //MAP in First Auxiliary const uint16_t AirTempXPos=330,AirTempYPos=150; //Air Temperature in First Auxiliary const uint16_t LambdaXPos=330,LambdaYPos=210; //Lambda Sensor value in First Auxiliary @@ -67,7 +69,13 @@ void SetNumber(int num,int Font,uint16_t StartXPos,uint16_t StartYPos, int digits, int dec_point, int sign); //Set number to specific value function void DrawRGBImage(IMAGE Image,uint16_t StartXPos,uint16_t StartYPos); //Draw RGB Coloured image function void UpdateSpeedMeter(int V,int dV); //Update Speedmeter function -void ChangeCrank(int Crank); //Update Crank error message function +void ChangeCrank(int Crank); +int UpdateCapBar(int H, int H0, uint16_t StartXPos, uint16_t StartYPos); //Update Crank error message function int UpdateLVDTScale(int H,int H0, uint16_t StartXPos, uint16_t StartYPos); //Update LVDT Bar function void BrakeSignal(uint16_t brake); //Set Brake signal function -void TestFont(); //Test font 50 function +void TestFont(); +void DrawBatTempMap(); +void UpdateBatTempMap(); +uint32_t TempColor(uint8_t temperature); +void UpdateCellTemp(uint8_t hsegment, uint8_t row, uint8_t temp); //Test font 50 function +void SetFixedAccTemp(); \ No newline at end of file
diff -r 4b63e6845a8e -r d6e001d7cf16 gears.h --- a/gears.h Wed Nov 28 12:01:20 2018 +0000 +++ b/gears.h Wed Feb 12 18:49:12 2020 +0000 @@ -86020,4 +86020,1398 @@ 0x00, 0x00, 0x00, +}; + +uint8_t logosmallea[] = {0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x03, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x02, +0x80, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x03, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x02, +0x20, +0x00, +0x00, +0x00, +0x00, +0x00, +0x02, +0x01, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x07, +0x03, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x0d, +0x82, +0x80, +0x00, +0x00, +0x00, +0x00, +0x00, +0x0f, +0x03, +0x20, +0x00, +0x00, +0x00, +0x00, +0x00, +0x12, +0x03, +0x60, +0x00, +0x00, +0x00, +0x00, +0x00, +0x60, +0x01, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x80, +0x00, +0x80, +0x00, +0x00, +0x00, +0x00, +0x00, +0xb8, +0x01, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0xb8, +0x03, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x03, +0xc0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x00, +0x20, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x03, +0xc0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x03, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x00, +0x20, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x01, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x02, +0x40, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x01, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x08, +0x90, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x1c, +0x90, +0x03, +0xa0, +0x00, +0x00, +0x00, +0x00, +0x3e, +0x90, +0x02, +0xa0, +0x00, +0x00, +0x00, +0x00, +0x1c, +0x98, +0x02, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x29, +0x0c, +0x42, +0x00, +0x00, +0x00, +0x00, +0x00, +0x44, +0x02, +0xe3, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x88, +0x01, +0xf2, +0x00, +0x00, +0x00, +0x00, +0x03, +0x10, +0x00, +0xe3, +0xc0, +0x00, +0x00, +0x00, +0x04, +0x40, +0x00, +0x40, +0x20, +0x00, +0x00, +0x00, +0x08, +0x00, +0x00, +0x03, +0xc0, +0x00, +0x00, +0x00, +0x31, +0x00, +0x00, +0x03, +0xe0, +0x00, +0x00, +0x00, +0x40, +0x00, +0x00, +0x02, +0x20, +0x00, +0x00, +0x01, +0x84, +0x00, +0x00, +0x01, +0xc0, +0x00, +0x00, +0x02, +0x10, +0x00, +0x00, +0x03, +0xe0, +0x00, +0x00, +0x04, +0x20, +0x00, +0x00, +0x02, +0xa0, +0x00, +0x00, +0x18, +0x40, +0x00, +0x00, +0x03, +0xe0, +0x00, +0x00, +0x21, +0x00, +0x00, +0x00, +0x00, +0x40, +0x00, +0x00, +0x42, +0x00, +0x00, +0x00, +0x03, +0xe0, +0x00, +0x00, +0x80, +0x00, +0x00, +0x00, +0x02, +0x00, +0x00, +0x01, +0x10, +0x00, +0x00, +0x00, +0x83, +0xe0, +0x00, +0x06, +0x20, +0x00, +0x00, +0x01, +0xc2, +0x00, +0x00, +0x08, +0x40, +0x00, +0x00, +0x03, +0x60, +0x00, +0x00, +0x31, +0x80, +0x00, +0x00, +0x01, +0xc0, +0x00, +0x00, +0x62, +0x00, +0x00, +0x00, +0x01, +0x82, +0x00, +0x00, +0x84, +0x00, +0x00, +0x00, +0x02, +0x03, +0xe0, +0x01, +0x10, +0x00, +0x00, +0x00, +0x02, +0x02, +0x00, +0x06, +0x20, +0x00, +0x00, +0x00, +0x04, +0x83, +0xe0, +0x08, +0x40, +0x00, +0x00, +0x00, +0x09, +0xc2, +0xa0, +0x11, +0x00, +0x00, +0x00, +0x00, +0x0b, +0xe1, +0xe0, +0x22, +0x00, +0x00, +0x00, +0x00, +0x11, +0xc2, +0x40, +0x22, +0x00, +0x00, +0x00, +0x80, +0x21, +0x81, +0xe0, +0x22, +0x00, +0x00, +0x01, +0xc0, +0x23, +0x03, +0xe0, +0x23, +0xff, +0xff, +0xff, +0x60, +0x44, +0x01, +0x00, +0x20, +0x00, +0x00, +0x01, +0xc0, +0x80, +0x00, +0x80, +0x20, +0x00, +0x00, +0x00, +0x80, +0x88, +0x01, +0x00, +0x20, +0x02, +0x00, +0x00, +0x01, +0x10, +0x03, +0xe4, +0x70, +0x05, +0x00, +0x00, +0x02, +0x20, +0x00, +0x1a, +0xd8, +0x0f, +0xff, +0xfc, +0x00, +0x20, +0x00, +0x27, +0x60, +0x07, +0x00, +0x03, +0x04, +0x40, +0x00, +0x87, +0x20, +0x02, +0x00, +0x00, +0xc4, +0x80, +0x09, +0x0f, +0x00, +0x00, +0x00, +0x00, +0x44, +0x80, +0x1e, +0x22, +0x00, +0x00, +0x0f, +0x38, +0x40, +0x80, +0x3c, +0xc0, +0x00, +0x00, +0x10, +0x0c, +0x64, +0x80, +0x19, +0x00, +0x00, +0x00, +0x20, +0x04, +0x24, +0x80, +0x02, +0x00, +0x00, +0x00, +0x40, +0x04, +0x24, +0x80, +0x08, +0x00, +0x00, +0x00, +0x80, +0x04, +0x24, +0x40, +0x00, +0x00, +0x00, +0x00, +0x80, +0x04, +0x24, +0x40, +0x08, +0x08, +0x00, +0x00, +0x80, +0x04, +0x24, +0x40, +0x15, +0x54, +0x00, +0x00, +0x82, +0x06, +0x24, +0x40, +0x15, +0x54, +0x00, +0x00, +0x83, +0x88, +0x22, +0x40, +0x15, +0x54, +0x00, +0x00, +0x43, +0xc0, +0x22, +0x40, +0x15, +0x54, +0x00, +0x00, +0x43, +0xc0, +0x22, +0x40, +0x15, +0x54, +0x00, +0x00, +0x23, +0xe0, +0x72, +0x40, +0x08, +0x88, +0x00, +0x00, +0x31, +0xe0, +0xfa, +0x40, +0x0f, +0xf8, +0x00, +0x00, +0x09, +0xf0, +0x72, +0x40, +0x10, +0x04, +0x00, +0x00, +0x07, +0xe0, +0x22, +0x40, +0x0f, +0xf4, +0x00, +0x00, +0x00, +0x00, +0x02, +0x20, +0x00, +0x14, +0x00, +0x00, +0x00, +0x00, +0x00, +0x20, +0x00, +0x14, +0x00, +0x00, +0x00, +0x00, +0x02, +0x00, +0x00, +0x14, +0x00, +0x00, +0x00, +0x00, +0x02, +0x20, +0x00, +0x08, +0x00, +0x00, +0x00, +0x00, +0x02, +0x20, +0x08, +0x08, +0x00, +0x00, +0x00, +0x00, +0x02, +0x20, +0x15, +0x54, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x15, +0x54, +0x00, +0x00, +0x00, +0x00, +0x00, +0x20, +0x15, +0x54, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x15, +0x54, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x15, +0x54, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x08, +0x88, +0x00, +0x00, +0x00, +0x00, +0x01, +0x00, +0x03, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x01, +0x30, +0x0c, +0x18, +0x00, +0x00, +0x00, +0x00, +0x00, +0x10, +0x11, +0xc4, +0x00, +0x00, +0x00, +0x00, +0x01, +0x10, +0x16, +0x34, +0x00, +0x00, +0x00, +0x00, +0x01, +0x10, +0x14, +0x14, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x14, +0x14, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x08, +0x08, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x08, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0xb8, +0x14, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0xfc, +0x14, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0xb8, +0x13, +0xf8, +0x00, +0x00, +0x00, +0x00, +0x00, +0x90, +0x10, +0x04, +0x00, +0x00, +0x00, +0x00, +0x00, +0x80, +0x13, +0xf8, +0x00, +0x00, +0x00, +0x00, +0x00, +0x80, +0x14, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x80, +0x14, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x40, +0x08, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x40, +0x0f, +0xf8, +0x00, +0x00, +0x00, +0x00, +0x00, +0x40, +0x10, +0x04, +0x00, +0x00, +0x00, +0x00, +0x00, +0x40, +0x12, +0x78, +0x00, +0x00, +0x00, +0x00, +0x00, +0x40, +0x14, +0x40, +0x00, +0x00, +0x00, +0x00, +0x00, +0x40, +0x11, +0x38, +0x00, +0x00, +0x00, +0x00, +0x00, +0x40, +0x0e, +0x84, +0x00, +0x00, +0x00, +0x00, +0x02, +0x40, +0x00, +0x78, +0x00, +0x00, +0x00, +0x00, +0x07, +0x40, +0x0f, +0xf8, +0x00, +0x00, +0x00, +0x00, +0x0f, +0xc0, +0x10, +0x04, +0x00, +0x00, +0x00, +0x00, +0x07, +0x20, +0x0f, +0xf8, +0x00, +0x00, +0x00, +0x00, +0x02, +0x20, +0x03, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x02, +0x20, +0x0c, +0x18, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x11, +0xc4, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x16, +0x34, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x14, +0x14, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x14, +0x14, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x08, +0x08, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x00, +0x08, +0x00, +0x00, +0x00, +0x00, +0x01, +0x20, +0x00, +0x34, +0x00, +0x00, +0x00, +0x00, +0x02, +0x10, +0x00, +0xc4, +0x00, +0x00, +0x00, +0x00, +0x0c, +0x20, +0x03, +0x18, +0x00, +0x00, +0x00, +0x00, +0x18, +0x80, +0x0c, +0x60, +0x00, +0x00, +0x00, +0x00, +0x31, +0x00, +0x11, +0x80, +0x00, +0x00, +0x00, +0x00, +0x42, +0x00, +0x0c, +0x60, +0x00, +0x00, +0x00, +0x01, +0x8c, +0x00, +0x03, +0x18, +0x00, +0x00, +0x00, +0x02, +0x00, +0x00, +0x00, +0xc4, +0x00, +0x00, +0x00, +0x00, +0x20, +0x00, +0x00, +0x34, +0x00, +0x00, +0x00, +0x00, +0x40, +0x00, +0x00, +0x08, +0x00, +0x00, +0x00, +0x00, +0x40, +0x00, +0x0f, +0xf8, +0x00, +0x00, +0x00, +0x00, +0x40, +0x00, +0x10, +0x04, +0x00, +0x00, +0x00, +0x00, +0x40, +0x00, +0x12, +0x78, +0x00, +0x00, +0x00, +0x04, +0x40, +0x00, +0x14, +0x40, +0x00, +0x00, +0x00, +0x04, +0x40, +0x00, +0x11, +0x38, +0x00, +0x00, +0x00, +0x04, +0x48, +0x00, +0x0e, +0x84, +0x00, +0x00, +0x00, +0x04, +0x5c, +0x00, +0x00, +0x78, +0x00, +0x00, +0x00, +0x04, +0x7e, +0x00, +0x0f, +0xf8, +0x00, +0x00, +0x00, +0x00, +0x5c, +0x00, +0x10, +0x04, +0x00, +0x00, +0x00, +0x00, +0x48, +0x00, +0x12, +0x78, +0x00, +0x00, +0x00, +0x00, +0x48, +0x00, +0x14, +0x40, +0x00, +0x00, +0x00, +0x0e, +0x48, +0x00, +0x11, +0x38, +0x00, +0x00, +0x00, +0x1f, +0x48, +0x00, +0x0e, +0x84, +0x00, +0x00, +0x00, +0x0e, +0x4c, +0x00, +0x00, +0x78, +0x00, +0x00, +0x00, +0x04, +0x62, +0x00, +0x07, +0xf0, +0x00, +0x00, +0x00, +0x00, +0x11, +0x00, +0x08, +0x08, +0x00, +0x00, +0x00, +0x00, +0x08, +0xc0, +0x13, +0xe4, +0x00, +0x00, +0x00, +0x00, +0x04, +0x20, +0x14, +0x14, +0x00, +0x00, +0x00, +0x00, +0x01, +0x11, +0x14, +0x14, +0x00, +0x00, +0x00, +0x00, +0x00, +0x8f, +0x93, +0xe4, +0x00, +0x00, +0x00, +0x00, +0x00, +0x67, +0xc8, +0x08, +0x00, +0x00, +0x00, +0x00, +0x00, +0x13, +0x87, +0xf0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x09, +0x08, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x04, +0x17, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x03, +0x10, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x03, +0x8e, +0x18, +0x00, +0x00, +0x00, +0x00, +0x00, +0x07, +0xc1, +0xc4, +0x00, +0x00, +0x00, +0x00, +0x00, +0x03, +0x80, +0x88, +0x00, +0x00, +0x00, +0x00, +0x00, +0x01, +0x01, +0x30, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x03, +0x40, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x01, +0x30, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x88, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x01, +0xc4, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x0e, +0x18, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x10, +0xe0, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x17, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x08, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00, +0x00 }; \ No newline at end of file
diff -r 4b63e6845a8e -r d6e001d7cf16 main.cpp --- a/main.cpp Wed Nov 28 12:01:20 2018 +0000 +++ b/main.cpp Wed Feb 12 18:49:12 2020 +0000 @@ -6,7 +6,7 @@ LCD_DISCO_F469NI lcd; //Initialize LCD Display SD_DISCO_F469NI sd; //Initialize SD Card //EEPROM_DISCO_F469NI eep; //Initialize EEPROM Internal memory -Serial pc(USBTX, USBRX); //Initialize Serial. This is used only while debuging code. +Serial pc(USBTX, USBRX,115200); //Initialize Serial. This is used only while debuging code. CAN can(PB_5, PB_13,1000000); //Initialize CAN. I2C i2c(D14, D15); DigitalOut reset(D8); @@ -14,12 +14,13 @@ Timer t_int,t_store; // Variables received from DTA, LVDTs and brakes -uint16_t Rpm0=0,Speed0=0,Gear0=0,Water_Temp0=0,Oil_Temp0=0,TPS0=0,Brakes0=0,MAP0=0,Air_Temp0=0,Lambda0=0,Volts0=0; -uint16_t Rpm=0,Speed=0,Gear=0,Water_Temp=0,Oil_Temp=0,TPS=0,Brakes=0,MAP=0,Air_Temp=0,Lambda=0,Volts=0; +uint16_t Capacity0=0,HV_Voltage0=0,Rpm0=0,Speed0=0,Gear0=0,Water_Temp0=0,Bat_Temp0=0,TPS0=0,Brakes0=0,MAP0=0,Air_Temp0=0,Lambda0=0,Volts0=0; +uint16_t Capacity=80,HV_Voltage=542,Rpm=0,Speed=720,Gear=0,Water_Temp=47,Bat_Temp=34,TPS=69,Brakes=0,MAP=0,Air_Temp=0,Lambda=0,Volts=0; int FL_LVDT0=0,FR_LVDT0=0,RL_LVDT0=0,RR_LVDT0=0,FL_LVDT=0,FR_LVDT=0,RL_LVDT=0,RR_LVDT=0; //Referrent LVDT values. First received value is referrent. int FL_LVDT_Ref,FR_LVDT_Ref,RL_LVDT_Ref,RR_LVDT_Ref; //float Meter_counter=0,Meter_counter0=0; +uint8_t Acc_Temperature[70],Acc_Temperature0[70]; uint8_t change_flag=0; uint16_t rx_flag=0x0000; // Receive specific CAN data message @@ -57,7 +58,7 @@ } void showLedRpm(int RPM){ - pc.printf("%d\n",RPM); + //pc.printf("%d\n",RPM); if(RPM<1000) { cmd[1]=0xFF; cmd[2]=0xFF; @@ -120,18 +121,24 @@ int main(){ +//pc.printf("proba\n"); LEDInitialize(); can.attach(&CANMsgReceive,CAN::RxIrq); // Attach interrupt function to CAN RX change_screen_input.rise(&ChangeCommand); //Attach interrupt function to rising edge of DigitalIn for changing screen. - SetIntro(); // Display logo when starting display - SetMain(); // First screen is main by default + //SetIntro(); // Display logo when starting display + SetMain(); + lcd.SetTextColor(LCD_COLOR_BLACK); // First screen is main by default sd.Init(); - + for (uint8_t k = 1 ; k <= 70 ; k++){ + Acc_Temperature0[k] = 0; + }; + SetFixedAccTemp(); while(1){ if(change_flag){ // Check if screen is changed ChangeScreen(); }; UpdateInfo(); // Update info for DTA values in every iteration + //pc.printf("proba2\n"); switch(screen_flag){ // Display only changes visible on current screen case(1): MainUpdate();
diff -r 4b63e6845a8e -r d6e001d7cf16 screen_library.cpp --- a/screen_library.cpp Wed Nov 28 12:01:20 2018 +0000 +++ b/screen_library.cpp Wed Feb 12 18:49:12 2020 +0000 @@ -6,13 +6,15 @@ extern uint8_t screen_flag,ft_main_flag,ft_2aux_flag,change_flag; extern GEAR *Gears; +extern CHAR LogoSmallEA; extern IMAGE LogoBig,LogoSmall,Branko,NewYearCongat; -extern uint16_t Rpm0, Speed0, Gear0, Water_Temp0, Oil_Temp0, TPS0, Brakes0, MAP0, Air_Temp0, Lambda0, Volts0, Crank0; -extern uint16_t Rpm, Speed, Gear, Water_Temp, Oil_Temp, TPS, Brakes, MAP, Air_Temp, Lambda, Volts, Crank; +extern uint16_t Capacity0,HV_Voltage0, Rpm0, Speed0, Gear0, Water_Temp0, Bat_Temp0, TPS0, Brakes0, MAP0, Air_Temp0, Lambda0, Volts0, Crank0; +extern uint16_t Capacity,HV_Voltage, Rpm, Speed, Gear, Water_Temp, Bat_Temp, TPS, Brakes, MAP, Air_Temp, Lambda, Volts, Crank; extern int FL_LVDT0, FR_LVDT0, RL_LVDT0, RR_LVDT0, FL_LVDT, FR_LVDT, RL_LVDT, RR_LVDT; extern int FL_LVDT_Ref,FR_LVDT_Ref,RL_LVDT_Ref,RR_LVDT_Ref; extern int LVDT_Max; +extern uint8_t Acc_Temperature0[]; //extern float Meter_counter,Meter_counter0; void ChangeCommand(){ //Interrupt function for registering change command @@ -52,23 +54,25 @@ lcd.SetTextColor(LCD_COLOR_BLACK); //Draw Main screen DrawSpeedMeter(); - DrawRGBImage(LogoSmall,LogoSmallXPos,LogoSmallYPos); + PrintChar(LogoSmallEA,LogoSmallXPos,LogoSmallYPos,LCD_COLOR_BLACK); lcd.SetFont(&Font24); - lcd.DisplayStringAt(30,170,(uint8_t*)"Oil Temp",LEFT_MODE); + lcd.DisplayStringAt(30,170,(uint8_t*)"Battery Temp",LEFT_MODE); lcd.DisplayStringAt(30,320,(uint8_t*)"Water Temp",LEFT_MODE); lcd.DisplayStringAt(584,170,(uint8_t*)"TPS",LEFT_MODE); - lcd.SetTextColor(LCD_COLOR_DARKRED); - lcd.FillRect(560,340,230,68); - lcd.SetBackColor(LCD_COLOR_DARKRED); - PrintString("BRAKE",50,575,350,LCD_COLOR_BLACK); - lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.DisplayStringAt(584,320,(uint8_t*)"HVDC Voltage",LEFT_MODE); //Display initial values - PrintChar(Gears[Gear],GearXPos,GearYPos,LCD_COLOR_BLACK); - SetNumber(Oil_Temp,100,OilTempXPos,OilTempYPos,3,0,0); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.FillRect(CapXPos-5,CapYPos-5,210,310); + lcd.FillRect(CapXPos+60,CapYPos-20,80,20); + lcd.SetTextColor(LCD_COLOR_WHITE); + lcd.FillRect(CapXPos,CapYPos,200,300); + lcd.SetTextColor(LCD_COLOR_BLACK); + UpdateCapBar(Capacity,0,CapXPos,CapYPos); + SetNumber(Bat_Temp,100,BatTempXPos,BatTempYPos,3,0,0); SetNumber(Water_Temp,100,WaterTempXPos,WaterTempYPos,3,0,0); SetNumber(TPS,100,TPSXPos,TPSYPos,3,0,0); - BrakeSignal(Brakes); + SetNumber(HV_Voltage,100,HVVXPos,HVVYPos,3,0,0); }; @@ -77,6 +81,8 @@ lcd.SetTextColor(LCD_COLOR_WHITE); lcd.FillRect(0,0,800,480); lcd.SetTextColor(LCD_COLOR_BLACK); + //PrintChar(LogoSmallEA,LogoSmallXPos,LogoSmallYPos,LCD_COLOR_BLACK); + /* //Draw First Auxiliary screen PrintString("RPM",50,20,30,LCD_COLOR_BLACK); PrintString("MAP",50,20,90,LCD_COLOR_BLACK); @@ -98,6 +104,11 @@ SetNumber(Lambda,50,LambdaXPos,LambdaYPos,4,1,0); SetNumber(Volts,50,VoltsXPos,VoltsYPos,3,2,0); //SetNumber((int)(Meter_counter/10),50,Meter_counterXPos,Meter_counterYPos,5,3,0); + */ + DrawBatTempMap(); + for (uint8_t k = 1; k <= 70; k++){ + Acc_Temperature0[k] = 10; + }; }; @@ -108,7 +119,7 @@ lcd.SetTextColor(LCD_COLOR_BLACK); // Draw Second Auxiliary screen PrintString("LVDT Sensors",50,200,20,LCD_COLOR_BLACK); - DrawRGBImage(LogoSmall,LogoSmallXPos,LogoSmallYPos); + //DrawRGBImage(LogoSmall,LogoSmallXPos,LogoSmallYPos); lcd.SetTextColor(LCD_COLOR_BLACK); lcd.SetFont(&Font24); lcd.DisplayStringAt(FLLVDTBarXPos+25,FLLVDTBarYPos,(uint8_t*)"FL",LEFT_MODE); @@ -124,7 +135,7 @@ UpdateLVDTScale(FR_LVDT,-100,FRLVDTBarXPos,FRLVDTBarYPos); UpdateLVDTScale(RL_LVDT,-100,RLLVDTBarXPos,RLLVDTBarYPos); UpdateLVDTScale(RR_LVDT,-100,RRLVDTBarXPos,RRLVDTBarYPos); - + PrintChar(LogoSmallEA,LogoSmallXPos,LogoSmallYPos,LCD_COLOR_BLACK); }; @@ -140,11 +151,11 @@ if(Speed!=Speed0){ //Check is value is changed. If it is then update it on screen. UpdateSpeedMeter((int)(Speed0/10),(int)((Speed-Speed0)/10)); }; - if(Gear!=Gear0){ - PrintChar(Gears[Gear],GearXPos,GearYPos,LCD_COLOR_BLACK); + if(Capacity!=Capacity0){ + UpdateCapBar(Capacity,Capacity0,CapXPos,CapYPos); }; - if(Oil_Temp!=Oil_Temp0){ - ChangeNumber(Oil_Temp,Oil_Temp0,100,OilTempXPos,OilTempYPos,3,0,0); + if(Bat_Temp!=Bat_Temp0){ + ChangeNumber(Bat_Temp,Bat_Temp0,100,BatTempXPos,BatTempYPos,3,0,0); }; if(Water_Temp!=Water_Temp0){ ChangeNumber(Water_Temp,Water_Temp0,100,WaterTempXPos,WaterTempYPos,3,0,0); @@ -152,14 +163,14 @@ if(TPS!=TPS0){ ChangeNumber(TPS,TPS0,100,TPSXPos,TPSYPos,3,0,0); }; - if(Brakes!=Brakes0){ - BrakeSignal(Brakes); + if(HV_Voltage!=HV_Voltage0){ + ChangeNumber(HV_Voltage,HV_Voltage0,100,HVVXPos,HVVYPos,3,0,0); }; }; void FirstAuxUpdate(){ // Update information in First Auxiliary screen - if (Rpm!=Rpm0){ + /*if (Rpm!=Rpm0){ ChangeNumber(Rpm,Rpm0,50,RpmXPos,RpmYPos,5,0,0); }; if (MAP!=MAP0){ @@ -177,6 +188,8 @@ //if (Meter_counter!=Meter_counter0){ // ChangeNumber((int)(Meter_counter/10),(int)(Meter_counter0/10),50,Meter_counterXPos,Meter_counterYPos,5,3,0); //}; + */ + UpdateBatTempMap(); }; void SecondAuxUpdate(){ // Update information in Second Auxiliary screen