use crate::encode::Encode;
use alloc::string::{String, ToString};
use serde::{Deserialize, Serialize};
#[allow(clippy::struct_excessive_bools)]
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
pub struct Settings {
pub xp: u32,
pub badges: u32,
pub lang: [u8; 2],
pub country: [u8; 2],
pub name: String,
pub timezone: String,
pub rotate_screen: bool,
pub screen_brightness: u8,
pub leds_brightness: u8,
pub speakers_volume: u8,
pub headphones_volume: u8,
pub font_size: u8,
pub theme: u32,
pub auto_lock: u8,
pub reduce_flashing: bool,
pub telemetry: bool,
pub gamepad_mode: bool,
pub contrast: bool,
pub easter_eggs: bool,
pub extra_flags: u32,
}
impl Encode<'_> for Settings {}
impl Default for Settings {
fn default() -> Self {
const DEFAULT_THEME: u32 = 0x_0D_6C_00;
Self {
xp: 0,
badges: 0,
lang: [b'e', b'n'],
country: [b'N', b'L'],
name: "firefly-zero".to_string(),
timezone: "Europe/Amsterdam".to_string(),
rotate_screen: false,
screen_brightness: 255,
leds_brightness: 255,
speakers_volume: 64,
headphones_volume: 64,
font_size: 9,
theme: DEFAULT_THEME,
auto_lock: 5,
reduce_flashing: false,
telemetry: false,
gamepad_mode: false,
contrast: false,
easter_eggs: false,
extra_flags: 0,
}
}
}
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
pub struct BatteryInfo {
pub min_voltage: u16,
pub max_voltage: u16,
}
impl Encode<'_> for BatteryInfo {}