Commit 0fd6d958 authored by schneider's avatar schneider

Merge branch 'schneider/fix-ble-mac-write' into 'master'

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

See merge request card10/firmware!373
parents 2cd151e7 bd170694
Pipeline #4471 passed with stages
in 1 minute and 32 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