-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprinter_file_manager.h
More file actions
79 lines (64 loc) · 2.55 KB
/
Copy pathprinter_file_manager.h
File metadata and controls
79 lines (64 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "main.h"
#ifndef _WIN32
#include "include/sdcard.h"
#else
#include "sdcard.h"
#endif
#include "printer_entities.h"
#include "printer_memory_manager.h"
#include "ff.h"
#ifndef __PRINTER_GCODE_FILE__
#define __PRINTER_GCODE_FILE__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct FILE_MANAGER
{
uint32_t id;
} *HFILEMANAGER;
HFILEMANAGER FileManagerConfigure(HSDCARD sdcard, HSDCARD ram, MemoryManager* memory, HGCODE interpreter, GCodeAxisConfig* axis_cfg, FIL* file_handle, void* logger);
// The following operation is split on 3 steps: [start -> work -> complete] to avoid blocking UI
/// <summary>
/// Initiating translation of the external gcode file to ram
/// </summary>
/// <param name="hfile">handle to file manager</param>
/// <param name="filename">name of the file on SDCARD to be cashed into RAM</param>
/// <returns>number of blocks in the incoming file</returns>
size_t FileManagerOpenGCode(HFILEMANAGER hfile, const char* filename);
/// <summary>
/// Converting GCode file to RAM using single SDCARD_BLOCK_SIZE chunk of memory
/// </summary>
/// <param name="hfile">handle to file manager</param>
/// <returns>Operation status. PRINTER_OK if no error occured</returns>
PRINTER_STATUS FileManagerReadGCodeBlock(HFILEMANAGER hfile);
/// <summary>
/// Completes file translation by writing control block
/// </summary>
/// <param name="hfile">handle to file manager</param>
/// <returns>Operation status. PRINTER_OK if no error ocured</returns>
PRINTER_STATUS FileManagerCloseGCode(HFILEMANAGER hfile);
char* FileManagerGetError(HFILEMANAGER hfile);
/// <summary>
/// Flash mtl file into RAM
/// </summary>
/// <param name="hfile">handle to file manager</param>
/// <param name="filename">name of the file on SDCARD to be flashed into RAM</param>
/// <returns>Operation status. PRINTER_OK if no error ocured</returns>
PRINTER_STATUS FileManagerSaveMTL(HFILEMANAGER hfile, const char* filename);
/// <summary>
/// Removes mtl file from RAM by material name
/// </summary>
/// <param name="hfile">handle to file manager</param>
/// <param name="filename">name of the material to be removed</param>
/// <returns>Operation status. PRINTER_OK if no error ocured</returns>
PRINTER_STATUS FileManagerRemoveMTL(HFILEMANAGER hfile, const char* material_name);
/// <summary>
/// Removes mtl file from RAM by material name
/// </summary>
/// <param name="hfile">handle to file manager</param>
/// <returns>Pointer to valid material or nullptr otherwise</returns>
MaterialFile* FileManagerGetNextMTL(HFILEMANAGER hfile);
#ifdef __cplusplus
}
#endif
#endif //__PRINTER_GCODE_FILE__