diff --git a/services/status/Cargo.toml b/services/status/Cargo.toml index d4efa8aec..88bb940c7 100644 --- a/services/status/Cargo.toml +++ b/services/status/Cargo.toml @@ -17,7 +17,7 @@ llio = { path = "../llio" } xous = "0.9.64" xous-ipc = "0.10.4" xous-names = { package = "xous-api-names", version = "0.9.65" } -graphics-server = { path = "../graphics-server" } +ux-api = { path = "../../libs/ux-api" } gam = { path = "../gam" } locales = { path = "../../locales" } susres = { package = "xous-api-susres", version = "0.9.63" } diff --git a/services/status/src/main.rs b/services/status/src/main.rs index 1d557f3a4..36baea78d 100644 --- a/services/status/src/main.rs +++ b/services/status/src/main.rs @@ -24,10 +24,11 @@ use chrono::prelude::*; use com::api::*; use crossbeam::channel::{Receiver, Sender, at, select, unbounded}; use gam::{GamObjectList, GamObjectType}; -use graphics_server::*; use locales::t; use num_traits::*; use root_keys::api::{BackupKeyboardLayout, BackupOp}; +use ux_api::minigfx::*; +use ux_api::service::api::*; use xous::{CID, Message, msg_scalar_unpack, send_message}; use crate::preferences::{PrefsMenuUpdateOp, percentage_to_db}; @@ -288,8 +289,8 @@ fn wrapped_main() -> ! { // layout: 336 px wide // 0 150 150 200 // Feb 05 15:00 (00:06:23) xxxx 3.72V/-100mA/99% - const CPU_BAR_WIDTH: i16 = 46; - const CPU_BAR_OFFSET: i16 = 8; + const CPU_BAR_WIDTH: isize = 46; + const CPU_BAR_OFFSET: isize = 8; let time_rect = Rectangle::new_with_style( Point::new(0, 0), Point::new(screensize.x / 2 - CPU_BAR_WIDTH / 2 - 1 + CPU_BAR_OFFSET, screensize.y / 2 - 1), @@ -1104,7 +1105,7 @@ fn wrapped_main() -> ! { } gam.post_textview(&mut battstats_tv).expect("|status: can't draw battery stats"); if let Some(bounds) = battstats_tv.bounds_computed { - if bounds.height() as i16 > screensize.y / 2 + 1 { + if bounds.height() as isize > screensize.y / 2 + 1 { // the clipping rectangle limits the bounds to the overall height of the status area, // so the overlap between status and secnotes must be managed // within this server @@ -1132,10 +1133,10 @@ fn wrapped_main() -> ! { let (latest_activity, period) = llio.activity_instantaneous().expect("couldn't get CPU activity"); let activity_to_width = if period == 0 { - cpuload_rect.width() as i16 - 4 + cpuload_rect.width() as isize - 4 } else { (((latest_activity as u64) * 1000u64 * (cpuload_rect.width() as u64 - 4)) - / (period as u64 * 1000u64)) as i16 + / (period as u64 * 1000u64)) as isize }; draw_list .push(GamObjectType::Rect(Rectangle::new_coords_with_style( @@ -1143,7 +1144,7 @@ fn wrapped_main() -> ! { cpuload_rect.tl().y + 2, cpuload_rect.tl().x + 2 - + (activity_to_width).min(cpuload_rect.width() as i16 - 4), + + (activity_to_width).min(cpuload_rect.width() as isize - 4), cpuload_rect.br().y - 2, DrawStyle::new(PixelColor::Dark, PixelColor::Dark, 0), ))) @@ -1267,7 +1268,7 @@ fn wrapped_main() -> ! { .expect("|status: can't write string"); gam.post_textview(&mut uptime_tv).expect("|status: can't draw uptime"); if let Some(bounds) = uptime_tv.bounds_computed { - if bounds.height() as i16 > screensize.y / 2 + 1 { + if bounds.height() as isize > screensize.y / 2 + 1 { // the clipping rectangle limits the bounds to the overall height of the status // area, so the overlap between status and secnotes // must be managed within this server @@ -1788,12 +1789,12 @@ fn compute_bars(wifi_bars: &mut [PixelColor; 5], rssi: u8) -> bool { /// The smallest bar will be exactly `(x, y)` in size. fn bars( g: &gam::Gam, - canvas: graphics_server::Gid, + canvas: ux_api::service::api::Gid, levels: &[PixelColor; 5], top_left: Point, - (x, y): (i16, i16), - growth: i16, - bars_spacing: i16, + (x, y): (isize, isize), + growth: isize, + bars_spacing: isize, ) { let mut dl = gam::GamObjectList::new(canvas); @@ -1806,7 +1807,7 @@ fn bars( 0 => gam::Rectangle::new_coords_with_style( top_left.x, top_left.y, - bottom_right.x as i16, + bottom_right.x as isize, bottom_right.y, color, ), @@ -1817,9 +1818,9 @@ fn bars( }; gam::Rectangle::new_coords_with_style( - last.x1() as i16 + bars_spacing, - last.y0() as i16 - growth, - last.x1() as i16 + growth + bars_spacing, + last.x1() as isize + bars_spacing, + last.y0() as isize - growth, + last.x1() as isize + growth + bars_spacing, bottom_right.y, color, )