Skip to content

Commit 4b2110a

Browse files
committed
Version, Added folding on battery option, Added keep awake option
1 parent 0b5245c commit 4b2110a

File tree

14 files changed

+54
-11
lines changed

14 files changed

+54
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Folding@home Client Changelog
22
=============================
33

4+
## v8.3.2
5+
- Added folding on battery option
6+
- Added keep awake option
7+
48
## v8.3.1
59
- Updated copyrights.
610

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fah-client",
3-
"version": "8.3.1",
3+
"version": "8.3.2",
44
"bin": {
55
"fah-client": "./fah-client"
66
},

src/fah/client/App.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ void App::setState(const string &state) {
286286

287287

288288
bool App::getPaused() const {return getGroups()->getPaused();}
289+
bool App::keepAwake() const {return getGroups()->keepAwake();}
289290

290291

291292
void App::validate(const Certificate &cert,

src/fah/client/App.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ namespace FAH {
128128
void setState(const cb::JSON::Value &msg);
129129
void setState(const std::string &state);
130130
bool getPaused() const;
131+
bool keepAwake() const;
131132

132133
const cb::KeyPair &getKey() const {return key;}
133134
void validate(const cb::Certificate &cert,

src/fah/client/Config.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ void Config::setState(const JSON::Value &msg) {
8585
}
8686

8787

88-
bool Config::getOnIdle() const {return getBoolean("on_idle");}
88+
bool Config::getOnIdle() const {return getBoolean("on_idle");}
89+
bool Config::getOnBattery() const {return getBoolean("on_battery");}
90+
bool Config::getKeepAwake() const {return getBoolean("keep_awake");}
8991

9092

9193
void Config::setPaused(bool paused) {

src/fah/client/Config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ namespace FAH {
5252
void setState(const cb::JSON::Value &msg);
5353

5454
bool getOnIdle() const;
55+
bool getOnBattery() const;
56+
bool getKeepAwake() const;
5557
void setPaused(bool paused);
5658
bool getPaused() const;
5759
bool getFinish() const;

src/fah/client/Group.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ bool Group::waitForIdle() const {
8282
}
8383

8484

85+
bool Group::waitOnBattery() const {
86+
return !config->getOnBattery() && app.getOS().isOnBattery();
87+
}
88+
89+
90+
bool Group::keepAwake() const {return config->getKeepAwake() && isActive();}
91+
92+
8593
bool Group::isActive() const {
8694
for (auto unit: units())
8795
if (!unit->isPaused()) return true;

src/fah/client/Group.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ namespace FAH {
4444
cb::SmartPointer<Config> config;
4545

4646
cb::Event::EventPtr event;
47-
uint32_t failures = 0;
48-
uint64_t waitUntil = 0;
47+
uint32_t failures = 0;
48+
uint64_t waitUntil = 0;
4949

5050
std::function<void ()> shutdownCB;
5151

@@ -103,6 +103,8 @@ namespace FAH {
103103
void setState(const cb::JSON::Value &msg);
104104

105105
bool waitForIdle() const;
106+
bool waitOnBattery() const;
107+
bool keepAwake() const;
106108
bool isActive() const;
107109
bool hasUnrunWUs() const;
108110
void triggerUpdate();

src/fah/client/Groups.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,12 @@ bool Groups::getPaused() const {
130130

131131
return true;
132132
}
133+
134+
135+
bool Groups::keepAwake() const {
136+
for (auto &name: keys())
137+
if (getGroup(name).keepAwake())
138+
return true;
139+
140+
return false;
141+
}

src/fah/client/Groups.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ namespace FAH {
5050
void triggerUpdate();
5151
void setState(const cb::JSON::Value &msg);
5252
bool getPaused() const;
53+
bool keepAwake() const;
5354
};
5455
}
5556
}

0 commit comments

Comments
 (0)