Charging Optimization

Developed by @user244945

Dls
Ver
v14
Size
0.44 MB
Date
13 Aug 2026
charging-optimization.md

Charge Turbo Module

A charge control and thermal management module for rooted Android devices. The module ID is turbo-charge. This repository is continuously maintained based on the original project, adding features such as three-stage temperature control, charge-stop based on battery level, bypass charging, Meizu device adaptation, expanded thermal control paths, and a WebUI.

[!CAUTION]
This module modifies /sys charging nodes and may stop or bypass certain system thermal control policies. Incorrect configuration can result in device overheating, battery life degradation, charging anomalies, reboots, or hardware damage. Use at your own risk.

Project Origin and Attribution

This project retains and acknowledges the following upstream work:

  • chase535/turbo-charge: The original base project, authored by Coolapk user @Nuojiya.
  • Coolapk user @MisakaThepoor: For the thermal control removal solution and related detection/mounting concepts.
  • @tanxue0118 / A Dreaming Cat: Current repository maintenance and secondary development.

When citing, modifying, or distributing this project, please retain the upstream sources, author, and contributor statements, and comply with the AGPL-3.0-only license.

Main Features

Charging and Battery Level Control

  • Automatically scans for writable charging current, charging pause, and step charging nodes on the device.
  • Allows setting the maximum charging current and toggling step charging off.
  • Monitors the configuration file via inotify, allowing on-the-fly reloading after modifications.
  • Battery level control uses hysteresis logic: it triggers upon reaching CHARGE_STOP and recovers when dropping to CHARGE_START, preventing frequent toggling around a single threshold.
  • Upon reaching the target battery level, you can choose to stop charging entirely or request bypass charging.

Bypass Charging

Bypass charging can be triggered by battery level thresholds or specific foreground applications:

  1. Prioritizes probing standard power_supply interfaces and dedicated nodes containing "bypass" in their name.
  2. Verifies if the node genuinely takes effect by writing the hardware bypass value and then re-reading it.
  3. Saves the node's original value before enabling, and attempts to restore it when exiting bypass, unplugging the power source, or terminating the process.
  4. If the device lacks a verifiable hardware bypass node but has a current control node, it falls back to a 500000 μA (500 mA) compatibility mode.
  5. Logs an entry if neither hardware bypass nor compatibility mode is available, and retries probing in subsequent loops.

Note: The 500 mA compatibility mode is merely a low-current power supply solution and is not equivalent to a true hardware bypass. Whether the charger can directly handle the system load depends on the device kernel, charging IC, and the manufacturer's driver implementation.

Once BYPASS_CHARGE=1 is enabled, you can add application package names (one per line) in bypass_charge.txt. Bypass is requested when the target application is in the foreground and the screen is on; it restores the original state upon leaving the app, turning off the screen, unplugging the power source, or disabling the feature.

Three-Stage Temperature Control

  • Stage 1: Implements mild current limiting using TEMP_LEVEL1_CURRENT when the temperature reaches TEMP_LEVEL1.
  • Stage 2: Implements further current limiting using TEMP_LEVEL2_CURRENT when the temperature reaches TEMP_LEVEL2.
  • Stage 3: Stops charging entirely when the temperature reaches TEMP_MAX.
  • Restores the charging state as the temperature drops, preventing frequent toggling caused by a single high-temperature threshold.

Thermal Control Path Mounting

  • Uses bind mount to map placeholder files within the module to the system's thermal configuration paths.
  • Currently, module/thermal_files includes 487 thermal-related paths covering locations like system, vendor, product, and system_ext.
  • Supports recursive scanning and mounting up to a limit of 1024 paths, while retaining compatibility paths for older devices.
  • Offers the choice of global mounting or mounting only while charging.

Other Features

  • Battery temperature simulation, which can be applied globally or only while charging.
  • Meizu device adaptation, supporting the Flyme clearing solution and the extremegt relaxation solution.
  • Thermal service handling for OPPO, realme, and OnePlus, plus Xiaomi cloud control directory management.
  • A WebUI that displays real-time battery level, temperature, current, power, and operation logs, and allows editing of module configurations.

Common paths after installation:

Configuration File: /data/adb/modules/turbo-charge/option.txt
Bypass List:        /data/adb/modules/turbo-charge/bypass_charge.txt
Runtime Log:        /data/adb/modules/turbo-charge/log.txt
Main Executable:    /data/adb/modules/turbo-charge/bin/turbo-charge

Main Configurations

Configuration ItemDescriptionDefault Value
CYCLE_TIMEMain loop interval, in seconds1
CURRENT_MAXMaximum charging current, in μA50000000
STEP_CHARGING_DISABLEDToggle to disable step charging0
TEMP_CTRLToggle to enable three-stage temperature control1
TEMP_LEVEL1Stage 1 temperature threshold, in Celsius45
TEMP_LEVEL1_CURRENTStage 1 current limit, in μA3000000
TEMP_LEVEL2Stage 2 temperature threshold, in Celsius50
TEMP_LEVEL2_CURRENTStage 2 current limit, in μA1000000
TEMP_MAXStage 3 high-temp charge-stop threshold, in Celsius52
POWER_CTRLToggle to enable battery level control0
CHARGE_STOPBattery level threshold to stop charging or enter bypass95
CHARGE_STARTBattery level threshold to resume charging or exit bypass80
POWER_CTRL_MODE0 for stop charging, 1 for bypass charging0
BYPASS_CHARGEToggle to enable foreground app bypass0
TEMP_SIMULATEToggle to enable battery temperature simulation0
THERMAL_MOUNT_MODE0 for global mount, 1 for mount during charging only0
MEIZU_DEVICEToggle to enable Meizu device adaptation0

For the full configuration and comments, refer to module/option.txt.

Execution Flow

  1. module/service.sh waits for Android boot completion and finishes vendor-specific initialization.
  2. Starts module/bin/turbo-charge, writing standard output and error output to log.txt.
  3. The main program reads the configuration, scans device nodes, and starts the configuration listener and control loop.
  4. Executes current control, charge-stopping, bypass charging, temperature simulation, and thermal path mounting based on external power, battery level, temperature, screen, and foreground app status.
  5. Reloads configuration upon changes; attempts to restore previously saved node states whenever features are disabled, power is unplugged, or the program exits.

Repository Structure

charge-turbo/
├─ module/                 Current Magisk Module
│  ├─ META-INF/            Installation Entry
│  ├─ bin/turbo-charge     AArch64 Android Main Executable
│  ├─ thermal_files/       Thermal Control Path Files
│  ├─ meizu_files/         Meizu Adaptation Files
│  ├─ webroot/             WebUI
│  ├─ action.sh
│  ├─ bypass_charge.txt
│  ├─ customize.sh
│  ├─ module.prop
│  ├─ option.txt
│  ├─ service.sh
│  └─ uninstall.sh
├─ Source_Code/
│  └─ Modularized/         Official Main Source Code
├─ LICENSE                 Full AGPL-3.0-only License text
└─ README.md

Open Source License

This project is released under the GNU Affero General Public License v3.0 only (AGPL-3.0-only). For the full terms, see LICENSE.

If you distribute a modified version or offer the functionality of the modified program to users over a network, you must retain the copyright and license notices and provide complete, modifiable source code to the corresponding users as required by AGPL-3.0.

This project is provided without any express or implied warranties. Users must evaluate and bear the risks associated with device compatibility, data security, battery health, and hardware.

user244945

user244945

Official Developer

Reviews (0)

No reviews yet. Be the first to review!