JAndrassy / WiFiEspAT

Arduino networking library. Standard Arduino WiFi networking API over ESP8266 or ESP32 AT commands.
GNU Lesser General Public License v2.1
288 stars 44 forks source link

WiFi.macAddress() not supported in JB 1.7 firmware #32

Closed iactiva closed 3 years ago

iactiva commented 3 years ago

Just noticed WiFi.macAddress() is not working with Jiri Bilek firmware 1.7 as AT command AT+CIPSTAMAC? is not supported.

As command AT+CIFSR is still working, I have done a quick temporary fix to function staMacQuery() in utility/EspAtDrv.cpp.

bool EspAtDrvClass::staMacQuery(uint8_t* mac) {
  maintain();

  LOG_INFO_PRINT_PREFIX();
  LOG_INFO_PRINTLN(F("STA MAC query "));

  cmd->print(F("AT+CIFSR"));
  if (!sendCommand(PSTR("+CIFSR")))
    return false;
  const char* delims = ":\"";
  char* tok = strtok(buffer, delims); //+CIFSR:STAMAC,"
  for (int i = 6; i >= 0; i--) {
    tok = strtok(NULL, delims); // <mac>[i]
    mac[i] = strtol(tok, NULL, 16);
  }
  return readOK();
}
JAndrassy commented 3 years ago

the firmware is an Arduino sketch. you can add the command there