Feature additions (#434)
Lots of things "ported" over from the "enhanced" fork. With some adjustments here and there. KeyboardBacklight driver (for T-Deck only currently) Trackball driver (for T-Deck only currently) Keyboard backlight sleep/wake (for T-Deck only currently...also requires keyboard firmware update) Display sleep/wake Files - create file/folder Keyboard settings (for T-Deck only currently) Time & Date settings tweaks Locale settings tweaks Systeminfo additions Espnow wifi coexist initI2cDevices - moved to T-deck init.cpp / initBoot KeyboardInitService - removed, moved to T-deck init.cpp / initBoot Adjusted TIMER_UPDATE_INTERVAL to 2 seconds. Added lock to ActionCreateFolder Maybe missed some things in the list. Display wake could do with some kind of block on wake first touch to prevent UI elements being hit when waking device with touch. Same with encoder/trackball/keyboard press i guess. The original code was written by @cscott0108 at https://github.com/cscott0108/tactility-enhanced-t-deck
This commit is contained in:
@@ -15,6 +15,8 @@ constexpr auto* SETTINGS_FILE = "/data/settings/display.properties";
|
||||
constexpr auto* SETTINGS_KEY_ORIENTATION = "orientation";
|
||||
constexpr auto* SETTINGS_KEY_GAMMA_CURVE = "gammaCurve";
|
||||
constexpr auto* SETTINGS_KEY_BACKLIGHT_DUTY = "backlightDuty";
|
||||
constexpr auto* SETTINGS_KEY_TIMEOUT_ENABLED = "backlightTimeoutEnabled";
|
||||
constexpr auto* SETTINGS_KEY_TIMEOUT_MS = "backlightTimeoutMs";
|
||||
|
||||
static Orientation getDefaultOrientation() {
|
||||
auto* display = lv_display_get_default();
|
||||
@@ -90,9 +92,23 @@ bool load(DisplaySettings& settings) {
|
||||
}
|
||||
}
|
||||
|
||||
bool timeout_enabled = true;
|
||||
auto timeout_enabled_entry = map.find(SETTINGS_KEY_TIMEOUT_ENABLED);
|
||||
if (timeout_enabled_entry != map.end()) {
|
||||
timeout_enabled = (timeout_enabled_entry->second == "1" || timeout_enabled_entry->second == "true" || timeout_enabled_entry->second == "True");
|
||||
}
|
||||
|
||||
uint32_t timeout_ms = 60000; // default 60s
|
||||
auto timeout_ms_entry = map.find(SETTINGS_KEY_TIMEOUT_MS);
|
||||
if (timeout_ms_entry != map.end()) {
|
||||
timeout_ms = static_cast<uint32_t>(std::strtoul(timeout_ms_entry->second.c_str(), nullptr, 10));
|
||||
}
|
||||
|
||||
settings.orientation = orientation;
|
||||
settings.gammaCurve = gamma_curve;
|
||||
settings.backlightDuty = backlight_duty;
|
||||
settings.backlightTimeoutEnabled = timeout_enabled;
|
||||
settings.backlightTimeoutMs = timeout_ms;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -101,7 +117,9 @@ DisplaySettings getDefault() {
|
||||
return DisplaySettings {
|
||||
.orientation = getDefaultOrientation(),
|
||||
.gammaCurve = 1,
|
||||
.backlightDuty = 200
|
||||
.backlightDuty = 200,
|
||||
.backlightTimeoutEnabled = true,
|
||||
.backlightTimeoutMs = 60000
|
||||
};
|
||||
}
|
||||
|
||||
@@ -118,6 +136,8 @@ bool save(const DisplaySettings& settings) {
|
||||
map[SETTINGS_KEY_BACKLIGHT_DUTY] = std::to_string(settings.backlightDuty);
|
||||
map[SETTINGS_KEY_GAMMA_CURVE] = std::to_string(settings.gammaCurve);
|
||||
map[SETTINGS_KEY_ORIENTATION] = toString(settings.orientation);
|
||||
map[SETTINGS_KEY_TIMEOUT_ENABLED] = settings.backlightTimeoutEnabled ? "1" : "0";
|
||||
map[SETTINGS_KEY_TIMEOUT_MS] = std::to_string(settings.backlightTimeoutMs);
|
||||
return file::savePropertiesFile(SETTINGS_FILE, map);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user