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/>.
8 #include "libs/Kernel.h"
10 #include "PanelScreen.h"
11 #include "PrepareScreen.h"
12 #include "libs/nuts_bolts.h"
13 #include "libs/utils.h"
15 #include "libs/SerialMessage.h"
18 PrepareScreen::PrepareScreen(){
20 // this->extruder_screen = (new ExtruderScreen() )->set_parent(this);
21 // this->temp_screen = (new TempScreen() )->set_parent(this);
24 void PrepareScreen::on_enter(){
25 this->panel
->enter_menu_mode();
26 this->panel
->setup_menu(7, 4); // 7 menu items, 4 lines
27 this->refresh_screen();
30 void PrepareScreen::on_refresh(){
31 if( this->panel
->menu_change() ){
32 this->refresh_screen();
34 if( this->panel
->click() ){
35 this->clicked_menu_entry(this->panel
->menu_current_line());
39 void PrepareScreen::refresh_screen(){
43 void PrepareScreen::display_menu_line(uint16_t line
){
45 case 0: this->panel
->lcd
->printf("Back" ); break;
46 case 1: this->panel
->lcd
->printf("Home All Axis" ); break;
47 case 2: this->panel
->lcd
->printf("Set Home" ); break;
48 case 3: this->panel
->lcd
->printf("Pre Heat" ); break;
49 case 4: this->panel
->lcd
->printf("Cool Down" ); break;
50 case 5: this->panel
->lcd
->printf("Extrude" ); break;
51 case 6: this->panel
->lcd
->printf("Set Temperature"); break;
55 void PrepareScreen::clicked_menu_entry(uint16_t line
){
57 case 0: this->panel
->enter_screen(this->parent
); break;
58 case 1: send_gcode("G28"); break;
59 case 2: send_gcode("G92 X0 Y0 Z0"); break;
60 case 3: this->preheat(); break;
61 case 4: this->cooldown(); break;
62 case 5: this->panel
->enter_screen(this->extruder_screen
); break;
63 case 6: this->panel
->enter_screen(this->temp_screen
); break;
70 void PrepareScreen::preheat() {
73 void PrepareScreen::cooldown() {
76 void PrepareScreen::send_gcode(const char* gcstr
) {
78 struct SerialMessage message
;
79 message
.message
= gcode
;
80 message
.stream
= &(StreamOutput::NullStream
);
81 THEKERNEL
->call_event(ON_CONSOLE_LINE_RECEIVED
, &message
);