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