From 2365585964e92499b9c5c552fac5400c68203316 Mon Sep 17 00:00:00 2001 From: NotYourAverageGamer <104248676+NotYourAverageGamer@users.noreply.github.com> Date: Fri, 18 Apr 2025 16:55:31 +1000 Subject: [PATCH] fix: dualsense battery status - fixes battery charge level percentage: previously it would show "100%" and charging for dualsense controllers that were not 100%. - this would also fix the battery safety check if implemented (doesn't look like `can_use_tool` is being used?) --- core.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core.js b/core.js index 45c9804..9fa493b 100644 --- a/core.js +++ b/core.js @@ -1462,7 +1462,7 @@ function update_nvs_changes_status(new_value) { function update_battery_status(bat_capacity, cable_connected, is_charging, is_error) { var bat_txt = bat_percent_to_text(bat_capacity, is_charging); - var can_use_tool = (bat_capacity >= 30 && cable_connected && !is_error); + var can_use_tool = (bat_capacity >= 30 && cable_connected && !is_error); // is this even being used? if(bat_txt != last_bat_txt) { $("#d-bat").html(bat_txt); @@ -1561,7 +1561,7 @@ function process_ds_input(data) { if(bat_status == 0) { bat_capacity = Math.min(bat_charge * 10 + 5, 100); } else if(bat_status == 1) { - bat_capacity = Math.max(bat_charge * 10 + 5, 100); + bat_capacity = Math.min(bat_charge * 10 + 5, 100); is_charging = true; cable_connected = true; } else if(bat_status == 2) {