yashsingh1/xdaforums huggingface dataset:
[Magisk] VR25:
**2018.10.7-beta (201810070)**

- Improved diagnostics engine

- Keep an eye on battery capacity while in cool down loop to make sure charging doesn't stop early or a few % over <maxCapacity%>.

- <log=<path>> is now <verbose=true/false>. If enabled, comprehensive diagnostic data is generated. Else, only basic debugging info is logged. The log path is </data/media/mcs*/mcs.log*>.

- Renamed config variable <sleep> to <loopDelay> to prevent confusion.

- Use seconds instead of minutes for coolDownRatio.
[Magisk] paolocorpo:
Thanks develoepr for yor effort !

May I install over the rpevious beta version ?
[Magisk] Specktäter:
If anyone getting the same problems, just want you to know:

Update to Magisk Beta 17.2 didnt help, too.

But now I made an Android-update to 8.0 (and Xposed 90 Beta3): 2018.08.08 works again like it should. Dont know why...

Thank you all for your help, and VR25 - thank you especially for your hard work! :)
[Magisk] paolocorpo:
Dear developer,

Below my feedback

I was running last beta release

All good for the first charge over the night

Today morning I connected the device with 15% of battery level to the usb port of car

I faced no charging confirmed by Ampere app :(

The file running was normally into right folder

I deleted file running

The charging started

Ciao

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
You're welcome. :)

The current beta should work for you too, BTW. It's already good enough to use as a daily driver.

So, are you saying on AC, charging was controlled as expected, whereas on USB, it wasn't allowed at all?

If so, coolDownRatio may still be behind the issue.

I was going to release another update just now. Postponed it due to this report. I'll make coolDownRatio optional for USB charging. There will be a dedicated on/off config switch for it.

I may be able to implement that today. Else, the update will be up by tomorrow. Thanks.
[Magisk] paolocorpo:
That's right

Ok

I remain tuned on this 3D

For the meantime I will use charger wo mcs control

Thanks a lot
[Magisk] VR25:
**2018.10.9-beta (201810090)**

- Cool down while charging via USB is optional (off by default -- coolDownUSB=false).

- Default coolDownRatio set to 90/60. I'm trying to find the sweetest spot for a nice balance between charging time and optimal battery temperature/voltage. Expect frequent changes to this default setting! Your battery is happy about that.

- Fixed <auto-shutdown at shutdownCapacity% not working>.

- Fixed <unreliable verbose state detection>.

- Improved overall efficiency

- Use actual capacity value for coolDownCapacity as opposed to a maxCapacity difference (more flexible battery temperature and voltage control). The default value is set to 60.

- Updated documentation

- Verbose is enabled by default on beta builds. This setting is not enforced, though.

---

Enjoy a cooler and less stressed battery!
[Magisk] paolocorpo:
First trial with last beta

Connected to USB of car with 90% of level

The charging is not started as expected

Let wait for my next trial

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] paolocorpo:
New trials with last beta

I connected device with 62% to USB of car and charging has not started

I checked and file running was present

The level of capacity dropped down to 58% and charging has not started yet

I arrived to home

I connected device with 56% to AC charger and charging has not started yet

Are these things all as expected ... ?

I think NO but please developer I appreciate your opinion about them

Thank you

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] paolocorpo:
New trial with last beta

I connected the device with 23% of battery capacity to the AC charger

The charging is not started !

I rebooted the device

I reconnected the device to the AC charger

So finally the charging started

We can say definitely that this last beta requires some improvement by developer

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
[MENTION=5056724]paolocorpo[/MENTION], thanks, but I couldn't reproduce this issue on my system. The module has been working for me as expected.

Proceed as follows, so we can debug that...

0. Unplug from charger/USB.

1. Set <maxCapacity> to your current battery level (i.e., 54).

2. Set <resumeCapacity> to 1% below your current battery level (i.e., 53).

3. Connect AC charger.

4. After 11+ seconds have passed, disconnect AC charger.

5. Do some heavy stuff on the phone (i.e., play a game) until battery level drops to 1% below <resumeCapacity> (i.e.,52).

6. Reconnect AC charger

7. After 11+ seconds have passed, upload both log files from </data/media/mcs_beta/logs/>.
[Magisk] paolocorpo:
No problems to cooperate in this way but I need to understand if I have to create this log:

when the system looks as frozen (2/3 times yesterday as I said)

or

when the system looks as normal (as yesterday after the reboot)

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
Any time is fine. You don't have to wait until specific conditions apply. However, if that's not inconvenient for you, proceed as you wish. Thanks.
[Magisk] paolocorpo:
Ok I will collect the log asap

See you soon

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] ronyscomparim:
I used the standard installation, the load stopped at 70% load and 30 ° C
[Magisk] VR25:
Didn't it resume after a minute and a half?
[Magisk] ronyscomparim:
Yes but stopped with 70% of the load.
[Magisk] paolocorpo:
Here my log

The charging is not started never ...

EDIT

I cannot attach log because Your file of 1.81 MB bytes exceeds the forum's limit of 512.0 KB for this filetype.

EDIT 2

Zipped and attached

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
Once battery temperature is within a fair range (default: between 40°C and 45°C) and/or capacity (level) is between <coolDownCapacity> (default: 60) and <maxCapacity> (default: 80), charging is halted for a few seconds (default: 90), then allowed for another couple of seconds (default: 60). This works based on <coolDownRatio> (default: 90/60). The process is repeated until battery level reaches <maxCapacity> and/or temperature drops below <fairTemp> (40°C). Besides cooling things down, this strategy also prevents battery voltage from raising too fast and staying high for too long (which is actually worse than a full charge).

Please, confirm whether this is what actually happened. Thanks.

I'll take a look. Thanks.
[Magisk] Jamess27:
How can I set a maximum temperature at which the phone stops charging?
[Magisk] VR25:
Set <maxTemp=NUMBER> in </data/media/mcs_beta/config.txt>. <NUMBER> must be in <degrees Celsius, multiplied by 10>. For example, if you wanted max temperature to be 40°C, you would have <maxTemp=400>; <maxTemp=500> would translate to 50°C, and so on...
[Magisk] ronyscomparim:
the temperature at 26, but the load did not exceed 70%
[Magisk] paolocorpo:
Ciao,

After some trials as for my previous posts I have a big doubt

In my opinion the mcs service looks as stopped after every only one batch of charging

The mcs service looks as frozen and the only way to restore it is a reboot (no success deleting running file

For instance this night I charged normally the device that reached 80% as expected

Now I am into the car and no way to start

I was obliged to reboot

Please developer let analyze this my feeling and let tease a new updated version with this fix

Thanks

Paolo

View attachment 4616507

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] paolocorpo:
Another trial

Rebooted the device

AC charger

I have charged the device until 60%

The charging stopped at cool down capacity target (60) and I don't know why ...

I disconnected the device from AC charger

The capacity dropped down until 56% that is smaller than the cool down capacity target (60)

But the charging is not started at all and I don't know why ...

I waited around 3 minutes and nothing happened and I don't know why ...

During this trial the temperature has been always around 29°C very smaller than fair temperature (40°C)

Only a new reboot allows the mcs to restart normally

It is absolutely unexpected

Dear developer we need a new fix

Thanks

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
[MENTION=5056724]paolocorpo[/MENTION], thanks for all the interest and contribution! Improvements will keep coming.

Could you upload two screenshots showing the output of <su -c dumpsys battery> while charging (via USB then AC) and another with charger/USB unplugged? Thanks.
[Magisk] paolocorpo:
No problem

This First screenshot is related to the status when charger is unplugged:

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] paolocorpo:
This screenshot is when AC Charger is plugged but the charging is not started

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] paolocorpo:
This third screenshot has been captured after a reboot in order to allows the charging

Of course AC charger was plugged

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
Wait... are you absolutely sure battery wasn't charging? This is interesting!

My output is different. Status should be 4 when plugged in but not charging. It should be 3 only when charger is unplugged.

Please confirm this so I can take action. Thanks.
[Magisk] paolocorpo:
99% sure because the led was off and the app Ampere was showing no charging

Right now I cannot reproduce the status because I rebooted and so ... The mcs service is allowing the charging when I plug in a charger

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
That's fair enough! I have the info I needed. Thanks. An update will be up within hours.
[Magisk] paolocorpo:
Ok

Probably I will see it tomorrow morning (for me is 10 pm now)

Have you a good job

Ciao

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
**2018.10.11-beta (201810110)**

- Default <coolDownratio> set to 30/20.

- Updated charging control keys.

- Use alternate charging status detection method to prevent device-specific plugged/unplugged status disparities.

[MENTION=5056724]paolocorpo[/MENTION]
[Magisk] psychoela:
Latest beta now not work with my device,btw mcs 18.10.9 working fine:(
[Magisk] ronyscomparim:
is connected and loading! the information is correct
[Magisk] VR25:
[MENTION=3335876]ronyscomparim[/MENTION], is charging control working as expected on your device?

Please, upload screenshots of <su -c dumpsys battery>'s output while charging and when unplugged. Thanks.
[Magisk] paolocorpo:
Dear [MENTION=5228676]VR25[/MENTION],

my first feeling is very good

I used this morning it in my car and the charging started and continued

After 30 min I unplugged by car and plugged to AC charger in my Home and teh charging started and achieved 80% as expected

EDIT

The capacity reached 100% ... I think that it is not normal ... What do you think ??

Very soon I will post screenshot of app Ampere and of output while charging

Thanks for your effort

Paolo
[Magisk] paolocorpo:
EDIT

The capacity reached 100% ... I think that it is not normal ... What do you think ??

Attached the screenshot of first trails as I promised

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
The <dumpsys battery> command is unreliable. It's time for another update.

I'm curious as to whether the status is actually 1 when fully charged!

The next update won't take long...
[Magisk] paolocorpo:
DO you need some report/log by me ?
[Magisk] psychoela:
Thanks.
[Magisk] Jamess27:
I'm using latest beta but I have some problems...

Each time I reboot my phone I have to configure again mcs (<mcs 75 65>), if I don't do so, the phone charges to 100
[Magisk] VR25:
**2018.10.12-beta (201810120)**

- Fixed <unreliable plugged/unplugged detection>.

- Read charging status from </sys/class/power_supply/*battery*/status> (path), as opposed to <dumpsys battery> (command, unreliable).

[MENTION=5056724]paolocorpo[/MENTION], [MENTION=6263858]psychoela[/MENTION], [MENTION=6958311]Jamess27[/MENTION]
[Magisk] Jamess27:
I flashed this new beta, rebooted and then plugged the phone to the charger at 85% of battery, no charging!

When the battery level drops under 65 I'll plug the phone again and see if it starts charging
[Magisk] paolocorpo:
I installed this last release

Device was 82%

I plugged the AC charger

The charging is not started as expected and this has been confirmed by app Ampere and status

Well !!

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
Yet another update...

**2018.10.12.1-beta (201810121)**

- Fixed <battery cooling mechanism not working>.

---

Humm, your device seems to be drawing a lot of power from the battery. With such a high load (670mAh), your battery goes from 100% to zero capacity in ~4.6 hours! That's not related to MCS in any way, though.

What's been running on your phone? I'm sure optimizations can be made to minimize power consumption.

Just to put things into perspective, my Moto G4 Play (harpia) has a 2800mAh battery and the average load is 270mAh. That's about three times less than what your device is consuming!
[Magisk] paolocorpo:
I don't remember what was running

I am pretty happy of my battery

Usually I have 5/6 SOT and it is aligned with others Mi A1 experiences that I am sharing with others owners

I will install the new release

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] paolocorpo:
This for instance is much better

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
Ok, perhaps that load was just momentary.

EDIT

Yeah, that's way better!
[Magisk] ronyscomparim:
Yes 100%

---------- Post added at 01:08 PM ---------- Previous post was at 01:06 PM ----------

Yes 100,%
[Magisk] ronyscomparim:
last beta 2018.10.12.1
[Magisk] paolocorpo:
Last beta

Plugged to AC charger with 71%

Not charging ... As expected ??

I think so ... But I am not sure [MENTION=5228676]VR25[/MENTION]

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] paolocorpo:
Last beta

Plugged to an AC charger with 66%

No charging ... as expected ??

I think so ... But I am not sure [MENTION=5228676]VR25[/MENTION]

Next trial when the capacity will drop down under 60%

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] paolocorpo:
Last beta

Plugged to USB of Car at 57%

Charging is ON ... As expected

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
[MENTION=5056724]paolocorpo[/MENTION], recall that the default <coolDownRatio> is <30/20> and <coolDownCapacity>, <60>. That means, when conditions apply, charging is limited to every 50 seconds, for 20 seconds (disabled for the remaining 30 seconds). Do you confirm that charging wasn't permanently stopped before $maxCapacity%? Thanks.
[Magisk] paolocorpo:
[MENTION=5228676]VR25[/MENTION]

Between 57 and 60 the charging has been constant (I was driving and cannot be sure at 100% but I think so)

After 60% I faced an alternate charging; this is based only on a personal vision of few minutes when I was unplugging I noted that charging was before off and after few seconds ON

But again ... I was driving and cannot be sure about what happened immediately after that capacity reached 60%

But please let clarify me a couple of doubts

Let figure out these below "initial" conditions in occasion of a "new plugging" to the charger

%< 60% the charging starts

%> 60% the charging does not start

Is it right ?

If the charging starts ... It allows to reach the max capacity 80% ( with a special strategy between 60/80)

If the charger is not unplugged the % drops down until 70 and only in this condition restarts re reaching 80%

Is it right ?

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
The answer...

This happens so that your battery temperature is kept at a nice threshold and its voltage, down as long as possible.

In simpler words, charging slows down a bit at %>60 to keep battery cool and happy.

By default this doesn't apply to USB charging (i.e., phone connected to a PC), since the charging rate is already slow, in general.
[Magisk] paolocorpo:
So the right thing is:

Let figure out these below "initial" conditions in occasion of a "new plugging" to the charger

%< 60% the charging starts continuosly

%> 60% the charging starts with a special strategy (basically alternating on and off)

Is it right ?

If the charging starts ... It allows to reach the max capacity 80% ( with a special strategy between 60/80)

If the charger is not unplugged the % drops down until 70 and only in this condition restarts re reaching 80%

Is it right ?

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] Jamess27:
Battery at 64%, plugged in, not charging.

I flashed the latest beta (12.1), rebooted, plugged but not charging

On terminal I typed MCs 75 65 but the device doesn't detect the charger
[Magisk] paolocorpo:
Have you waited some minutes ?

As developer said in that range the charging is allowed as succession of ON and OFF

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] Jamess27:
Still waiting...
[Magisk] paolocorpo:
Are you using last beta ?

I am not sure that the command mcs "something" is functionally well ...

It was for stable release

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
Yes, yes, that's right! :)

No... you're not supposed to use more than one charging controller! That's similar to using two or more anti-virus softwares simultaneously (both running with real-time protection ON).

These days, we've been talking about betas only. Stable version is on hold, as it's about to be replaced soon.

Current betas have no such thing as <mcs # #> command. In fact, I'm getting rid of all commands altogether to make things simpler. All you have to deal with is a simple text file.
[Magisk] Jamess27:
Ok I set the control file, I'll check later if it's working
[Magisk] paolocorpo:
Dear [MENTION=5228676]VR25[/MENTION],

Probably the is an issue with last beta (and previous one ... In fact this is the second time that I faced this issue .. let see my post #1426)

Yesterday night I plugged the device around 55% to AC charger

I noted that charging started (confirmed by app Ampere and led)

But today morning after around 7 hours the device was not able to reach 80%

I founded it at 62% ... :(

Can you fix it ?

Thanks

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
The graph's slope suggests battery has been charging... slowly (or too slow).

I'll make cooling down optional, so we can see whether it's responsible for this.
[Magisk] paolocorpo:
Thanks

Probably the cool down capacity could became 70 or the cool down ratio could be 30/40 or 30/60

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
Current settings work fine for me (after multiple tests).

For you, charging rate is too slow while in the cool down loop.

Try a cool down ratio of 15/15, leaving cool down capacity untouched.
[Magisk] paolocorpo:
Now I am trying with 30/60 and the charging runs more fast

Is it too aggressive ... ??

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
There's no universal answer to this.

If that keeps battery temperature at a nice threshold, then it's fine. You have to actually test how warm your device feels.

Additionally, watch battery's voltage on Ampere app, or even better, from</sys/class/power_supply/*battery*/voltage_ocv>. That's battery's open circuit voltage.

If the voltage takes too long to drop whenever charging stops, then that setting is not ideal.

We're getting into electricity/electronics territory now. Are you comfortable with that?
[Magisk] paolocorpo:
Ciao

I was driving for a couple of hours ...

Excuse for the delayed response

No ... I am not comfortable with electric rules ...

The temperature looks to be under control (touching the external case I mean)

I can use Ampere too

After a complete recharge cycle I mean for instance keeping charger plugged over the night as I am usual to do every night ... which is the right battery temperature that I have to find ?

And about the voltage ...which is the right dropping down that I have to check when the charge stops ??

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
Ok, no worries...

"The temperature looks to be under control (touching the external case I mean)." That's a good answer. :)

From a usability standpoint, and to keep things simple, if the temperature doesn't make you fell uncomfortable while holding your device, then it's good enough.

I set default maxTemp to 45°C and intermediate (fairTemp) to 40°C. Cool down also applies when battery temp is between these two values (fairTemp <= temp < maxTemp).

That's another thing you don't have to worry about at this point. As long as it drops, no matter by how much, you're good.

The important thing to know is that whenever it drops, your battery "relaxes." It takes a break from charging-induced stress.

EDIT

Your suggested cool down ratios, 30/40 and 30/60 are good.

I think lowering down the values, while keeping a similar difference would be optimal. For example something like 10/20 or 20/30 looks fine.
[Magisk] paolocorpo:
Thanks a lot for all your explanations!!

I really appreciate them :)

I will change to 20/30 as suggested the ratio cool down as only my personal variation to the default setting

I will keep under control the temperature of battery at the end of every charging step touching the external cover and/or analyzing the report of app Ampere too

And I will take a look to the dropping of capacity level as well ...

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] paolocorpo:
Report with last beta

I plugged the device with around 25% to USB of car

Android Auto, BT, Spotify were running

The level of battery is increased a lot and very slowly as picture

I stopped Spotify and the level of battery is increased to 35% more quickly as picture

The battery reached later the level of 57% in around 1,5 hours but into last period of time the speed of charge reduced (Probably because I opened the GPS navigation in meantime)

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
You're welcome. Your interest and reports have been helping me a lot in polishing the module. :)

Considering how slow USB charging generally is, and the high load of the apps you were using while driving, I would say that charging rate is normal.

Regarding cool down ratio, after a few more tests (and thanks to your reports), I thought of a better implementation of it.

Instead of two values (say 20/30), we'll use only one.

I'll be like this:

<CoolDownSeconds=20>

That means when conditions apply, every minute, battery will be allowed to charge for 40 seconds only.

In other words, charging will be OFF 1/3 of the time, which accounts for a charging/cooling ratio of 40/20 (seconds).
[Magisk] paolocorpo:
I want update my cool down strategy accordingly to your last suggestion but ... Are you sure that I have write 40/20 ?

I think it would be 20/40 if we want that every minute would be divided into 40 sec of charging and 20 sec of cooling

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
That example applies only to the upcoming update, as I've inverted the ratios... cooling/charging -> charging/cooling. The correct setting for current version is indeed 20/40.
[Magisk] paolocorpo:
Ok I will apply 20/40 right now ;)

Thanks

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] ronyscomparim:
No, I uninstalled and installed the old version.
[Magisk] paolocorpo:
Dear developer,

After a night in which the charging has charged up to 80% as expected and later dropped down to 78% thanks to 4/5 hours in aereo status ...

... Now I have plugged the cigarette lighter adapter to the device with 65% and I am noting that the cooldown strategy is running with the ratio 20/40

My question is:

The cigarette lighter adapter is not considered as USB ... It is right ?

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
Yes, the phone "sees" that as a regular AC power supply adapter. So, cooldown applies when using it.

A cigarette lighter adapter generaly supplies much more power than old-fashioned USB. Some even support Qualcom's Quick Charge and alike.
[Magisk] paolocorpo:
Yes, you have right !!

Ampere app says that the cigarette lighter adapter provides around 1A ... :)

Inviato dal mio Mi A1 utilizzando Tapatalk