FIx suspend/pause and saving/restoring Extruder state, this is complex due to possibl...
[clinton/Smoothieware.git] / src / modules / utils / player / Player.h
CommitLineData
663d7943
L
1/*
2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4 Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
6*/
7
8
9#ifndef PLAYER_H
10#define PLAYER_H
11
9ef9c12a 12#include "Module.h"
663d7943 13
9ef9c12a
JM
14#include <stdio.h>
15#include <string>
02e4b295
JM
16#include <map>
17#include <vector>
9ef9c12a
JM
18using std::string;
19
20class StreamOutput;
663d7943
L
21
22class Player : public Module {
23 public:
02e4b295 24 Player();
663d7943
L
25
26 void on_module_loaded();
27 void on_console_line_received( void* argument );
28 void on_main_loop( void* argument );
63888663 29 void on_second_tick(void* argument);
35089dc7
JM
30 void on_get_public_data(void* argument);
31 void on_set_public_data(void* argument);
c4e56997 32 void on_gcode_received(void *argument);
75f4581c
JM
33
34 private:
663d7943 35 void play_command( string parameters, StreamOutput* stream );
addfb453
L
36 void progress_command( string parameters, StreamOutput* stream );
37 void abort_command( string parameters, StreamOutput* stream );
02e4b295
JM
38 void suspend_command( string parameters, StreamOutput* stream );
39 void resume_command( string parameters, StreamOutput* stream );
428d1181 40 string extract_options(string& args);
0f11f650 41 void suspend_part2();
663d7943 42
e2cd3423 43 string filename;
d467fcad
JM
44 string after_suspend_gcode;
45 string before_resume_gcode;
7a42f8a2 46 string on_boot_gcode;
663d7943 47 StreamOutput* current_stream;
c4e56997 48 StreamOutput* reply_stream;
0f11f650 49
663d7943 50 FILE* current_file_handler;
be6a1e19
DM
51 long file_size;
52 unsigned long played_cnt;
53 unsigned long elapsed_secs;
de2ee57c 54 float saved_position[3]; // only saves XYZ
02e4b295 55 std::map<uint16_t, float> saved_temperatures;
4c09283b
JM
56 struct {
57 bool on_boot_gcode_enable:1;
58 bool booted:1;
59 bool playing_file:1;
02e4b295 60 bool suspended:1;
02e4b295 61 bool was_playing_file:1;
f6fc8c0d 62 bool leave_heaters_on:1;
16d1a7b7 63 bool override_leave_heaters_on:1;
0f11f650 64 uint8_t suspend_loops:4;
4c09283b 65 };
663d7943
L
66};
67
68#endif // PLAYER_H