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 "MainMenuScreen.h"
12 #include "WatchScreen.h"
13 #include "FileScreen.h"
14 #include "ControlScreen.h"
15 #include "PrepareScreen.h"
16 #include "libs/nuts_bolts.h"
17 #include "libs/utils.h"
18 #include "modules/utils/player/PlayerPublicAccess.h"
24 MainMenuScreen::MainMenuScreen(){
26 this->jog_screen
= (new JogScreen() )->set_parent(this);
27 this->watch_screen
= (new WatchScreen() )->set_parent(this);
28 this->file_screen
= (new FileScreen() )->set_parent(this);
29 this->prepare_screen
= (new PrepareScreen() )->set_parent(this);
30 this->set_parent(this->watch_screen
);
33 void MainMenuScreen::on_enter(){
34 this->panel
->enter_menu_mode();
35 this->panel
->setup_menu(6, 4); // 6 menu items, 4 lines
36 this->refresh_screen();
39 void MainMenuScreen::on_refresh(){
40 if( this->panel
->menu_change() ){
41 this->refresh_screen();
43 if( this->panel
->click() ){
44 this->clicked_menu_entry(this->panel
->menu_current_line());
50 void MainMenuScreen::refresh_screen(){
54 void MainMenuScreen::display_menu_line(uint16_t line
){
56 case 0: this->panel
->lcd
->printf("Watch"); break;
57 case 1: this->panel
->lcd
->printf(panel
->is_playing() ? "Abort" : "Play"); break;
58 case 2: this->panel
->lcd
->printf("Jog"); break;
59 case 3: this->panel
->lcd
->printf("Prepare"); break;
60 case 4: this->panel
->lcd
->printf("Configure"); break;
61 case 5: this->panel
->lcd
->printf("Tune"); break;
66 void MainMenuScreen::clicked_menu_entry(uint16_t line
){
68 case 0: this->panel
->enter_screen(this->watch_screen
); break;
69 case 1: if(this->panel
->is_playing())
72 this->panel
->enter_screen(this->file_screen
);
74 case 2: this->panel
->enter_screen(this->jog_screen
); break;
75 case 3: this->panel
->enter_screen(this->prepare_screen
); break;
80 void MainMenuScreen::abort_playing() {
81 THEKERNEL
->public_data
->set_value(player_checksum
, abort_play_checksum
, NULL
);
82 this->panel
->enter_screen(this->watch_screen
);