Skip to content

Commit 1ae7074

Browse files
committed
Use the new PM function in the library instead of our own
1 parent f7c8442 commit 1ae7074

File tree

4 files changed

+6
-36
lines changed

4 files changed

+6
-36
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ half = "2.6.0"
5252
env_logger = "0.11.8"
5353
anyhow = "1.0"
5454
crazyflie-link = { version = "0.4.2", default-features = false }
55-
crazyflie-lib = { version = "0.7.0", default-features = false }
55+
crazyflie-lib = { version = "0.7.1", default-features = false }
5656
crazyradio = { version = "0.6.0", features = ["async"] }
5757
cfloader = { git="https://github.com/ataffanel/cfloader-rs.git", default-features = false }
5858
clap = { version = "4.5.46", features = ["derive"] }

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,13 +1492,13 @@ async fn main() -> Result<()> {
14921492
modules::bootloader::reboot(&link_context, uri.as_str()).await?;
14931493
},
14941494
PlatformCommands::PowerOff => {
1495-
modules::bootloader::power_off(&link_context, uri.as_str()).await?;
1495+
crazyflie_lib::Crazyflie::power_off_all(&link_context, uri.as_str()).await?;
14961496
},
14971497
PlatformCommands::Sleep => {
1498-
modules::bootloader::sysoff(&link_context, uri.as_str()).await?;
1498+
crazyflie_lib::Crazyflie::power_off_stm32_domain(&link_context, uri.as_str()).await?;
14991499
},
15001500
PlatformCommands::Wakeup => {
1501-
modules::bootloader::syson(&link_context, uri.as_str()).await?;
1501+
crazyflie_lib::Crazyflie::power_on_stm32_domain(&link_context, uri.as_str()).await?;
15021502
}
15031503
}
15041504

src/modules/bootloader.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ struct BootloaderInfo {
2828
#[repr(u8)]
2929
#[derive(Debug, Clone, Copy)]
3030
enum BootloaderCommand {
31-
AllOff = 0x01,
32-
SysOff = 0x02,
33-
SysOn = 0x03,
3431
ResetInit = 0xFF,
3532
Reset = 0xF0,
3633
}
@@ -254,33 +251,6 @@ pub async fn reboot(link_context: &crazyflie_link::LinkContext, uri: &str,) -> R
254251
Ok(())
255252
}
256253

257-
pub async fn power_off(link_context: &crazyflie_link::LinkContext, uri: &str,) -> Result<()> {
258-
259-
let link = link_context.open_link(uri).await?;
260-
send_command(&link, BootloaderCommand::AllOff, None).await?;
261-
sleep(Duration::from_millis(500)).await;
262-
263-
Ok(())
264-
}
265-
266-
pub async fn sysoff(link_context: &crazyflie_link::LinkContext, uri: &str,) -> Result<()> {
267-
268-
let link = link_context.open_link(uri).await?;
269-
send_command(&link, BootloaderCommand::SysOff, None).await?;
270-
sleep(Duration::from_millis(500)).await;
271-
272-
Ok(())
273-
}
274-
275-
pub async fn syson(link_context: &crazyflie_link::LinkContext, uri: &str,) -> Result<()> {
276-
277-
let link = link_context.open_link(uri).await?;
278-
send_command(&link, BootloaderCommand::SysOn, None).await?;
279-
sleep(Duration::from_millis(500)).await;
280-
281-
Ok(())
282-
}
283-
284254
async fn get_flashable_firmware(cf: &Crazyflie, firmwares: &[Firmware]) -> Result<Vec<Firmware>> {
285255
let mut flashable_firmares = Vec::new();
286256
let memories = cf.memory.get_memories(Some(MemoryType::DeckMemory));

0 commit comments

Comments
 (0)