esp-hal release wip
This commit is contained in:
@@ -233,7 +233,7 @@ async fn safe_main(spawner: Spawner) -> FatResult<()> {
|
||||
{
|
||||
info!("No wifi configured, starting initial config mode");
|
||||
|
||||
let stack = board.board_hal.get_esp().wifi_ap().await?;
|
||||
let stack = board.board_hal.get_esp().wifi_ap(spawner).await?;
|
||||
|
||||
let reboot_now = Arc::new(AtomicBool::new(false));
|
||||
println!("starting webserver");
|
||||
@@ -244,7 +244,7 @@ async fn safe_main(spawner: Spawner) -> FatResult<()> {
|
||||
|
||||
let mut stack: OptionLock<Stack> = OptionLock::empty();
|
||||
let network_mode = if board.board_hal.get_config().network.ssid.is_some() {
|
||||
try_connect_wifi_sntp_mqtt(&mut board, &mut stack).await
|
||||
try_connect_wifi_sntp_mqtt(&mut board, &mut stack, spawner).await
|
||||
} else {
|
||||
info!("No wifi configured");
|
||||
//the current sensors require this amount to stabilize, in the case of Wi-Fi this is already handled due to connect timings;
|
||||
@@ -257,7 +257,7 @@ async fn safe_main(spawner: Spawner) -> FatResult<()> {
|
||||
|
||||
let res = {
|
||||
let esp = board.board_hal.get_esp();
|
||||
esp.wifi_ap().await
|
||||
esp.wifi_ap(spawner).await
|
||||
};
|
||||
match res {
|
||||
Ok(ap_stack) => {
|
||||
@@ -839,9 +839,10 @@ macro_rules! mk_static {
|
||||
async fn try_connect_wifi_sntp_mqtt(
|
||||
board: &mut MutexGuard<'static, CriticalSectionRawMutex, HAL<'static>>,
|
||||
stack_store: &mut OptionLock<Stack<'static>>,
|
||||
spawner: Spawner,
|
||||
) -> NetworkMode {
|
||||
let nw_conf = &board.board_hal.get_config().network.clone();
|
||||
match board.board_hal.get_esp().wifi(nw_conf).await {
|
||||
match board.board_hal.get_esp().wifi(nw_conf, spawner).await {
|
||||
Ok(stack) => {
|
||||
stack_store.replace(stack);
|
||||
|
||||
@@ -865,7 +866,12 @@ async fn try_connect_wifi_sntp_mqtt(
|
||||
let mqtt_connected = if board.board_hal.get_config().network.mqtt_url.is_some() {
|
||||
let nw_config = board.board_hal.get_config().network.clone();
|
||||
let nw_config = mk_static!(NetworkConfig, nw_config);
|
||||
match board.board_hal.get_esp().mqtt(nw_config, stack).await {
|
||||
match board
|
||||
.board_hal
|
||||
.get_esp()
|
||||
.mqtt(nw_config, stack, spawner)
|
||||
.await
|
||||
{
|
||||
Ok(_) => {
|
||||
info!("Mqtt connection ready");
|
||||
true
|
||||
@@ -1052,7 +1058,7 @@ async fn wait_infinity(
|
||||
}
|
||||
}
|
||||
|
||||
#[esp_hal_embassy::main]
|
||||
#[esp_rtos::main]
|
||||
async fn main(spawner: Spawner) -> ! {
|
||||
// intialize embassy
|
||||
logger::init_logger_from_env();
|
||||
|
||||
Reference in New Issue
Block a user