Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stopwatch: allow sleep #2048

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/displayapp/screens/StopWatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "displayapp/screens/Symbols.h"
#include "displayapp/InfiniTimeTheme.h"

#include "systemtask/SystemTask.h"

using namespace Pinetime::Applications::Screens;

namespace {
Expand Down Expand Up @@ -34,7 +36,7 @@ namespace {
constexpr TickType_t blinkInterval = pdMS_TO_TICKS(1000);
}

StopWatch::StopWatch(System::SystemTask& systemTask) : wakeLock(systemTask) {
StopWatch::StopWatch() {
static constexpr uint8_t btnWidth = 115;
static constexpr uint8_t btnHeight = 80;
btnPlayPause = lv_btn_create(lv_scr_act(), nullptr);
Expand Down Expand Up @@ -134,7 +136,6 @@ void StopWatch::Start() {
SetInterfaceRunning();
startTime = xTaskGetTickCount();
currentState = States::Running;
wakeLock.Lock();
}

void StopWatch::Pause() {
Expand All @@ -144,7 +145,6 @@ void StopWatch::Pause() {
oldTimeElapsed = laps[lapsDone];
blinkTime = xTaskGetTickCount() + blinkInterval;
currentState = States::Halted;
wakeLock.Release();
}

void StopWatch::Refresh() {
Expand Down
7 changes: 2 additions & 5 deletions src/displayapp/screens/StopWatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include <FreeRTOS.h>
#include "portmacro_cmsis.h"

#include "systemtask/SystemTask.h"
#include "systemtask/WakeLock.h"
#include "displayapp/apps/Apps.h"
#include "displayapp/Controllers.h"
#include "Symbols.h"
Expand All @@ -27,7 +25,7 @@ namespace Pinetime {

class StopWatch : public Screen {
public:
explicit StopWatch(System::SystemTask& systemTask);
explicit StopWatch();
~StopWatch() override;
void Refresh() override;

Expand All @@ -44,7 +42,6 @@ namespace Pinetime {
void Start();
void Pause();

Pinetime::System::WakeLock wakeLock;
States currentState = States::Init;
TickType_t startTime;
TickType_t oldTimeElapsed = 0;
Expand All @@ -67,7 +64,7 @@ namespace Pinetime {
static constexpr const char* icon = Screens::Symbols::stopWatch;

static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::StopWatch(*controllers.systemTask);
return new Screens::StopWatch();
};
};
}
Expand Down