UPDATE-EDIT:
No need to reply, I found my error!
The ini file entry should look like this:
-D AP_BSSID="{0x7C, 0x10, 0xC9, 0xAF, 0x4C, 0x88}"
The problem was the extra " entries, which came from other settings I have had to do in the ini file.
Removing these made the build work just fine!
USELESS POST FOLLOWS
My ESP8266 projects has 4 targets with slightly varied values for some items, which are defined in the platformio.ini file.
I want to define some MAC addresses too via the entries in env sections in the ini file, but I am doing something wrong…
So here is the current code in the Start_WiFi() function using the direct literal declaration:
const uint8_t myap_bssid[6] = {0x7C, 0x10, 0xC9, 0xAF, 0x4C, 0x88};
This builds fine and I can use myap_bssid in the WiFi handling code.
So I hoped that putting this into the env:xxx section in the platformio.ini file I could move the setting into the ini file:
build_flags =
-D AP_BSSID="\"{0x7C:0x10:0xC9:0xAF:0x4C:0x88}\""
The : use is from an earlier question on the forum.
Then in the code I would replace the line above with:
const uint8_t myap_bssid[6] = AP_BSSID;
However this causes a build error:
src\main.cpp: In function 'int Start_WiFi()':
<command-line>:0:10: error: initializer-string for array of chars is too long [-fpermissive]
src\main.cpp:354:29: note: in expansion of macro 'AP_BSSID'
uint8_t myap_bssid[6] = AP_BSSID;
But if I change the content in the ini file to get it to be the same as in the source:
-D AP_BSSID="\"{0x7C, 0x10, 0xC9, 0xAF, 0x4C,0x88}\""
then I get this build error:
src\main.cpp: In function 'int Start_WiFi()':
<command-line>:0:10: error: initializer-string for array of chars is too long [-fpermissive]
Archiving .pio\build\esp01_serial-aspo\lib071\libNTPClient.a
src\main.cpp:354:35: note: in expansion of macro 'AP_BSSID'
const uint8_t myap_bssid[6] = AP_BSSID;
So how should I handle this transfer of the MAC address from platformio.ini rather than hard coding inside the main.cpp source?