Skip to content
Snippets Groups Projects
Commit bd170694 authored by schneider's avatar schneider
Browse files

fix(ble): write new mac if files does not exist

parent 2cd151e7
No related branches found
No related tags found
No related merge requests found
......@@ -96,7 +96,7 @@ static void setAddress(void)
int result = fs_read_text_file("mac.txt", buf, sizeof(buf));
if (result == -1) {
if (result < 0) {
APP_TRACE_INFO0("mac.txt not found, generating random MAC");
epic_trng_read(bdAddr + 3, 3);
sprintf(buf,
......
......@@ -333,7 +333,7 @@ static void bleSetup(bleMsg_t *pMsg)
char buf[32];
char a, b, c, d, e, f, K;
if (fs_read_text_file("mac.txt", buf, sizeof(buf)))
if (fs_read_text_file("mac.txt", buf, sizeof(buf)) > 0)
{
if (sscanf(buf, "%c%c:%c%c:%c%c:%c%c:%c%c:%c%c", &K,&K,&K,&K,&K,&K, &a, &b, &c, &d, &e, &f) == 12)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment