diff --git a/ESP32-Chademo/ESP32-Chademo.ino b/ESP32-Chademo/ESP32-Chademo.ino index b988078..7577ebe 100644 --- a/ESP32-Chademo/ESP32-Chademo.ino +++ b/ESP32-Chademo/ESP32-Chademo.ino @@ -78,6 +78,8 @@ void setup() { pinMode(CHADEMO_IN2, INPUT); pinMode(CHADEMO_IN1, INPUT); + pinMode(CHADEMO_OUT1, OUTPUT); + pinMode(CHADEMO_OUT2, OUTPUT); pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, HIGH); diff --git a/ESP32-Chademo/Globals.h b/ESP32-Chademo/Globals.h index 301dba9..bc04eb5 100644 --- a/ESP32-Chademo/Globals.h +++ b/ESP32-Chademo/Globals.h @@ -16,7 +16,7 @@ #define CAN_BAUD 500000 #define min(a, b) (((a) < (b)) ? (a) : (b)) -#define EEPROM_VALID 0xEE +#define EEPROM_VALID 0xCC //These have been moved to eeprom. After initial compile the values will be read from EEPROM. //These thus set the default value to write to eeprom upon first start up @@ -39,6 +39,8 @@ typedef struct uint8_t capacity; //27 uint8_t debuggingLevel; //29 bool useBms; + bool currentMissmatch; + } EESettings; extern EESettings settings; diff --git a/ESP32-Chademo/data/index.js b/ESP32-Chademo/data/index.js index 643f96f..349aab4 100644 --- a/ESP32-Chademo/data/index.js +++ b/ESP32-Chademo/data/index.js @@ -35,23 +35,8 @@ function setValue(id, value) { element.innerHTML = value } -// STARTUP, -SEND_INITIAL_PARAMS, -WAIT_FOR_EVSE_PARAMS, -SET_CHARGE_BEGIN, -WAIT_FOR_BEGIN_CONFIRMATION, -CLOSE_CONTACTORS, -WAIT_FOR_PRECHARGE, -RUNNING, -CEASE_CURRENT, -WAIT_FOR_ZERO_CURRENT, -OPEN_CONTACTOR, -FAULTED, -STOPPED, -LIMBO -// function updateText(key, data) { - if (key == 'status') { + if (key == 'chademoState') { if (data == 0) { setValue('mode', "Waiting"); } else if (data == 1) { @@ -115,7 +100,7 @@ function onLoad() { function onOpen(evt) { console.log("Socket Connected"); } - + function onMessage(json) { Object.keys(json).forEach(function(key) { updateGauge(key, json[key]); @@ -128,20 +113,20 @@ function onMessage(json) { function onError(evt) { console.log("Socket Error") } - + function doSend(message) { websocket.send(message); } - + function writeToScreen(message) { - var pre = document.createElement("p"); - pre.style.wordWrap = "break-word"; + var pre = document.createElement("p"); + pre.style.wordWrap = "break-word"; pre.innerHTML = message; output.appendChild(pre); } function chargerWebSocket(wsUri) { websocket = new WebSocket(wsUri); - + websocket.onopen = function(evt) { onOpen(evt) }; @@ -149,11 +134,11 @@ function onMessage(json) { websocket.onclose = function(evt) { console.log(evt) }; - + websocket.onmessage = function(evt) { onMessage(JSON.parse(evt.data)) }; - + websocket.onerror = function(evt) { onError(evt) }; @@ -164,18 +149,18 @@ function onMessage(json) { } /** @brief uploads file to web server, if bin-file uploaded, starts a firmware upgrade */ -function uploadFile() +function uploadFile() { var xmlhttp = new XMLHttpRequest(); var form = document.getElementById('uploadform'); - + if (form.getFormData) var fd = form.getFormData(); else var fd = new FormData(form); var file = document.getElementById('updatefile').files[0].name; - xmlhttp.onload = function() + xmlhttp.onload = function() { document.getElementById("bar").innerHTML = "

Upload complete

"; if (file.endsWith(".hex")) @@ -188,4 +173,4 @@ function uploadFile() xmlhttp.open("POST", "/edit"); xmlhttp.send(fd); -} \ No newline at end of file +} diff --git a/Hardware/Schematic_ESP32-Chademo.pdf b/Hardware/Schematic_ESP32-Chademo.pdf new file mode 100644 index 0000000..b45dae4 Binary files /dev/null and b/Hardware/Schematic_ESP32-Chademo.pdf differ