Compare commits
4 Commits
5e0eb8b9db
...
26773507d5
| Author | SHA1 | Date | |
|---|---|---|---|
| 26773507d5 | |||
| 0c2b4ac07e | |||
| 557646916d | |||
| 6d83ec1b16 |
@@ -45,6 +45,11 @@ enum nconfig_type
|
|||||||
NCONFIG_TYPE_MAX, ///< Sentinel for the maximum number of configuration types.
|
NCONFIG_TYPE_MAX, ///< Sentinel for the maximum number of configuration types.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Erase all of nvs data and restart system
|
||||||
|
*/
|
||||||
|
void reset_nconfig();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Checks if a specific configuration value has been set.
|
* @brief Checks if a specific configuration value has been set.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "nconfig.h"
|
#include "nconfig.h"
|
||||||
|
|
||||||
|
#include "indicator.h"
|
||||||
|
#include "system.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
|
|
||||||
@@ -43,11 +45,11 @@ struct default_value const default_values[] = {
|
|||||||
{NETIF_DNS1, "8.8.8.8"},
|
{NETIF_DNS1, "8.8.8.8"},
|
||||||
{NETIF_DNS2, "8.8.4.4"},
|
{NETIF_DNS2, "8.8.4.4"},
|
||||||
{WIFI_MODE, "apsta"},
|
{WIFI_MODE, "apsta"},
|
||||||
{AP_SSID, "odroid-pm"},
|
{AP_SSID, "powermate"},
|
||||||
{AP_PASSWORD, "powermate"},
|
{AP_PASSWORD, "hardkernel"},
|
||||||
{VIN_CURRENT_LIMIT, "8.0"},
|
{VIN_CURRENT_LIMIT, "4.0"},
|
||||||
{MAIN_CURRENT_LIMIT, "7.0"},
|
{MAIN_CURRENT_LIMIT, "3.0"},
|
||||||
{USB_CURRENT_LIMIT, "5.0"},
|
{USB_CURRENT_LIMIT, "3.0"},
|
||||||
};
|
};
|
||||||
|
|
||||||
esp_err_t init_nconfig()
|
esp_err_t init_nconfig()
|
||||||
@@ -70,6 +72,13 @@ esp_err_t init_nconfig()
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset_nconfig()
|
||||||
|
{
|
||||||
|
nvs_erase_all(handle);
|
||||||
|
led_set(LED_RED, BLINK_FAST);
|
||||||
|
start_reboot_timer(1);
|
||||||
|
}
|
||||||
|
|
||||||
bool nconfig_value_is_not_set(enum nconfig_type type)
|
bool nconfig_value_is_not_set(enum nconfig_type type)
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|||||||
@@ -257,7 +257,7 @@
|
|||||||
<div id="ap-mode-config" style="display: none;">
|
<div id="ap-mode-config" style="display: none;">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="ap-ssid" class="form-label">AP SSID</label>
|
<label for="ap-ssid" class="form-label">AP SSID</label>
|
||||||
<input type="text" class="form-control" id="ap-ssid" placeholder="odroid-pm">
|
<input type="text" class="form-control" id="ap-ssid" placeholder="powermate">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="ap-password" class="form-label">AP Password</label>
|
<label for="ap-password" class="form-label">AP Password</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user