Commit | Line | Data |
---|---|---|
446deda2 | 1 | /* |
35089dc7 JM |
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. | |
446deda2 | 5 | You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. |
35089dc7 JM |
6 | */ |
7 | ||
8 | #include "libs/Kernel.h" | |
9 | #include "libs/SerialMessage.h" | |
10 | #include "Panel.h" | |
11 | #include "PanelScreen.h" | |
12 | #include "MainMenuScreen.h" | |
13 | #include "JogScreen.h" | |
14 | #include "ControlScreen.h" | |
15 | #include "libs/nuts_bolts.h" | |
16 | #include "libs/utils.h" | |
17 | #include <string> | |
18 | ||
19 | using namespace std; | |
20 | ||
21 | ||
22 | JogScreen::JogScreen(){ | |
58d6d841 JM |
23 | this->control_screen = new ControlScreen(); |
24 | this->control_screen->set_parent(this); | |
35089dc7 JM |
25 | } |
26 | ||
27 | void JogScreen::on_enter(){ | |
58d6d841 | 28 | this->panel->enter_menu_mode(); |
f65ce58f | 29 | this->panel->setup_menu(4); // 6 menu items |
58d6d841 | 30 | this->refresh_screen(); |
35089dc7 JM |
31 | } |
32 | ||
33 | void JogScreen::on_refresh(){ | |
58d6d841 JM |
34 | if( this->panel->menu_change() ){ |
35 | this->refresh_screen(); | |
36 | } | |
37 | if( this->panel->click() ){ | |
446deda2 | 38 | this->clicked_menu_entry(this->panel->get_menu_current_line()); |
58d6d841 | 39 | } |
35089dc7 JM |
40 | } |
41 | ||
42 | void JogScreen::refresh_screen(){ | |
58d6d841 | 43 | this->refresh_menu(); |
35089dc7 JM |
44 | } |
45 | ||
46 | void JogScreen::display_menu_line(uint16_t line){ | |
47 | switch( line ){ | |
446deda2 JM |
48 | case 0: this->panel->lcd->printf("Back"); break; |
49 | case 1: this->panel->lcd->printf("Move 10.0mm \x7E"); break; | |
50 | case 2: this->panel->lcd->printf("Move 1.0mm \x7E"); break; | |
51 | case 3: this->panel->lcd->printf("Move 0.1mm \x7E"); break; | |
35089dc7 JM |
52 | } |
53 | } | |
54 | ||
55 | void JogScreen::clicked_menu_entry(uint16_t line){ | |
56 | switch( line ){ | |
58d6d841 JM |
57 | case 0: this->panel->enter_screen(this->parent); return; |
58 | case 1: this->control_screen->set_jog_increment(10.0); break; | |
59 | case 2: this->control_screen->set_jog_increment(1.0); break; | |
60 | case 3: this->control_screen->set_jog_increment(0.1); break; | |
35089dc7 | 61 | } |
58d6d841 | 62 | this->panel->enter_screen(this->control_screen); |
35089dc7 | 63 | } |