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 "ExtruderScreen.h"
13 #include "libs/nuts_bolts.h"
14 #include "libs/utils.h"
15 #include "PublicDataRequest.h"
16 #include "modules/tools/temperaturecontrol/TemperatureControlPublicAccess.h"
17 #include "PublicData.h"
18 #include "checksumm.h"
23 PrepareScreen::PrepareScreen()
26 this->extruder_screen
= (new ExtruderScreen() )->set_parent(this);
27 // this->temp_screen = (new TempScreen() )->set_parent(this);
30 void PrepareScreen::on_enter()
32 this->panel
->enter_menu_mode();
33 this->panel
->setup_menu(8);
37 void PrepareScreen::on_refresh()
39 if ( this->panel
->menu_change() ) {
42 if ( this->panel
->click() ) {
43 this->clicked_menu_entry(this->panel
->get_menu_current_line());
47 void PrepareScreen::display_menu_line(uint16_t line
)
50 case 0: this->panel
->lcd
->printf("Back" ); break;
51 case 1: this->panel
->lcd
->printf("Home All Axis" ); break;
52 case 2: this->panel
->lcd
->printf("Set Home" ); break;
53 case 3: this->panel
->lcd
->printf("Set Z0" ); break;
54 case 4: this->panel
->lcd
->printf("Pre Heat" ); break;
55 case 5: this->panel
->lcd
->printf("Cool Down" ); break;
56 case 6: this->panel
->lcd
->printf("Extrude" ); break;
57 case 7: this->panel
->lcd
->printf("Motors off" ); break;
58 //case 8: this->panel->lcd->printf("Set Temperature"); break;
62 void PrepareScreen::clicked_menu_entry(uint16_t line
)
65 case 0: this->panel
->enter_screen(this->parent
); break;
66 case 1: command
= "G28"; break;
67 case 2: command
= "G92 X0 Y0 Z0"; break;
68 case 3: command
= "G92 Z0"; break;
69 case 4: this->preheat(); break;
70 case 5: this->cooldown(); break;
71 case 6: this->panel
->enter_screen(this->extruder_screen
); break;
72 case 7: command
= "M84"; break;
73 //case 8: this->panel->enter_screen(this->temp_screen ); break;
77 void PrepareScreen::preheat()
79 float t
= panel
->get_default_hotend_temp();
80 THEKERNEL
->public_data
->set_value( temperature_control_checksum
, hotend_checksum
, &t
);
81 t
= panel
->get_default_bed_temp();
82 THEKERNEL
->public_data
->set_value( temperature_control_checksum
, bed_checksum
, &t
);
85 void PrepareScreen::cooldown()
88 THEKERNEL
->public_data
->set_value( temperature_control_checksum
, hotend_checksum
, &t
);
89 THEKERNEL
->public_data
->set_value( temperature_control_checksum
, bed_checksum
, &t
);
92 // queuing commands needs to be done from main loop
93 void PrepareScreen::on_main_loop()
95 // change actual axis value
96 if (this->command
.empty()) return;
97 send_command(this->command
.c_str());
98 this->command
.clear();