Check for `SEGMENTS_ALL` when printing

This commit is contained in:
Marijn van der Werf 2016-10-22 14:40:34 +02:00
parent 1ebfba60d9
commit 4b4c00a1af
1 changed files with 17 additions and 7 deletions

View File

@ -122,14 +122,24 @@ namespace Printer {
static std::string PrintSegmentSupportHeightCall(SegmentSupportCall call) {
std::string out = "";
int segmentsPrinted = 0;
for (int i = 0; i < 9; i++) {
if (call.segments & segment_offsets[i]) {
if (segmentsPrinted > 0) {
out += " | ";
if (call.segments == SEGMENTS_ALL)
{
out += "SEGMENTS_ALL";
}
else
{
int segmentsPrinted = 0;
for (int i = 0; i < 9; i++)
{
if (call.segments & segment_offsets[i])
{
if (segmentsPrinted > 0)
{
out += " | ";
}
out += String::Format("SEGMENT_%02X", 0xB4 + 4 * i);
segmentsPrinted++;
}
out += String::Format("SEGMENT_%02X", 0xB4 + 4 * i);
segmentsPrinted++;
}
}