Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sensors.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,15 +455,15 @@ export const Sensors = GObject.registerClass({
this._returnValue(callback, 'Energy (now)', output['ENERGY_NOW'], 'battery', 'watt-hour');
}

if ('ENERGY_FULL' in output && 'ENERGY_NOW' in output && 'POWER_NOW' in output && output['POWER_NOW'] > 0 && 'STATUS' in output && (output['STATUS'] == 'Charging' || output['STATUS'] == 'Discharging')) {
if ('ENERGY_FULL' in output && 'ENERGY_NOW' in output && 'POWER_NOW' in output && output['POWER_NOW'] !== 0 && 'STATUS' in output && (output['STATUS'] == 'Charging' || output['STATUS'] == 'Discharging')) {
Comment thread
ragotpaul marked this conversation as resolved.

let timeLeft = 0;

// two different formulas depending on if we are charging or discharging
if (output['STATUS'] == 'Charging') {
timeLeft = ((output['ENERGY_FULL'] - output['ENERGY_NOW']) / output['POWER_NOW']);
} else {
timeLeft = (output['ENERGY_NOW'] / output['POWER_NOW']);
timeLeft = (output['ENERGY_NOW'] / Math.abs(output['POWER_NOW']));
}

// don't process Infinity values
Expand Down Expand Up @@ -644,7 +644,7 @@ export const Sensors = GObject.registerClass({
if(vendor === "0x1002") {
// read GPU usage and create group lebel for card
new FileModule.File('/sys/class/drm/card'+i+'/device/gpu_busy_percent').read().then(value => {
// create group
// create group
this._returnGpuValue(callback, 'Graphics', parseInt(value) * 0.01, typeName + '-group', 'percent');
this._returnGpuValue(callback, 'Vendor', "AMD", typeName, 'string');
this._returnGpuValue(callback, 'Usage', parseInt(value) * 0.01, typeName, 'percent');
Expand Down