nom-reprap-response 0.1.0

A nom-based parser for serial response for RepRap firmwares primarily targeting Marlin.
Documentation
# Ultimaker 2 with a custom DBG Extruder-specific firmware
[firmware]
  # "N14 M115*19\n" - Note: this response has been split into multiple lines for readability
  m115_firmware_info = """\
    FIRMWARE_NAME:Marlin Ultimaker2; Sprinter/grbl mashup for gen6 \
    FIRMWARE_URL:http://github.com/Ultimaker \
    PROTOCOL_VERSION:1.0 \
    MACHINE_TYPE:Ultimaker \
    EXTRUDER_COUNT:1\n\
    ok\n\
  """

[greeting]
  # Start the printer with an SD card inserted
  # Note: There is a firmware bug where sarting the Ultimaker 2 with a SD Card the printer fails to
  # respond to MCodes sent over serial and eventually times out.
  greeting_with_sd_card = """\
    start\n\
    echo:Marlin 1.0.0\n\
    echo: Last Updated: Nov 17 2017 23:41:38 | Author: Version DEV\n\
    Compiled: Nov 17 2017\n\
    echo: Free Memory: 2052  PlannerBufferBytes: 1232\n\
    echo:Stored settings retrieved\n\
    echo:Steps per unit:\n\
    echo:  M92 X80.00 Y80.00 Z200.00 E311.00\n\
    echo:Maximum feedrates (mm/s):\n\
    echo:  M203 X300.00 Y300.00 Z40.00 E45.00\n\
    echo:Maximum Acceleration (mm/s2):\n\
    echo:  M201 X9000 Y9000 Z100 E10000\n\
    echo:Acceleration: S=acceleration, T=retract acceleration\n\
    echo:  M204 S3000.00 T3000.00\n\
    echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s),  Z=maximum Z jerk (mm/s),  E=maximum E jerk (mm/s)\n\
    echo:  M205 S0.00 T0.00 B20000 X20.00 Z0.40 E5.00\n\
    echo:Home offset (mm):\n\
    echo:  M206 X0.00 Y0.00 Z-11.45\n\
    echo:PID settings:\n\
    echo:   M301 P10.03 I1.50 D70.00\n\
  """

  # Start the printer without any SD card
  greeting_without_sd_card = """\
    start\n\
    echo:Marlin 1.0.0\n\
    echo: Last Updated: Nov 17 2017 23:41:38 | Author: Version DEV\n\
    Compiled: Nov 17 2017\n\
    echo: Free Memory: 2052  PlannerBufferBytes: 1232\n\
    echo:Stored settings retrieved\n\
    echo:Steps per unit:\n\
    echo:  M92 X80.00 Y80.00 Z200.00 E311.00\n\
    echo:Maximum feedrates (mm/s):\n\
    echo:  M203 X300.00 Y300.00 Z40.00 E45.00\n\
    echo:Maximum Acceleration (mm/s2):\n\
    echo:  M201 X9000 Y9000 Z100 E10000\n\
    echo:Acceleration: S=acceleration, T=retract acceleration\n\
    echo:  M204 S3000.00 T3000.00\n\
    echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s),  Z=maximum Z jerk (mm/s),  E=maximum E jerk (mm/s)\n\
    echo:  M205 S0.00 T0.00 B20000 X20.00 Z0.40 E5.00\n\
    echo:Home offset (mm):\n\
    echo:  M206 X0.00 Y0.00 Z-11.45\n\
    echo:PID settings:\n\
    echo:   M301 P10.03 I1.50 D70.00\n\
    echo:SD init fail\n\
  """

[errors]
  # "N27 m23 file.txt*119\n" (using a lowercase m is an invalid MCode)
  unknown_command = """\
    echo:Unknown command: \"N3 m23 file.txt*65\"\n\
    ok\n\
  """

# Common GCodes and MCodes
# #############################

[movement_gcodes]
  # "N1822 G1 X1*88\n"
  g1 = "ok\n"

  # "N1581 G28 X*86\n"
  g28 = "ok\n"

  # "N1825 G90*46\n"
  g90 = "ok\n"

  # "N1820 G91*42\n"
  g91 = "ok\n"


[polling_mcodes]
  # "N582 M105*40\n"
  m105 = """\
    ok T:38.2 /0.0 B:26.6 /0.0 @:0 B@:0\n\
  """

  # "N583 M114*41\n"
  m114 = """\
    X:0.00Y:0.00Z:0.00E:0.00 Count X: 0.00Y:0.00Z:0.00\n\
  """

  # "N3 M155 S0.5*121\n"
  #  Firmware Bug: Does nothing on the Ultimaker 2. No temperature auto-reports, just an "ok".
  m155_temperature_auto_report = "ok\n"

[temperature_control]
  # "N1044 M109*26\n"
  m109 = """\
    T:24.7 E:0 W:?\n\
    T:24.4 E:0 W:?\n\
    T:24.4 E:0 W:2\n\
  """

# SD Card
# #############################

# [m20_list_sd_card]
#   # "N187 M20*31\n"
#   m20_sucess = """\
#   """

#   # "N3 M20*18\n"
#   # Firmware Bug: m20 without an sd card freezes the printer/does not even respond to tickles.
#   # m20_no_sd_card = """\
#   # """

[m21_init_sd_card]
  # "N2448 M21*42\n"
  # Firmware Bug: m21 with an sd card inserted after the greeting freezes the printer/does not
  # even respond to tickles.
  # m21_success = """\
  # """

  # "N44 M21*32\n"
  m21_no_sd_card = """\
    echo:SD init fail\n\
    ok\n\
  """

[m23_select_sd_file]
  # # "N40 M23 file.txt*86\n"
  # m23_success = """\
  # """

  # "N19 M23 /teg.gcode*23\n"
  m23_no_sd_card = """\
    ok\n\
  """

# [m24_start_or_resume_sd_print]
#   # "N47 M24*38\n" (after streaming a G28, M114 and M105 to the file and opening it)
#   m24_success = """\
#   """

#   # "N56 M24*38\n"
#   m24_no_file_selected = """\
#   """

[m28_start_sd_write]
  # # "N389 M28 file.txt *75\n" (after an M21)
  # m28_success = """\
  # """

  # "N125 M28 teg.gcode*13\n" (same response as m23_no_sd_card)
  m28_no_sd_card = """\
    ok\n\
  """

# [m29_stop_sd_write]
#   # "N18 M29*33\n"
#   m29_file_open = """\
#   """

#   # "N24 M29*46\n"
#   m29_no_file_open = ""

[m30_delete_sd_file]
  # "N59 M30 file.txt*92\n"
  # m30_success = """\
  # """

  # "N109 M30 /teg.gcode*37\n"
  m30_no_file = """\
    ok\n\
  """