Refactor image rendering and add Bluetooth setting

- Added logic to render images only in BW mode in Page.cpp.
- Implemented getRenderMode() in GfxRenderer.h.
- Increased SETTINGS_COUNT and added bluetoothEnabled field in CrossPointSettings.
- Updated saveToFile and loadFromFile methods to handle the new Bluetooth setting.
- Added Bluetooth toggle in SettingsActivity.
This commit is contained in:
altsysrq
2025-12-30 21:25:33 -06:00
parent 9db4ef6f4b
commit 1f2380be56
8 changed files with 291 additions and 3 deletions

View File

@@ -12,7 +12,7 @@ CrossPointSettings CrossPointSettings::instance;
namespace {
constexpr uint8_t SETTINGS_FILE_VERSION = 1;
// Increment this when adding new persisted settings fields
constexpr uint8_t SETTINGS_COUNT = 10;
constexpr uint8_t SETTINGS_COUNT = 11;
constexpr char SETTINGS_FILE[] = "/.crosspoint/settings.bin";
} // namespace
@@ -37,6 +37,7 @@ bool CrossPointSettings::saveToFile() const {
serialization::writePod(outputFile, fontFamily);
serialization::writePod(outputFile, fontSize);
serialization::writePod(outputFile, lineSpacing);
serialization::writePod(outputFile, bluetoothEnabled);
outputFile.close();
Serial.printf("[%lu] [CPS] Settings saved to file\n", millis());
@@ -83,6 +84,8 @@ bool CrossPointSettings::loadFromFile() {
if (++settingsRead >= fileSettingsCount) break;
serialization::readPod(inputFile, lineSpacing);
if (++settingsRead >= fileSettingsCount) break;
serialization::readPod(inputFile, bluetoothEnabled);
if (++settingsRead >= fileSettingsCount) break;
} while (false);
inputFile.close();