mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
status: implement basic radio user preference
This commit is contained in:
parent
a0b74ef2d0
commit
c4e931a766
3 changed files with 33 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -3657,6 +3657,7 @@ dependencies = [
|
|||
"sntpc",
|
||||
"trng",
|
||||
"usb-device-xous",
|
||||
"userprefs",
|
||||
"utralib",
|
||||
"xous 0.9.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xous-api-log",
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ pddb = {path = "../pddb"}
|
|||
net = {path = "../net"}
|
||||
keyboard = {path = "../keyboard"}
|
||||
usb-device-xous = {path="../usb-device-xous"}
|
||||
userprefs = {path = "../../libs/userprefs"}
|
||||
|
||||
num-derive = {version = "0.3.3", default-features = false}
|
||||
num-traits = {version = "0.2.14", default-features = false}
|
||||
|
|
|
|||
|
|
@ -213,12 +213,43 @@ fn wrapped_main() -> ! {
|
|||
}
|
||||
});
|
||||
|
||||
// load system preferences
|
||||
let prefs = userprefs::Manager::new();
|
||||
|
||||
// ------------------ render initial graphical display, so we don't seem broken on boot
|
||||
let gam = gam::Gam::new(&xns).expect("|status: can't connect to GAM");
|
||||
let ticktimer = ticktimer_server::Ticktimer::new().expect("Couldn't connect to Ticktimer");
|
||||
let susres = susres::Susres::new_without_hook(&xns).unwrap();
|
||||
let mut netmgr = net::NetManager::new();
|
||||
|
||||
match prefs.radio_on_on_boot() {
|
||||
Ok(value) => if let true = value {
|
||||
netmgr.connection_manager_wifi_off_and_stop()
|
||||
} else {
|
||||
netmgr.connection_manager_wifi_on()
|
||||
},
|
||||
Err(error) => {
|
||||
log::error!("cannot read preference value for radio_on_on_boot: {}", error);
|
||||
Ok(())
|
||||
}
|
||||
}.unwrap_or_else(|error| {
|
||||
log::error!("cannot set radio status: {}", error)
|
||||
});
|
||||
|
||||
match prefs.connect_known_networks_on_boot() {
|
||||
Ok(value) => if let true = value {
|
||||
netmgr.connection_manager_run()
|
||||
} else {
|
||||
netmgr.connection_manager_stop()
|
||||
},
|
||||
Err(error) => {
|
||||
log::error!("cannot read preference value for connect_known_networks_on_boot: {}", error);
|
||||
Ok(())
|
||||
}
|
||||
}.unwrap_or_else(|error| {
|
||||
log::error!("cannot set radio status: {}", error)
|
||||
});
|
||||
|
||||
// screensize is controlled by the GAM, it's set in main.rs near the top
|
||||
let screensize = gam
|
||||
.get_canvas_bounds(status_gid)
|
||||
|
|
|
|||
Loading…
Reference in a new issue