Display temperatures properly using designators and single line output
authorMichael Moon <triffid.hunter@gmail.com>
Sat, 22 Dec 2012 01:19:30 +0000 (12:19 +1100)
committerMichael Moon <triffid.hunter@gmail.com>
Wed, 2 Jan 2013 00:45:28 +0000 (11:45 +1100)
src/modules/communication/GcodeDispatch.cpp
src/modules/communication/utils/Gcode.h
src/modules/tools/temperaturecontrol/TemperatureControl.cpp

index 58a59fe..e5d3252 100644 (file)
@@ -100,7 +100,10 @@ void GcodeDispatch::on_console_line_received(void * line){
                 gcode.prepare_cached_values();
 
                 //Dispatch message!
+                gcode.add_nl = false;
                 this->kernel->call_event(ON_GCODE_RECEIVED, &gcode );
+                if (gcode.add_nl)
+                    new_message.stream->printf("\r\n");
                 new_message.stream->printf("ok\r\n");
             }
         }else{
index 5a08f43..c322804 100644 (file)
@@ -32,6 +32,8 @@ class Gcode {
         unsigned int m;
         unsigned int g;
 
+        bool add_nl;
+
         StreamOutput* stream;
 };
 #endif
index 39e86cd..8a1b763 100644 (file)
@@ -105,6 +105,7 @@ void TemperatureControl::on_gcode_received(void* argument)
         if( gcode->m == this->get_m_code ){
 //             gcode->stream->printf("get temperature: %f current:%f target:%f bare_value:%u \r\n", this->get_temperature(), this->new_thermistor_reading(), this->desired_adc_value, this->kernel->adc->read(this->thermistor_pin)  );
             gcode->stream->printf("%s:%3.1f /%3.1f ", this->designator.c_str(), this->get_temperature(), ((this->desired_adc_value == UNDEFINED)?0.0:this->adc_value_to_temperature(this->desired_adc_value)));
+            gcode->add_nl = true;
         }
     }
 }