|
1 | 1 | use crate::encode::Encode; |
2 | | -use alloc::string::String; |
| 2 | +use alloc::string::{String, ToString}; |
3 | 3 | use serde::{Deserialize, Serialize}; |
4 | 4 |
|
| 5 | +/// System settings. Stored in `sys/config`. |
| 6 | +/// |
| 7 | +/// Since we don't have a realiable vesioning for the system config, |
| 8 | +/// some of the settings are added "just in case" and might be not used yet |
| 9 | +/// or maybe even won't be ever used. |
| 10 | +#[allow(clippy::struct_excessive_bools)] |
5 | 11 | #[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] |
6 | 12 | pub struct Settings { |
7 | 13 | /// How much XP the player earned over all games. |
8 | 14 | pub xp: u32, |
9 | 15 |
|
10 | | - /// How many badges the player eanred over all games. |
| 16 | + /// How many badges the player earned over all games. |
11 | 17 | pub badges: u32, |
12 | 18 |
|
13 | 19 | /// A two-letter ASCII ISO 639 Set 1 language code. |
14 | 20 | pub lang: [u8; 2], |
15 | 21 |
|
16 | | - /// The device name. |
| 22 | + /// The device name. Randomly generated when creating vFS. |
17 | 23 | pub name: String, |
18 | 24 |
|
19 | 25 | /// The full timezone name as in the IANA database. |
20 | 26 | pub timezone: String, |
| 27 | + |
| 28 | + /// If true, rotate the image on the screen 180 degrees. |
| 29 | + pub rotate_screen: bool, |
| 30 | + |
| 31 | + /// Brightness of the screen backlight. |
| 32 | + pub screen_brightness: u8, |
| 33 | + |
| 34 | + /// Brightness of the LEDs. |
| 35 | + pub leds_brightness: u8, |
| 36 | + |
| 37 | + /// How loud the speakers should play sounds. |
| 38 | + pub speakers_volume: u8, |
| 39 | + |
| 40 | + /// How loud the headphones should play sounds. |
| 41 | + pub headphones_volume: u8, |
| 42 | + |
| 43 | + /// Color scheme to use. |
| 44 | + pub theme: u8, |
| 45 | + |
| 46 | + /// Automatically lock the screen after N minutes. |
| 47 | + /// |
| 48 | + /// If zero, never locks automatically. |
| 49 | + /// The screen is never locked when in multiplayer. |
| 50 | + pub auto_lock: u8, |
| 51 | + |
| 52 | + /// If enabled, apps are advised to skip flashy animations. |
| 53 | + pub reduce_flashing: bool, |
| 54 | + |
| 55 | + /// If enabled, collect and send anonymous telemetry. |
| 56 | + pub telemetry: bool, |
| 57 | + |
| 58 | + /// Emulate gamepad when connecting Firefly Zero to a PC via USB. |
| 59 | + pub gamepad_mode: bool, |
| 60 | + |
| 61 | + /// Increase contrast of colors in the default color palette. |
| 62 | + pub contrast: bool, |
| 63 | + |
| 64 | + /// Let the system apps show easter eggs, holiday effects, and weird jokes. |
| 65 | + pub easter_eggs: bool, |
21 | 66 | } |
22 | 67 |
|
23 | 68 | impl Encode<'_> for Settings {} |
24 | 69 |
|
| 70 | +impl Default for Settings { |
| 71 | + fn default() -> Self { |
| 72 | + Self { |
| 73 | + xp: 0, |
| 74 | + badges: 0, |
| 75 | + lang: [b'e', b'n'], |
| 76 | + name: "firefly-zero".to_string(), |
| 77 | + timezone: "Europe/Amsterdam".to_string(), |
| 78 | + rotate_screen: false, |
| 79 | + screen_brightness: 255, |
| 80 | + leds_brightness: 255, |
| 81 | + speakers_volume: 64, |
| 82 | + headphones_volume: 64, |
| 83 | + theme: 0, |
| 84 | + auto_lock: 5, |
| 85 | + reduce_flashing: false, |
| 86 | + telemetry: false, |
| 87 | + gamepad_mode: false, |
| 88 | + contrast: false, |
| 89 | + easter_eggs: false, |
| 90 | + } |
| 91 | + } |
| 92 | +} |
| 93 | + |
25 | 94 | #[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] |
26 | 95 | pub struct BatteryInfo { |
27 | 96 | pub min_voltage: u16, |
|
0 commit comments