Merge pull request #9677 from RetiredWizard/lmhostname
Optimize hostname variable size
This commit is contained in:
commit
a9e50e2661
2 changed files with 4 additions and 5 deletions
|
|
@ -7,7 +7,6 @@
|
||||||
#
|
#
|
||||||
# LWIP
|
# LWIP
|
||||||
#
|
#
|
||||||
CONFIG_LWIP_LOCAL_HOSTNAME="sunton-esp32-8048S050"
|
|
||||||
# end of LWIP
|
# end of LWIP
|
||||||
|
|
||||||
# end of Component config
|
# end of Component config
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@
|
||||||
#include "py/gc.h"
|
#include "py/gc.h"
|
||||||
#include "py/mpstate.h"
|
#include "py/mpstate.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/objstr.h"
|
|
||||||
#include "py/objint.h"
|
|
||||||
|
|
||||||
#include "components/esp_wifi/include/esp_wifi.h"
|
#include "components/esp_wifi/include/esp_wifi.h"
|
||||||
|
|
||||||
|
|
@ -42,6 +40,8 @@ wifi_radio_obj_t common_hal_wifi_radio_obj;
|
||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MAC_ADDRESS_LENGTH 6
|
||||||
|
|
||||||
static const char *TAG = "CP wifi";
|
static const char *TAG = "CP wifi";
|
||||||
|
|
||||||
static void schedule_background_on_cp_core(void *arg) {
|
static void schedule_background_on_cp_core(void *arg) {
|
||||||
|
|
@ -200,8 +200,8 @@ void common_hal_wifi_init(bool user_initiated) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// set the default lwip_local_hostname
|
// set the default lwip_local_hostname
|
||||||
char cpy_default_hostname[80];
|
char cpy_default_hostname[strlen(CIRCUITPY_BOARD_ID) + (MAC_ADDRESS_LENGTH * 2) + 6];
|
||||||
uint8_t mac[6];
|
uint8_t mac[MAC_ADDRESS_LENGTH];
|
||||||
esp_wifi_get_mac(ESP_IF_WIFI_STA, mac);
|
esp_wifi_get_mac(ESP_IF_WIFI_STA, mac);
|
||||||
sprintf(cpy_default_hostname, "cpy_%s_%x", CIRCUITPY_BOARD_ID, (unsigned int)mac);
|
sprintf(cpy_default_hostname, "cpy_%s_%x", CIRCUITPY_BOARD_ID, (unsigned int)mac);
|
||||||
const char *default_lwip_local_hostname = cpy_default_hostname;
|
const char *default_lwip_local_hostname = cpy_default_hostname;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue