Brilliant!
Brilliant!
Explore... Chat... Share...
Moderator: igrr
thewiep wrote:chriscook8 wrote:https://github.com/chriscook8/esp-arduino-apboot
This reads from eeprom to get SSID and password information.s
Thanks a lot for this nice example!!
It has a lot of things in it I can use.
Like another user in another thread I also noticed that it stores the url encoded version of the ssid and pass.
Someone was kind enough to post code to complete this task:
https://gist.github.com/jmsaavedra/7964251
I slightly modified it so we also get the size of the url decoded version as this will likely be smallerCode: Select allint urldecode(char *dst, const char *src)
{
char a, b;
int new_size = 0;
while (*src) {
if ((*src == '%') &&
((a = src[1]) && (b = src[2])) &&
(isxdigit(a) && isxdigit(b))) {
if (a >= 'a')
a -= 'a'-'A';
if (a >= 'A')
a -= ('A' - 10);
else
a -= '0';
if (b >= 'a')
b -= 'a'-'A';
if (b >= 'A')
b -= ('A' - 10);
else
b -= '0';
*dst++ = 16*a+b;
src+=3;
}
else {
*dst++ = *src++;
}
new_size += 1;
}
*dst++ = '\0';
return new_size;
}
For the password I then used following codeCode: Select allint buffer_size = q_pass.length() + 1;
char pass_encoded[buffer_size];
char pass_decoded[buffer_size];
qpass.toCharArray(pass_encoded,buffer_size);
int decoded_size = urldecode(pass_decoded,pass_encoded);
Serial.println("writing eeprom pass:");
for (int i = 0; i < decoded_size; ++i)
{
EEPROM.write(32+i, pass_decoded[i]);
Serial.print("Wrote: ");
Serial.println(pass_decoded[i]);
}
this can probably be improved but I needed something quick
alextu wrote:cal wrote:Moin,
what is the eeprom? Where is it located? What is it normally being used for on the esp?
Cal
hi, thee eeprom is a nonvolatile memory where you can save and read stuff between restarts. in the case of the esp it s written on the flash chip, same as everything else
EEPROM (also written E2PROM and pronounced "e-e-prom", "double-e prom", "e-squared", or simply "e-prom") stands for Electrically Erasable Programmable Read-Only Memory and is a type of non-volatile memory used in computers and other electronic devices to store small amounts of data that must be saved when power is removed, e.g., calibration tables or device configuration.
Unlike bytes in most other kinds of non-volatile memory, individual bytes in a traditional EEPROM can be independently read, erased, and re-written.
When larger amounts of static data are to be stored (such as in USB flash drives) a specific type of EEPROM such as flash memory is more economical than traditional EEPROM devices. EEPROMs are organized as arrays of floating-gate transistors.
It takes about 20-25 seconds for home assistant c[…]
I tried to upgrade tof my sonoff basic R2 with the[…]
a problem Perhaps you want to define "Probl[…]
Rebooting your router will not give you a faster I[…]
There are no other notifications from esptool.py i[…]
Using the Arduino IDE, you'll learn how to set up […]
In this project, you will post to Twitter using an[…]
In this project, we will build a water level contr[…]
I guess I'm late, but I had the same problem and f[…]
Last night I received my first D1 Minis for a lear[…]
Although I am aware that this is an old post, I fe[…]