I'm trying to work up an initialization file for my app using the NVS partition generator. My .csv file looks like this:
Code: Select all
key,type,encoding,value
CD_WIFIBUTTON,namespace,,
NVS_LABEL,data,string,"My company"
MAC_ADDR,data,string,"aabbccddeeff"
SERIAL_NBR,data,string,"123456789"
DEVICE_NAME,data,string,"Wifi Button"
VERSION,data,hex2bin,01000000
SSID,data,string,"my_ssid"
PSK,data,string,"my_psk"
IPSOURCE,data,u32,1
ADDR,data,string,"10.10.10.10"
IPGATEWAY,data,string,"10.0.0.1"
IPSUBNET,data,string,"255.0.0.0"
NTP_SERVER,data,string,"pool.ntp.org"
TIMEZONE,data,string,"PST8PDT,M3.2.0/2,M11.1.0"
LED_DUTY_BATT,data,u32,2
LED_DUTY_LINE,data,u32,9
BUZZER_DUTY,data,u32,50
Code: Select all
const char NVS_KEY_IPSOURCE[] = "IPSOURCE";
string Nvs::getIpSource()
{
string s;
esp_err_t err;
uint32_t ipSource;
err = nvs_get_u32(m_nvsHandle, NVS_KEY_IPSOURCE, &ipSource);
if (err == ESP_OK)
{
...
}
else
{
ESP_LOGE(TAG, "getIpSource(): nvs_get_str returned %x.", err);
...