Skip to content

Commit

Permalink
Merge pull request #7 from purduehackers/matthew/sign-hotspot
Browse files Browse the repository at this point in the history
Temporarily connect to personal hotspot
  • Loading branch information
MatthewStanciu authored Dec 6, 2024
2 parents f1d5e4b + c0b764c commit ba89962
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sign-firmware"
version = "0.1.10"
version = "0.1.11"
authors = ["Jack Hogan <[email protected]>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down
47 changes: 24 additions & 23 deletions src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ use log::info;
use palette::rgb::Rgb;
use url::Url;

use crate::{anyesp, convert_error, EspTlsSocket, Leds};
// use crate::{anyesp, convert_error, EspTlsSocket, Leds};
use crate::{convert_error, EspTlsSocket, Leds};

#[derive(Debug, serde::Deserialize)]
struct GithubResponse {
Expand Down Expand Up @@ -288,33 +289,33 @@ pub async fn self_update(leds: &mut Leds) -> anyhow::Result<()> {
pub async fn connect_to_network(wifi: &mut AsyncWifi<EspWifi<'static>>) -> anyhow::Result<()> {
let config = Configuration::Client(ClientConfiguration {
ssid: dotenv!("WIFI_SSID").try_into().unwrap(),
password: "".try_into().unwrap(),
auth_method: esp_idf_svc::wifi::AuthMethod::WPA2Enterprise,
password: dotenv!("WIFI_PASSWORD").try_into().unwrap(),
auth_method: esp_idf_svc::wifi::AuthMethod::WPA2Personal,
..Default::default()
});

wifi.set_configuration(&config).map_err(convert_error)?;

unsafe {
use esp_idf_svc::sys::*;
anyesp!(esp_wifi_set_mode(wifi_mode_t_WIFI_MODE_STA))?;
anyesp!(esp_eap_client_set_identity(
dotenv!("WIFI_EMAIL").as_ptr(),
dotenv!("WIFI_EMAIL").len() as i32
))?;
anyesp!(esp_eap_client_set_username(
dotenv!("WIFI_USERNAME").as_ptr(),
dotenv!("WIFI_USERNAME").len() as i32
))?;
anyesp!(esp_eap_client_set_password(
dotenv!("WIFI_PASSWORD").as_ptr(),
dotenv!("WIFI_PASSWORD").len() as i32
))?;
anyesp!(esp_eap_client_set_ttls_phase2_method(
esp_eap_ttls_phase2_types_ESP_EAP_TTLS_PHASE2_MSCHAPV2
))?;
anyesp!(esp_wifi_sta_enterprise_enable())?;
}
// unsafe {
// use esp_idf_svc::sys::*;
// anyesp!(esp_wifi_set_mode(wifi_mode_t_WIFI_MODE_STA))?;
// anyesp!(esp_eap_client_set_identity(
// dotenv!("WIFI_EMAIL").as_ptr(),
// dotenv!("WIFI_EMAIL").len() as i32
// ))?;
// anyesp!(esp_eap_client_set_username(
// dotenv!("WIFI_USERNAME").as_ptr(),
// dotenv!("WIFI_USERNAME").len() as i32
// ))?;
// anyesp!(esp_eap_client_set_password(
// dotenv!("WIFI_PASSWORD").as_ptr(),
// dotenv!("WIFI_PASSWORD").len() as i32
// ))?;
// anyesp!(esp_eap_client_set_ttls_phase2_method(
// esp_eap_ttls_phase2_types_ESP_EAP_TTLS_PHASE2_MSCHAPV2
// ))?;
// anyesp!(esp_wifi_sta_enterprise_enable())?;
// }

wifi.start().await.map_err(convert_error)?;

Expand Down

0 comments on commit ba89962

Please sign in to comment.