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

write offset <LF> and <CR> inverted on micro SD #238

Open
JKPina opened this issue Nov 10, 2020 · 2 comments
Open

write offset <LF> and <CR> inverted on micro SD #238

JKPina opened this issue Nov 10, 2020 · 2 comments

Comments

@JKPina
Copy link

JKPina commented Nov 10, 2020

write offset LineFeed and CarriageReturn inverted on micro SD

There is a different behaviour when writing normally to openlog and when writing with offset, does this happen to anyone?

Your workbench

  • I'm working with a MKR1000 and openlog v4 on Serial3 @9600 baud
  • config.txt => 9600,36,3,0,1,1,0
    baud,escape,esc#,mode,verb,echo,ignoreRX

Steps to reproduce

  • initialize openlog, create a new LOGTIMER.csv file and set it into "append LOGTIMER.csv\r"
  • write normally a message (Serial3.println("DONE IN NORMAL WRITE MODE"))
  • write normally a another message
  • write normally a another message
  • write offset a message replacing the first one ("DONE IN WRITE OFFSET MODE")

This is how my 'write offset function' looks like. I have simplified for a better understanding

void my_write_offset(String reg) {
  openlog_command_mode(); // escape chars: $$$
  Serial3.println("read LOGTIMER.csv");
  openlog_while_not('\r');  // catch echo
  
  int byte_offset = -2;  
  int fila_found_in = 0;

  for (int timeOut = 0 ; timeOut < 100 ; timeOut++) {
    while (Serial3.available()) {
      String aux = Serial3.readStringUntil('\r');
      byte_offset++;
      if (aux.indexOf(reg_hora) > 0) {
      Serial3.print("write LOGTIMER.csv ");
      Serial3.print(byte_offset * 27);
      Serial3.write(13);
      openlog_while_not('\r'); 
      openlog_while_not('<');

      Serial3.println(reg);
      Serial3.print("\r");  // 13, CR

      timeOut = 100;
      break;
      }
    }
    delay(1);
  }

  sprintf(buff, "append LOGTIMER.csv\r");
  Serial3.print(buff);
  openlog_while_not('<');
}

And this is how it looks in the microSD

imagen

results:

LF then CR inverted when "write offset"
(note on the same script i can get proper CR and LF order with simply Serial3.println("DONE IN NORMAL WRITE MODE"))

@9600
Copy link

9600 commented Nov 10, 2020

Hello, you called?

@JKPina
Copy link
Author

JKPina commented Dec 7, 2020

Hi guys! Do anyone solve this issue?
Have a great week!

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

No branches or pull requests

2 participants