Firmware2/Marlin/src/gcode/units/M149.cpp

46 lines
1.5 KiB
C++
Raw Normal View History

/**
* Marlin 3D Printer Firmware
2020-02-03 15:00:57 +01:00
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
2019-06-28 06:57:50 +02:00
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program 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.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
2020-07-23 05:20:14 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
2017-09-17 06:15:33 +02:00
#include "../../inc/MarlinConfig.h"
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
#include "../gcode.h"
/**
* M149: Set temperature units
*/
2017-09-17 06:15:33 +02:00
void GcodeSuite::M149() {
if (parser.seenval('C')) parser.set_input_temp_units(TEMPUNIT_C);
else if (parser.seenval('K')) parser.set_input_temp_units(TEMPUNIT_K);
else if (parser.seenval('F')) parser.set_input_temp_units(TEMPUNIT_F);
2021-09-08 01:06:10 +02:00
else M149_report();
}
void GcodeSuite::M149_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_TEMPERATURE_UNITS));
2021-09-09 11:57:05 +02:00
SERIAL_ECHOPGM(" M149 ", AS_CHAR(parser.temp_units_code()), " ; Units in ");
2021-09-27 18:03:07 +02:00
SERIAL_ECHOLNF(parser.temp_units_name());
}
2017-09-17 06:15:33 +02:00
#endif // TEMPERATURE_UNITS_SUPPORT