Skip to content

Commit

Permalink
(draft) Add a special case for cell "details"
Browse files Browse the repository at this point in the history
This special case of "details" value would print as ':' in the ASCII
display mode. It is used in "positive/negative" graph display only.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
  • Loading branch information
Explorer09 committed May 2, 2024
1 parent 8b30ef4 commit 728ef87
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,9 @@ static int GraphMeterMode_lookupCell(const Meter* this, const GraphDrawContext*
blanksAtEnd = (blanksAtEnd % 8) / dotAlignment * dotAlignment;
*details = (uint8_t)((*details >> blanksAtEnd) << blanksAtEnd);
}
if (*details == 0x3C) {
*details = 0x24;
}
}
/* fallthrough */

Expand All @@ -1043,7 +1046,7 @@ static void GraphMeterMode_printCellDetails(uint8_t details) {
// byte contains specific bit patterns, it indicates that only half cell
// should be displayed in the ASCII display mode. The bits are supposed
// to be filled in the Unicode display mode.
if ((details & 0x9C) == 0x14 || (details & 0x39) == 0x28) {
if ((details & 0x9C) == 0x14 || (details & 0x39) == 0x28 || details == 0x24) {
if (details == 0x14 || details == 0x28) { // Special case
details = 0x18;
} else {
Expand Down Expand Up @@ -1081,6 +1084,8 @@ static void GraphMeterMode_printCellDetails(uint8_t details) {
c = upperHalf;
} else if ((details & 0x39) == 0x28) {
c = lowerHalf;
} else if (details == 0x24) {
c = fullCell;
// End of special cases
} else if (popCount8(details) > 4) {
c = fullCell;
Expand Down

0 comments on commit 728ef87

Please sign in to comment.