Fork of Smoothie to port to mbed non-LPC targets.

Dependencies:   mbed

Fork of Smoothie by Stéphane Cachat

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers JogScreen.cpp Source File

JogScreen.cpp

00001 /*
00002       This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
00003       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.
00004       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.
00005       You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
00006 */
00007 
00008 #include "libs/Kernel.h"
00009 #include "libs/SerialMessage.h"
00010 #include "Panel.h"
00011 #include "PanelScreen.h"
00012 #include "MainMenuScreen.h"
00013 #include "JogScreen.h"
00014 #include "ControlScreen.h"
00015 #include "libs/nuts_bolts.h"
00016 #include "libs/utils.h"
00017 #include <string>
00018 
00019 using namespace std;
00020 
00021 
00022 JogScreen::JogScreen()
00023 {
00024     this->control_screen = new ControlScreen();
00025     this->control_screen->set_parent(this);
00026 }
00027 
00028 void JogScreen::on_enter()
00029 {
00030     this->panel->enter_menu_mode();
00031     this->panel->setup_menu(4);
00032     this->refresh_menu();
00033 }
00034 
00035 void JogScreen::on_refresh()
00036 {
00037     if ( this->panel->menu_change() ) {
00038         this->refresh_menu();
00039     }
00040     if ( this->panel->click() ) {
00041         this->clicked_menu_entry(this->panel->get_menu_current_line());
00042     }
00043 }
00044 
00045 void JogScreen::display_menu_line(uint16_t line)
00046 {
00047     switch ( line ) {
00048         case 0: this->panel->lcd->printf("Back");  break;
00049         case 1: this->panel->lcd->printf("Move 10.0mm      \x7E"); break;
00050         case 2: this->panel->lcd->printf("Move  1.0mm      \x7E");  break;
00051         case 3: this->panel->lcd->printf("Move  0.1mm      \x7E");  break;
00052     }
00053 }
00054 
00055 void JogScreen::clicked_menu_entry(uint16_t line)
00056 {
00057     switch ( line ) {
00058         case 0: this->panel->enter_screen(this->parent); return;
00059         case 1: this->control_screen->set_jog_increment(10.0); break;
00060         case 2: this->control_screen->set_jog_increment(1.0); break;
00061         case 3: this->control_screen->set_jog_increment(0.1); break;
00062     }
00063     this->panel->enter_screen(this->control_screen);
00064 }