Skip to content

Commit

Permalink
add new setting field
Browse files Browse the repository at this point in the history
  • Loading branch information
solosky committed Aug 21, 2024
1 parent 9ca92f9 commit f98a3b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions fw/application/src/mod/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#ifdef OLED_SCREEN
// Though OLED doesn't necessarily imply rechargeable battery, it's usually the case.
#define DEFAULT_BAT_MODE 1
#else // !OLED_SCREEN
#else // !OLED_SCREEN
#define DEFAULT_BAT_MODE 0
#endif // OLED_SCREEN
#endif // OLED_SCREEN

const settings_data_t def_settings_data = {.backlight = 0,
.oled_contrast = 40,
Expand All @@ -26,7 +26,8 @@ const settings_data_t def_settings_data = {.backlight = 0,
.show_mem_usage = false,
.anim_enabled = false,
.amiidb_data_slot_num = 20,
.qrcode_enabled = true};
.qrcode_enabled = true,
.chameleon_freq_slot_index = INVALID_SLOT_INDEX};

settings_data_t m_settings_data = {0};

Expand Down Expand Up @@ -63,6 +64,7 @@ static void validate_settings() {
BOOL_VALIDATE(m_settings_data.qrcode_enabled, 0);
INT8_VALIDATE(m_settings_data.language, 0, LANGUAGE_COUNT - 1, LANGUAGE_EN_US);
INT8_VALIDATE(m_settings_data.amiidb_data_slot_num, 1, 100, 20);
INT8_VALIDATE(m_settings_data.chameleon_freq_slot_index, 0, 8, INVALID_SLOT_INDEX);
}

int32_t settings_init() {
Expand Down
7 changes: 5 additions & 2 deletions fw/application/src/mod/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
#include "app_amiibolink.h"
#include "i18n/language.h"

#define INVALID_SLOT_INDEX 0xFF

typedef struct {
bool backlight; //deprecated, keep for capability issue
bool backlight; // deprecated, keep for capability issue
uint8_t sleep_timeout_sec;
bool dirty;
bool auto_gen_amiibo;
bool auto_gen_amiibolink; //deprecated, keep for capability issue
bool auto_gen_amiibolink; // deprecated, keep for capability issue
bool skip_driver_select;
bool bat_mode;
ble_amiibolink_ver_t amiibo_link_ver;
Expand All @@ -24,6 +26,7 @@ typedef struct {
bool qrcode_enabled;
Language language;
uint8_t amiidb_data_slot_num;
uint8_t chameleon_freq_slot_index;
} settings_data_t;

int32_t settings_init();
Expand Down

0 comments on commit f98a3b0

Please sign in to comment.