Skip to content

Commit

Permalink
use uint8_t iter when printing vertical header (non-curses examples)
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Mar 7, 2024
1 parent 0cf9bed commit 76eee8d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions examples/scanner/scanner.ino
Original file line number Diff line number Diff line change
Expand Up @@ -215,22 +215,22 @@ void loop(void) {

void printHeader() {
// Print the hundreds digits
for (int i = 0; i < num_channels; ++i)
for (uint8_t i = 0; i < num_channels; ++i)
Serial.print(i / 100);
Serial.println();

// Print the tens digits
for (int i = 0; i < num_channels; ++i)
for (uint8_t i = 0; i < num_channels; ++i)
Serial.print((i % 100) / 10);
Serial.println();

// Print the singles digits
for (int i = 0; i < num_channels; ++i)
for (uint8_t i = 0; i < num_channels; ++i)
Serial.print(i % 10);
Serial.println();

// Print the header's divider
for (int i = 0; i < num_channels; ++i)
for (uint8_t i = 0; i < num_channels; ++i)
Serial.print(F("~"));
Serial.println();
}
16 changes: 8 additions & 8 deletions examples_linux/scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int main(int argc, char** argv)

// print a line that should not be wrapped
cout << "\n!!! This example requires a width of at least 126 characters. "
<< "If this text uses multiple lines, then the output will look bad.\n"
<< "If this text uses multiple lines, then the output will look bad."
<< endl;

// set the data rate
Expand Down Expand Up @@ -179,22 +179,22 @@ int main(int argc, char** argv)
void printHeader()
{
// print the hundreds digits
for (int i = 0; i < num_channels; ++i)
cout << (i / 100);
for (uint8_t int i = 0; i < num_channels; ++i)
cout << static_cast<int>(i / 100);
cout << endl;

// print the tens digits
for (int i = 0; i < num_channels; ++i)
cout << ((i % 100) / 10);
for (uint8_t i = 0; i < num_channels; ++i)
cout << static_cast<int>((i % 100) / 10);
cout << endl;

// print the singles digits
for (int i = 0; i < num_channels; ++i)
cout << (i % 10);
for (uint8_t i = 0; i < num_channels; ++i)
cout << static_cast<int>(i % 10);
cout << endl;

// print the header's divider
for (int i = 0; i < num_channels; ++i)
for (uint8_t i = 0; i < num_channels; ++i)
cout << '~';
cout << endl;
}
Expand Down
8 changes: 4 additions & 4 deletions examples_pico/scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,22 @@ void scanChannel(uint8_t channel)
void printHeader()
{
// print the hundreds digits
for (int i = 0; i < num_channels; ++i)
for (uint8_t i = 0; i < num_channels; ++i)
printf("%d", (i / 100));
printf("\n");

// print the tens digits
for (int i = 0; i < num_channels; ++i)
for (uint8_t i = 0; i < num_channels; ++i)
printf("%d", ((i % 100) / 10));
printf("\n");

// print the singles digits
for (int i = 0; i < num_channels; ++i)
for (uint8_t i = 0; i < num_channels; ++i)
printf("%d", (i % 10));
printf("\n");

// print the header's divider
for (int i = 0; i < num_channels; ++i)
for (uint8_t i = 0; i < num_channels; ++i)
printf("~");
printf("\n");
}

0 comments on commit 76eee8d

Please sign in to comment.