Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle '\r' #2114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bartlomiejcieszkowski
Copy link

carriage return wasn't handled
spinner is now correctly working

tried making spinner, instead of returning to back of line, it kept writing on and on till going off the screen

minimal loop for reproducing:

void loop() {
  u8x8.setFont(u8x8_font_chroma48medium8_r);
  u8x8.setCursor(0, 0);
  int length = 60;
  char spinner[] = "|/-\\";
  for (int i = 0; i < length; i++) {
    // do something
    u8x8.printf("%c\r", spinner[i%4]);
    delay(200);
  }
}

carriage return wasn't handled
spinner is now correctly working
@olikraus
Copy link
Owner

I don't see a reason to merge this..

@CodeAsm
Copy link

CodeAsm commented Apr 18, 2024

this worked for me (altho there are some bits in the logging i miss, maybe ill spin my own version)

void wait() {
  int length = 32;
  char spinner[] = "|/-\\";
  for (int i = 0; i < length; i++) {
    // do something
    u8x8log.print(spinner[i%4]);
    u8x8log.print('\r');
    delay(100);
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants