Fixed a header file name

pull/8/head
Hieromon Ikasamo 7 years ago
parent 0fad2b23ad
commit cfd164f234
  1. 5
      src/AutoConnect.cpp
  2. 6
      src/AutoConnect.h
  3. 14
      src/AutoConnectCredential.cpp
  4. 2
      src/AutoConnectCredential.h
  5. 2
      src/AutoConnectPage.cpp

@ -8,7 +8,6 @@
*/ */
#include "AutoConnect.h" #include "AutoConnect.h"
#include "AutoConnectCredentail.h"
/** /**
* AutoConnect default constructor. This entry activates WebServer * AutoConnect default constructor. This entry activates WebServer
@ -299,7 +298,7 @@ void AutoConnect::handleRequest() {
// Save current credential // Save current credential
if (_apConfig.autoSave == AC_SAVECREDENTIAL_AUTO) { if (_apConfig.autoSave == AC_SAVECREDENTIAL_AUTO) {
AutoConnectCredential credit; AutoConnectCredential credit(_apConfig.saveOffset);
credit.save(&_credential); credit.save(&_credential);
AC_DBG("%s credential saved\n", _credential.ssid); AC_DBG("%s credential saved\n", _credential.ssid);
} }
@ -444,7 +443,7 @@ String AutoConnect::_induceConnect(PageArgument& args) {
// Retrieve credential from the post method content. // Retrieve credential from the post method content.
if (args.hasArg(AUTOCONNECT_PARAMID_CRED)) { if (args.hasArg(AUTOCONNECT_PARAMID_CRED)) {
// Read from EEPROM // Read from EEPROM
AutoConnectCredential credential; AutoConnectCredential credential(_apConfig.saveOffset);
struct station_config entry; struct station_config entry;
AC_DBG("Load credential:%s\n", args.arg(AUTOCONNECT_PARAMID_CRED).c_str()); AC_DBG("Load credential:%s\n", args.arg(AUTOCONNECT_PARAMID_CRED).c_str());
credential.load(args.arg(AUTOCONNECT_PARAMID_CRED).c_str(), &entry); credential.load(args.arg(AUTOCONNECT_PARAMID_CRED).c_str(), &entry);

@ -22,9 +22,10 @@ extern "C" {
#include <user_interface.h> #include <user_interface.h>
} }
#include "AutoConnectPage.h" #include "AutoConnectPage.h"
#include "AutoConnectCredential.h"
// Uncomment the following AC_DEBUG to enable debug output. // Uncomment the following AC_DEBUG to enable debug output.
//#define AC_DEBUG #define AC_DEBUG
// Debug output destination can be defined externally with AC_DEBUG_PORT // Debug output destination can be defined externally with AC_DEBUG_PORT
#ifndef AC_DEBUG_PORT #ifndef AC_DEBUG_PORT
@ -114,6 +115,7 @@ class AutoConnectConfig {
channel(1), channel(1),
hidden(0), hidden(0),
autoSave(AC_SAVECREDENTIAL_AUTO), autoSave(AC_SAVECREDENTIAL_AUTO),
saveOffset(AC_IDENTIFIER_OFFSET),
uptime(AUTOCONNECT_STARTUPTIME), uptime(AUTOCONNECT_STARTUPTIME),
autoRise(true), autoRise(true),
autoReset(true), autoReset(true),
@ -130,6 +132,7 @@ class AutoConnectConfig {
channel(1), channel(1),
hidden(0), hidden(0),
autoSave(AC_SAVECREDENTIAL_AUTO), autoSave(AC_SAVECREDENTIAL_AUTO),
saveOffset(AC_IDENTIFIER_OFFSET),
uptime(AUTOCONNECT_STARTUPTIME), uptime(AUTOCONNECT_STARTUPTIME),
autoRise(true), autoRise(true),
autoReset(true), autoReset(true),
@ -146,6 +149,7 @@ class AutoConnectConfig {
channel = o.channel; channel = o.channel;
hidden = o.hidden; hidden = o.hidden;
autoSave = o.autoSave; autoSave = o.autoSave;
saveOffset = o.saveOffset;
uptime = o.uptime; uptime = o.uptime;
autoRise = o.autoRise; autoRise = o.autoRise;
autoReset = o.autoReset; autoReset = o.autoReset;

@ -8,7 +8,7 @@
*/ */
#include <EEPROM.h> #include <EEPROM.h>
#include "AutoConnectCredentail.h" #include "AutoConnectCredential.h"
#define AC_IDENTIFIER "AC_CREDT" #define AC_IDENTIFIER "AC_CREDT"
#define AC_HEADERSIZE ((int)(_offset + sizeof(AC_IDENTIFIER) - 1 + sizeof(uint8_t) + sizeof(uint16_t))) #define AC_HEADERSIZE ((int)(_offset + sizeof(AC_IDENTIFIER) - 1 + sizeof(uint8_t) + sizeof(uint16_t)))
@ -33,15 +33,19 @@
* Free area are filled with FF, which is reused as an area for insertion. * Free area are filled with FF, which is reused as an area for insertion.
*/ */
AutoConnectCredential::AutoConnectCredential() { AutoConnectCredential::AutoConnectCredential() {
AutoConnectCredential(AC_IDENTIFIER_OFFSET); _offset = AC_IDENTIFIER_OFFSET;
_allocateEntry();
} }
AutoConnectCredential::AutoConnectCredential(uint16_t offset) { AutoConnectCredential::AutoConnectCredential(uint16_t offset) {
char id_c[sizeof(AC_IDENTIFIER) - 1];
uint8_t c;
// Save offset for the credential area. // Save offset for the credential area.
_offset = offset; _offset = offset;
_allocateEntry();
}
void AutoConnectCredential::_allocateEntry() {
char id_c[sizeof(AC_IDENTIFIER) - 1];
uint8_t c;
EEPROM.begin(AC_HEADERSIZE); EEPROM.begin(AC_HEADERSIZE);

@ -40,7 +40,9 @@ class AutoConnectCredential {
bool save(const struct station_config* config); bool save(const struct station_config* config);
private: private:
void _allocateEntry(); /**< Initialize storage for credentials. */
void _retrieveEntry(char* ssid, char* password, uint8_t* bssid); /**< Read an available entry. */ void _retrieveEntry(char* ssid, char* password, uint8_t* bssid); /**< Read an available entry. */
uint8_t _entries; /**< Count of the available entry */ uint8_t _entries; /**< Count of the available entry */
uint16_t _containSize; /**< Container size */ uint16_t _containSize; /**< Container size */
int _dp; /**< The current address in EEPROM */ int _dp; /**< The current address in EEPROM */

@ -10,7 +10,7 @@
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#include "AutoConnect.h" #include "AutoConnect.h"
#include "AutoConnectPage.h" #include "AutoConnectPage.h"
#include "AutoConnectCredentail.h" #include "AutoConnectCredential.h"
extern "C" { extern "C" {
#include <user_interface.h> #include <user_interface.h>
} }

Loading…
Cancel
Save