Commit e3249be 1 parent 5a9f7dd commit e3249be Copy full SHA for e3249be
File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,16 @@ def thermald_thread():
195
195
msg .thermal .freeSpace = avail
196
196
with open ("/sys/class/power_supply/battery/capacity" ) as f :
197
197
msg .thermal .batteryPercent = int (f .read ())
198
+
199
+ #begining of limit charging. read the charging enabled flag in to charging_enabled
200
+ with open ("/sys/class/power_supply/battery/charging_enabled" ) as f :
201
+ charging_enabled = int (f .read ())
202
+ if msg .thermal .batteryPercent > 70 and charging_enabled :
203
+ os .system ("echo 0 > /sys/class/power_supply/battery/charging_enabled" )
204
+ elif msg .thermal .batteryPercent < 67 and not charging_enabled :
205
+ os .system ("echo 1 > /sys/class/power_supply/battery/charging_enabled" )
206
+ #end limit charging
207
+
198
208
with open ("/sys/class/power_supply/battery/status" ) as f :
199
209
msg .thermal .batteryStatus = f .read ().strip ()
200
210
with open ("/sys/class/power_supply/battery/current_now" ) as f :
@@ -262,7 +272,7 @@ def thermald_thread():
262
272
should_start = should_start and msg .thermal .freeSpace > 0.02
263
273
264
274
# require usb power in passive mode
265
- should_start = should_start and (not passive or msg .thermal .usbOnline )
275
+ # should_start = should_start and (not passive or msg.thermal.usbOnline)
266
276
267
277
# confirm we have completed training and aren't uninstalling
268
278
should_start = should_start and accepted_terms and (passive or completed_training ) and (not do_uninstall )
You can’t perform that action at this time.
0 commit comments