scope oshi_batteryLevel_withZeroPercentFix. static int #last = -1; // We assume actual 0% never appear longer than this static WaitForStableValue zeroSince = new(60.0); static double oshi_batteryLevel_withZeroPercentFix() { double dd = oshi_batteryLevel(); if (isNaN(dd)) ret dd; int d = iround(dd); zeroSince.set(d == 0); if (d == 0 && (last < 0 || last >= 99 || isTrue(zeroSince!))) d = 100; ret last = d; } end scope