| 80 | } |
| 81 | |
| 82 | static bool decode_format_string(const char* comment, size_t& index, size_t len, const char*& format) { |
| 83 | // comment[index] is '%' |
| 84 | const char* f = comment + index; |
| 85 | size_t rem = len - index; |
| 86 | if (rem > 1 && f[1] == 'd') { |
| 87 | ++index; |
| 88 | format = "%.0f"; |
| 89 | return true; |
| 90 | } |
| 91 | if (rem > 2 && f[1] == 'f') { |
| 92 | ++index; |
| 93 | format = "%.4f"; |
| 94 | return true; |
| 95 | } |
| 96 | if (rem > 3 && f[1] == '.' && f[2] >= '0' && f[2] <= '9' && f[3] == 'f') { |
| 97 | static char fmt[5]; |
| 98 | memcpy(fmt, f, 4); |
| 99 | fmt[4] = '\0'; |
| 100 | index += 3; |
| 101 | format = fmt; |
| 102 | return true; |
| 103 | } |
| 104 | return false; |
| 105 | } |
| 106 | |
| 107 | static void gcode_comment_msg(const char* comment) { |
| 108 | if (gc_state.skip_blocks) { |