Skip to content

Commit c350268

Browse files
authored
Merge pull request #542 from OpenEVSE/jeremypoulter/issue357
Removed old config update/save functions in place of the generic API
2 parents be39e34 + b7ac2d4 commit c350268

File tree

7 files changed

+4050
-4417
lines changed

7 files changed

+4050
-4417
lines changed

src/app_config.cpp

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -358,55 +358,7 @@ void config_set(const char *name, double val) {
358358
user_config.set(name, val);
359359
}
360360

361-
void config_save_emoncms(bool enable, String server, String node, String apikey,
362-
String fingerprint)
363-
{
364-
uint32_t newflags = flags & ~CONFIG_SERVICE_EMONCMS;
365-
if(enable) {
366-
newflags |= CONFIG_SERVICE_EMONCMS;
367-
}
368361

369-
user_config.set("emoncms_server", server);
370-
user_config.set("emoncms_node", node);
371-
user_config.set("emoncms_apikey", apikey);
372-
user_config.set("emoncms_fingerprint", fingerprint);
373-
user_config.set("flags", newflags);
374-
user_config.commit();
375-
}
376-
377-
void
378-
config_save_mqtt(bool enable, int protocol, String server, uint16_t port, String topic, bool retained, String user, String pass, String solar, String grid_ie, String live_pwr, bool reject_unauthorized)
379-
{
380-
uint32_t newflags = flags & ~(CONFIG_SERVICE_MQTT | CONFIG_MQTT_PROTOCOL | CONFIG_MQTT_ALLOW_ANY_CERT | CONFIG_MQTT_RETAINED);
381-
if(enable) {
382-
newflags |= CONFIG_SERVICE_MQTT;
383-
}
384-
if(!reject_unauthorized) {
385-
newflags |= CONFIG_MQTT_ALLOW_ANY_CERT;
386-
}
387-
if (retained) {
388-
newflags |= CONFIG_MQTT_RETAINED;
389-
}
390-
newflags |= protocol << 4;
391-
392-
user_config.set("mqtt_server", server);
393-
user_config.set("mqtt_port", port);
394-
user_config.set("mqtt_topic", topic);
395-
user_config.set("mqtt_user", user);
396-
user_config.set("mqtt_pass", pass);
397-
user_config.set("mqtt_solar", solar);
398-
user_config.set("mqtt_grid_ie", grid_ie);
399-
user_config.set("mqtt_live_pwr", live_pwr);
400-
user_config.set("flags", newflags);
401-
user_config.commit();
402-
}
403-
404-
void
405-
config_save_admin(String user, String pass) {
406-
user_config.set("www_username", user);
407-
user_config.set("www_password", pass);
408-
user_config.commit();
409-
}
410362

411363
void
412364
config_save_sntp(bool sntp_enable, String tz)
@@ -435,51 +387,6 @@ void config_set_timezone(String tz)
435387
tzset();
436388
}
437389

438-
void
439-
config_save_advanced(String hostname, String sntp_host) {
440-
user_config.set("hostname", hostname);
441-
user_config.set("sntp_hostname", sntp_host);
442-
user_config.commit();
443-
}
444-
445-
void
446-
config_save_wifi(String qsid, String qpass)
447-
{
448-
user_config.set("ssid", qsid);
449-
user_config.set("pass", qpass);
450-
user_config.commit();
451-
}
452-
453-
void
454-
config_save_ohm(bool enable, String qohm)
455-
{
456-
uint32_t newflags = flags & ~CONFIG_SERVICE_OHM;
457-
if(enable) {
458-
newflags |= CONFIG_SERVICE_OHM;
459-
}
460-
461-
user_config.set("ohm", qohm);
462-
user_config.set("flags", newflags);
463-
user_config.commit();
464-
}
465-
466-
void
467-
config_save_rfid(bool enable, String storage){
468-
uint32_t newflags = flags & ~CONFIG_RFID;
469-
if(enable) {
470-
newflags |= CONFIG_RFID;
471-
}
472-
user_config.set("flags", newflags);
473-
user_config.set("rfid_storage", rfid_storage);
474-
user_config.commit();
475-
}
476-
477-
void
478-
config_save_flags(uint32_t newFlags) {
479-
user_config.set("flags", newFlags);
480-
user_config.commit();
481-
}
482-
483390
void
484391
config_reset() {
485392
ResetEEPROM();

src/app_config.h

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -196,51 +196,11 @@ extern String ohm;
196196
extern void config_load_settings();
197197
extern void config_load_v1_settings();
198198

199-
// -------------------------------------------------------------------
200-
// Save the EmonCMS server details
201-
// -------------------------------------------------------------------
202-
extern void config_save_emoncms(bool enable, String server, String node, String apikey, String fingerprint);
203-
204-
// -------------------------------------------------------------------
205-
// Save the MQTT broker details
206-
// -------------------------------------------------------------------
207-
extern void config_save_mqtt(bool enable, int protocol, String server, uint16_t port, String topic, bool retained, String user, String pass, String solar, String grid_ie, String live_pwr, bool reject_unauthorized);
208-
209-
// -------------------------------------------------------------------
210-
// Save the admin/web interface details
211-
// -------------------------------------------------------------------
212-
extern void config_save_admin(String user, String pass);
213-
214199
// -------------------------------------------------------------------
215200
// Save the SNTP settings
216201
// -------------------------------------------------------------------
217202
extern void config_save_sntp(bool enable, String tz);
218203

219-
// -------------------------------------------------------------------
220-
// Save advanced settings
221-
// -------------------------------------------------------------------
222-
extern void config_save_advanced(String hostname, String sntp_host);
223-
224-
// -------------------------------------------------------------------
225-
// Save the Wifi details
226-
// -------------------------------------------------------------------
227-
extern void config_save_wifi(String qsid, String qpass);
228-
229-
// -------------------------------------------------------------------
230-
// Save the Ohm settings
231-
// -------------------------------------------------------------------
232-
extern void config_save_ohm(bool enable, String qohm);
233-
234-
// -------------------------------------------------------------------
235-
// Save RFID settings
236-
// -------------------------------------------------------------------
237-
extern void config_save_rfid(bool enable, String storage);
238-
239-
// -------------------------------------------------------------------
240-
// Save the flags
241-
// -------------------------------------------------------------------
242-
extern void config_save_flags(uint32_t flags);
243-
244204
// -------------------------------------------------------------------
245205
// Reset the config back to defaults
246206
// -------------------------------------------------------------------

0 commit comments

Comments
 (0)