Skip to content

Commit

Permalink
Dev Update to 1.0.4 (#59)
Browse files Browse the repository at this point in the history
* Update platformio.ini

* update x.0.2

bugfix:
- reset current after charge can now be saved in settings
- reducing the risk of corrupt files when saving the log file

* Update README.md

* moved bin files

moved bin files to www.evse-wifil.de/download

* v1.0.4

new:
- display rotation possible (esp32 only) 0°, 90°, 180°, 270°
- implementation of Modbus/TCP to control EVSE-WiFi externally
- new API parameter 'useMeter' to indicate that an energy meter is used

changed:
- EVSE modbus registers > 2002 are no longer editable
- switched to hw serial instead of sw serial (esp32 only)
- keep the charging data (GUI and oLED) until a new charging process starts
- Setting "reset current after charge" disabled and deactivated in remote mode to prevent confusing situations

bugfixes:
- log file was not shown in GUI while charging when using S0 meter.
  • Loading branch information
CurtRod authored Nov 20, 2020
1 parent 62b6eb3 commit e83e8dc
Show file tree
Hide file tree
Showing 10 changed files with 452 additions and 77 deletions.
2 changes: 2 additions & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct s_evseConfig {
bool alwaysactive;
bool remote;
uint8_t ledconfig;
uint8_t drotation;
bool resetcurrentaftercharge;
uint8_t maxcurrent;
float avgconsumption;
Expand Down Expand Up @@ -142,6 +143,7 @@ class EvseWiFiConfig {
bool ICACHE_FLASH_ATTR getEvseAlwaysActive(uint8_t evseId);
bool ICACHE_FLASH_ATTR getEvseRemote(uint8_t evseId);
uint8_t ICACHE_FLASH_ATTR getEvseLedConfig(uint8_t evseId);
uint8_t ICACHE_FLASH_ATTR getEvseDisplayRotation(uint8_t evseId);
uint8_t ICACHE_FLASH_ATTR getEvseLedPin(uint8_t evseId);
bool ICACHE_FLASH_ATTR getEvseResetCurrentAfterCharge(uint8_t evseId);
uint8_t ICACHE_FLASH_ATTR getEvseMaxCurrent(uint8_t evseId);
Expand Down
2 changes: 1 addition & 1 deletion include/oled.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class EvseWiFiOled {

public:
void begin(U8G2_SSD1327_WS_128X128_F_4W_HW_SPI*);
void begin(U8G2_SSD1327_WS_128X128_F_4W_HW_SPI*, uint8_t rotation);
void clearBuffer();
void sendBuffer();
void showDemo(uint8_t evseStatus, unsigned long chargingTime, uint8_t current, uint8_t maxcurrent, float power, float energy, time_t time, String* version);
Expand Down
19 changes: 15 additions & 4 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;PlatformIO Project Configuration File
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
Expand All @@ -12,15 +12,26 @@
platform = espressif32
board = wemos_d1_mini32
framework = arduino
upload_speed = 921600

upload_speed = 921600
lib_ignore = ESPAsyncUDP
board_build.partitions = min_spiffs.csv
board_build.f_cpu = 160000000L
board_build.f_cpu = 160000000L
lib_deps =
miguelbalboa/MFRC522@^1.4.7
plerup/EspSoftwareSerial@>=6.7.1
bblanchon/ArduinoJson@^6.16.1
emelianov/modbus-esp8266 @ ^3.0.3

[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino
upload_speed = 921600
build_flags = -D PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH -Wl,-Map,output.map
lib_ignore = U8g2
lib_ignore = U8g2
lib_deps =
miguelbalboa/MFRC522@^1.4.7
plerup/EspSoftwareSerial@>=6.7.1
bblanchon/ArduinoJson@^6.16.1
emelianov/modbus-esp8266 @ ^3.0.3
21 changes: 19 additions & 2 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ bool ICACHE_FLASH_ATTR EvseWiFiConfig::loadConfig(String givenConfig) {
jsonString = givenConfig;
}
else {
//SPIFFS.begin();
Serial.println("loadConfig: no config string given -> check config file");
File configFile = SPIFFS.open("/config.json", "r");
#ifdef ESP8266
Expand All @@ -35,6 +36,7 @@ bool ICACHE_FLASH_ATTR EvseWiFiConfig::loadConfig(String givenConfig) {
jsonString += char(configFile.read());
}
}
//SPIFFS.end();
}

DynamicJsonDocument jsonDoc(2000);
Expand Down Expand Up @@ -122,8 +124,6 @@ bool ICACHE_FLASH_ATTR EvseWiFiConfig::loadConfig(String givenConfig) {
// evseConfig
evseConfig[0].mbid = 1;
evseConfig[0].alwaysactive = jsonDoc["evse"][0]["alwaysactive"];

//evseConfig[0].ledconfig = jsonDoc["evse"][0]["ledconfig"];

evseConfig[0].resetcurrentaftercharge = jsonDoc["evse"][0]["resetcurrentaftercharge"];
evseConfig[0].maxcurrent = jsonDoc["evse"][0]["maxinstall"];
Expand All @@ -143,6 +143,10 @@ bool ICACHE_FLASH_ATTR EvseWiFiConfig::loadConfig(String givenConfig) {
evseConfig[0].ledconfig = jsonDoc["evse"][0]["ledconfig"];
}

if (jsonDoc["evse"][0].containsKey("drotation")) {
evseConfig[0].drotation = jsonDoc["evse"][0]["drotation"];
}

if (jsonDoc["evse"][0].containsKey("rsevalue")) {
evseConfig[0].rseValue = jsonDoc["evse"][0]["rsevalue"];
}
Expand Down Expand Up @@ -189,9 +193,13 @@ bool ICACHE_FLASH_ATTR EvseWiFiConfig::loadConfiguration() {
Serial.println("Use SDM630");
}
}



return true;
}
bool ICACHE_FLASH_ATTR EvseWiFiConfig::printConfigFile() {
//SPIFFS.begin();
File configFile = SPIFFS.open("/config.json", "r");
if (!configFile) {
return false;
Expand All @@ -207,6 +215,7 @@ bool ICACHE_FLASH_ATTR EvseWiFiConfig::printConfigFile() {
Serial.println(F("[ INFO ] Config File: "));
serializeJsonPretty(jsonDoc, Serial);
Serial.println();
//SPIFFS.end();
return true;
}
bool ICACHE_FLASH_ATTR EvseWiFiConfig::printConfig() {
Expand Down Expand Up @@ -261,6 +270,7 @@ bool ICACHE_FLASH_ATTR EvseWiFiConfig::printConfig() {
Serial.println("alwaysactive: " + String(getEvseAlwaysActive(0)));
Serial.println("remote: " + String(getEvseRemote(0)));
Serial.println("ledconfig: " + String(getEvseLedConfig(0)));
Serial.println("drotation: " + String(getEvseDisplayRotation(0)));
Serial.println("resetcurrentaftercharge: " + String(getEvseResetCurrentAfterCharge(0)));
Serial.println("evseinstall: " + String(getEvseMaxCurrent(0)));
Serial.println("avgconsumption: " + String(getEvseAvgConsumption(0)));
Expand Down Expand Up @@ -354,6 +364,7 @@ String ICACHE_FLASH_ATTR EvseWiFiConfig::getConfigJson() {
evseObject_0["alwaysactive"] = this->getEvseAlwaysActive(0);
evseObject_0["remote"] = this->getEvseRemote(0);
evseObject_0["ledconfig"] = this->getEvseLedConfig(0);
evseObject_0["drotation"] = this->getEvseDisplayRotation(0);
evseObject_0["resetcurrentaftercharge"] = this->getEvseResetCurrentAfterCharge(0);
evseObject_0["evseinstall"] = this->getEvseMaxCurrent(0);
evseObject_0["avgconsumption"] = this->getEvseAvgConsumption(0);
Expand All @@ -377,6 +388,7 @@ bool ICACHE_FLASH_ATTR EvseWiFiConfig::saveConfigFile(String jsonConfig) {
DeserializationError error = deserializeJson(jsonDoc, jsonConfig);
if (error) return false;

//SPIFFS.begin();
File configFile = SPIFFS.open("/config.json", "w+");
if (configFile) {
if (jsonDoc.containsKey("command")) {
Expand All @@ -399,9 +411,11 @@ bool ICACHE_FLASH_ATTR EvseWiFiConfig::saveConfigFile(String jsonConfig) {
Serial.println("[ SYSTEM ] New config file created");
}
configFile.close();
//SPIFFS.end();
return true;
}
}
//SPIFFS.end();
return false;
}
uint8_t ICACHE_FLASH_ATTR EvseWiFiConfig::getSystemConfigVersion() {
Expand Down Expand Up @@ -571,6 +585,9 @@ bool ICACHE_FLASH_ATTR EvseWiFiConfig::getEvseRemote(uint8_t evseId) {
uint8_t ICACHE_FLASH_ATTR EvseWiFiConfig::getEvseLedConfig(uint8_t evseId) {
return evseConfig[evseId].ledconfig;
}
uint8_t ICACHE_FLASH_ATTR EvseWiFiConfig::getEvseDisplayRotation(uint8_t evseId) {
return evseConfig[evseId].drotation;
}
uint8_t ICACHE_FLASH_ATTR EvseWiFiConfig::getEvseLedPin(uint8_t evseId) {
#ifdef ESP8266
return D0;
Expand Down
Loading

0 comments on commit e83e8dc

Please sign in to comment.