clippy
This commit is contained in:
parent
5031c09995
commit
f80309b176
1 changed files with 8 additions and 11 deletions
19
src/main.rs
19
src/main.rs
|
|
@ -68,7 +68,7 @@ async fn main(spawner: Spawner) {
|
|||
));
|
||||
|
||||
spawner.spawn(connection(controller)).ok();
|
||||
spawner.spawn(net_task(&stack)).ok();
|
||||
spawner.spawn(net_task(stack)).ok();
|
||||
|
||||
loop {
|
||||
if stack.is_link_up() {
|
||||
|
|
@ -103,7 +103,7 @@ async fn ring(stack: &'static Stack<WifiDevice<'static, WifiStaDevice>>) -> Resu
|
|||
|
||||
Timer::after(Duration::from_millis(1_000)).await;
|
||||
|
||||
let mut socket = TcpSocket::new(&stack, &mut rx_buffer, &mut tx_buffer);
|
||||
let mut socket = TcpSocket::new(stack, &mut rx_buffer, &mut tx_buffer);
|
||||
|
||||
socket.set_timeout(Some(embassy_time::Duration::from_secs(10)));
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ async fn ring(stack: &'static Stack<WifiDevice<'static, WifiStaDevice>>) -> Resu
|
|||
return Err("connect error");
|
||||
}
|
||||
|
||||
const JSON: &'static str = "{
|
||||
const JSON: &str = "{
|
||||
\"token\": \"ahgvt9acdx5sowxfobadt9cmpqhrzp\",
|
||||
\"user\": \"ud2btptjwvy92xi8y77tfurfew6z7a\",
|
||||
\"message\": \"DOOR BELL!!!\"
|
||||
|
|
@ -170,9 +170,9 @@ async fn ring_button_task(
|
|||
#[embassy_executor::task]
|
||||
async fn status_led_task(mut status_led: AnyPin<Output<PushPull>>) {
|
||||
loop {
|
||||
status_led.set_high();
|
||||
status_led.set_high().unwrap();
|
||||
Timer::after_millis(100).await;
|
||||
status_led.set_low();
|
||||
status_led.set_low().unwrap();
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
|
@ -200,9 +200,9 @@ async fn open_button_task(
|
|||
async fn open_task(opener: &'static Mutex<CriticalSectionRawMutex, AnyPin<Output<PushPull>>>) {
|
||||
let mut opener = opener.lock().await;
|
||||
|
||||
opener.set_high();
|
||||
opener.set_high().unwrap();
|
||||
Timer::after_secs(1).await;
|
||||
opener.set_low();
|
||||
opener.set_low().unwrap();
|
||||
}
|
||||
|
||||
#[embassy_executor::task]
|
||||
|
|
@ -210,13 +210,10 @@ async fn connection(mut controller: WifiController<'static>) {
|
|||
println!("start connection task");
|
||||
println!("Device capabilities: {:?}", controller.get_capabilities());
|
||||
loop {
|
||||
match esp_wifi::wifi::get_wifi_state() {
|
||||
WifiState::StaConnected => {
|
||||
if esp_wifi::wifi::get_wifi_state() == WifiState::StaConnected {
|
||||
// wait until we're no longer connected
|
||||
controller.wait_for_event(WifiEvent::StaDisconnected).await;
|
||||
Timer::after(Duration::from_millis(5000)).await
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if !matches!(controller.is_started(), Ok(true)) {
|
||||
let client_config = Configuration::Client(ClientConfiguration {
|
||||
|
|
|
|||
Loading…
Reference in a new issue