57b3397078
* Allow multiple wakeup modes at the same time. This commit adds multiple wakeup modes support. It does so by storing them as a uint8_t bitfield enum. It changes the following functions: Since multiple modes can be on now, older version would not cut it: WakeUpMode getWakeupMode() -> std::bitset<3> getWakeUpModes() Where each bit corresponds to a WakeUpMode We still need a way to check whether a specific wakeup mode is on, so: bool isWakeUpModeOn(const WakeUpMode mode) This function was changed to work correctly with the new implementation. setWakeUpMode(WakeupMode mode, bool enable) Previously, systemtask would exit SystemTask::OnTouchEvent() if the wake up mode was None or RaiseWrist, to prevent waking up when a touch was received. However, after enabling using multiple WakeUpModes, this caused a bug where when RaiseWrist was checked with SingleTap or DoubleTap, the tap detection wouldn't work. This commit fixes that bug. Next commit will update the settings WakeUpMode select UI to reflect these changes. Signed-off-by: Kozova1 <mug66kk@gmail.com> * Updated UI to reflect multiple WakeUp sources being available. Signed-off-by: Kozova1 <mug66kk@gmail.com>
34 lines
933 B
C++
34 lines
933 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <lvgl/lvgl.h>
|
|
#include "components/settings/Settings.h"
|
|
#include "displayapp/screens/Screen.h"
|
|
|
|
namespace Pinetime {
|
|
|
|
namespace Applications {
|
|
namespace Screens {
|
|
|
|
class SettingWakeUp : public Screen {
|
|
public:
|
|
SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
|
|
~SettingWakeUp() override;
|
|
|
|
bool Refresh() override;
|
|
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
|
|
|
private:
|
|
Controllers::Settings& settingsController;
|
|
uint8_t optionsTotal;
|
|
lv_obj_t* cbOption[4];
|
|
// When UpdateSelected is called, it uses lv_checkbox_set_checked,
|
|
// which can cause extra events to be fired,
|
|
// which might trigger UpdateSelected again, causing a loop.
|
|
// This variable is used as a mutex to prevent that.
|
|
bool ignoringEvents;
|
|
};
|
|
}
|
|
}
|
|
}
|