Skip to content

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

@JKPina

Description

@JKPina

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"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions