Compare commits
17 Commits
main
...
f3f6f1bc5f
| Author | SHA256 | Date | |
|---|---|---|---|
| f3f6f1bc5f | |||
| b718073907 | |||
| d36b91a0fd | |||
| 40f757b7d1 | |||
| a9ec101bc6 | |||
| 0236ebcdd1 | |||
| 05757a5038 | |||
| 020eb63e05 | |||
| 67929580d5 | |||
| 10f9645580 | |||
| df3825df3a | |||
| 8c3dbc2886 | |||
| 267197ec20 | |||
| 781f9a1445 | |||
| 09a3c3a22d | |||
| 0775fda0ca | |||
| cd73985740 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -291,5 +291,3 @@ dkms.conf
|
|||||||
*.out
|
*.out
|
||||||
*.app
|
*.app
|
||||||
|
|
||||||
managed_components/
|
|
||||||
dependencies.lock
|
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
|
||||||
|
set(EXTRA_COMPONENT_DIRS $ENV{ESP_IDF_LIB_PATH}/components)
|
||||||
|
|
||||||
# The following lines of boilerplate have to be in your project's CMakeLists
|
# The following lines of boilerplate have to be in your project's CMakeLists
|
||||||
# in this exact order for cmake to work correctly
|
# in this exact order for cmake to work correctly
|
||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|||||||
@ -18,19 +18,5 @@ menu "Smart Oil Heating Control System"
|
|||||||
config SNTP_SERVER_IP_ADDR
|
config SNTP_SERVER_IP_ADDR
|
||||||
string "SNTP IPv4 server address"
|
string "SNTP IPv4 server address"
|
||||||
default "192.168.0.1"
|
default "192.168.0.1"
|
||||||
config ENV_WIFI_BSSID_LOCK
|
|
||||||
bool "Lock to specific Access Point (BSSID)"
|
|
||||||
default n
|
|
||||||
help
|
|
||||||
When enabled, the device will only connect to the access point
|
|
||||||
with the specified MAC address (BSSID). Useful when multiple APs
|
|
||||||
share the same SSID.
|
|
||||||
config ENV_WIFI_BSSID
|
|
||||||
string "Access Point MAC Address (BSSID)"
|
|
||||||
default "00:00:00:00:00:00"
|
|
||||||
depends on ENV_WIFI_BSSID_LOCK
|
|
||||||
help
|
|
||||||
MAC address of the access point to connect to.
|
|
||||||
Format: XX:XX:XX:XX:XX:XX (uppercase or lowercase)
|
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|||||||
@ -382,7 +382,6 @@ void findControlCurrentTemperatureEntry(void)
|
|||||||
gCurrentControlEntry.fReturnFlowTemperature,
|
gCurrentControlEntry.fReturnFlowTemperature,
|
||||||
gCurrentControlEntry.fChamberTemperature);
|
gCurrentControlEntry.fChamberTemperature);
|
||||||
*/
|
*/
|
||||||
xSemaphoreGiveRecursive(xMutexAccessControl);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
## IDF Component Manager Manifest File
|
|
||||||
dependencies:
|
|
||||||
## Required IDF version
|
|
||||||
idf:
|
|
||||||
version: '>=4.1.0'
|
|
||||||
# # Put list of dependencies here
|
|
||||||
# # For components maintained by Espressif:
|
|
||||||
# component: "~1.0.0"
|
|
||||||
# # For 3rd party components:
|
|
||||||
# username/component: ">=1.0.0,<2.0.0"
|
|
||||||
# username2/component2:
|
|
||||||
# version: "~1.0.0"
|
|
||||||
# # For transient dependencies `public` flag can be set.
|
|
||||||
# # `public` flag doesn't have an effect dependencies of the `main` component.
|
|
||||||
# # All dependencies of `main` are public by default.
|
|
||||||
# public: true
|
|
||||||
esp-idf-lib/ds18x20: '*'
|
|
||||||
40
main/wifi.c
40
main/wifi.c
@ -24,7 +24,6 @@ static bool s_initial_connect = true;
|
|||||||
|
|
||||||
static void event_handler(void *arg, esp_event_base_t event_base,
|
static void event_handler(void *arg, esp_event_base_t event_base,
|
||||||
int32_t event_id, void *event_data);
|
int32_t event_id, void *event_data);
|
||||||
static bool parse_bssid(const char *bssid_str, uint8_t *bssid);
|
|
||||||
|
|
||||||
void initWifi(void)
|
void initWifi(void)
|
||||||
{
|
{
|
||||||
@ -68,21 +67,6 @@ void initWifi(void)
|
|||||||
.threshold.authmode = WIFI_AUTH_WPA2_PSK,
|
.threshold.authmode = WIFI_AUTH_WPA2_PSK,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#if CONFIG_ENV_WIFI_BSSID_LOCK
|
|
||||||
/* Lock to specific AP by BSSID */
|
|
||||||
if (parse_bssid(CONFIG_ENV_WIFI_BSSID, wifi_config.sta.bssid))
|
|
||||||
{
|
|
||||||
wifi_config.sta.bssid_set = true;
|
|
||||||
ESP_LOGI(TAG, "BSSID lock enabled: %s", CONFIG_ENV_WIFI_BSSID);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ESP_LOGE(TAG, "Invalid BSSID format: %s", CONFIG_ENV_WIFI_BSSID);
|
|
||||||
wifi_config.sta.bssid_set = false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
|
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
|
||||||
|
|
||||||
@ -168,27 +152,3 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Parse BSSID string to byte array
|
|
||||||
*
|
|
||||||
* @param bssid_str BSSID string in format "XX:XX:XX:XX:XX:XX"
|
|
||||||
* @param bssid Output byte array (6 bytes)
|
|
||||||
* @return true on success, false on parse error
|
|
||||||
*/
|
|
||||||
static bool parse_bssid(const char *bssid_str, uint8_t *bssid)
|
|
||||||
{
|
|
||||||
unsigned int tmp[6];
|
|
||||||
int parsed = sscanf(bssid_str, "%x:%x:%x:%x:%x:%x",
|
|
||||||
&tmp[0], &tmp[1], &tmp[2],
|
|
||||||
&tmp[3], &tmp[4], &tmp[5]);
|
|
||||||
if (parsed != 6)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < 6; i++)
|
|
||||||
{
|
|
||||||
bssid[i] = (uint8_t)tmp[i];
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user