Go Down

Topic: IDE update screwed up my libraries (Read 539 times) previous topic - next topic

Nick Gammon

Quote

Code: [Select]


void loop (){
if(CAN_Connect == true)
  {
      Get_CAN_Data( &RPM,  &SPEED,  &EngineTemp,  &TPS,  &Drivers_Torque_Demand,  &Actual_Torque,   &Engine_Torque_Reference, &Timing_Advance, &Caculated_Load, &Maf);// "&" passes the address of input to the function
      //Serial_CAN_Print(RPM,  SPEED, EngineTemp, TPS,  Drivers_Torque_Demand,  Actual_Torque, Engine_Torque_Reference, Timing_Advance, Caculated_Load, Maf); // doesnt need "&" not editing data **** comment out this line later ***
     
     Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x00+4);Wire.write(itoa(RPM,buffer2,10)); Wire.endTransmission();
      /*Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x00+14);Wire.write(itoa(TPS,buffer2,10)); Wire.endTransmission();
      Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x40+12);Wire.write(itoa(Engine_Torque_Reference,buffer2,10)); Wire.endTransmission();
      delay(100);*/
}
}



May I suggest more conventional formatting? This is almost impossible to read.

keaton


Quote

Code: [Select]


void loop (){
if(CAN_Connect == true)
  {
      Get_CAN_Data( &RPM,  &SPEED,  &EngineTemp,  &TPS,  &Drivers_Torque_Demand,  &Actual_Torque,   &Engine_Torque_Reference, &Timing_Advance, &Caculated_Load, &Maf);// "&" passes the address of input to the function
      //Serial_CAN_Print(RPM,  SPEED, EngineTemp, TPS,  Drivers_Torque_Demand,  Actual_Torque, Engine_Torque_Reference, Timing_Advance, Caculated_Load, Maf); // doesnt need "&" not editing data **** comment out this line later ***
     
     Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x00+4);Wire.write(itoa(RPM,buffer2,10)); Wire.endTransmission();
      /*Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x00+14);Wire.write(itoa(TPS,buffer2,10)); Wire.endTransmission();
      Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x40+12);Wire.write(itoa(Engine_Torque_Reference,buffer2,10)); Wire.endTransmission();
      delay(100);*/
}
}



May I suggest more conventional formatting? This is almost impossible to read.


i can change it for the sake of making it more readable for you (and other), but the way it is laid out is easier to read for me as it follows strings of data that make up 1 line...
i2c lines are like:  0x50, 0xFE,0x45,0x00,"data for that line", end... [address][CMD][CMD][parameter][data][end]


I think my problem may be my car... its a CAN car but it may be a special VW protocol where a 0x7DF address might not be the correct address for the ECU. This car has 21 nodes on the CAN bus..

Tomorrow i will test what i have on another CAN car/truck

Go Up