scope oshi_batteryLevel_withZeroPercentFix. static int #last = -1; // We assume actual 0% never appear longer than this static WaitForStableValue<Bool> 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
Began life as a copy of #1016190
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1016191 | 
| Snippet name: | oshi_batteryLevel_withZeroPercentFix | 
| Eternal ID of this version: | #1016191/5 | 
| Text MD5: | 3ea47ddc0268f97d99bedaf61f13594c | 
| Author: | stefan | 
| Category: | javax / gui | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2018-06-10 00:10:12 | 
| Source code size: | 462 bytes / 18 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 730 / 781 | 
| Version history: | 4 change(s) | 
| Referenced in: | [show references] |