Merge remote-tracking branch 'upstream/edge' into upstream-master
[clinton/Smoothieware.git] / src / modules / utils / panel / screens / JogScreen.cpp
CommitLineData
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"
383c9c1c 12#include "LcdBase.h"
35089dc7
JM
13#include "MainMenuScreen.h"
14#include "JogScreen.h"
15#include "ControlScreen.h"
16#include "libs/nuts_bolts.h"
17#include "libs/utils.h"
18#include <string>
19
20using namespace std;
21
22
862fc625
JM
23JogScreen::JogScreen()
24{
58d6d841
JM
25 this->control_screen = new ControlScreen();
26 this->control_screen->set_parent(this);
35089dc7
JM
27}
28
862fc625
JM
29void JogScreen::on_enter()
30{
cee1bb2d 31 THEPANEL->enter_menu_mode();
cb0b1658 32 THEPANEL->setup_menu(5);
862fc625 33 this->refresh_menu();
35089dc7
JM
34}
35
862fc625
JM
36void JogScreen::on_refresh()
37{
cee1bb2d 38 if ( THEPANEL->menu_change() ) {
862fc625 39 this->refresh_menu();
58d6d841 40 }
cee1bb2d
JM
41 if ( THEPANEL->click() ) {
42 this->clicked_menu_entry(THEPANEL->get_menu_current_line());
58d6d841 43 }
35089dc7
JM
44}
45
862fc625
JM
46void JogScreen::display_menu_line(uint16_t line)
47{
48 switch ( line ) {
cee1bb2d
JM
49 case 0: THEPANEL->lcd->printf("Back"); break;
50 case 1: THEPANEL->lcd->printf("Move 10.0mm \x7E"); break;
51 case 2: THEPANEL->lcd->printf("Move 1.0mm \x7E"); break;
52 case 3: THEPANEL->lcd->printf("Move 0.1mm \x7E"); break;
cb0b1658 53 case 4: THEPANEL->lcd->printf("Move 0.01mm \x7E"); break;
35089dc7
JM
54 }
55}
56
862fc625
JM
57void JogScreen::clicked_menu_entry(uint16_t line)
58{
59 switch ( line ) {
cee1bb2d 60 case 0: THEPANEL->enter_screen(this->parent); return;
58d6d841
JM
61 case 1: this->control_screen->set_jog_increment(10.0); break;
62 case 2: this->control_screen->set_jog_increment(1.0); break;
63 case 3: this->control_screen->set_jog_increment(0.1); break;
cb0b1658 64 case 4: this->control_screen->set_jog_increment(0.01); break;
35089dc7 65 }
cee1bb2d 66 THEPANEL->enter_screen(this->control_screen);
35089dc7 67}