Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Gcode.cpp
- Revision:
- 0:1d67da0805fd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Gcode.cpp	Wed May 14 10:34:11 2014 +0000
@@ -0,0 +1,70 @@
+#include"Gcode.h"
+#include <string>
+using std::string;
+#include"mbed.h"
+Gcode::Gcode(const string& command, Serial* stream):command(command),m(0),g(0),stream(stream),add_nl(false)
+{
+    prepare_cached_values();
+    this->millimeters_of_travel = 0.0F;
+    this->accepted_by_module = false;
+}
+
+Gcode::Gcode(const Gcode& to_copy)
+{
+    
+    this->command.assign( to_copy.command );
+    this->millimeters_of_travel = to_copy.millimeters_of_travel;
+    this->has_m                 = to_copy.has_m;
+    this->has_g                 = to_copy.has_g;
+    this->m                     = to_copy.m;
+    this->g                     = to_copy.g;
+    this->add_nl                = to_copy.add_nl;
+    this->stream                = to_copy.stream;
+    this->accepted_by_module=false;
+    this->txt_after_ok.assign( to_copy.txt_after_ok );
+    
+}
+
+Gcode& Gcode::operator=(const Gcode& to_copy)
+{
+    if(this != &to_copy)
+    {
+        this->command.assign( to_copy.command );
+        this->millimeters_of_travel = to_copy.millimeters_of_travel;
+        this->has_m                 = to_copy.has_m;
+        this->has_g                 = to_copy.has_g;
+        this->m                     = to_copy.m;
+        this->g                     = to_copy.g;
+        this->add_nl                = to_copy.add_nl;
+        this->stream                = to_copy.stream;
+        this->txt_after_ok.assign( to_copy.txt_after_ok );
+    }    
+    this->accepted_by_module = false;
+    return *this;
+}
+
+
+
+bool Gcode::has_letter(char letter)
+{
+    for(std::string::iterator c = this->command.begin(); c != this->command.end(); c++)      //iterator  const_iterator not support  why?
+    {
+        if(*c == letter)
+        {
+            return true; 
+        }  
+    }
+    
+    return false;
+}
+
+// 
+float Gcode::get_float(char letter)
+{
+        
+    
+}
+void Gcode::prepare_cached_values(){
+
+
+}