Skip to content

Commit

Permalink
Features/increased temp safety menu (#49)
Browse files Browse the repository at this point in the history
* Added max temp menu item

* Added max temp menu item
  • Loading branch information
k-janssens authored Jul 20, 2022
1 parent 9b2e713 commit 3baa2d8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
7 changes: 6 additions & 1 deletion SmartEVSE-3/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Building filesystem:
Execute in a PlatformIO terminal (see menu bar bottom screen)
pio run -t buildfs
pio run -t buildfs


Create Release:
git tag v1.m.p-serkri-v3
git push --tags
3 changes: 2 additions & 1 deletion SmartEVSE-3/data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
$('#mode').text(data.mode);
$('#car_connected').text(data.car_connected == "true" ? "Yes" : "No");
$('#state').text(data.evse.state);
$('#temp').text(data.evse.temp + " °C");
$('#temp').text(data.evse.temp + " °C / " + data.evse.temp_max + " °C");
$('#temp_max').text(data.evse.temp_max + " °C");
if(data.evse.error != "None") {
$('#error').text(data.evse.error);
$('[id=with_errors]').show();
Expand Down
5 changes: 4 additions & 1 deletion SmartEVSE-3/include/evse.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
#define WIFI_MODE 0
#define AP_PASSWORD "00000000"
#define USE_3PHASES 0
#define MAX_TEMPERATURE 65


// Mode settings
Expand Down Expand Up @@ -273,7 +274,8 @@
#define MENU_EMCUSTOM_READMAX 36 // 0x0218: Maximum register read (ToDo)
#define MENU_WIFI 37 // 0x0219: WiFi mode
#define MENU_3F 38
#define MENU_EXIT 39
#define MENU_MAX_TEMP 39
#define MENU_EXIT 40

#define MENU_STATE 50

Expand Down Expand Up @@ -453,6 +455,7 @@ const struct {
{"EMREAD", "READ MAX","Max register read at once of custom electric meter", 3, 255, 3},
{"WIFI", "WIFI", "Connect to WiFi access point", 0, 2, WIFI_MODE},
{"EV3P", "3 PHASE", "Can EV use 3 phases", 0, 1, USE_3PHASES},
{"MXTMP", "MAX TEMP", "Maximum temperature for the EVSE module", 40, 75, MAX_TEMPERATURE},

{"EXIT", "EXIT", "EXIT", 0, 0, 0}
};
Expand Down
20 changes: 16 additions & 4 deletions SmartEVSE-3/src/evse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ uint8_t WIFImode = WIFI_MODE; // W
String APpassword = "00000000";

boolean enable3f = USE_3PHASES;
uint16_t maxTemp = MAX_TEMPERATURE;

int32_t Irms[3]={0, 0, 0}; // Momentary current per Phase (23 = 2.3A) (resolution 100mA)
// Max 3 phases supported
Expand Down Expand Up @@ -1040,6 +1041,7 @@ uint8_t getMenuItems (void) {
MenuItems[m++] = MENU_IMPORT; // - Import Current from Grid (A)
}
MenuItems[m++] = MENU_3F;
MenuItems[m++] = MENU_MAX_TEMP;
MenuItems[m++] = MENU_LOADBL; // Load Balance Setting (0:Disable / 1:Master / 2-8:Node)
if (Mode && LoadBl < 2) { // ? Mode Smart/Solar and Load Balancing Disabled/Master?
MenuItems[m++] = MENU_MAINS; // - Max Mains Amps (hard limit, limited by the MAINS connection) (A) (Mode:Smart/Solar)
Expand Down Expand Up @@ -1109,6 +1111,9 @@ uint8_t setItemValue(uint8_t nav, uint16_t val) {
}

switch (nav) {
case MENU_MAX_TEMP:
maxTemp = val;
break;
case MENU_3F:
enable3f = val == 1;
break;
Expand Down Expand Up @@ -1270,6 +1275,8 @@ uint8_t setItemValue(uint8_t nav, uint16_t val) {
*/
uint16_t getItemValue(uint8_t nav) {
switch (nav) {
case MENU_MAX_TEMP:
return maxTemp;
case MENU_3F:
return enable3f;
case MENU_CONFIG:
Expand Down Expand Up @@ -1384,6 +1391,9 @@ const char * getMenuItemOption(uint8_t nav) {
value = getItemValue(nav);

switch (nav) {
case MENU_MAX_TEMP:
sprintf(Str, "%2u C", maxTemp);
return Str;
case MENU_3F:
return enable3f ? "Yes" : "No";
case MENU_CONFIG:
Expand Down Expand Up @@ -2098,8 +2108,7 @@ void Timer1S(void * parameter) {
}
} else AccessTimer = 0; // Not in state A, then disable timer


if ((TempEVSE <= 60) && (ErrorFlags & TEMP_HIGH)) { // Temperature below limit?
if ((TempEVSE < (maxTemp - 10)) && (ErrorFlags & TEMP_HIGH)) { // Temperature below limit?
ErrorFlags &= ~TEMP_HIGH; // clear Error
}

Expand Down Expand Up @@ -2133,7 +2142,7 @@ void Timer1S(void * parameter) {
ResetBalancedStates();
} else if (timeout) timeout--;

if (TempEVSE > 70 && !(ErrorFlags & TEMP_HIGH)) // Temperature too High?
if (TempEVSE > maxTemp && !(ErrorFlags & TEMP_HIGH)) // Temperature too High?
{
ErrorFlags |= TEMP_HIGH;
setState(STATE_A); // ERROR, switch back to STATE_A
Expand Down Expand Up @@ -2639,7 +2648,8 @@ void read_settings(bool write) {
APpassword = preferences.getString("APpassword",AP_PASSWORD);

enable3f = preferences.getUChar("enable3f", false);

maxTemp = preferences.getUShort("maxTemp", MAX_TEMPERATURE);

preferences.end();

if (write) write_settings();
Expand Down Expand Up @@ -2692,6 +2702,7 @@ void write_settings(void) {
preferences.putString("APpassword", APpassword);

preferences.putBool("enable3f", enable3f);
preferences.putUShort("maxTemp", maxTemp);

preferences.end();

Expand Down Expand Up @@ -2907,6 +2918,7 @@ void StartwebServer(void) {
doc["car_connected"] = evConnected;

doc["evse"]["temp"] = TempEVSE;
doc["evse"]["temp_max"] = maxTemp;
doc["evse"]["connected"] = evConnected;
doc["evse"]["access"] = Access_bit == 1;
doc["evse"]["mode"] = Mode;
Expand Down

0 comments on commit 3baa2d8

Please sign in to comment.