From 40a20dba5716d2224edf56852a9c79c47581221b Mon Sep 17 00:00:00 2001 From: Luc Date: Tue, 19 Jan 2016 16:01:22 +0800 Subject: [PATCH] Code optimization / Typo fixes use more F() macro to save space, fixe several typo issue Thanks @treepleks --- esp8266/config.cpp | 177 ++++++++++++++++++++++++--------------------- esp8266/config.h | 2 +- 2 files changed, 96 insertions(+), 83 deletions(-) diff --git a/esp8266/config.cpp b/esp8266/config.cpp index 849bafb8..0c4185cd 100644 --- a/esp8266/config.cpp +++ b/esp8266/config.cpp @@ -31,22 +31,21 @@ bool CONFIG::read_string(int pos, char byte_buffer[], int size_max) //check if parameters are acceptable if (size_max==0 || pos+size_max+1 > EEPROM_SIZE || byte_buffer== NULL)return false; EEPROM.begin(EEPROM_SIZE); - byte b=0; + byte b = 13; // non zero for the while loop below int i=0; - //read first byte - b = EEPROM.read(pos + i); - byte_buffer[i]=b; - i++; + //read until max size is reached or \0 is found - while (i EEPROM_SIZE )return false; - byte b=0; + byte b = 13; // non zero for the while loop below int i=0; sbuffer=""; + EEPROM.begin(EEPROM_SIZE); - //read first byte - b = EEPROM.read(pos + i); - sbuffer+=char(b); - i++; //read until max size is reached or \0 is found - while (i