Skip to content

Commit

Permalink
testing .. don't use this build for production
Browse files Browse the repository at this point in the history
  • Loading branch information
lincomatic committed May 10, 2015
1 parent bedc5bf commit 52f3151
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
10 changes: 4 additions & 6 deletions Adafruit_MCP9808.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,18 @@ boolean Adafruit_MCP9808::begin(uint8_t addr) {

/**************************************************************************/
/*!
@brief Reads the 16-bit temperature register and returns the Centigrade
temperature as a float.
@brief Reads the 16-bit temperature register and returns Centigrade*10
*/
/**************************************************************************/
float Adafruit_MCP9808::readTempC( void )
int16_t Adafruit_MCP9808::readTempC10( void )
{
uint16_t t = read16(MCP9808_REG_AMBIENT_TEMP);

float temp = t & 0x0FFF;
temp /= 16.0;
uint32_t temp = ((t & 0x0FFF)*10)/16;
if (t & 0x1000) temp -= 256;

return temp;
return (int16_t) temp;
}

/**************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions Adafruit_MCP9808.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class Adafruit_MCP9808 {
public:
Adafruit_MCP9808();
boolean begin(uint8_t a = MCP9808_I2CADDR_DEFAULT);
float readTempF( void );
float readTempC( void );
// float readTempF( void );
int16_t readTempC10( void );

void write16(uint8_t reg, uint16_t val);
uint16_t read16(uint8_t reg);
Expand Down
24 changes: 11 additions & 13 deletions Adafruit_TMP007.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,30 @@ boolean Adafruit_TMP007::begin(uint8_t samplerate) {
}

//////////////////////////////////////////////////////

double Adafruit_TMP007::readDieTempC(void) {
double Tdie = readRawDieTemperature();
/*
int16_t Adafruit_TMP007::readDieTempC(void) {
double Tdie = readRawDieTemperature();
Tdie *= 0.03125; // convert to celsius
#ifdef TMP007_DEBUG
Serial.print("Tdie = "); Serial.print(Tdie); Serial.println(" C");
#endif
return Tdie;
}
*/

double Adafruit_TMP007::readObjTempC(void) {
// return Celcius * 10
int16_t Adafruit_TMP007::readObjTempC10(void) {
int16_t raw = read16(TMP007_TOBJ);
// invalid

if (raw & 0x1) return NAN;
raw >>=2;

double Tobj = raw;
Tobj *= 0.03125; // convert to celsius
#ifdef TMP007_DEBUG
Serial.print("Tobj = "); Serial.print(Tobj); Serial.println(" C");
#endif
return Tobj;
uint32_t temp = ((int32_t)raw) * 78125;
return (int16_t) (temp / 1000000);
}



/*
int16_t Adafruit_TMP007::readRawDieTemperature(void) {
int16_t raw = read16(TMP007_TDIE);
Expand Down Expand Up @@ -108,7 +106,7 @@ int16_t Adafruit_TMP007::readRawVoltage(void) {
#endif
return raw;
}

*/

/*********************************************************************/

Expand Down
4 changes: 2 additions & 2 deletions Adafruit_TMP007.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class Adafruit_TMP007 {

int16_t readRawDieTemperature(void);
int16_t readRawVoltage(void);
double readObjTempC(void);
double readDieTempC(void);
int16_t readObjTempC10(void);
int16_t readDieTempC(void);

private:
uint8_t _addr;
Expand Down
2 changes: 1 addition & 1 deletion open_evse.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
// Option for AutoStart Menu. If defined, ManualStart feature is also defined by default - GoldServe
//#define AUTOSTART_MENU

#if defined(DELAYTIMER) && defined(BTN_MENU) && !defined(TEMPERATURE_MONITORING)
#if defined(DELAYTIMER) && defined(BTN_MENU)// && !defined(TEMPERATURE_MONITORING)
#define DELAYTIMER_MENU
#endif

Expand Down
12 changes: 8 additions & 4 deletions open_evse.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (c) 2011-2015 Sam C. Lin <[email protected]>
* Copyright (c) 2011-2014 Chris Howell <[email protected]>
* timer code Copyright (c) 2013 Kevin L <[email protected]>
* portions Copyright (c) 2014 Nick Sayer <[email protected]>
* portions Copyright (c) 2014-2015 Nick Sayer <[email protected]>
* portions Copyright (c) 2015 Craig Kirkpatrick
Revised Ver By Reason
Expand Down Expand Up @@ -325,10 +325,10 @@ void TempMonitor::Init()
void TempMonitor::Read()
{
#ifdef TMP007_IS_ON_I2C
m_TMP007_temperature = 10 * m_tmp007.readObjTempC(); // using the TI TMP007 IR sensor
m_TMP007_temperature = m_tmp007.readObjTempC10(); // using the TI TMP007 IR sensor
#endif
#ifdef MCP9808_IS_ON_I2C
m_MCP9808_temperature = 10 * m_tempSensor.readTempC(); // for the MCP9808
m_MCP9808_temperature = m_tempSensor.readTempC10(); // for the MCP9808
#endif


Expand Down Expand Up @@ -1296,10 +1296,14 @@ uint8_t Gfi::SelfTest()
}
while(pin.read());

#ifndef OPENEVSE_2
// sometimes getting spurious GFI faults when testing just before closing
// relay.
// wait a little more for everything to settle down
delay(200);
// this delay is needed only if 10uF cap is in the circuit, which makes the circuit
// temporarily overly sensitive to trips until it discharges
delay(1000);
#endif // OPENEVSE_2

m_GfiFault = 0;
testInProgress = 0;
Expand Down

0 comments on commit 52f3151

Please sign in to comment.