Enhance CrossPointSettings with hotspot scheduler settings and update related serialization methods
This commit is contained in:
@@ -75,10 +75,8 @@ void FileTransferActivity::onEnter() {
|
||||
|
||||
// Launch protocol selection subactivity
|
||||
Serial.printf("[%lu] [FTACT] Launching ProtocolSelectionActivity...\n", millis());
|
||||
enterNewActivity(new ProtocolSelectionActivity(renderer, mappedInput,
|
||||
[this](const FileTransferProtocol protocol) {
|
||||
onProtocolSelected(protocol);
|
||||
}));
|
||||
enterNewActivity(new ProtocolSelectionActivity(
|
||||
renderer, mappedInput, [this](const FileTransferProtocol protocol) { onProtocolSelected(protocol); }));
|
||||
}
|
||||
|
||||
void FileTransferActivity::onExit() {
|
||||
@@ -144,7 +142,8 @@ void FileTransferActivity::onExit() {
|
||||
}
|
||||
|
||||
void FileTransferActivity::onProtocolSelected(const FileTransferProtocol protocol) {
|
||||
Serial.printf("[%lu] [FTACT] Protocol selected: %s\n", millis(), protocol == FileTransferProtocol::HTTP ? "HTTP" : "FTP");
|
||||
Serial.printf("[%lu] [FTACT] Protocol selected: %s\n", millis(),
|
||||
protocol == FileTransferProtocol::HTTP ? "HTTP" : "FTP");
|
||||
|
||||
selectedProtocol = protocol;
|
||||
|
||||
|
||||
@@ -13,7 +13,11 @@ namespace {
|
||||
constexpr int settingsCount = 16;
|
||||
const SettingInfo settingsList[settingsCount] = {
|
||||
// Should match with SLEEP_SCREEN_MODE
|
||||
{"Sleep Screen", SettingType::ENUM, &CrossPointSettings::sleepScreen, nullptr, {"Dark", "Light", "Custom", "Cover"}},
|
||||
{"Sleep Screen",
|
||||
SettingType::ENUM,
|
||||
&CrossPointSettings::sleepScreen,
|
||||
nullptr,
|
||||
{"Dark", "Light", "Custom", "Cover"}},
|
||||
{"Status Bar", SettingType::ENUM, &CrossPointSettings::statusBar, nullptr, {"None", "No Progress", "Full"}},
|
||||
{"Extra Paragraph Spacing", SettingType::TOGGLE, &CrossPointSettings::extraParagraphSpacing, nullptr, {}},
|
||||
{"Short Power Button Click", SettingType::TOGGLE, &CrossPointSettings::shortPwrBtn, nullptr, {}},
|
||||
@@ -37,7 +41,11 @@ const SettingInfo settingsList[settingsCount] = {
|
||||
&CrossPointSettings::fontFamily,
|
||||
nullptr,
|
||||
{"Bookerly", "Noto Sans", "Open Dyslexic"}},
|
||||
{"Reader Font Size", SettingType::ENUM, &CrossPointSettings::fontSize, nullptr, {"Small", "Medium", "Large", "X Large"}},
|
||||
{"Reader Font Size",
|
||||
SettingType::ENUM,
|
||||
&CrossPointSettings::fontSize,
|
||||
nullptr,
|
||||
{"Small", "Medium", "Large", "X Large"}},
|
||||
{"Reader Line Spacing", SettingType::ENUM, &CrossPointSettings::lineSpacing, nullptr, {"Tight", "Normal", "Wide"}},
|
||||
{"Reader Paragraph Alignment",
|
||||
SettingType::ENUM,
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
class CrossPointSettings;
|
||||
|
||||
enum class SettingType { TOGGLE, ENUM, ACTION, TEXT };
|
||||
enum class SettingType { TOGGLE, ENUM, ACTION, TEXT, VALUE };
|
||||
|
||||
// Structure to hold setting information
|
||||
struct SettingInfo {
|
||||
const char* name; // Display name of the setting
|
||||
SettingType type; // Type of setting
|
||||
uint8_t CrossPointSettings::* valuePtr; // Pointer to member in CrossPointSettings (for TOGGLE/ENUM)
|
||||
const char* name; // Display name of the setting
|
||||
SettingType type; // Type of setting
|
||||
uint8_t CrossPointSettings::* valuePtr; // Pointer to member in CrossPointSettings (for TOGGLE/ENUM)
|
||||
std::string CrossPointSettings::* stringValuePtr; // Pointer to string member (for TEXT)
|
||||
std::vector<std::string> enumValues;
|
||||
|
||||
@@ -31,17 +31,19 @@ struct SettingInfo {
|
||||
|
||||
// Static constructors
|
||||
static SettingInfo Toggle(const char* name, uint8_t CrossPointSettings::* ptr) {
|
||||
return {name, SettingType::TOGGLE, ptr};
|
||||
return {name, SettingType::TOGGLE, ptr, nullptr, {}, {0, 0, 0}};
|
||||
}
|
||||
|
||||
static SettingInfo Enum(const char* name, uint8_t CrossPointSettings::* ptr, std::vector<std::string> values) {
|
||||
return {name, SettingType::ENUM, ptr, std::move(values)};
|
||||
return {name, SettingType::ENUM, ptr, nullptr, std::move(values), {0, 0, 0}};
|
||||
}
|
||||
|
||||
static SettingInfo Action(const char* name) { return {name, SettingType::ACTION, nullptr}; }
|
||||
static SettingInfo Action(const char* name) {
|
||||
return {name, SettingType::ACTION, nullptr, nullptr, {}, {0, 0, 0}};
|
||||
}
|
||||
|
||||
static SettingInfo Value(const char* name, uint8_t CrossPointSettings::* ptr, const ValueRange valueRange) {
|
||||
return {name, SettingType::VALUE, ptr, {}, valueRange};
|
||||
return {name, SettingType::VALUE, ptr, nullptr, {}, valueRange};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user