Skip to content

Badge Display: Display Print Number -> Leftover leading/trailing digit(s) #1692

Open
@francisbauer

Description

@francisbauer

When trying to display a count-down of a numeric variable (such as: repeat item from 10 to 1 by -1) using the Display Print Number routine and a constant Display Set Cursor position, the trailing 0 from the 10 is left when the 9 to 1 digits are printed. So on the display you see 10, 90, 80, ...

The following blocklyprop code (translated) demonstrates the issue and also what I did as a work-around, (see the if statement).

// ------ Libraries and Definitions ------
#include "simpletools.h"
#include "badgewxtools.h"

// ------ Global Variables and Objects ------
int item;



// ------ Main Program ------
int main() {
  badge_setup();
  // Second Program
  // Allow the Badge WX to be programmed over WiFi
  high(17);

  "Hello";

  if (0) {}


  clear();
  cursor(0, 0);
  text_size(LARGE);
  oledprint("Francis");
  cursor(1, 1);
  oledprint("Bauer");
  text_size(SMALL);
  while (1) {
    for (item = 10; item >= 0; item--) {
      cursor(6, 4);
      if (item < 10) {
        // Display print bug, it leaves leading/trailing digit
        // Print 0 to remove leading digit.
        oledprint("%d", 0);
      }

      oledprint("%d", item);
      pause(250);

    }
    pause(1000);
  }

}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions