Skip to content

Commit

Permalink
Add is_dhcp check
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Jan 3, 2020
1 parent 544a800 commit 1a230f4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions esp_at_lib/src/esp/esp_sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,17 @@ esp_sta_is_joined(void) {
espr_t
esp_sta_copy_ip(esp_ip_t* ip, esp_ip_t* gw, esp_ip_t* nm, uint8_t* is_dhcp) {
espr_t res = espERR;
if ((ip != NULL || gw != NULL || nm != NULL) && esp_sta_has_ip()) { /* Do we have a valid IP address? */
if ((ip != NULL || gw != NULL || nm != NULL || is_dhcp != NULL)
&& esp_sta_has_ip()) { /* Do we have a valid IP address? */
esp_core_lock();
if (ip != NULL) {
ESP_MEMCPY(ip, &esp.m.sta.ip, sizeof(esp.m.sta.ip));/* Copy IP address */
ESP_MEMCPY(ip, &esp.m.sta.ip, sizeof(esp.m.sta.ip));
}
if (gw != NULL) {
ESP_MEMCPY(gw, &esp.m.sta.gw, sizeof(esp.m.sta.gw));/* Copy gateway address */
ESP_MEMCPY(gw, &esp.m.sta.gw, sizeof(esp.m.sta.gw));
}
if (nm != NULL) {
ESP_MEMCPY(nm, &esp.m.sta.nm, sizeof(esp.m.sta.nm));/* Copy netmask address */
ESP_MEMCPY(nm, &esp.m.sta.nm, sizeof(esp.m.sta.nm));
}
if (is_dhcp != NULL) {
*is_dhcp = esp.m.sta.dhcp;
Expand Down

0 comments on commit 1a230f4

Please sign in to comment.