lich4 / ChargeLimiter

Charge limiter for iOS, inspired by AlDente
GNU General Public License v3.0
709 stars 36 forks source link

介绍

  ChargeLimiter(CL)是针对iOS开发的AlDente替代工具,适用于长时间过充情况下保护电池健康度.
  支持有根越狱(???-arm.deb)/无根越狱(???-arm64.deb )/巨魔(???.tipa),目前支持iOS12-17.0(注意: 巨魔环境下安装新版之前请先卸载旧版)   测试过的环境: iPhone6/7+iOS12/13 Checkra1n/Unc0ver/Odyssey; iPhone7/X/11+iOS15/16 Palera1n/Dopamine/TrollStore.
  v1.4.1功能可以满足大多数用户需求,v1.5兼容不支持停充的电池,v1.6兼容充电电流过大的电池, v1.7兼容SBC
  CL是开放式项目,如果有兴趣参与或者对CL有建议的的欢迎参提交代码.
  CL纯属偶然兴趣而开发,CL的完美运行强依赖软硬件环境, 作者没有义务保证每个人都完美使用. 如果你的软硬件环境不兼容则不建议使用.
  CL承诺永久免费且无广告,但因为使用CL导致系统或硬件方面的影响(或认为会有影响的)作者不负任何责任,用户使用CL即为默认同意本条款.

已知BUG

常见问题

什么情况下需要用CL?

CL更费电吗?

CL支持第三方电池吗?

使用CL后能增加健康度吗?

为什么手机无法停充或恢复充电?(小白经常遇到的问题)

我的电池&小板硬件是否支持CL停充?

CL(及类似功能的软件)可以不依赖越狱或巨魔类工具吗?

夏天怎样降低电池温度?

怎样使用电池最好?

遇到问题时如何自行诊断?

如何找到耗电应用?

测试电池兼容性

  在使用CL前需要测试电池兼容性,如果不支持请放弃使用

品牌新电池激活

  电池保养官方文档: https://www.apple.com.cn/batteries/maximizing-performance/。电池激活是指电池刚出厂后需要采取正确方式,排除虚电并激发电池中全部的锂离子活性。建议咨询电池卖家或电池厂商获取正确激活方式,否则可能导致CL无法正常工作,常见品牌已整理在此

充电宝兼容性

  CL可以和充电宝配合使用,停充模式下充电宝优先为手机供电,充电宝电量耗尽后再由手机电池供电,对长途旅行的用户更为有意义,充电宝的容量性价比也远高于手机电池。注意:

使用前必看

使用说明

名词解释

启用

  设置全局启用,关闭后CL将恢复充电状态,并处于观察者模式,只读取电池信息,不进行任何操作.

悬浮窗

模式

  插电即充模式适合随用随充的普通用户使用:

  边缘触发模式适合手机常年连电源的工作室使用:

  触发优先级从高到低:

更新频率

阈值设定

行为

  用于控制触发充电和停充时的行为,目前仅支持系统通知,每次重装CL需要重选以生效.

高级

注意:

电池信息

历史统计

  统计图用于查看一段时间内的电池状态,左右滑动可时移,点击上方标签可显示或隐藏特定指标

快捷指令

(适用于某些巨魔用户存在服务被杀导致软件失效的情况):
+新建快捷指令 - 添加操作 - 类别 - "网页" - "Safari浏览器" - "打开URL"(以下是URL内容,标题自己设置)

注意:

集成快捷指令(iOS16+): https://www.icloud.com/shortcuts/2ec3aed94f414378918f3e082b7bf6b0

HTTP接口(可配合快捷指令)

curl http://localhost:1230 -d '{"api":"get_conf","key":"enable"}' -H "content-type:application/json"
=> {"status":0,"data":true}
类型 描述
enable 布尔 关闭后CL将处于观察者模式,只读取电池信息,不进行任何操作
floatwnd 布尔 开启悬浮窗
floatwnd_auto 布尔 悬浮窗自动隐藏
mode 字符串 模式,charge_on_plug为插电即充,edge_trigger为边缘触发
charge_below 整型 电量最小值
charge_above 整型 电量最大值
enable_temp 布尔 温控开关
charge_temp_above 整型 温度最小值
charge_temp_below 整型 温度最大值
acc_charge 布尔 加速充电开关
acc_charge_airmode 布尔 飞行模式
acc_charge_wifi 布尔 WiFi
acc_charge_blue 布尔 蓝牙
acc_charge_bright 布尔 亮度
acc_charge_lpm 布尔 低电量模式
action 字符串 触发行为,noti为系统通知
adv_prefer_smart 布尔 开启SmartBattery
adv_predictive_inhibit_charge 布尔 开启智能停充
adv_disable_inflow 布尔 开启禁流
adv_limit_inflow 布尔 开启限流
adv_limit_inflow_mode 字符串 限流模拟高温等级,off/nominal/light/moderate/heavy
adv_def_thermal_mode 字符串 默认模拟高温等级,off/nominal/light/moderate/heavy
adv_thermal_mode_lock 布尔 模拟高温等级锁定
thermal_simulate_mode 字符串 实际温度模拟等级(只读)
ppm_simulate_mode 字符串 (实际)峰值性能等级
use_smart 布尔 是否支持SmartBattery(只读)
请求 类型 描述
api 字符串 get_conf
key 字符串 全局参数,若不指定则返回所有配置
响应
status 整型 0:成功
data 数据
请求 类型 描述
api 字符串 set_conf
key 字符串 全局参数
val
响应
status 整型 0:成功
data 数据
请求 类型 描述
api 字符串 get_bat_info
响应
status 整型 0:成功
data 数据
类型 描述
Amperage 整型 电流(mA)
AppleRawCurrentCapacity 整型 原始电量(mAh)
BatteryInstalled 布尔 电池已安装(mV)
BootVoltage 整型 启动电压(mV)
CurrentCapacity 整型 电量(%)
CycleCount 整型 循环数
DesignCapacity 整型 设计容量(mAh)
ExternalChargeCapable 布尔 电源可充电
ExternalConnected 布尔 电源已连接
InstantAmperage 整型 瞬时电流(mA)
IsCharging 布尔 正在充电
NominalChargeCapacity 整型 实际容量(mAh)
Serial 字符串 序列号
Temperature 整型 温度(℃/100)
UpdateTime 整型 更新时间
AdapterDetails.Voltage 整型 电压(mV)
AdapterDetails.Current 整型 电源电流(mA)
AdapterDetails.Description 整型 电源描述
AdapterDetails.IsWireless 整型 是否无线(需结合电源描述)
AdapterDetails.Manufacturer 整型 电源厂商
AdapterDetails.Name 整型 电源名称
AdapterDetails.Voltage 整型 电源电压(mV)
AdapterDetails.Watts 整型 电源功率(W)
请求 类型 描述
api 字符串 set_charge_status
flag 布尔 启用
响应
status 整型 0:成功
请求 类型 描述
api 字符串 set_inflow_status
flag 布尔 启用
响应
status 整型 0:成功

下载地址:(https://github.com/lich4/ChargeLimiter/releases)
交流QQ群:669869453

编译

  使用XCode/Theos编译, 需要Theos+MonkeyDev

  增加新语言: 修改www/lang.json www/help_en.md并提交到github或我这.

感谢

Introduction

ChargeLimiter(CL) is inspired by MacOS version AlDente, used to prevent iDevice from getting overcharged, which will cause damage to the battery.

Support Rootful Jailbreak(???-arm.deb)/Rootless Jailbreak(???-arm64.deb)/TrollStore(???.tipa). Currently support iOS12-17.0(Notice: For TrollStore, Please uninstall older version CL before installing a newer one)

Tested on iPhone6/7+iOS12/13 Checkra1n/Unc0ver/Odyssey; iPhone7/X/11+iOS15/16 Palera1n/Dopamine/TrollStore.

v1.4.1 is for most users; v1.5 is for batteries not support ChargeInhibit; v1.6 is for batteries with too large amperage during charging.

This project is opensourced, any better ideas, submit code directly; any suggestions, submit to issue region. This software will be opensourced, free, without ads forever. Author is not responsible for any impact on iOS system or hardware caused by this software.

Known issues

FAQ

Why should I use CL?

Does CL consume more power?

Does CL support 3rd party battery?

Will the battery health percentage increase after using CL for a period of time?

Why does my iDevice unable to charge or discharge(Most questions from freshman)?

Is it possible to install CL without Jailbreak or TrollStore(-like) environment?

How to cool down the battery in summer?

What is the best way to keep the battery healthy?

How can I debug CL myself when sth. goes wrong?

How to find out power killer App with CL?

Compatibility

Please test battery compatibility before using CL, stop and uninstall CL if unsupported

Battery activation

Official document: https://www.apple.com.cn/batteries/maximizing-performance/

Compatibility with battery banks

CL can be used together with a power bank. iDevice will be powered by the power bank in the first place in ChargeInhibit mode, and the battery of iDevice will supply power after the power bank running out of power. This is meaningful for users who plans to make a long journey, and power bank have more capacity and lower price than battery. Notice:

Notice

Instruction

Terms

"Enable" button

Enable or disable CL globally. CL will become an readonly observer if disabled, and shows battery information only.

Floating window

Mode

"Plug and charge" mode is for individual, charge and discharge at any time, triggers as follows:

"Edge trigger" mode is for developer & studio, with iDevice always connecting to an power source, triggers as follows:

triggers precedence from high to low:

Update frequency

The thresholds

Action

Action on trigger start/stop charging. Please reset it after reinstalling/updating CL.

Advanced

Battery Information

History

  Show battery status for a period of time, slide horizontally to shift time, and click the legend to hide or show specific source.

For Shortcuts.app

New Shortcut - Add Action - Web - Safari - Open URLs

Integrated shortcut(iOS16+): https://www.icloud.com/shortcuts/2ec3aed94f414378918f3e082b7bf6b0

HTTP Interface

curl http://localhost:1230 -d '{"api":"get_conf","key":"enable"}' -H "content-type:application/json"
=> {"status":0,"data":true}
key type description
enable boolean CL will become an readonly observer if disabled, and shows battery information only
floatwnd boolean Floating window
floatwnd_auto boolean Floating window auto hide
mode string Mode,"charge_on_plug" or "edge_trigger"
charge_below integer Capacity threshold
charge_above integer Capacity threshold
enable_temp boolean Temperature control
charge_temp_above integer Temperature threshold
charge_temp_below integer Temperature threshold
acc_charge boolean Speedup charging
acc_charge_airmode boolean Airplane mode
acc_charge_wifi boolean WiFi
acc_charge_blue boolean Bluetooth
acc_charge_bright boolean Brightness
acc_charge_lpm boolean LPM
action string Action on trigger, "noti" to use system notification
adv_prefer_smart boolean Use SmartBattery
adv_predictive_inhibit_charge boolean Use predictive inhibit charge
adv_disable_inflow boolean Auto inhibit inflow
adv_limit_inflow boolean Auto limit inflow
adv_limit_inflow_mode string Auto limit inflow with thermal simulation level,off/nominal/light/moderate/heavy
adv_def_thermal_mode string Default thermal simulation level,off/nominal/light/moderate/heavy
adv_thermal_mode_lock boolean Lock thermal simulation level
thermal_simulate_mode string Actual thermal simulation level(readonly)
ppm_simulate_mode string Actual Peak power performance level
use_smart boolean SmartBattery available(readonly)
request type description
api string get_conf
key string return all conf if unspecified
response
status integer 0:success
data data
request type description
api string set_conf
key string Global configuration fields
val data
response
status integer 0:success
data data
request type description
api string get_bat_info
response
status integer 0:成功
data 数据
key type description
Amperage integer (mA)
AppleRawCurrentCapacity integer (mAh)
BatteryInstalled boolean (mV)
BootVoltage integer (mV)
CurrentCapacity integer (%)
CycleCount integer
DesignCapacity integer (mAh)
ExternalChargeCapable boolean
ExternalConnected boolean
InstantAmperage integer (mA)
IsCharging boolean
NominalChargeCapacity integer (mAh)
Serial string
Temperature integer (℃/100)
UpdateTime integer
AdapterDetails.Voltage integer (mV)
AdapterDetails.Current integer (mA)
AdapterDetails.Description integer
AdapterDetails.IsWireless integer
AdapterDetails.Manufacturer integer
AdapterDetails.Name integer
AdapterDetails.Voltage integer (mV)
AdapterDetails.Watts integer (W)
request type description
api string set_charge_status
flag boolean enable
response
status integer 0:success
request type description
api string set_inflow_status
flag boolean enable
response
status integer 0:success

If you have better ideas, please join the project and push your code
Download URL:(https://github.com/lich4/ChargeLimiter/releases)
Telegram group:
https://t.me/chargelimiter

Compile

XCode+MonkeyDev or Theos

Add new language: modify www/lang.json www/help_en.md and submit to github or to me.

Special Thanks