Fix charging bugs, remove disabling charging since its not supported in HW

This commit is contained in:
Nik Rozman
2026-03-04 08:31:34 +01:00
parent 953edd4065
commit c325336508
5 changed files with 15 additions and 18 deletions
+6 -6
View File
@@ -16,7 +16,7 @@ const FLAG_AUTO_RECAL_ENABLED = 0x04;
const FLAG_ALL_DEFAULT = FLAG_TAP_ENABLED | FLAG_TEMP_COMP_ENABLED | FLAG_AUTO_RECAL_ENABLED;
// Local shadow of the current config (kept in sync with device)
const config = { sensitivity:600, deadZone:0.06, accelStrength:0.08, curve:0, axisFlip:0, chargeMode:1,
const config = { sensitivity:600, deadZone:0.06, accelStrength:0.08, curve:0, axisFlip:0, chargeMode:0,
tapThreshold:12, tapAction:0, tapKey:0, tapMod:0, tapFreezeEnabled:1, jerkThreshold:2000,
featureFlags:FLAG_ALL_DEFAULT,
btnLeftPin:0xFF, btnRightPin:0xFF, btnMiddlePin:0xFF };
@@ -210,7 +210,7 @@ async function checkHashMatch() {
// ConfigBlob read / write
// ConfigBlob layout (25 bytes LE):
// float sensitivity [0], float deadZone [4], float accelStrength [8]
// uint8 curve [12], uint8 axisFlip [13], uint8 chargeMode [14]
// uint8 curve [12], uint8 axisFlip [13], uint8 chargeMode [14] (0=SLOW 1=FAST)
// uint8 tapThreshold [15], uint8 tapAction [16], uint8 tapKey [17], uint8 tapMod [18], uint8 tapFreezeEnabled [19]
// float jerkThreshold [20], uint8 featureFlags [24]
@@ -384,15 +384,15 @@ function setChargeMode(val) {
config.chargeMode = val;
setChargeModeUI(val);
writeConfigBlob();
log(`Charge → ${['OFF','SLOW 50mA','FAST 100mA'][val]}`,'warn');
log(`Charge → ${['SLOW 50mA','FAST 100mA'][val]}`,'warn');
}
function setChargeModeUI(val) {
[['chgOff','off'],['chgSlow','slow'],['chgFast','fast']].forEach(([id,cls],i) => {
[['chgSlow','slow'],['chgFast','fast']].forEach(([id,cls],i) => {
const b = document.getElementById(id);
b.classList.remove('active','off','slow','fast');
b.classList.remove('active','slow','fast');
if (i===val) b.classList.add('active', cls);
});
document.getElementById('ciMode').textContent = ['Off (0mA)','50 mA','100 mA'][val] ?? '--';
document.getElementById('ciMode').textContent = ['50 mA','100 mA'][val] ?? '--';
}
function onCapTapChange(enabled) {
+2 -3
View File
@@ -86,9 +86,8 @@
<div class="param" style="border-bottom:none;padding:0">
<div><div class="param-label">Charge Mode</div><div class="param-desc">BQ25100 ISET via P0.13 (HICHG)</div></div>
<div class="segmented charge-seg" style="grid-column:2/4">
<button class="seg-btn off" id="chgOff" onclick="setChargeMode(0)" disabled>OFF</button>
<button class="seg-btn slow" id="chgSlow" onclick="setChargeMode(1)" disabled>SLOW · 50mA</button>
<button class="seg-btn fast" id="chgFast" onclick="setChargeMode(2)" disabled>FAST · 100mA</button>
<button class="seg-btn slow" id="chgSlow" onclick="setChargeMode(0)" disabled>SLOW · 50mA</button>
<button class="seg-btn fast" id="chgFast" onclick="setChargeMode(1)" disabled>FAST · 100mA</button>
</div>
</div>
<div class="charge-info" id="chargeInfo">
-1
View File
@@ -199,7 +199,6 @@
.seg-btn:last-child { border-right:none; }
.seg-btn.active { background:var(--accent); color:var(--bg); font-weight:bold; }
.seg-btn:disabled { cursor:not-allowed; opacity:0.35; }
.charge-seg .seg-btn.active.off { background:var(--dim); color:#fff; }
.charge-seg .seg-btn.active.slow { background:var(--warn); color:var(--bg); }
.charge-seg .seg-btn.active.fast { background:var(--accent2);color:#fff; }