Skip to content

Commit

Permalink
merge vD3.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lincomatic committed Jun 5, 2015
1 parent a78f26c commit c61bee3
Show file tree
Hide file tree
Showing 25 changed files with 3,725 additions and 2,379 deletions.
4 changes: 2 additions & 2 deletions Adafruit_MCP9808.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "TinyWireM.h"
#define Wire TinyWireM
#else
#include <Wire.h>
#include "./Wire.h"
#endif

static inline void wiresend(uint8_t x) {
Expand Down Expand Up @@ -64,7 +64,7 @@ Adafruit_MCP9808::Adafruit_MCP9808() {
/**************************************************************************/
boolean Adafruit_MCP9808::begin(uint8_t addr) {
_i2caddr = addr;
Wire.begin();
//don't need - open_evse.ino does it Wire.begin();

if (read16(MCP9808_REG_MANUF_ID) != 0x0054) return false;
if (read16(MCP9808_REG_DEVICE_ID) != 0x0400) return false;
Expand Down
2 changes: 1 addition & 1 deletion Adafruit_MCP9808.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "TinyWireM.h"
#define Wire TinyWireM
#else
#include <Wire.h>
#include "./Wire.h"
#endif

#define MCP9808_I2CADDR_DEFAULT 0x18
Expand Down
2 changes: 1 addition & 1 deletion Adafruit_TMP007.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Adafruit_TMP007::Adafruit_TMP007(uint8_t i2caddr) {


boolean Adafruit_TMP007::begin(uint8_t samplerate) {
Wire.begin();
//don't need - open_evse.ino does it Wire.begin();

write16(TMP007_CONFIG, TMP007_CFG_MODEON | TMP007_CFG_ALERTEN |
TMP007_CFG_TRANSC | samplerate);
Expand Down
2 changes: 1 addition & 1 deletion Adafruit_TMP007.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#else
#include "WProgram.h"
#endif
#include "Wire.h"
#include "./Wire.h"

// uncomment for debugging!
//#define TMP007_DEBUG 1
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
Change Log


vD3.9.0 SCL 20150604
- split out Gfi/J1772Pilot/J1772EvseController into separate files
- add support for changing I2C frequency
- increase I2C bus from 100KHz -> 200KHz
- use modified local Wire/twi to get rid of digitalWrite()
- on POST failure, go directly to Setup menu. Setup menu exits to reboot on POST failure
- shrink MaxCurrent/ChargeLimit/TimeLimit menu memory/code by calculating allowed
values rather than using RAM lookup tables
- put strings in strings.cpp
- fix bugs from 3.8.4: 1) Setup menu Exit sometimes didn't work 2) Setup menu would
start on Exit item after first use
- GFCI and No Ground faults auto reset when EV is unplugged, even if hard fault
- GFCI and No Ground faults display auto reset countdown when applicable
GFCI FAULT
RETRY IN 04:55
- when waiting for timer, just display Sleeping instead of Waiting
- during a fault, short press goes directly to Setup menu instead of putting
EVSE in Sleep state
- send $WF WIFI_MODE_AP_DEFAULT instead of WIFI_MODE_AP to client on very long
button press

v3.8.4 SCL 20150526
-> pushed to stable branch

Expand Down
93 changes: 93 additions & 0 deletions Gfi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* This file is part of Open EVSE.
* Open EVSE is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
* Open EVSE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Open EVSE; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "open_evse.h"

#ifdef GFI
// interrupt service routing
void gfi_isr()
{
g_EvseController.SetGfiTripped();
}


void Gfi::Init()
{
pin.init(GFI_REG,GFI_IDX,DigitalPin::INP);
// GFI triggers on rising edge
attachInterrupt(GFI_INTERRUPT,gfi_isr,RISING);

#ifdef GFI_SELFTEST
pinTest.init(GFITEST_REG,GFITEST_IDX,DigitalPin::OUT);
#endif

Reset();
}


//RESET GFI LOGIC
void Gfi::Reset()
{
WDT_RESET();

#ifdef GFI_SELFTEST
testInProgress = 0;
testSuccess = 0;
#endif // GFI_SELFTEST

if (pin.read()) m_GfiFault = 1; // if interrupt pin is high, set fault
else m_GfiFault = 0;
}

#ifdef GFI_SELFTEST

uint8_t Gfi::SelfTest()
{
testInProgress = 1;
testSuccess = 0;
for(int i=0; i < GFI_TEST_CYCLES; i++) {
pinTest.write(1);
delayMicroseconds(GFI_PULSE_DURATION_US);
pinTest.write(0);
delayMicroseconds(GFI_PULSE_DURATION_US);
if (testSuccess) break; // no need to keep trying.
}

// wait for GFI pin to clear
do {
delay(50);
WDT_RESET();
}
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
// 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;

return !testSuccess;
}
#endif // GFI_SELFTEST
#endif // GFI
47 changes: 47 additions & 0 deletions Gfi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Open EVSE Firmware
*
* This file is part of Open EVSE.
* Open EVSE is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
* Open EVSE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Open EVSE; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#pragma once

class Gfi {
DigitalPin pin;
uint8_t m_GfiFault;
#ifdef GFI_SELFTEST
uint8_t testSuccess;
uint8_t testInProgress;
#endif // GFI_SELFTEST
public:
#ifdef GFI_SELFTEST
DigitalPin pinTest;
#endif

Gfi() {}

void Init();
void Reset();
void SetFault() { m_GfiFault = 1; }
uint8_t Fault() { return m_GfiFault; }
#ifdef GFI_SELFTEST
uint8_t SelfTest();
void SetTestSuccess() { testSuccess = 1; }
uint8_t SelfTestSuccess() { return testSuccess; }
uint8_t SelfTestInProgress() { return testInProgress; }
#endif
};
Loading

0 comments on commit c61bee3

Please sign in to comment.