Add settings item

This commit is contained in:
Finlay Davidson 2021-11-12 01:48:04 +01:00
parent 943589d998
commit a6d9028f86
3 changed files with 18 additions and 6 deletions

View File

@ -16,6 +16,7 @@ namespace Pinetime {
DoubleTap = 1,
RaiseWrist = 2,
Shake = 3,
LowerWrist = 4
};
enum class Colors : uint8_t {
White,
@ -172,7 +173,7 @@ namespace Pinetime {
}
};
std::bitset<4> getWakeUpModes() const {
std::bitset<5> getWakeUpModes() const {
return settings.wakeUpMode;
}
@ -227,8 +228,9 @@ namespace Pinetime {
PineTimeStyle PTS;
std::bitset<4> wakeUpMode {0};
std::bitset<5> wakeUpMode {0};
uint16_t shakeWakeThreshold = 150;
Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium;
};

View File

@ -24,9 +24,9 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::
lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
lv_obj_set_style_local_border_width(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0);
lv_obj_set_pos(container1, 10, 60);
lv_obj_set_pos(container1, 10, 35);
lv_obj_set_width(container1, LV_HOR_RES - 20);
lv_obj_set_height(container1, LV_VER_RES - 50);
lv_obj_set_height(container1, LV_VER_RES - 20);
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
@ -73,6 +73,14 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " Lower Wrist");
cbOption[optionsTotal]->user_data = this;
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::LowerWrist)) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
}
SettingWakeUp::~SettingWakeUp() {

View File

@ -503,8 +503,10 @@ void SystemTask::UpdateMotion() {
motionController.Should_ShakeWake(settingsController.GetShakeThreshold())) {
GoToRunning();
}
if (motionController.ShouldSleep(isSleeping))
PushMessage(Messages::GoToSleep);
if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::LowerWrist)) {
if (motionController.ShouldSleep(isSleeping))
PushMessage(Messages::GoToSleep);
}
}
void SystemTask::HandleButtonAction(Controllers::ButtonActions action) {