Skip to content

Commit 9ba62ad

Browse files
committed
Revert "Merge pull request #97 from OpenEVSE/esp8622_port"
This reverts commit 28ffc95, reversing changes made to 222565e.
1 parent 28ffc95 commit 9ba62ad

File tree

12 files changed

+62
-63
lines changed

12 files changed

+62
-63
lines changed

platformio.ini

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ lib_deps =
3838
3939
4040
41-
41+
4242
extra_scripts = scripts/extra_script.py
4343
debug_flags =
4444
-DENABLE_DEBUG
@@ -54,20 +54,24 @@ ota_flags = -DENABLE_OTA -DWIFI_LED=LED_BUILTIN
5454
src_build_flags =
5555
# -DENABLE_ASYNC_WIFI_SCAN
5656
build_flags =
57+
-DCS_PLATFORM=CS_P_ESP32
58+
-DMG_ENABLE_SSL=1
5759
-DMG_ENABLE_HTTP_STREAMING_MULTIPART=1
58-
-DMG_ENABLE_SNTP=1
60+
-DMG_SSL_MBED_DUMMY_RANDOM=1
61+
-DMG_SSL_IF=MG_SSL_IF_MBEDTLS
62+
-DMG_SSL_IF_MBEDTLS_FREE_CERTS=1
5963
#-DMG_SSL_IF_MBEDTLS_MAX_FRAG_LEN=2048
6064
#-DARDUINO_MONGOOSE_DEFAULT_STREAM_BUFFER=2048
6165
#-DARDUINO_MONGOOSE_SEND_BUFFER_SIZE=2048
6266
#-DENABLE_DEBUG
6367
#-DCS_ENABLE_DEBUG
6468
#-DMBEDTLS_DEBUG_C
69+
-DMG_ENABLE_SNTP=1
6570
build_flags_esp8266 =
71+
-DMG_ESP8266
72+
-DCS_PLATFORM=CS_P_ESP8266
6673
build_flags_esp32 =
67-
-DMG_ENABLE_SSL=1
68-
-DMG_SSL_MBED_DUMMY_RANDOM=1
69-
-DMG_SSL_IF=MG_SSL_IF_MBEDTLS
70-
-DMG_SSL_IF_MBEDTLS_FREE_CERTS=1
74+
-DCS_PLATFORM=CS_P_ESP32
7175
src_build_flags_esp32 =
7276
-DENABLE_OTA
7377
build_partitions_esp32 = min_spiffs.csv
@@ -84,7 +88,7 @@ monitor_flags = --filter=esp8266_exception_decoder
8488
# specify exact Arduino ESP SDK version, requires platformio 3.5+ (curently dev version)
8589
# http://docs.platformio.org/en/latest/projectconf/section_env_general.html#platform
8690
platform = https://github.com/platformio/platform-espressif8266.git#release/v1.6.0
87-
platform_stage = https://github.com/platformio/platform-espressif8266.git#develop
91+
platform_stage = https://github.com/platformio/platform-espressif8266.git#feature/stage
8892
#platform_esp32 = https://github.com/platformio/platform-espressif32.git#feature/stage
8993
#platform_esp32 = https://github.com/platformio/platform-espressif32.git#develop
9094
platform_esp32 = [email protected]
@@ -95,9 +99,6 @@ platform = ${common.platform}
9599
board = esp12e
96100
framework = arduino
97101
lib_deps = ${common.lib_deps}
98-
build_flags =
99-
${common.build_flags}
100-
${common.build_flags_esp8266}
101102
src_build_flags = ${common.version} ${common.src_build_flags}
102103
# Upload at faster baud: takes 20s instead of 50s. Use 'pio run -t upload -e evse_slow to use slower default baud rate'
103104
upload_speed = 921600
@@ -109,9 +110,6 @@ platform = ${common.platform}
109110
board = esp12e
110111
framework = arduino
111112
lib_deps = ${common.lib_deps}
112-
build_flags =
113-
${common.build_flags}
114-
${common.build_flags_esp8266}
115113
src_build_flags = ${common.version} ${common.src_build_flags}
116114
monitor_speed = ${common.monitor_speed}
117115
extra_scripts = ${common.extra_scripts}
@@ -121,9 +119,6 @@ platform = ${common.platform}
121119
board = esp12e
122120
framework = arduino
123121
lib_deps = ${common.lib_deps}
124-
build_flags =
125-
${common.build_flags}
126-
${common.build_flags_esp8266}
127122
src_build_flags = ${common.version}.dev ${common.src_build_flags} ${common.ota_flags} ${common.debug_flags}
128123
upload_protocol = espota
129124
upload_port = openevse.local
@@ -135,11 +130,8 @@ platform = ${common.platform}
135130
board = esp12e
136131
framework = arduino
137132
lib_deps = ${common.lib_deps}
138-
build_flags =
139-
${common.build_flags}
140-
${common.build_flags_esp8266}
141133
src_build_flags = ${common.version}.dev ${common.src_build_flags} ${common.ota_flags} ${common.debug_flags}
142-
upload_speed = 921600
134+
upload_speed=921600
143135
monitor_speed = ${common.monitor_speed}
144136
extra_scripts = ${common.extra_scripts}
145137

@@ -150,21 +142,11 @@ platform = ${common.platform_stage}
150142
board = esp12e
151143
framework = arduino
152144
lib_deps = ${common.lib_deps}
153-
build_flags =
154-
-ggdb
155-
-DDEBUG_ESP_WIFI
156-
${common.build_flags}
157-
${common.build_flags_esp8266}
158-
src_build_flags =
159-
${common.version}.stag
160-
${common.src_build_flags}
161-
${common.ota_flags}
162-
${common.debug_flags}
163-
upload_speed = 921600
164-
#upload_protocol = espota
165-
#upload_port = openevse.local
145+
build_flags = -DDEBUG_ESP_WIFI
146+
src_build_flags = ${common.version}.stag ${common.src_build_flags} ${common.ota_flags} ${common.debug_flags}
147+
upload_protocol = espota
148+
upload_port = openevse.local
166149
monitor_speed = ${common.monitor_speed}
167-
monitor_flags = ${common.monitor_flags}
168150
extra_scripts = ${common.extra_scripts}
169151

170152
# staging Arduino framwork and latest libs
@@ -173,9 +155,6 @@ platform = ${common.platform_stage}
173155
board = esp12e
174156
framework = arduino
175157
lib_deps = https://github.com/knolleary/pubsubclient, https://github.com/me-no-dev/ESPAsyncWebServer.git, https://github.com/me-no-dev/ESPAsyncTCP.git
176-
build_flags =
177-
${common.build_flags}
178-
${common.build_flags_esp8266}
179158
src_build_flags = ${common.version}.stagelib ${common.src_build_flags} ${common.ota_flags} ${common.debug_flags}
180159
upload_protocol = espota
181160
upload_port = openevse.local

src/app_config.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ String mqtt_vrms;
4747
String mqtt_announce_topic;
4848

4949
// Time
50-
String timezone;
50+
String time_zone;
5151

5252
// 24-bits of Flags
5353
uint32_t flags;
@@ -86,7 +86,7 @@ ConfigOpt *opts[] =
8686
new ConfigOptDefenition<String>(sntp_hostname, SNTP_DEFAULT_HOST, "sntp_hostname", "sh"),
8787

8888
// Time
89-
new ConfigOptDefenition<String>(timezone, "", "time_zone", "tz"),
89+
new ConfigOptDefenition<String>(time_zone, "", "time_zone", "tz"),
9090

9191
// EMONCMS SERVER strings
9292
new ConfigOptDefenition<String>(emoncms_server, "https://data.openevse.com/emoncms", "emoncms_server", "es"),
@@ -169,7 +169,7 @@ void config_changed(String name)
169169
DBUGF("%s changed", name.c_str());
170170

171171
if(name == "time_zone") {
172-
config_set_timezone(timezone);
172+
config_set_timezone(time_zone);
173173
} else if(name == "flags") {
174174
divertmode_update((config_divert_enabled() && 1 == config_charge_mode()) ? DIVERT_MODE_ECO : DIVERT_MODE_NORMAL);
175175
if(mqtt_connected() != config_mqtt_enabled()) {

src/app_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extern String mqtt_vrms;
4343
extern String mqtt_announce_topic;
4444

4545
// Time
46-
extern String timezone;
46+
extern String time_zone;
4747

4848
// Divert settings
4949
extern double divert_attack_smoothing_factor;

src/app_config_v1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ config_load_v1_settings() {
181181
EEPROM_read_string(EEPROM_SNTP_HOST_START, EEPROM_SNTP_HOST_SIZE, sntp_hostname);
182182

183183
// Timezone
184-
EEPROM_read_string(EEPROM_TIME_ZONE_START, EEPROM_TIME_ZONE_SIZE, timezone);
185-
config_set_timezone(timezone);
184+
EEPROM_read_string(EEPROM_TIME_ZONE_START, EEPROM_TIME_ZONE_SIZE, time_zone);
185+
config_set_timezone(time_zone);
186186

187187
EEPROM.end();
188188
}

src/debug.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
#define DEBUG_BEGIN(speed) DEBUG_PORT.begin(speed)
2222

23-
//#ifdef ARDUINO_ESP8266_RELEASE_2_4_0
24-
//// Serial.printf_P needs Git version of Arduino Core
25-
//#define DBUGF(format, ...) DEBUG_PORT.printf_P(PSTR(format "\n"), ##__VA_ARGS__)
26-
//#else
23+
#ifdef ARDUINO_ESP8266_RELEASE_2_4_0
24+
// Serial.printf_P needs Git version of Arduino Core
25+
#define DBUGF(format, ...) DEBUG_PORT.printf_P(PSTR(format "\n"), ##__VA_ARGS__)
26+
#else
2727
#define DBUGF(format, ...) DEBUG_PORT.printf(format "\n", ##__VA_ARGS__)
28-
//#endif
28+
#endif
2929

3030
#define DBUG(...) DEBUG_PORT.print(__VA_ARGS__)
3131
#define DBUGLN(...) DEBUG_PORT.println(__VA_ARGS__)

src/emoncms.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ void emoncms_publish(JsonDocument &data)
8585
}
8686
});
8787
} else {
88-
if(!emoncms_connected) {
89-
emoncms_result(false, String("Disabled"));
90-
}
88+
emoncms_result(false, String("Disabled"));
9189
}
9290

9391
Profile_End(emoncms_publish, 10);

src/input.cpp

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
#include <Arduino.h>
66
#include <ArduinoJson.h>
77

8-
#include <time.h>
9-
#include <sys/time.h>
10-
118
#include "emonesp.h"
129
#include "input.h"
1310
#include "app_config.h"
@@ -250,6 +247,34 @@ handleRapiRead()
250247
}
251248
});
252249

250+
#ifdef ENABLE_LEGACY_API
251+
rapiSender.sendCmd("$GH", [](int ret)
252+
{
253+
if(RAPI_RESPONSE_OK == ret)
254+
{
255+
if(rapiSender.getTokenCnt() >= 2)
256+
{
257+
const char *val;
258+
val = rapiSender.getToken(1);
259+
kwh_limit = strtol(val, NULL, 10);
260+
}
261+
}
262+
});
263+
264+
rapiSender.sendCmd("$G3", [](int ret)
265+
{
266+
if(RAPI_RESPONSE_OK == ret)
267+
{
268+
if(rapiSender.getTokenCnt() >= 2)
269+
{
270+
const char *val;
271+
val = rapiSender.getToken(1);
272+
time_limit = strtol(val, NULL, 10);
273+
}
274+
}
275+
});
276+
#endif
277+
253278
rapiSender.sendCmd("$GE", [](int ret)
254279
{
255280
if(RAPI_RESPONSE_OK == ret)

src/main.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ void setup()
8585

8686
// Initialise Mongoose networking library
8787
Mongoose.begin();
88-
89-
#if MG_ENABLE_SSL
9088
Mongoose.setRootCa(root_ca);
91-
#endif // MG_ENABLE_SSL
9289

9390
// Bring up the web server
9491
web_server_setup();
@@ -258,7 +255,5 @@ void hardware_setup()
258255
}
259256
#endif
260257

261-
#ifdef ESP32
262258
enableLoopWDT();
263-
#endif // ESP32
264259
}

src/mqtt.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ mqtt_publish(JsonDocument &data) {
207207
topic += kv.key().c_str();
208208
String val = kv.value().as<String>();
209209
mqttclient.publish(topic, val);
210+
topic = mqtt_topic + "/";
210211
}
211212

212213
Profile_End(mqtt_publish, 5);

src/net_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ net_loop()
512512
dnsServer.processNextRequest(); // Captive portal DNS re-dierct
513513
}
514514

515-
Profile_End(net_loop, 5);
515+
Profile_End(net_wifi_loop, 5);
516516
}
517517

518518
void

0 commit comments

Comments
 (0)