I'm trying to set the Mac, this is my code:
void user_init(void)
{
struct softap_config acfg;
struct station_config scfg;
char ssid[10] = { 0 };
char buf[64] = { 0 };
char mac[6] = { 0 };
char sofap_mac[6] = { 0x1a, 0xfe, 0x36, 0x97, 0xd5, 0x7b };
char sta_mac[6] = { 0x1a, 0xfe, 0x36, 0x97, 0xd5, 0x7b };
wifi_softap_dhcps_stop();
wifi_station_dhcpc_stop();
wifi_station_set_auto_connect(false);
wifi_set_opmode(3);
wifi_set_macaddr(STATION_IF, sta_mac);
wifi_set_macaddr(SOFTAP_IF, sofap_mac);
sclr((uint8 *)&acfg, 0, sizeof(acfg));
sclr((uint8 *)&scfg, 0, sizeof(scfg));
os_strcpy(ssid, "ATcmd_2");
os_memcpy(acfg.ssid, ssid, os_strlen(ssid));
os_memcpy(scfg.ssid, ssid, os_strlen(ssid));
wifi_softap_set_config(&acfg);
wifi_station_set_config(&scfg);
at_init();
at_cmd_array_regist(&at_custom_cmd[0], sizeof(at_custom_cmd) / sizeof(at_custom_cmd[0]));
wifi_get_macaddr(STATION_IF, mac);
os_sprintf(buf,"Compilado: %s %s\r\nSSID: %s\r\nSMAC: "MACSTR"\r\n",
__DATE__,__TIME__,scfg.ssid, MAC2STR(mac));
at_set_custom_info(buf);
at_port_print(buf);
at_port_print("Iniciado..\r\n");
}
void sclr(uint8 *dest, uint8 c, size_t n) {
while (n--)
*dest++ = c;
}
and this the result:
14:11:57 Compilado: Apr 25 2016 13:52:59
SSID: ATcmd_2
SMAC: 12:0d:f0:0c:02:0d
Iniciado..
why MAC did not set to that I want..?
Thank you very muchStatistics: Posted by martinch — Tue Apr 26, 2016 1:16 am
]]>