fix logic bug in usb lock status update

This commit is contained in:
bunnie 2022-02-06 01:31:08 +08:00
parent 3dae62a20d
commit c86df3d095
2 changed files with 8 additions and 4 deletions

View file

@ -506,12 +506,14 @@ mod implementation {
#[derive(Copy, Clone, Debug)]
pub struct Llio {
usb_disable: bool,
}
pub fn log_init() -> *mut u32 { 0 as *mut u32 }
impl Llio {
pub fn new(_handler_conn: xous::CID, _gpio_base: *mut u32) -> Llio {
Llio {
usb_disable: false,
}
}
pub fn suspend(&self) {}
@ -590,9 +592,10 @@ mod implementation {
}
pub fn get_usb_disable(&self) -> bool {
false
self.usb_disable
}
pub fn set_usb_disable(&mut self, _state: bool) {
pub fn set_usb_disable(&mut self, state: bool) {
self.usb_disable = state;
}
}

View file

@ -452,12 +452,13 @@ fn xmain() -> ! {
|| (sec_notes.lock().unwrap().len() > 1)
&& ((stats_phase % secnotes_interval) == 0)
{
log::info!("updating lock state text");
if debug_locked != is_locked {
if debug_locked {
if is_locked {
sec_notes
.lock()
.unwrap()
.remove(&"secnotes.usb_unlock".to_string());
.remove(&"secnote.usb_unlock".to_string()); // this is the key, not the value to remove
} else {
sec_notes.lock().unwrap().insert(
"secnotes.usb_unlock".to_string(),