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/>.
15 // Whether or not a Gcode has a letter
16 bool Gcode::has_letter( char letter
){
17 //return ( this->command->find( letter ) != string::npos );
18 for (size_t i
=0; i
< this->command
.length(); i
++){
19 if( this->command
.at(i
) == letter
){
26 // Retrieve the value for a given letter
27 // We don't use the high-level methods of std::string because they call malloc and it's very bad to do that inside of interrupts
28 double Gcode::get_value( char letter
){
30 for (size_t i
=0; i
<= this->command
.length()-1; i
++){
31 if( letter
== this->command
.at(i
) ){
32 size_t beginning
= i
+1;
34 for(size_t j
=beginning
; j
<= this->command
.length(); j
++){
36 if( j
== this->command
.length() ){ c
= ';'; }else{ c
= this->command
.at(j
); }
37 if( c
!= '.' && c
!= '-' && ( c
< '0' || c
> '9' ) ){
38 buffer
[j
-beginning
] = '\0';
42 buffer
[j
-beginning
] = c
;