Skip to content

Commit c61bee3

Browse files
committed
merge vD3.9.0
1 parent a78f26c commit c61bee3

25 files changed

+3725
-2379
lines changed

Adafruit_MCP9808.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "TinyWireM.h"
2929
#define Wire TinyWireM
3030
#else
31-
#include <Wire.h>
31+
#include "./Wire.h"
3232
#endif
3333

3434
static inline void wiresend(uint8_t x) {
@@ -64,7 +64,7 @@ Adafruit_MCP9808::Adafruit_MCP9808() {
6464
/**************************************************************************/
6565
boolean Adafruit_MCP9808::begin(uint8_t addr) {
6666
_i2caddr = addr;
67-
Wire.begin();
67+
//don't need - open_evse.ino does it Wire.begin();
6868

6969
if (read16(MCP9808_REG_MANUF_ID) != 0x0054) return false;
7070
if (read16(MCP9808_REG_DEVICE_ID) != 0x0400) return false;

Adafruit_MCP9808.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "TinyWireM.h"
2828
#define Wire TinyWireM
2929
#else
30-
#include <Wire.h>
30+
#include "./Wire.h"
3131
#endif
3232

3333
#define MCP9808_I2CADDR_DEFAULT 0x18

Adafruit_TMP007.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Adafruit_TMP007::Adafruit_TMP007(uint8_t i2caddr) {
2626

2727

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

3131
write16(TMP007_CONFIG, TMP007_CFG_MODEON | TMP007_CFG_ALERTEN |
3232
TMP007_CFG_TRANSC | samplerate);

Adafruit_TMP007.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#else
2121
#include "WProgram.h"
2222
#endif
23-
#include "Wire.h"
23+
#include "./Wire.h"
2424

2525
// uncomment for debugging!
2626
//#define TMP007_DEBUG 1

CHANGELOG

+21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
Change Log
22

33

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

Gfi.cpp

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
* This file is part of Open EVSE.
3+
4+
* Open EVSE is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 3, or (at your option)
7+
* any later version.
8+
9+
* Open EVSE is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
14+
* You should have received a copy of the GNU General Public License
15+
* along with Open EVSE; see the file COPYING. If not, write to the
16+
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17+
* Boston, MA 02111-1307, USA.
18+
*/
19+
#include "open_evse.h"
20+
21+
#ifdef GFI
22+
// interrupt service routing
23+
void gfi_isr()
24+
{
25+
g_EvseController.SetGfiTripped();
26+
}
27+
28+
29+
void Gfi::Init()
30+
{
31+
pin.init(GFI_REG,GFI_IDX,DigitalPin::INP);
32+
// GFI triggers on rising edge
33+
attachInterrupt(GFI_INTERRUPT,gfi_isr,RISING);
34+
35+
#ifdef GFI_SELFTEST
36+
pinTest.init(GFITEST_REG,GFITEST_IDX,DigitalPin::OUT);
37+
#endif
38+
39+
Reset();
40+
}
41+
42+
43+
//RESET GFI LOGIC
44+
void Gfi::Reset()
45+
{
46+
WDT_RESET();
47+
48+
#ifdef GFI_SELFTEST
49+
testInProgress = 0;
50+
testSuccess = 0;
51+
#endif // GFI_SELFTEST
52+
53+
if (pin.read()) m_GfiFault = 1; // if interrupt pin is high, set fault
54+
else m_GfiFault = 0;
55+
}
56+
57+
#ifdef GFI_SELFTEST
58+
59+
uint8_t Gfi::SelfTest()
60+
{
61+
testInProgress = 1;
62+
testSuccess = 0;
63+
for(int i=0; i < GFI_TEST_CYCLES; i++) {
64+
pinTest.write(1);
65+
delayMicroseconds(GFI_PULSE_DURATION_US);
66+
pinTest.write(0);
67+
delayMicroseconds(GFI_PULSE_DURATION_US);
68+
if (testSuccess) break; // no need to keep trying.
69+
}
70+
71+
// wait for GFI pin to clear
72+
do {
73+
delay(50);
74+
WDT_RESET();
75+
}
76+
while(pin.read());
77+
78+
#ifndef OPENEVSE_2
79+
// sometimes getting spurious GFI faults when testing just before closing
80+
// relay.
81+
// wait a little more for everything to settle down
82+
// this delay is needed only if 10uF cap is in the circuit, which makes the circuit
83+
// temporarily overly sensitive to trips until it discharges
84+
delay(1000);
85+
#endif // OPENEVSE_2
86+
87+
m_GfiFault = 0;
88+
testInProgress = 0;
89+
90+
return !testSuccess;
91+
}
92+
#endif // GFI_SELFTEST
93+
#endif // GFI

Gfi.h

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Open EVSE Firmware
3+
*
4+
* This file is part of Open EVSE.
5+
6+
* Open EVSE is free software; you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation; either version 3, or (at your option)
9+
* any later version.
10+
11+
* Open EVSE is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
16+
* You should have received a copy of the GNU General Public License
17+
* along with Open EVSE; see the file COPYING. If not, write to the
18+
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19+
* Boston, MA 02111-1307, USA.
20+
*/
21+
#pragma once
22+
23+
class Gfi {
24+
DigitalPin pin;
25+
uint8_t m_GfiFault;
26+
#ifdef GFI_SELFTEST
27+
uint8_t testSuccess;
28+
uint8_t testInProgress;
29+
#endif // GFI_SELFTEST
30+
public:
31+
#ifdef GFI_SELFTEST
32+
DigitalPin pinTest;
33+
#endif
34+
35+
Gfi() {}
36+
37+
void Init();
38+
void Reset();
39+
void SetFault() { m_GfiFault = 1; }
40+
uint8_t Fault() { return m_GfiFault; }
41+
#ifdef GFI_SELFTEST
42+
uint8_t SelfTest();
43+
void SetTestSuccess() { testSuccess = 1; }
44+
uint8_t SelfTestSuccess() { return testSuccess; }
45+
uint8_t SelfTestInProgress() { return testInProgress; }
46+
#endif
47+
};

0 commit comments

Comments
 (0)