Commit bd170694 authored by schneider's avatar schneider

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

parent 2cd151e7
Pipeline #4470 passed with stages
in 2 minutes and 9 seconds
......@@ -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)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment