mirror of
https://github.com/stakwork/sphinx-key.git
synced 2025-12-17 07:14:23 +01:00
better clear bin
This commit is contained in:
@@ -10,7 +10,7 @@ A Lightning Hardware Wallet based on [Validating Lightning Signer](https://gitla
|
||||
|
||||
Find your port (`ls /dev/tty.*`)
|
||||
|
||||
`PORT=/dev/tty.usbserial-1420`
|
||||
`PORT=/dev/tty.usbserial-1410`
|
||||
|
||||
`espflash $PORT target/riscv32imc-esp-espidf/release/sphinx-key-factory`
|
||||
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
mod conn;
|
||||
mod core;
|
||||
mod ota;
|
||||
mod periph;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::periph::sd::mount_sd_card;
|
||||
|
||||
use esp_idf_sys as _; // If using the `binstart` feature of `esp-idf-sys`, always keep this module imported
|
||||
|
||||
// use embedded_svc::storage::StorageBase;
|
||||
use esp_idf_svc::nvs::EspNvs;
|
||||
use esp_idf_svc::nvs::*;
|
||||
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
pub const ROOT_STORE: &str = "/sdcard/store";
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
// NvsDefault::new();
|
||||
let default_nvs = EspDefaultNvsPartition::take()?;
|
||||
@@ -13,5 +26,28 @@ fn main() -> anyhow::Result<()> {
|
||||
store.remove("nonce").expect("couldnt remove nonce 1");
|
||||
store.remove("policy").expect("couldnt remove policy 1");
|
||||
println!("NVS cleared!");
|
||||
|
||||
println!("About to mount the sdcard...");
|
||||
while let Err(_e) = mount_sd_card() {
|
||||
println!("Failed to mount sd card. Make sure it is connected, trying again...");
|
||||
std::thread::sleep(std::time::Duration::from_secs(5));
|
||||
}
|
||||
println!("SD card mounted!");
|
||||
|
||||
let dir = Path::new(ROOT_STORE);
|
||||
println!("root store is dir {}", dir.is_dir());
|
||||
if dir.is_dir() {
|
||||
for entry in fs::read_dir(dir)? {
|
||||
let entry = entry?;
|
||||
let path = entry.path();
|
||||
if path.is_dir() {
|
||||
println!("PATH {}", path.display());
|
||||
if let Err(e) = fs::remove_dir_all(path) {
|
||||
println!("err removing dir");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ use log::*;
|
||||
use std::sync::mpsc;
|
||||
use std::thread;
|
||||
|
||||
pub const QOS: QoS = QoS::ExactlyOnce;
|
||||
pub const QOS: QoS = QoS::AtMostOnce;
|
||||
|
||||
pub fn make_client(
|
||||
broker: &str,
|
||||
|
||||
Reference in New Issue
Block a user