#include "ff.h"
#include <stdbool.h>
#include <stdio.h>
Go to the source code of this file.
◆ f_gcode_thumb_open()
int f_gcode_thumb_open |
( |
FILE * |
fp, |
|
|
FIL * |
real_file |
|
) |
| |
31 DBG(
"a gcode png file is already open");
38 memset(fp, 0,
sizeof(FILE));
46 fp->_bf._base = (
uint8_t *)malloc(fp->_lbfsize);
47 fp->_bf._size = fp->_lbfsize;
◆ f_gcode_thumb_close()
int f_gcode_thumb_close |
( |
FILE * |
fp | ) |
|
53 if (fp && fp->_bf._base) {
◆ f_gcode_get_next_comment_assignment()
bool f_gcode_get_next_comment_assignment |
( |
FIL * |
fp, |
|
|
char * |
name_buffer, |
|
|
int |
name_buffer_len, |
|
|
char * |
value_buffer, |
|
|
int |
value_buffer_len |
|
) |
| |
Parse comment line in given file
Reads from the file current line and parses it. Example: Read line: ; infill extrusion width = 0.40mm\n
Ouptut: name = "infill extrusion width", value = "0.40mm"
104 if (strncmp(line,
";", 1) != 0)
108 int equal_sign_pos = -1;
109 for (
int i = 1;
i < (
int)strlen(line);
i++) {
110 if (line[
i] ==
'=') {
115 if (equal_sign_pos == -1)
120 while (name_start < equal_sign_pos && line[name_start] ==
' ')
122 int value_start = equal_sign_pos + 1;
123 while (line[value_start] ==
' ')
127 snprintf(name_buffer, name_buffer_len,
"%.*s",
128 equal_sign_pos - name_start,
129 (
const char *)line.
l + name_start);
130 snprintf(value_buffer, value_buffer_len,
"%s",
131 (
const char *)line.
l + value_start);