started cleanup and moving from std to no_std
This commit is contained in:
@@ -187,7 +187,7 @@ fn get_backup_config(
|
||||
let json = match board.board_hal.get_rtc_module().get_backup_config() {
|
||||
Ok(config) => from_utf8(&config)?.to_owned(),
|
||||
Err(err) => {
|
||||
println!("Error get backup config {:?}", err);
|
||||
log::info!("Error get backup config {:?}", err);
|
||||
err.to_string()
|
||||
}
|
||||
};
|
||||
@@ -318,7 +318,7 @@ fn wifi_scan(
|
||||
let mut ssids: Vec<&String<32>> = Vec::new();
|
||||
scan_result.iter().for_each(|s| ssids.push(&s.ssid));
|
||||
let ssid_json = serde_json::to_string(&SSIDList { ssids })?;
|
||||
println!("Sending ssid list {}", &ssid_json);
|
||||
log::info!("Sending ssid list {}", &ssid_json);
|
||||
anyhow::Ok(Some(ssid_json))
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ fn ota(
|
||||
) -> Result<Option<std::string::String>, anyhow::Error> {
|
||||
let mut board = BOARD_ACCESS.lock().unwrap();
|
||||
let mut ota = OtaUpdate::begin()?;
|
||||
println!("start ota");
|
||||
log::info!("start ota");
|
||||
|
||||
//having a larger buffer is not really faster, requires more stack and prevents the progress bar from working ;)
|
||||
const BUFFER_SIZE: usize = 512;
|
||||
@@ -366,13 +366,13 @@ fn ota(
|
||||
break;
|
||||
}
|
||||
}
|
||||
println!("wrote bytes ota {total_read}");
|
||||
println!("finish ota");
|
||||
log::info!("wrote bytes ota {total_read}");
|
||||
log::info!("finish ota");
|
||||
let partition = ota.raw_partition();
|
||||
println!("finalizing and changing boot partition to {partition:?}");
|
||||
log::info!("finalizing and changing boot partition to {partition:?}");
|
||||
|
||||
let mut finalizer = ota.finalize()?;
|
||||
println!("changing boot partition");
|
||||
log::info!("changing boot partition");
|
||||
board.board_hal.get_esp().set_restart_to_conf(true);
|
||||
drop(board);
|
||||
finalizer.set_as_boot_partition()?;
|
||||
@@ -380,7 +380,7 @@ fn ota(
|
||||
}
|
||||
|
||||
fn query_param(uri: &str, param_name: &str) -> Option<std::string::String> {
|
||||
println!("{uri} get {param_name}");
|
||||
log::info!("{uri} get {param_name}");
|
||||
let parsed = Url::parse(&format!("http://127.0.0.1/{uri}")).unwrap();
|
||||
let value = parsed.query_pairs().find(|it| it.0 == param_name);
|
||||
match value {
|
||||
@@ -551,14 +551,14 @@ pub fn httpd(reboot_now: Arc<AtomicBool>) -> Box<EspHttpServer<'static>> {
|
||||
break;
|
||||
}
|
||||
}
|
||||
println!("wrote {total_read} for file {filename}");
|
||||
log::info!("wrote {total_read} for file {filename}");
|
||||
drop(file_handle);
|
||||
response.flush()?;
|
||||
}
|
||||
Err(err) => {
|
||||
//todo set headers here for filename to be error
|
||||
let error_text = err.to_string();
|
||||
println!("error handling get file {}", error_text);
|
||||
log::info!("error handling get file {}", error_text);
|
||||
cors_response(request, 500, &error_text)?;
|
||||
}
|
||||
}
|
||||
@@ -599,7 +599,7 @@ pub fn httpd(reboot_now: Arc<AtomicBool>) -> Box<EspHttpServer<'static>> {
|
||||
Err(err) => {
|
||||
//todo set headers here for filename to be error
|
||||
let error_text = err.to_string();
|
||||
println!("error handling get file {}", error_text);
|
||||
log::info!("error handling get file {}", error_text);
|
||||
cors_response(request, 500, &error_text)?;
|
||||
}
|
||||
}
|
||||
@@ -697,7 +697,7 @@ fn handle_error_to500(
|
||||
},
|
||||
Err(err) => {
|
||||
let error_text = err.to_string();
|
||||
println!("error handling process {}", error_text);
|
||||
log::info!("error handling process {}", error_text);
|
||||
cors_response(request, 500, &error_text)?;
|
||||
}
|
||||
}
|
||||
@@ -725,6 +725,6 @@ fn read_up_to_bytes_from_request(
|
||||
data_store.push(actual_data.to_owned());
|
||||
}
|
||||
let allvec = data_store.concat();
|
||||
println!("Raw data {}", from_utf8(&allvec)?);
|
||||
log::info!("Raw data {}", from_utf8(&allvec)?);
|
||||
Ok(allvec)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user