Skip to content

Commit d2c1696

Browse files
committed
more settings, bump version
1 parent fd5073c commit d2c1696

3 files changed

Lines changed: 74 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "firefly-types"
3-
version = "0.7.1"
3+
version = "0.8.0"
44
rust-version = "1.89.0"
55
edition = "2024"
66
authors = ["Firefly Zero team"]

src/settings.rs

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,96 @@
11
use crate::encode::Encode;
2-
use alloc::string::String;
2+
use alloc::string::{String, ToString};
33
use serde::{Deserialize, Serialize};
44

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)]
511
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
612
pub struct Settings {
713
/// How much XP the player earned over all games.
814
pub xp: u32,
915

10-
/// How many badges the player eanred over all games.
16+
/// How many badges the player earned over all games.
1117
pub badges: u32,
1218

1319
/// A two-letter ASCII ISO 639 Set 1 language code.
1420
pub lang: [u8; 2],
1521

16-
/// The device name.
22+
/// The device name. Randomly generated when creating vFS.
1723
pub name: String,
1824

1925
/// The full timezone name as in the IANA database.
2026
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,
2166
}
2267

2368
impl Encode<'_> for Settings {}
2469

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+
2594
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
2695
pub struct BatteryInfo {
2796
pub min_voltage: u16,

0 commit comments

Comments
 (0)