Added new data to save to flash and new accessor functions, work is still in progress !

This commit is contained in:
anschrammh 2023-04-20 13:15:15 +02:00
parent ef0abe0ab7
commit 17d8c9949d
2 changed files with 46 additions and 18 deletions

View File

@ -31,8 +31,8 @@ static const WatchSettings_t defaultWatchSettings =
.notification = {
.notification_vibration_duration = 3,
.notification_vibration_strength = 6,
.vibrate_on_email = true,
.vibrate_on_sms = true,
.notification_vibrate_on_email = true,
.notification_vibrate_on_sms = true,
},
.connectivity = {
.connectivity_ble_enabled = false,
@ -93,7 +93,7 @@ void watch_settings_display_set_orientation(LCDOrientation_e orientation)
_params_changed = true;
}
void watch_settings_display_set_wrist_wakeup(bool wakeup)
void watch_settings_display_wrist_wakeup_enabled(bool wakeup)
{
watchSettings.display.display_wrist_wakeup = wakeup;
_params_changed = true;
@ -141,8 +141,11 @@ void watch_settings_language_and_UI_set_language(TranslationLanguage_e language)
_params_changed = true;
}
void watch_settings_activity_step_counter_enabled(bool enabled)
{
watchSettings.activity.activity_step_counter_en = enabled;
_params_changed = true;
}
void persistency_init(void)
{

View File

@ -6,13 +6,13 @@
#include "translation.h"
/**
* @brief The address in flash storage where the settings are saved
* @brief The address in flash storage where the settings are saved.
*
*/
#define WATCH_SETTINGS_FLASH_STORAGE_ADDRESS (0x1E0000)
/**
* @brief Time and Date Settings
* @brief Time and Date Settings.
*
*/
typedef struct TimeAndDate
@ -23,7 +23,7 @@ typedef struct TimeAndDate
} TimeAndDate_t;
/**
* @brief Display Settings
* @brief Display Settings.
*
*/
typedef struct Display
@ -37,28 +37,28 @@ typedef struct Display
} Display_t;
/**
* @brief Activity settings
* @brief Activity settings.
*
*/
typedef struct Activity
{
uint32_t activity_step_counter_en:1;
uint32_t activity_step_counter_en:1; // Not yet used
} Activity_t;
/**
* @brief Notification Settings
* @brief Notification Settings.
*
*/
typedef struct Notification
{
uint32_t vibrate_on_sms:1,
vibrate_on_email:1,
uint32_t notification_vibrate_on_sms:1,
notification_vibrate_on_email:1,
notification_vibration_strength:3,
notification_vibration_duration:3;
} Notification_t;
/**
* @brief Connectivity Settings
* @brief Connectivity Settings.
*
*/
typedef struct Connectivity
@ -68,9 +68,9 @@ typedef struct Connectivity
} Connectivity_t;
/**
* @brief Language and UI Settings
* @brief Language and UI Settings.
*
* @note Languages : English, French and German will be available
* @note Languages : English, French and German will be available.
*
*/
typedef struct LanguageAndUI
@ -79,7 +79,24 @@ typedef struct LanguageAndUI
} LanguageAndUI_t;
/**
* @brief Main setting structure
* @brief Watch sensor calibration data if there are any.
*
* @note For the moment, only the magnetometer have some.
*
*/
typedef struct SensorCalibrationData
{
int16_t sensor_calibration_data_magnetometer_x_min;
int16_t sensor_calibration_data_magnetometer_x_max;
int16_t sensor_calibration_data_magnetometer_y_min;
int16_t sensor_calibration_data_magnetometer_y_max;
int16_t sensor_calibration_data_magnetometer_z_min;
int16_t sensor_calibration_data_magnetometer_z_max;
float sensor_calibration_data_magnetometer_temperature_offset;
} SensorCalibrationData_t;
/**
* @brief Main setting structure.
*
*/
typedef struct WatchSettings
@ -91,6 +108,7 @@ typedef struct WatchSettings
Connectivity_t connectivity;
LanguageAndUI_t languageAndUI;
Activity_t activity;
SensorCalibrationData_t sensorCalibrationData;
} WatchSettings_t;
/**
@ -140,7 +158,7 @@ void watch_settings_display_set_orientation(LCDOrientation_e orientation);
*
* @param wakeup
*/
void watch_settings_display_set_wrist_wakeup(bool wakeup);
void watch_settings_display_wrist_wakeup_enabled(bool wakeup);
/**
* @brief
@ -191,6 +209,13 @@ void watch_settings_connectivity_set_wifi_enabled(bool enabled);
*/
void watch_settings_language_and_UI_set_language(TranslationLanguage_e language);
/**
* @brief
*
* @param enabled
*/
void watch_settings_activity_step_counter_enabled(bool enabled);
/**