Fork of Smoothie to port to mbed non-LPC targets.
Fork of Smoothie by
ExtruderScreen.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 "ExtruderScreen.h" 00013 #include "libs/nuts_bolts.h" 00014 #include "libs/utils.h" 00015 #include <string> 00016 00017 using namespace std; 00018 00019 00020 ExtruderScreen::ExtruderScreen() 00021 { 00022 } 00023 00024 void ExtruderScreen::on_enter() 00025 { 00026 this->panel->enter_menu_mode(); 00027 this->panel->setup_menu(3); 00028 this->refresh_menu(); 00029 } 00030 00031 void ExtruderScreen::on_refresh() 00032 { 00033 if ( this->panel->menu_change() ) { 00034 this->refresh_menu(); 00035 } 00036 if ( this->panel->click() ) { 00037 this->clicked_menu_entry(this->panel->get_menu_current_line()); 00038 } 00039 } 00040 00041 void ExtruderScreen::display_menu_line(uint16_t line) 00042 { 00043 switch ( line ) { 00044 case 0: this->panel->lcd->printf("Back"); break; 00045 case 1: this->panel->lcd->printf("Extrude 5mm"); break; 00046 case 2: this->panel->lcd->printf("Retract 5mm"); break; 00047 } 00048 } 00049 00050 void ExtruderScreen::clicked_menu_entry(uint16_t line) 00051 { 00052 switch ( line ) { 00053 case 0: this->panel->enter_screen(this->parent); return; 00054 case 1: command = "G91\nG1 E5 F100\nG90"; break; 00055 case 2: command = "G91\nG1 E-5 F100\nG90"; break; 00056 } 00057 } 00058 00059 // queuing commands needs to be done from main loop 00060 void ExtruderScreen::on_main_loop() 00061 { 00062 if (this->command.empty()) return; 00063 send_command(this->command.c_str()); 00064 this->command.clear(); 00065 }
Generated on Tue Jul 12 2022 20:09:01 by 1.7.2