Skip to content

Commit

Permalink
Revert "Expansion to 20x4 LCD"
Browse files Browse the repository at this point in the history
This reverts commit d40316b.
  • Loading branch information
waal70 committed Sep 9, 2015
1 parent b69e9ac commit 63f0625
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 98 deletions.
74 changes: 4 additions & 70 deletions s60can/s60can.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
** Changelog:
** 24-08-2015: Start of dpfmonitor branch
** 26-08-2015: Start of EGRMonitor branch
** 08-09-2015: New display, 20x4
**
*/

//TODO:
Expand All @@ -36,7 +36,7 @@
// This enables the sending of periodic keep-alive messages
// Also pretty useful for loopback testing
#define KEEPALIVE
#define LOOPBACKMODE 1
#define LOOPBACKMODE 0

// This enables using the apparatus as an indepent DPF temp monitor
// the original goal for making this :)
Expand Down Expand Up @@ -91,9 +91,6 @@ char foo; // for the sake of Arduino header parsing anti-automagic. Remove and

// initialize the library with the numbers of the interface pins
#ifdef LCD
//GND, VCC to GND and 5V
//SDA to A4
//SCL to A5
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
int globalMessageCounter = 0;
#endif
Expand Down Expand Up @@ -258,7 +255,7 @@ void write_DPF_msg_on_LCD (tCAN *message) {
else
lcd.print(F("DPF: 0 \337C"));

lcd.setCursor(16,3);
lcd.setCursor(12,1);
lcd.print(globalMessageCounter);

globalMessageCounter++;
Expand Down Expand Up @@ -298,65 +295,6 @@ void write_EGR_msg_on_LCD (tCAN *message) {
else
lcd.print(F("EGR: 0 %"));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void write_OIL_msg_on_LCD (tCAN *message) {

//pre-condition isOILMessage is true (1)
lcd.setCursor(0,2);
char temp[7];
char msg[16];
float factor = 0.01220703125;
uint16_t value;
// CD 11 E6 01 96 0B D4 00
// This gets the 6th and 7th element from the DPF response message (tested through isDPFMessage())
// And calculates the temperature as follows:
// Decimal value is temperature in tenths of degrees Kelvin. Therefore:
// decimal value /10 - 273.15 = degrees celsius:
value = (uint16_t)(((message->data[5] << 8) | (message->data[6])) & 0xFFFF);

// Check for a valid temperature, between 0 and 2000 degrees celsius
// Character buffers need to be at least 1 character longer than the number of characters you are writing to them
// As we are writing 0.1 to maximum 2000.0 this means a buffer of 6+1
if (((double)value > 0) && ((double)value < 8193) )
{
dtostrf((double)value*factor-12.3,3,1,temp);
//337 is the degree symbol
sprintf(msg, "OIL: %s \337C", temp);
lcd.print(msg);
}
else
lcd.print(F("OIL: NaN"));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void write_BOOST_msg_on_LCD (tCAN *message) {

lcd.setCursor(0,3);
char temp[7];
char msg[16];
float factor = 0.0001220703125;
uint16_t value;
// CD 11 E6 01 96 0B D4 00
// This gets the 6th and 7th element from the DPF response message (tested through isDPFMessage())
// And calculates the temperature as follows:
// Decimal value is temperature in tenths of degrees Kelvin. Therefore:
// decimal value /10 - 273.15 = degrees celsius:
value = (uint16_t)(((message->data[5] << 8) | (message->data[6])) & 0xFFFF);

// Check for a valid temperature, between 0 and 2000 degrees celsius
// Character buffers need to be at least 1 character longer than the number of characters you are writing to them
// As we are writing 0.1 to maximum 2000.0 this means a buffer of 6+1
if (((double)value > 0) && ((double)value < 8193) )
{
dtostrf((double)value*factor+.65,2,2,temp);
//337 is the degree symbol
sprintf(msg, "TRB: %s bar", temp);
lcd.print(msg);
}
else
lcd.print(F("TRB: 0 %"));
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef LCD
Expand Down Expand Up @@ -595,7 +533,7 @@ void setup() {
stdout = &uartout ;

#ifdef LCD
lcd.begin(20, 4);
lcd.begin(16, 2);
lcd.print(F("S60 logger CAN"));
lcd.setCursor(0, 1);
char version[16];
Expand Down Expand Up @@ -678,10 +616,6 @@ void handle_CAN_rx() {
write_DPF_msg_on_LCD(&message);
if (isEGRMessage(&message))
write_EGR_msg_on_LCD(&message);
if (isOILMessage(&message))
write_OIL_msg_on_LCD(&message);
if (isBOOSTMessage(&message))
write_BOOST_msg_on_LCD(&message);

#ifdef DATALOGGER
write_CAN_msg_to_file(&message, true);
Expand Down
26 changes: 0 additions & 26 deletions s60can/s60can_msgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,32 +86,6 @@ int isEGRMessage(tCAN * message) {
else
return ((message->data[1] == 0x11) && (message->data[2] == 0xE6) && (message->data[3] == 0x00) && (message->data[4] == 0x2C));

}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 1 = succes, 0 = fail
int isOILMessage(tCAN * message) {

// Ignore canid. Different cars may send different diagnostic id's
// DPF-return message contains: CE 11 E6 01 96 xx yy 00. 11 E6 01 96 are relevant
//loopback testing:
if (LOOPBACKMODE)
return ((message->data[1] == 0x11) && (message->data[2] == 0xA6) && (message->data[3] == 0x00) && (message->data[4] == 0x2C));
else
return ((message->data[1] == 0x11) && (message->data[2] == 0xE6) && (message->data[3] == 0x00) && (message->data[4] == 0x2C));

}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 1 = succes, 0 = fail
int isBOOSTMessage(tCAN * message) {

// Ignore canid. Different cars may send different diagnostic id's
// DPF-return message contains: CE 11 E6 01 96 xx yy 00. 11 E6 01 96 are relevant
//loopback testing:
if (LOOPBACKMODE)
return ((message->data[1] == 0x11) && (message->data[2] == 0xA6) && (message->data[3] == 0x00) && (message->data[4] == 0x2C));
else
return ((message->data[1] == 0x11) && (message->data[2] == 0xE6) && (message->data[3] == 0x00) && (message->data[4] == 0x2C));

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 0 additions & 2 deletions s60can/s60can_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,4 @@ void init_keepalive(int blnLBM);
void init_dpf(int blnLBM);
int isEGRMessage(tCAN * message);
int isDPFMessage(tCAN * message);
int isOILMessage(tCAN * message);
int isBOOSTMessage(tCAN * message);
void checksend_CAN_msgs();

0 comments on commit 63f0625

Please sign in to comment.