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