… | |
… | |
1009 | buf.printf ("(capacity %dk; it is ", op->stats.maxsp / 1000); |
1009 | buf.printf ("(capacity %dk; it is ", op->stats.maxsp / 1000); |
1010 | } |
1010 | } |
1011 | else |
1011 | else |
1012 | buf.printf ("(capacity %d; it is ", op->stats.maxsp); |
1012 | buf.printf ("(capacity %d; it is ", op->stats.maxsp); |
1013 | |
1013 | |
1014 | i = (op->stats.sp * 10) / op->stats.maxsp; |
1014 | i = op->stats.sp * 10 / max (op->stats.maxsp, 1); |
1015 | if (op->stats.sp == 0) |
1015 | |
1016 | buf << "empty"; |
1016 | if (op->stats.sp == 0) buf << "empty"; |
1017 | else if (i == 0) |
1017 | else if (i <= 0) buf << "almost empty"; |
1018 | buf << "almost empty"; |
1018 | else if (i <= 2) buf << "partially filled"; |
1019 | else if (i < 3) |
1019 | else if (i <= 5) buf << "half full"; |
1020 | buf << "partially filled"; |
1020 | else if (i <= 8) buf << "well charged"; |
1021 | else if (i < 6) |
|
|
1022 | buf << "half full"; |
|
|
1023 | else if (i < 9) |
|
|
1024 | buf << "well charged"; |
|
|
1025 | else if (op->stats.sp == op->stats.maxsp) |
1021 | else if (op->stats.sp < op->stats.maxsp) buf << "almost full"; |
1026 | buf << "fully charged"; |
1022 | else buf << "fully charged"; |
1027 | else |
|
|
1028 | buf << "almost full"; |
|
|
1029 | |
1023 | |
1030 | buf << ')'; |
1024 | buf << ')'; |
1031 | break; |
1025 | break; |
1032 | |
1026 | |
1033 | case LAMP: |
1027 | case LAMP: |