fix for read line

This commit is contained in:
Empire Phoenix 2024-08-12 19:46:56 +02:00
parent 66e276f15e
commit ca26f090fa

View File

@ -330,26 +330,16 @@ pub fn shared() -> Box<EspHttpServer<'static>> {
println!("Updated btn");
loop {
let mut line = std::string::String::new();
println!("Check for line");
let has_line = line_buffer.read_line(&mut line);
let mut line_size = 0;
match has_line {
Ok(size) => {
line_size = size;
if size == 0 {
let has_line = line_buffer.contains(&b'\n');
if has_line {
println!("Was no line no string read");
break;
}
},
Err(err) => {
println!("Was no line and error {}", err);
break;
},
}
let mut line = std::string::String::new();
let line_size = line_buffer.read_line(&mut line)?;
println!("Processing line with size {} {}", line_size, line);
//let validate = board.flash_bq34_z100(&line, is_dry_run);
let validate = anyhow::Ok(());
let validate = board.flash_bq34_z100(&line, is_dry_run);
delay.delay_us(2);
if validate.is_err() {
let mut response = request.into_status_response(400_u16).unwrap();