resolved merge conflicts between edge marlin-compatibility and dev-p24

This commit is contained in:
Alden Hart
2017-03-23 11:07:12 -04:00
41 changed files with 2457 additions and 347 deletions
+1 -1
Submodule Motate updated: 222de41d50...41e5b92a98
+11 -8
View File
@@ -52,14 +52,17 @@ NEEDS_PRINTF_FLOAT=1
# Now invoke the Motate compile system
include $(MOTATE_PATH)/Motate.mk
ifeq ($(DEBUG),0)
DEVICE_DEFINES += DEBUG=0 IN_DEBUGGER=0
endif
ifeq ($(DEBUG),1)
DEVICE_DEFINES += DEBUG=1 IN_DEBUGGER=0
endif
ifeq ($(DEBUG),2)
DEVICE_DEFINES += DEBUG=1 IN_DEBUGGER=1
ifeq ($(DEBUG),0)
DEVICE_DEFINES += DEBUG=0 IN_DEBUGGER=0
endif
ifeq ($(DEBUG),1)
DEVICE_DEFINES += DEBUG=1 IN_DEBUGGER=0
endif
ifeq ($(DEBUG),2)
DEVICE_DEFINES += DEBUG=1 IN_DEBUGGER=1
endif
ifeq ($(DEBUG),3)
DEVICE_DEFINES += DEBUG=1 IN_DEBUGGER=1 DEBUG_SEMIHOSTING=1
endif
#ifeq ($(DEBUG),3)
# DEVICE_DEFINES += DEBUG=1 IN_DEBUGGER=1 DEBUG_SEMIHOSTING=1
+5 -1
View File
@@ -76,7 +76,9 @@ void board_hardware_init(void) // called 1st
}
void board_xio_init(void) // called later than board_hardware_init (there are thing in between)
auto startup_file = make_xio_flash_file("");
void board_xio_init(void) // called later than board_hardware_init (there are things in between)
{
// Init SPI
#if XIO_HAS_SPI
@@ -87,4 +89,6 @@ void board_xio_init(void) // called later than board_hardware_init (there are th
#if XIO_HAS_UART
Serial.init();
#endif
xio_send_file(startup_file);
}
+1
View File
@@ -31,6 +31,7 @@
#define board_xio_h
#include "settings.h"
#include "xio.h"
//******** USB ********
#if XIO_HAS_USB
+73 -5
View File
@@ -352,9 +352,21 @@ void cm_set_model_linenum(int32_t linenum)
nv_add_object((const char *)"n"); // then add the line number to the nv list
}
/*
* cm_check_linenum() - Check line number for Marlin protocol
*/
stat_t cm_check_linenum() {
if (cm->gmx.last_line_number != cm->gm.linenum) {
debug_trap("line number out of sequence");
return STAT_LINE_NUMBER_OUT_OF_SEQUENCE;
}
cm->gmx.last_line_number = cm->gm.linenum;
return STAT_OK;
}
/****************************************************************************************
**** COORDINATE SYSTEMS AND OFFSETS ****************************************************
****************************************************************************************
* COORDINATE SYSTEMS AND OFFSETS
* Functions to get, set and report coordinate systems and work offsets
* These functions are not part of the NIST defined functions
****************************************************************************************/
@@ -645,6 +657,28 @@ stat_t cm_set_tram(nvObj_t *nv)
return (STAT_OK);
}
/****************************************************************************************
* cm_set_nxt_line() - JSON command to set the next line number
* cm_get_nxt_line() - JSON query to get the next expected line number
*/
stat_t cm_set_nxln(nvObj_t *nv)
{
if (nv->valuetype == TYPE_INTEGER || nv->valuetype == TYPE_FLOAT)
{
cm->gmx.last_line_number = nv->value_int - 1;
return (STAT_OK);
}
return (STAT_INPUT_VALUE_RANGE_ERROR);
}
stat_t cm_get_nxln(nvObj_t *nv)
{
nv->value_int = cm->gmx.last_line_number+1;
nv->valuetype = TYPE_INTEGER;
return (STAT_OK);
}
/****************************************************************************************
* cm_set_model_target() - set target vector in GM model
*
@@ -674,7 +708,8 @@ static float _calc_ABC(const uint8_t axis, const float target[])
if ((cm->a[axis].axis_mode == AXIS_STANDARD) || (cm->a[axis].axis_mode == AXIS_INHIBITED)) {
return(target[axis]); // no mm conversion - it's in degrees
}
return(_to_millimeters(target[axis]) * 360 / (2 * M_PI * cm->a[axis].radius));
// radius mode
return (_to_millimeters(target[axis]) * 360.0 / (2 * M_PI * cm->a[axis].radius));
}
void cm_set_model_target(const float target[], const bool flags[])
@@ -705,9 +740,29 @@ void cm_set_model_target(const float target[], const bool flags[])
} else {
tmp = _calc_ABC(axis, target);
}
#if MARLIN_COMPAT_ENABLED == true
// If we are in absolute mode (generally), but the extruder is relative,
// then we adjust the extruder to a relative position
if (mst.marlin_flavor && (cm->a[axis].axis_mode == AXIS_RADIUS)) {
if ((cm->gm.distance_mode == INCREMENTAL_DISTANCE_MODE) || (mst.extruder_mode == EXTRUDER_MOVES_RELATIVE)) {
cm->gm.target[axis] += tmp;
}
else { // if (cm.gmx.extruder_mode == EXTRUDER_MOVES_NORMAL)
cm->gm.target[axis] = tmp + cm_get_combined_offset(axis);
}
// TODO - volumetric filament conversion
// else {
// cm->gm.target[axis] += tmp * cm.gmx.volume_to_filament_length[axis-3];
// }
}
else
#endif // MARLIN_COMPAT_ENABLED
if (cm->gm.distance_mode == ABSOLUTE_DISTANCE_MODE) {
cm->gm.target[axis] = tmp + cm_get_combined_offset(axis); // sacidu93's fix to Issue #22
} else {
}
else {
cm->gm.target[axis] += tmp;
}
cm->return_flags[axis] = true;
@@ -903,7 +958,7 @@ stat_t cm_set_tl_offset(const uint8_t H_word, const bool H_flag, const bool appl
for (uint8_t axis = AXIS_X; axis < AXES; axis++) {
cm->tool_offset[axis] += tt.tt_offset[tool][axis];
}
} else {
} else {
for (uint8_t axis = AXIS_X; axis < AXES; axis++) {
cm->tool_offset[axis] = tt.tt_offset[tool][axis];
}
@@ -1615,6 +1670,17 @@ stat_t cm_json_command(char *json_string)
return mp_json_command(json_string);
}
/*
* cm_json_command_immediate() - M100.1
*/
stat_t cm_json_command_immediate(char *json_string)
{
return mp_json_command_immediate(json_string);
}
/*
* cm_json_wait() - M102
*/
stat_t cm_json_wait(char *json_string)
{
return mp_json_wait(json_string);
@@ -2357,6 +2423,7 @@ static const char fmt_fro[] = "[fro] feedrate override%15.3f [0.05 < mfo < 2.0
static const char fmt_troe[] = "[troe] traverse over enable%8d [0=disable,1=enable]\n";
static const char fmt_tro[] = "[tro] traverse override%15.3f [0.05 < mto < 1.00]\n";
static const char fmt_tram[] = "[tram] is coordinate space rotated to be tram %s\n";
static const char fmt_nxln[] = "[nxln] next line number %lu\n";
void cm_print_m48(nvObj_t *nv) { text_print(nv, fmt_m48);} // TYPE_INT
void cm_print_froe(nvObj_t *nv) { text_print(nv, fmt_froe);} // TYPE INT
@@ -2364,6 +2431,7 @@ void cm_print_fro(nvObj_t *nv) { text_print(nv, fmt_fro);} // TYPE FLOAT
void cm_print_troe(nvObj_t *nv) { text_print(nv, fmt_troe);} // TYPE INT
void cm_print_tro(nvObj_t *nv) { text_print(nv, fmt_tro);} // TYPE FLOAT
void cm_print_tram(nvObj_t *nv) { text_print(nv, fmt_tram);}; // TYPE BOOL
void cm_print_nxln(nvObj_t *nv) { text_print(nv, fmt_nxln);}; // TYPE INT
/*
* axis print functions
+89 -2
View File
@@ -34,8 +34,13 @@
#include "config.h"
#include "hardware.h" // Note: hardware.h is specific to the hardware target selected
#include "settings.h"
#include "gcode.h"
#if MARLIN_COMPAT_ENABLED == true
#include "marlin_compatibility.h" // import Marlin definitions and enums
#endif
/* Defines, Macros, and Assorted Parameters */
#define MODEL (GCodeState_t *)&cm->gm // absolute pointer from canonical machine gm model
@@ -49,7 +54,6 @@
#define JERK_INPUT_MIN (0.01) // minimum allowable jerk setting in millions mm/min^3
#define JERK_INPUT_MAX (1000000) // maximum allowable jerk setting in millions mm/min^3
#define PROBES_STORED 3 // we store three probes for coordinate rotation computation
#define RADIUS_MIN (0.0001) // minimum value for ABC radius settings
#define MAX_LINENUM 2000000000 // set 2 billion as max line number
/*****************************************************************************
@@ -166,7 +170,7 @@ typedef enum { // applies to cm->homing_state
typedef enum { // applies to cm->probe_state
PROBE_FAILED = 0, // probe reached endpoint without triggering
PROBE_SUCCEEDED = 1, // probe was triggered, cm.probe_results has position
PROBE_SUCCEEDED = 1, // probe was triggered, cm->probe_results has position
PROBE_WAITING = 2 // probe is waiting to be started or is running
} cmProbeState;
@@ -377,6 +381,7 @@ void cm_set_motion_mode(GCodeState_t *gcode_state, const uint8_t motion_mode);
void cm_set_tool_number(GCodeState_t *gcode_state, const uint8_t tool);
void cm_set_absolute_override(GCodeState_t *gcode_state, const uint8_t absolute_override);
void cm_set_model_linenum(int32_t linenum);
stat_t cm_check_linenum();
// Coordinate systems and offsets
float cm_get_combined_offset(const uint8_t axis);
@@ -481,6 +486,7 @@ void cm_optional_program_stop(void); // M1
void cm_program_end(void); // M2
stat_t cm_json_command(char *json_string); // M100
stat_t cm_json_command_immediate(char *json_string); // M100.1
stat_t cm_json_wait(char *json_string); // M102
/**** Cycles and External FIles ****/
@@ -649,6 +655,9 @@ stat_t cm_set_tro(nvObj_t *nv); // set traverse override factor
stat_t cm_set_tram(nvObj_t *nv); // attempt setting the rotation matrix
stat_t cm_get_tram(nvObj_t *nv); // return if the rotation matrix is non-identity
stat_t cm_set_nxln(nvObj_t *nv); // set what value we expect the next line number to have
stat_t cm_get_nxln(nvObj_t *nv); // return what value we expect the next line number to have
stat_t cm_get_gpl(nvObj_t *nv); // get gcode default plane
stat_t cm_set_gpl(nvObj_t *nv); // set gcode default plane
stat_t cm_get_gun(nvObj_t *nv); // get gcode default units mode
@@ -664,6 +673,7 @@ stat_t cm_set_gdi(nvObj_t *nv); // set gcode default distance mode
#ifdef __TEXT_MODE
/* <<<<<< HEAD
void cm_print_vel(nvObj_t *nv); // model state reporting
void cm_print_feed(nvObj_t *nv);
void cm_print_line(nvObj_t *nv);
@@ -729,6 +739,82 @@ stat_t cm_set_gdi(nvObj_t *nv); // set gcode default distance mode
void cm_print_cofs(nvObj_t *nv);
void cm_print_cpos(nvObj_t *nv);
=======*/
void cm_print_vel(nvObj_t *nv); // model state reporting
void cm_print_feed(nvObj_t *nv);
void cm_print_line(nvObj_t *nv);
void cm_print_stat(nvObj_t *nv);
void cm_print_macs(nvObj_t *nv);
void cm_print_cycs(nvObj_t *nv);
void cm_print_mots(nvObj_t *nv);
void cm_print_hold(nvObj_t *nv);
void cm_print_home(nvObj_t *nv);
void cm_print_hom(nvObj_t *nv);
void cm_print_unit(nvObj_t *nv);
void cm_print_coor(nvObj_t *nv);
void cm_print_momo(nvObj_t *nv);
void cm_print_plan(nvObj_t *nv);
void cm_print_path(nvObj_t *nv);
void cm_print_dist(nvObj_t *nv);
void cm_print_admo(nvObj_t *nv);
void cm_print_frmo(nvObj_t *nv);
void cm_print_tool(nvObj_t *nv);
void cm_print_g92e(nvObj_t *nv);
void cm_print_gpl(nvObj_t *nv); // Gcode defaults
void cm_print_gun(nvObj_t *nv);
void cm_print_gco(nvObj_t *nv);
void cm_print_gpa(nvObj_t *nv);
void cm_print_gdi(nvObj_t *nv);
void cm_print_lin(nvObj_t *nv); // generic print for linear values
void cm_print_pos(nvObj_t *nv); // print runtime work position in prevailing units
void cm_print_mpo(nvObj_t *nv); // print runtime work position always in MM uints
void cm_print_ofs(nvObj_t *nv); // print runtime work offset always in MM uints
void cm_print_tof(nvObj_t *nv); // print tool length offset
void cm_print_jt(nvObj_t *nv); // global CM settings
void cm_print_ct(nvObj_t *nv);
void cm_print_zl(nvObj_t *nv);
void cm_print_sl(nvObj_t *nv);
void cm_print_lim(nvObj_t *nv);
void cm_print_saf(nvObj_t *nv);
void cm_print_m48(nvObj_t *nv);
void cm_print_froe(nvObj_t *nv);
void cm_print_fro(nvObj_t *nv);
void cm_print_troe(nvObj_t *nv);
void cm_print_tro(nvObj_t *nv);
// void cm_print_m48e(nvObj_t *nv);
// void cm_print_mfoe(nvObj_t *nv);
// void cm_print_mfo(nvObj_t *nv);
// void cm_print_mtoe(nvObj_t *nv);
// void cm_print_mto(nvObj_t *nv);
void cm_print_tram(nvObj_t *nv); // print if the axis has been rotated
void cm_print_nxln(nvObj_t *nv); // print the value of the next line number expected
void cm_print_am(nvObj_t *nv); // axis print functions
void cm_print_fr(nvObj_t *nv);
void cm_print_vm(nvObj_t *nv);
void cm_print_tm(nvObj_t *nv);
void cm_print_tn(nvObj_t *nv);
void cm_print_jm(nvObj_t *nv);
void cm_print_jh(nvObj_t *nv);
void cm_print_ra(nvObj_t *nv);
void cm_print_hi(nvObj_t *nv);
void cm_print_hd(nvObj_t *nv);
void cm_print_sv(nvObj_t *nv);
void cm_print_lv(nvObj_t *nv);
void cm_print_lb(nvObj_t *nv);
void cm_print_zb(nvObj_t *nv);
void cm_print_cofs(nvObj_t *nv);
void cm_print_cpos(nvObj_t *nv);
//>>>>>>> refs/heads/edge
#else // __TEXT_MODE
#define cm_print_vel tx_print_stub // model state reporting
@@ -778,6 +864,7 @@ stat_t cm_set_gdi(nvObj_t *nv); // set gcode default distance mode
#define cm_print_tram tx_print_stub
#define cm_print_tram tx_print_stub
#define cm_print_nxln tx_print_stub
#define cm_print_am tx_print_stub // axis print functions
#define cm_print_fr tx_print_stub
+1 -1
View File
@@ -687,7 +687,7 @@ nvObj_t *nv_add_conditional_message(const char *string) // conditionally add
void nv_print_list(stat_t status, uint8_t text_flags, uint8_t json_flags)
{
if (js.json_mode == JSON_MODE) {
if ((js.json_mode == JSON_MODE) || (js.json_mode == MARLIN_COMM_MODE)) {
json_print_list(status, json_flags);
} else {
text_print_list(status, text_flags);
+2 -1
View File
@@ -194,7 +194,8 @@ typedef uint16_t index_t; // use this if there are > 255 indexed o
typedef enum {
TEXT_MODE = 0, // sticky text mode
JSON_MODE, // sticky JSON mode
AUTO_MODE // auto-configure communications mode
AUTO_MODE, // auto-configure communications mode
MARLIN_COMM_MODE, // sticky marlin-compatibility mode (if compiled in)
} commMode;
typedef enum {
+362
View File
@@ -113,6 +113,7 @@ const cfgItem_t cfgArray[] = {
{ "sys", "id", _sn, 0, hw_print_id, hw_get_id, set_ro, nullptr, 0 }, // device ID (ASCII signature)
// dynamic model attributes for reporting purposes (up front for speed)
//<<<<<< HEAD
{ "", "stat",_i0, 0, cm_print_stat, cm_get_stat, set_ro, nullptr, 0 }, // combined machine state
{ "","stat2",_i0, 0, cm_print_stat, cm_get_stat2,set_ro, nullptr, 0 }, // combined machine state
{ "", "n", _ii, 0, cm_print_line, cm_get_mline,set_noop,nullptr,0 }, // Model line number
@@ -133,6 +134,28 @@ const cfgItem_t cfgArray[] = {
{ "", "frmo",_i0, 0, cm_print_frmo, cm_get_frmo, set_ro, nullptr, 0 }, // feed rate mode
{ "", "tool",_i0, 0, cm_print_tool, cm_get_toolv,set_ro, nullptr, 0 }, // active tool
{ "", "g92e",_i0, 0, cm_print_g92e, cm_get_g92e, set_ro, nullptr, 0 }, // G92 enable state
/*=======
{ "", "stat",_f0, 0, cm_print_stat, cm_get_stat, set_ro, (float *)&cs.null, 0 }, // combined machine state
{ "", "n", _fi, 0, cm_print_line, cm_get_mline,set_noop,(float *)&cs.null, 0 }, // Model line number
{ "", "line",_fi, 0, cm_print_line, cm_get_line, set_ro, (float *)&cs.null, 0 }, // Active line number - model or runtime line number
{ "", "vel", _f0, 2, cm_print_vel, cm_get_vel, set_ro, (float *)&cs.null, 0 }, // current velocity
{ "", "feed",_f0, 2, cm_print_feed, cm_get_feed, set_ro, (float *)&cs.null, 0 }, // feed rate
{ "", "macs",_f0, 0, cm_print_macs, cm_get_macs, set_ro, (float *)&cs.null, 0 }, // raw machine state
{ "", "cycs",_f0, 0, cm_print_cycs, cm_get_cycs, set_ro, (float *)&cs.null, 0 }, // cycle state
{ "", "mots",_f0, 0, cm_print_mots, cm_get_mots, set_ro, (float *)&cs.null, 0 }, // motion state
{ "", "hold",_f0, 0, cm_print_hold, cm_get_hold, set_ro, (float *)&cs.null, 0 }, // feedhold state
{ "", "unit",_f0, 0, cm_print_unit, cm_get_unit, set_ro, (float *)&cs.null, 0 }, // units mode
{ "", "coor",_f0, 0, cm_print_coor, cm_get_coor, set_ro, (float *)&cs.null, 0 }, // coordinate system
{ "", "momo",_f0, 0, cm_print_momo, cm_get_momo, set_ro, (float *)&cs.null, 0 }, // motion mode
{ "", "plan",_f0, 0, cm_print_plan, cm_get_plan, set_ro, (float *)&cs.null, 0 }, // plane select
{ "", "path",_f0, 0, cm_print_path, cm_get_path, set_ro, (float *)&cs.null, 0 }, // path control mode
{ "", "dist",_f0, 0, cm_print_dist, cm_get_dist, set_ro, (float *)&cs.null, 0 }, // distance mode
{ "", "admo",_f0, 0, cm_print_admo, cm_get_admo, set_ro, (float *)&cs.null, 0 }, // arc distance mode
{ "", "frmo",_f0, 0, cm_print_frmo, cm_get_frmo, set_ro, (float *)&cs.null, 0 }, // feed rate mode
{ "", "tool",_f0, 0, cm_print_tool, cm_get_toolv,set_ro, (float *)&cs.null, 0 }, // active tool
{ "", "g92e",_f0, 0, cm_print_g92e, get_ui8, set_ro, (float *)&cm.gmx.origin_offset_enable, 0 }, // G92 enabled
>>>>>>> refs/heads/edge*/
#ifdef TEMPORARY_HAS_LEDS
{ "", "_leds",_i0, 0, tx_print_nul, _get_leds,_set_leds, nullptr, 0 }, // TEMPORARY - change LEDs
#endif
@@ -584,6 +607,7 @@ const cfgItem_t cfgArray[] = {
{ "g92","g92c",_fic, 5, cm_print_cofs, cm_get_g92, set_ro, nullptr, 0 },
// Coordinate positions (G28, G30)
//<<<<<< HEAD
{ "g28","g28x",_fic, 5, cm_print_cpos, cm_get_g28, set_ro, nullptr, 0 },// g28 handled differently
{ "g28","g28y",_fic, 5, cm_print_cpos, cm_get_g28, set_ro, nullptr, 0 },
{ "g28","g28z",_fic, 5, cm_print_cpos, cm_get_g28, set_ro, nullptr, 0 },
@@ -597,6 +621,254 @@ const cfgItem_t cfgArray[] = {
{ "g30","g30a",_fic, 5, cm_print_cpos, cm_get_g30, set_ro, nullptr, 0 },
{ "g30","g30b",_fic, 5, cm_print_cpos, cm_get_g30, set_ro, nullptr, 0 },
{ "g30","g30c",_fic, 5, cm_print_cpos, cm_get_g30, set_ro, nullptr, 0 },
/*=======
{ "g28","g28x",_fic, 3, cm_print_cpos, get_flt, set_ro, (float *)&cm.gmx.g28_position[AXIS_X], 0 },// g28 handled differently
{ "g28","g28y",_fic, 3, cm_print_cpos, get_flt, set_ro, (float *)&cm.gmx.g28_position[AXIS_Y], 0 },
{ "g28","g28z",_fic, 3, cm_print_cpos, get_flt, set_ro, (float *)&cm.gmx.g28_position[AXIS_Z], 0 },
{ "g28","g28a",_fi, 3, cm_print_cpos, get_flt, set_ro, (float *)&cm.gmx.g28_position[AXIS_A], 0 },
{ "g28","g28b",_fi, 3, cm_print_cpos, get_flt, set_ro, (float *)&cm.gmx.g28_position[AXIS_B], 0 },
{ "g28","g28c",_fi, 3, cm_print_cpos, get_flt, set_ro, (float *)&cm.gmx.g28_position[AXIS_C], 0 },
{ "g30","g30x",_fic, 3, cm_print_cpos, get_flt, set_ro, (float *)&cm.gmx.g30_position[AXIS_X], 0 },// g30 handled differently
{ "g30","g30y",_fic, 3, cm_print_cpos, get_flt, set_ro, (float *)&cm.gmx.g30_position[AXIS_Y], 0 },
{ "g30","g30z",_fic, 3, cm_print_cpos, get_flt, set_ro, (float *)&cm.gmx.g30_position[AXIS_Z], 0 },
{ "g30","g30a",_fi, 3, cm_print_cpos, get_flt, set_ro, (float *)&cm.gmx.g30_position[AXIS_A], 0 },
{ "g30","g30b",_fi, 3, cm_print_cpos, get_flt, set_ro, (float *)&cm.gmx.g30_position[AXIS_B], 0 },
{ "g30","g30c",_fi, 3, cm_print_cpos, get_flt, set_ro, (float *)&cm.gmx.g30_position[AXIS_C], 0 },
// Default values for current tool length offsets (not configurable, set to zero)
{ "tof","tofx",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tl_offset[AXIS_X], 0 },
{ "tof","tofy",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tl_offset[AXIS_Y], 0 },
{ "tof","tofz",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tl_offset[AXIS_Z], 0 },
{ "tof","tofa",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tl_offset[AXIS_A], 0 },
{ "tof","tofb",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tl_offset[AXIS_B], 0 },
{ "tof","tofc",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tl_offset[AXIS_C], 0 },
// Tool table offsets
{ "tt1","tt1x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[1][AXIS_X], TT1_X_OFFSET },
{ "tt1","tt1y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[1][AXIS_Y], TT1_Y_OFFSET },
{ "tt1","tt1z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[1][AXIS_Z], TT1_Z_OFFSET },
{ "tt1","tt1a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[1][AXIS_A], TT1_A_OFFSET },
{ "tt1","tt1b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[1][AXIS_B], TT1_B_OFFSET },
{ "tt1","tt1c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[1][AXIS_C], TT1_C_OFFSET },
{ "tt2","tt2x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[2][AXIS_X], TT2_X_OFFSET },
{ "tt2","tt2y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[2][AXIS_Y], TT2_Y_OFFSET },
{ "tt2","tt2z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[2][AXIS_Z], TT2_Z_OFFSET },
{ "tt2","tt2a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[2][AXIS_A], TT2_A_OFFSET },
{ "tt2","tt2b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[2][AXIS_B], TT2_B_OFFSET },
{ "tt2","tt2c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[2][AXIS_C], TT2_C_OFFSET },
{ "tt3","tt3x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[3][AXIS_X], TT3_X_OFFSET },
{ "tt3","tt3y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[3][AXIS_Y], TT3_Y_OFFSET },
{ "tt3","tt3z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[3][AXIS_Z], TT3_Z_OFFSET },
{ "tt3","tt3a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[3][AXIS_A], TT3_A_OFFSET },
{ "tt3","tt3b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[3][AXIS_B], TT3_B_OFFSET },
{ "tt3","tt3c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[3][AXIS_C], TT1_C_OFFSET },
{ "tt4","tt4x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[4][AXIS_X], TT4_X_OFFSET },
{ "tt4","tt4y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[4][AXIS_Y], TT4_Y_OFFSET },
{ "tt4","tt4z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[4][AXIS_Z], TT4_Z_OFFSET },
{ "tt4","tt4a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[4][AXIS_A], TT4_A_OFFSET },
{ "tt4","tt4b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[4][AXIS_B], TT4_B_OFFSET },
{ "tt4","tt4c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[4][AXIS_C], TT4_C_OFFSET },
{ "tt5","tt5x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[5][AXIS_X], TT5_X_OFFSET },
{ "tt5","tt5y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[5][AXIS_Y], TT5_Y_OFFSET },
{ "tt5","tt5z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[5][AXIS_Z], TT5_Z_OFFSET },
{ "tt5","tt5a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[5][AXIS_A], TT5_A_OFFSET },
{ "tt5","tt5b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[5][AXIS_B], TT5_B_OFFSET },
{ "tt5","tt5c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[5][AXIS_C], TT5_C_OFFSET },
{ "tt6","tt6x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[6][AXIS_X], TT6_X_OFFSET },
{ "tt6","tt6y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[6][AXIS_Y], TT6_Y_OFFSET },
{ "tt6","tt6z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[6][AXIS_Z], TT6_Z_OFFSET },
{ "tt6","tt6a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[6][AXIS_A], TT6_A_OFFSET },
{ "tt6","tt6b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[6][AXIS_B], TT6_B_OFFSET },
{ "tt6","tt6c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[6][AXIS_C], TT6_C_OFFSET },
{ "tt7","tt7x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[7][AXIS_X], TT7_X_OFFSET },
{ "tt7","tt7y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[7][AXIS_Y], TT7_Y_OFFSET },
{ "tt7","tt7z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[7][AXIS_Z], TT7_Z_OFFSET },
{ "tt7","tt7a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[7][AXIS_A], TT7_A_OFFSET },
{ "tt7","tt7b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[7][AXIS_B], TT7_B_OFFSET },
{ "tt7","tt7c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[7][AXIS_C], TT7_C_OFFSET },
{ "tt8","tt8x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[8][AXIS_X], TT8_X_OFFSET },
{ "tt8","tt8y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[8][AXIS_Y], TT8_Y_OFFSET },
{ "tt8","tt8z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[8][AXIS_Z], TT8_Z_OFFSET },
{ "tt8","tt8a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[8][AXIS_A], TT8_A_OFFSET },
{ "tt8","tt8b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[8][AXIS_B], TT8_B_OFFSET },
{ "tt8","tt8c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[8][AXIS_C], TT8_C_OFFSET },
{ "tt9","tt9x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[9][AXIS_X], TT9_X_OFFSET },
{ "tt9","tt9y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[9][AXIS_Y], TT9_Y_OFFSET },
{ "tt9","tt9z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[9][AXIS_Z], TT9_Z_OFFSET },
{ "tt9","tt9a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[9][AXIS_A], TT9_A_OFFSET },
{ "tt9","tt9b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[9][AXIS_B], TT9_B_OFFSET },
{ "tt9","tt9c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[9][AXIS_C], TT9_C_OFFSET },
{ "tt10","tt10x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[10][AXIS_X], TT10_X_OFFSET },
{ "tt10","tt10y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[10][AXIS_Y], TT10_Y_OFFSET },
{ "tt10","tt10z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[10][AXIS_Z], TT10_Z_OFFSET },
{ "tt10","tt10a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[10][AXIS_A], TT10_A_OFFSET },
{ "tt10","tt10b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[10][AXIS_B], TT10_B_OFFSET },
{ "tt10","tt10c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[10][AXIS_C], TT10_C_OFFSET },
{ "tt11","tt11x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[11][AXIS_X], TT11_X_OFFSET },
{ "tt11","tt11y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[11][AXIS_Y], TT11_Y_OFFSET },
{ "tt11","tt11z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[11][AXIS_Z], TT11_Z_OFFSET },
{ "tt11","tt11a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[11][AXIS_A], TT11_A_OFFSET },
{ "tt11","tt11b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[11][AXIS_B], TT11_B_OFFSET },
{ "tt11","tt11c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[11][AXIS_C], TT11_C_OFFSET },
{ "tt12","tt12x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[12][AXIS_X], TT12_X_OFFSET },
{ "tt12","tt12y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[12][AXIS_Y], TT12_Y_OFFSET },
{ "tt12","tt12z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[12][AXIS_Z], TT12_Z_OFFSET },
{ "tt12","tt12a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[12][AXIS_A], TT12_A_OFFSET },
{ "tt12","tt12b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[12][AXIS_B], TT12_B_OFFSET },
{ "tt12","tt12c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[12][AXIS_C], TT12_C_OFFSET },
{ "tt13","tt13x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[13][AXIS_X], TT13_X_OFFSET },
{ "tt13","tt13y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[13][AXIS_Y], TT13_Y_OFFSET },
{ "tt13","tt13z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[13][AXIS_Z], TT13_Z_OFFSET },
{ "tt13","tt13a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[13][AXIS_A], TT13_A_OFFSET },
{ "tt13","tt13b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[13][AXIS_B], TT13_B_OFFSET },
{ "tt13","tt13c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[13][AXIS_C], TT13_C_OFFSET },
{ "tt14","tt14x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[14][AXIS_X], TT14_X_OFFSET },
{ "tt14","tt14y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[14][AXIS_Y], TT14_Y_OFFSET },
{ "tt14","tt14z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[14][AXIS_Z], TT14_Z_OFFSET },
{ "tt14","tt14a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[14][AXIS_A], TT14_A_OFFSET },
{ "tt14","tt14b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[14][AXIS_B], TT14_B_OFFSET },
{ "tt14","tt14c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[14][AXIS_C], TT14_C_OFFSET },
{ "tt15","tt15x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[15][AXIS_X], TT15_X_OFFSET },
{ "tt15","tt15y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[15][AXIS_Y], TT15_Y_OFFSET },
{ "tt15","tt15z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[15][AXIS_Z], TT15_Z_OFFSET },
{ "tt15","tt15a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[15][AXIS_A], TT15_A_OFFSET },
{ "tt15","tt15b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[15][AXIS_B], TT15_B_OFFSET },
{ "tt15","tt15c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[15][AXIS_C], TT15_C_OFFSET },
{ "tt16","tt16x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[16][AXIS_X], TT16_X_OFFSET },
{ "tt16","tt16y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[16][AXIS_Y], TT16_Y_OFFSET },
{ "tt16","tt16z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[16][AXIS_Z], TT16_Z_OFFSET },
{ "tt16","tt16a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[16][AXIS_A], TT16_A_OFFSET },
{ "tt16","tt16b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[16][AXIS_B], TT16_B_OFFSET },
{ "tt16","tt16c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[16][AXIS_C], TT16_C_OFFSET },
{ "tt17","tt17x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[17][AXIS_X], TT17_X_OFFSET },
{ "tt17","tt17y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[17][AXIS_Y], TT17_Y_OFFSET },
{ "tt17","tt17z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[17][AXIS_Z], TT17_Z_OFFSET },
{ "tt17","tt17a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[17][AXIS_A], TT17_A_OFFSET },
{ "tt17","tt17b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[17][AXIS_B], TT17_B_OFFSET },
{ "tt17","tt17c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[17][AXIS_C], TT17_C_OFFSET },
{ "tt18","tt18x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[18][AXIS_X], TT18_X_OFFSET },
{ "tt18","tt18y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[18][AXIS_Y], TT18_Y_OFFSET },
{ "tt18","tt18z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[18][AXIS_Z], TT18_Z_OFFSET },
{ "tt18","tt18a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[18][AXIS_A], TT18_A_OFFSET },
{ "tt18","tt18b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[18][AXIS_B], TT18_B_OFFSET },
{ "tt18","tt18c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[18][AXIS_C], TT18_C_OFFSET },
{ "tt19","tt19x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[19][AXIS_X], TT19_X_OFFSET },
{ "tt19","tt19y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[19][AXIS_Y], TT19_Y_OFFSET },
{ "tt19","tt19z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[19][AXIS_Z], TT19_Z_OFFSET },
{ "tt19","tt19a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[19][AXIS_A], TT19_A_OFFSET },
{ "tt19","tt19b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[19][AXIS_B], TT19_B_OFFSET },
{ "tt19","tt19c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[19][AXIS_C], TT19_C_OFFSET },
{ "tt20","tt20x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[20][AXIS_X], TT20_X_OFFSET },
{ "tt20","tt20y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[20][AXIS_Y], TT20_Y_OFFSET },
{ "tt20","tt20z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[20][AXIS_Z], TT20_Z_OFFSET },
{ "tt20","tt20a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[20][AXIS_A], TT20_A_OFFSET },
{ "tt20","tt20b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[20][AXIS_B], TT20_B_OFFSET },
{ "tt20","tt20c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[20][AXIS_C], TT20_C_OFFSET },
{ "tt21","tt21x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[21][AXIS_X], TT21_X_OFFSET },
{ "tt21","tt21y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[21][AXIS_Y], TT21_Y_OFFSET },
{ "tt21","tt21z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[21][AXIS_Z], TT21_Z_OFFSET },
{ "tt21","tt21a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[21][AXIS_A], TT21_A_OFFSET },
{ "tt21","tt21b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[21][AXIS_B], TT21_B_OFFSET },
{ "tt21","tt21c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[21][AXIS_C], TT21_C_OFFSET },
{ "tt22","tt22x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[22][AXIS_X], TT22_X_OFFSET },
{ "tt22","tt22y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[22][AXIS_Y], TT22_Y_OFFSET },
{ "tt22","tt22z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[22][AXIS_Z], TT22_Z_OFFSET },
{ "tt22","tt22a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[22][AXIS_A], TT22_A_OFFSET },
{ "tt22","tt22b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[22][AXIS_B], TT22_B_OFFSET },
{ "tt22","tt22c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[22][AXIS_C], TT22_C_OFFSET },
{ "tt23","tt23x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[23][AXIS_X], TT23_X_OFFSET },
{ "tt23","tt23y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[23][AXIS_Y], TT23_Y_OFFSET },
{ "tt23","tt23z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[23][AXIS_Z], TT23_Z_OFFSET },
{ "tt23","tt23a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[23][AXIS_A], TT23_A_OFFSET },
{ "tt23","tt23b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[23][AXIS_B], TT23_B_OFFSET },
{ "tt23","tt23c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[23][AXIS_C], TT23_C_OFFSET },
{ "tt24","tt24x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[24][AXIS_X], TT24_X_OFFSET },
{ "tt24","tt24y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[24][AXIS_Y], TT24_Y_OFFSET },
{ "tt24","tt24z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[24][AXIS_Z], TT24_Z_OFFSET },
{ "tt24","tt24a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[24][AXIS_A], TT24_A_OFFSET },
{ "tt24","tt24b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[24][AXIS_B], TT24_B_OFFSET },
{ "tt24","tt24c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[24][AXIS_C], TT24_C_OFFSET },
{ "tt25","tt25x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[25][AXIS_X], TT25_X_OFFSET },
{ "tt25","tt25y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[25][AXIS_Y], TT25_Y_OFFSET },
{ "tt25","tt25z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[25][AXIS_Z], TT25_Z_OFFSET },
{ "tt25","tt25a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[25][AXIS_A], TT25_A_OFFSET },
{ "tt25","tt25b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[25][AXIS_B], TT25_B_OFFSET },
{ "tt25","tt25c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[25][AXIS_C], TT25_C_OFFSET },
{ "tt26","tt26x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[26][AXIS_X], TT26_X_OFFSET },
{ "tt26","tt26y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[26][AXIS_Y], TT26_Y_OFFSET },
{ "tt26","tt26z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[26][AXIS_Z], TT26_Z_OFFSET },
{ "tt26","tt26a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[26][AXIS_A], TT26_A_OFFSET },
{ "tt26","tt26b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[26][AXIS_B], TT26_B_OFFSET },
{ "tt26","tt26c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[26][AXIS_C], TT26_C_OFFSET },
{ "tt27","tt27x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[27][AXIS_X], TT27_X_OFFSET },
{ "tt27","tt27y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[27][AXIS_Y], TT27_Y_OFFSET },
{ "tt27","tt27z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[27][AXIS_Z], TT27_Z_OFFSET },
{ "tt27","tt27a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[27][AXIS_A], TT27_A_OFFSET },
{ "tt27","tt27b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[27][AXIS_B], TT27_B_OFFSET },
{ "tt27","tt27c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[27][AXIS_C], TT27_C_OFFSET },
{ "tt28","tt28x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[28][AXIS_X], TT28_X_OFFSET },
{ "tt28","tt28y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[28][AXIS_Y], TT28_Y_OFFSET },
{ "tt28","tt28z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[28][AXIS_Z], TT28_Z_OFFSET },
{ "tt28","tt28a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[28][AXIS_A], TT28_A_OFFSET },
{ "tt28","tt28b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[28][AXIS_B], TT28_B_OFFSET },
{ "tt28","tt28c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[28][AXIS_C], TT28_C_OFFSET },
{ "tt29","tt29x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[29][AXIS_X], TT29_X_OFFSET },
{ "tt29","tt29y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[29][AXIS_Y], TT29_Y_OFFSET },
{ "tt29","tt29z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[29][AXIS_Z], TT29_Z_OFFSET },
{ "tt29","tt29a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[29][AXIS_A], TT29_A_OFFSET },
{ "tt29","tt29b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[29][AXIS_B], TT29_B_OFFSET },
{ "tt29","tt29c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[29][AXIS_C], TT29_C_OFFSET },
{ "tt30","tt30x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[30][AXIS_X], TT30_X_OFFSET },
{ "tt30","tt30y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[30][AXIS_Y], TT30_Y_OFFSET },
{ "tt30","tt30z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[30][AXIS_Z], TT30_Z_OFFSET },
{ "tt30","tt30a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[30][AXIS_A], TT30_A_OFFSET },
{ "tt30","tt30b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[30][AXIS_B], TT30_B_OFFSET },
{ "tt30","tt30c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[30][AXIS_C], TT30_C_OFFSET },
{ "tt31","tt31x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[31][AXIS_X], TT31_X_OFFSET },
{ "tt31","tt31y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[31][AXIS_Y], TT31_Y_OFFSET },
{ "tt31","tt31z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[31][AXIS_Z], TT31_Z_OFFSET },
{ "tt31","tt31a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[31][AXIS_A], TT31_A_OFFSET },
{ "tt31","tt31b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[31][AXIS_B], TT31_B_OFFSET },
{ "tt31","tt31c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[31][AXIS_C], TT31_C_OFFSET },
{ "tt32","tt32x",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[32][AXIS_X], TT32_X_OFFSET },
{ "tt32","tt32y",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[32][AXIS_Y], TT32_Y_OFFSET },
{ "tt32","tt32z",_fipc, 3, cm_print_cofs, get_flt, set_flu,(float *)&cm.tt_offset[32][AXIS_Z], TT32_Z_OFFSET },
{ "tt32","tt32a",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[32][AXIS_A], TT32_A_OFFSET },
{ "tt32","tt32b",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[32][AXIS_B], TT32_B_OFFSET },
{ "tt32","tt32c",_fip, 3, cm_print_cofs, get_flt, set_flt,(float *)&cm.tt_offset[32][AXIS_C], TT32_C_OFFSET },
>>>>>>> refs/heads/edge */
// this is a 128bit UUID for identifying a previously committed job state
{ "jid","jida",_d0, 0, tx_print_nul, get_data, set_data, (float *)&cfg.job_id[0], 0 },
@@ -644,11 +916,20 @@ const cfgItem_t cfgArray[] = {
#ifdef __TEXT_MODE
{ "sys","tv", _iipn, 0, tx_print_tv, txt_get_tv, txt_set_tv, nullptr, TEXT_VERBOSITY },
#endif
//<<<<<< HEAD
{ "sys","ej", _iipn, 0, js_print_ej, js_get_ej, js_set_ej, nullptr, COMM_MODE },
{ "sys","jv", _iipn, 0, js_print_jv, js_get_jv, js_set_jv, nullptr, JSON_VERBOSITY },
{ "sys","qv", _iipn, 0, qr_print_qv, qr_get_qv, qr_set_qv, nullptr, QUEUE_REPORT_VERBOSITY },
{ "sys","sv", _iipn, 0, sr_print_sv, sr_get_sv, sr_set_sv, nullptr, STATUS_REPORT_VERBOSITY },
{ "sys","si", _iipn, 0, sr_print_si, sr_get_si, sr_set_si, nullptr, STATUS_REPORT_INTERVAL_MS },
/*=======
{ "sys","ej", _fipn, 0, js_print_ej, get_ui8, json_set_ej,(float *)&cs.comm_mode, COMM_MODE },
{ "sys","jv", _fipn, 0, js_print_jv, get_ui8, json_set_jv,(float *)&js.json_verbosity, JSON_VERBOSITY },
{ "sys","qv", _fipn, 0, qr_print_qv, get_ui8, set_012, (float *)&qr.queue_report_verbosity, QR_OFF}, // default to OFF, set to QUEUE_REPORT_VERBOSITY after connected
{ "sys","sv", _fipn, 0, sr_print_sv, get_ui8, set_012, (float *)&sr.status_report_verbosity, SR_OFF}, // default to OFF, set to STATUS_REPORT_VERBOSITY after connectied
{ "sys","si", _fipn, 0, sr_print_si, get_int, sr_set_si, (float *)&sr.status_report_interval, STATUS_REPORT_INTERVAL_MS },
{ "", "nxln", _f0, 0, cm_print_nxln,cm_get_nxln,cm_set_nxln,(float *)&cs.null, 0 },
>>>>>>> refs/heads/edge */
// Gcode defaults
// NOTE: The ordering within the gcode defaults is important for token resolution. gc must follow gco
@@ -1093,6 +1374,7 @@ const cfgItem_t cfgArray[] = {
#if (MOTORS >= 6)
{ "","6", _f0, 0, tx_print_nul, get_grp, set_grp, nullptr, 0 },
#endif
//<<<<<< HEAD
#define DIGITAL_IN_GROUPS 10
{ "","in", _f0, 0, tx_print_nul, get_grp, set_grp, nullptr, 0 }, // input state
@@ -1185,6 +1467,86 @@ const cfgItem_t cfgArray[] = {
{ "","pid1",_f0, 0, tx_print_nul, get_grp, set_grp, nullptr, 0 }, // PID 1 group
{ "","pid2",_f0, 0, tx_print_nul, get_grp, set_grp, nullptr, 0 }, // PID 2 group
{ "","pid3",_f0, 0, tx_print_nul, get_grp, set_grp, nullptr, 0 }, // PID 3 group
/*=======
// +4 = 6
{ "","x", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // axis groups
{ "","y", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","z", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","a", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","b", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","c", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
// +6 = 12
{ "","in", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // input state
{ "","di1", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // input configs
{ "","di2", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","di3", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","di4", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","di5", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","di6", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","di7", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","di8", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","di9", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
// +10 = 22
{ "","out", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // output state
{ "","do1", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // output configs
{ "","do2", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","do3", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","do4", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","do5", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","do6", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","do7", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","do8", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","do9", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","do10", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","do11", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","do12", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","do13", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
// +14 = 36
{ "","g54",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // coord offset groups
{ "","g55",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","g56",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","g57",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","g58",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","g59",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 },
{ "","g92",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // origin offsets
{ "","g28",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // g28 home position
{ "","g30",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // g30 home position
// +9 = 45
{ "","tof",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tool offsets
{ "","tt1",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt2",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt3",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt4",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt5",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt6",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt7",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt8",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt9",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt10",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt11",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt12",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt13",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt14",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt15",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
{ "","tt16",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // tt offsets
// +17 = 62
{ "","mpo",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // machine position group
{ "","pos",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // work position group
{ "","ofs",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // work offset group
{ "","hom",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // axis homing state group
{ "","prb",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // probing state group
{ "","pwr",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // motor power enagled group
{ "","jog",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // axis jogging state group
{ "","jid",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // job ID group
// +8 = 70
{ "","he1", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // heater 1 group
{ "","he2", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // heater 2 group
{ "","he3", _f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // heater 3 group
{ "","pid1",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // PID 1 group
{ "","pid2",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // PID 2 group
{ "","pid3",_f0, 0, tx_print_nul, get_grp, set_grp,(float *)&cs.null,0 }, // PID 3 group
// +6 = 76
>>>>>>> refs/heads/edge */
#ifdef __USER_DATA
#define USER_DATA_GROUPS 4
+74 -2
View File
@@ -48,6 +48,10 @@
#include "MotatePower.h"
#if MARLIN_COMPAT_ENABLED == true
#include "marlin_compatibility.h"
#endif
/***********************************************************************************
**** STRUCTURE ALLOCATIONS *********************************************************
***********************************************************************************/
@@ -172,6 +176,9 @@ static void _controller_HSM()
DISPATCH(cm_deferred_write_callback()); // persist G10 changes when not in machining cycle
DISPATCH(cm_feedhold_command_blocker()); // blocks new Gcode from arriving while in feedhold
#if MARLIN_COMPAT_ENABLED == true
DISPATCH(marlin_callback()); // handle Marlin stuff - may return EAGAIN, must be after planner_callback!
#endif
//----- command readers and parsers --------------------------------------------------//
@@ -227,7 +234,17 @@ static void _dispatch_kernel(const devflags_t flags)
// It's possible to let some stuff through, but that's not happening yet.
return;
}
#if MARLIN_COMPAT_ENABLED == true
// marlin_handle_fake_stk500 returns true if it responded to a stk500v2 message
if (marlin_handle_fake_stk500(cs.bufp)) {
js.json_mode = MARLIN_COMM_MODE;
sr.status_report_verbosity = SR_OFF;
qr.queue_report_verbosity = QR_OFF;
return;
}
#endif
while ((*cs.bufp == SPC) || (*cs.bufp == TAB)) { // position past any leading whitespace
cs.bufp++;
}
@@ -269,6 +286,13 @@ static void _dispatch_kernel(const devflags_t flags)
text_response(gcode_parser(cs.bufp), cs.saved_buf);
}
#endif
#if MARLIN_COMPAT_ENABLED == true
else if (js.json_mode == MARLIN_COMM_MODE) { // handle marlin-specific protocol gcode
cs.comm_request_mode = MARLIN_COMM_MODE; // mode of this command
marlin_response(gcode_parser(cs.bufp), cs.saved_buf);
}
#endif
else { // anything else is interpreted as Gcode
cs.comm_request_mode = JSON_MODE; // mode of this command
@@ -278,12 +302,37 @@ static void _dispatch_kernel(const devflags_t flags)
nv_copy_string(nv, cs.bufp); // copy the Gcode line
nv->valuetype = TYPE_STRING;
status = gcode_parser(cs.bufp);
#if MARLIN_COMPAT_ENABLED == true
if (js.json_mode == MARLIN_COMM_MODE) { // in case a marlin-specific M-code was found
cs.comm_request_mode = MARLIN_COMM_MODE; // mode of this command
// We are switching to marlin_comm_mode, kill status reports and queue reports
sr.status_report_verbosity = SR_OFF;
qr.queue_report_verbosity = QR_OFF;
marlin_response(status, cs.saved_buf);
return;
}
#endif
nv_print_list(status, TEXT_NO_PRINT, JSON_RESPONSE_FORMAT);
sr_request_status_report(SR_REQUEST_TIMED); // generate incremental status report to show any changes
}
}
/**** Local Functions ********************************************************/
/*
* _reset_comms_mode() - reset the communications mode (and other effected settings) after connection or disconnection
*/
void _reset_comms_mode() {
// reset the communications mode
cs.comm_mode = COMM_MODE;
js.json_mode = (COMM_MODE < AUTO_MODE) ? COMM_MODE : JSON_MODE;
sr.status_report_verbosity = STATUS_REPORT_VERBOSITY;
qr.queue_report_verbosity = QUEUE_REPORT_VERBOSITY;
}
/* CONTROLLER STATE MANAGEMENT
* _controller_state() - manage controller connection, startup, and other state changes
*/
@@ -293,9 +342,24 @@ static stat_t _controller_state()
{
if (cs.controller_state == CONTROLLER_CONNECTED) { // first time through after reset
cs.controller_state = CONTROLLER_STARTUP;
// This is here just to put a small delay in before the startup message.
#if MARLIN_COMPAT_ENABLED == true
// For Marlin compatibility, we need this to be long enough for the UI to say something and reveal
// if it's a Marlin-compatible UI.
if (xio_connected()) {
// xio_connected will only return true for USB and other non-permanent connections
_connection_timeout.set(2000);
} else {
_connection_timeout.set(1);
}
#else
_connection_timeout.set(10);
#endif
} else if ((cs.controller_state == CONTROLLER_STARTUP) && (_connection_timeout.isPast())) { // first time through after reset
if (MARLIN_COMM_MODE != js.json_mode) { // MARLIN_COMM_MODE is always defined, just not always used
_reset_comms_mode();
}
cs.controller_state = CONTROLLER_READY;
rpt_print_system_ready_message();
}
@@ -308,9 +372,14 @@ static stat_t _controller_state()
*/
void controller_set_connected(bool is_connected) {
// turn off reports while no-one's listening or we determine what dialect they speak
sr.status_report_verbosity = SR_OFF;
qr.queue_report_verbosity = QR_OFF;
if (is_connected) {
cs.controller_state = CONTROLLER_CONNECTED; // we JUST connected
} else { // we just disconnected from the last device, we'll expect a banner again
_reset_comms_mode();
cs.controller_state = CONTROLLER_NOT_CONNECTED;
}
}
@@ -327,7 +396,10 @@ void controller_set_muted(bool is_muted) {
const bool only_to_muted = true;
xio_writeline("{\"muted\":true}\n", only_to_muted);
} else {
// one channel just got unmuted, announce it (except to the muted)
// we're assuming anything that can be muted speaks g2core-dialect JSON
_reset_comms_mode();
// something was just unmuted (usually because USB disconnected), tell it
xio_writeline("{\"muted\":false}\n");
}
}
+4 -2
View File
@@ -62,10 +62,12 @@ typedef struct controllerSingleton { // main TG controller struct
uint32_t led_blink_rate; // used to flash indicator LED
// communications state variables
// cs.comm_mode is the setting for the communications mode
// js.json_mode is the actual current mode
// useful to know:
// cs.comm_mode is the setting for the communications mode
// js.json_mode is the actual current mode (see also js.json_now)
commMode comm_mode; // ej: 0=text mode sticky, 1=JSON mode sticky, 2=auto mode
commMode comm_request_mode; // mode of request (may be different than the setting)
bool responses_suppressed; // if true, responses are to be suppressed (for internal-file delivery)
// controller serial buffers
char *bufp; // pointer to primary or secondary in buffer
+4 -4
View File
@@ -49,6 +49,9 @@ struct hmHomingSingleton { // persistent homing runtime variables
bool set_coordinates; // G28.4 flag. true = set coords to zero at the end of homing cycle
stat_t (*func)(int8_t axis); // binding for callback function state machine
// float axes[AXES]; // local storage for axis words and associated flags
bool axis_flags[AXES]; // local storage for axis flags
// per-axis parameters
float direction; // set to 1 for positive (max), -1 for negative (to min);
float search_travel; // signed distance to travel in search
@@ -59,9 +62,6 @@ struct hmHomingSingleton { // persistent homing runtime variables
float max_clear_backoff; // maximum distance of switch clearing backoffs before erring out
float setpoint; // ultimate setpoint, usually zero, but not always
// float axes[AXES]; // local storage for axis words and associated flags
bool axis_flags[AXES];
// state saved from gcode model
cmUnitsMode saved_units_mode; // G20,G21 global setting
cmCoordSystem saved_coord_system; // G54 - G59 setting
@@ -548,4 +548,4 @@ static int8_t _get_next_axis(int8_t axis) {
return (-1); // done
#endif // (HOMING_AXES <= 4)
}
}
+8 -8
View File
@@ -203,10 +203,10 @@ char *get_status_message(stat_t status);
#define STAT_VALUE_TYPE_ERROR 116 // JSON value does not agree with variable type
#define STAT_INPUT_FROM_MUTED_CHANNEL_ERROR 117 // input from a muted channel was ignored
#define STAT_ERROR_118 118
#define STAT_ERROR_119 119
#define STAT_CHECKSUM_MATCH_FAILED 118 // the provided checksum didn't match
#define STAT_LINE_NUMBER_OUT_OF_SEQUENCE 119 // the provided line number was out of sequence
#define STAT_MISSING_LINE_NUMBER_WITH_CHECKSUM 120 // if a checksum is provided, a line number should be present as well
#define STAT_ERROR_120 120
#define STAT_ERROR_121 121
#define STAT_ERROR_122 122
#define STAT_ERROR_123 123
@@ -314,7 +314,7 @@ char *get_status_message(stat_t status);
#define STAT_TEMPERATURE_CONTROL_ERROR 209 // temperature controls err'd out
#define STAT_ERROR_210 210
#define STAT_G29_NOT_CONFIGURED 210
#define STAT_ERROR_211 211
#define STAT_ERROR_212 212
#define STAT_ERROR_213 213
@@ -500,9 +500,9 @@ static const char stat_113[] = "JSON string too long";
static const char stat_114[] = "JSON txt fields cannot be nested";
static const char stat_115[] = "JSON maximum nesting depth exceeded";
static const char stat_116[] = "JSON value does not agree with variable type";
static const char stat_117[] = "Device not active";
static const char stat_118[] = "118";
static const char stat_119[] = "119";
static const char stat_117[] = "Input from a muted channel was ignored";
static const char stat_118[] = "The provided checksum didn't match";
static const char stat_119[] = "The provided line number was out of sequence";
static const char stat_120[] = "120";
static const char stat_121[] = "121";
@@ -605,7 +605,7 @@ static const char stat_207[] = "Kill job";
static const char stat_208[] = "No GPIO for this value";
static const char stat_209[] = "209";
static const char stat_210[] = "210";
static const char stat_210[] = "Marlin G29 command was not configured at compile-time";
static const char stat_211[] = "211";
static const char stat_212[] = "212";
static const char stat_213[] = "213";
+8 -2
View File
@@ -73,7 +73,7 @@
<InterfaceName>SWD</InterfaceName>
</ToolOptions>
<ToolType>com.atmel.avrdbg.tool.atmelice</ToolType>
<ToolNumber>J41800036434</ToolNumber>
<ToolNumber>J41800030015</ToolNumber>
<ToolName>Atmel-ICE</ToolName>
</com_atmel_avrdbg_tool_atmelice>
<UseGdb>True</UseGdb>
@@ -100,7 +100,7 @@
<HWProgramCounterSampling>True</HWProgramCounterSampling>
</PercepioTrace>
<preserveEEPROM>true</preserveEEPROM>
<avrtoolserialnumber>J41800036434</avrtoolserialnumber>
<avrtoolserialnumber>J41800030015</avrtoolserialnumber>
<avrdeviceexpectedsignature>0x284E0A60</avrdeviceexpectedsignature>
<avrtoolinterfaceclock>10000000</avrtoolinterfaceclock>
<custom>
@@ -1719,6 +1719,12 @@
<Compile Include="g2core_info.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="marlin_compatibility.cpp">
<SubType>compile</SubType>
</Compile>
<Compile Include="marlin_compatibility.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="settings\settings_makeblock.h">
<SubType>compile</SubType>
</Compile>
+7 -1
View File
@@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
D44E72C11D663B0300ECD5DD /* coolant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D44E72C01D663B0300ECD5DD /* coolant.cpp */; };
D457117C17053EFA00EA19A8 /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = D457117B17053EFA00EA19A8 /* Makefile */; };
D4694F9E1E295B5E00F813BA /* marlin_compatibility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4694F9C1E295B5E00F813BA /* marlin_compatibility.cpp */; };
D48F5A56172CB1FA00D0E055 /* canonical_machine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D48F5A40172CB1F900D0E055 /* canonical_machine.cpp */; };
D48F5A57172CB1FA00D0E055 /* config_app.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D48F5A41172CB1F900D0E055 /* config_app.cpp */; };
D48F5A58172CB1FA00D0E055 /* config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D48F5A42172CB1F900D0E055 /* config.cpp */; };
@@ -59,6 +60,8 @@
D44E72C21D663B0F00ECD5DD /* coolant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = coolant.h; sourceTree = "<group>"; };
D4522DC91C45F41D0086AAE6 /* g2core_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = g2core_info.h; sourceTree = "<group>"; };
D457117B17053EFA00EA19A8 /* Makefile */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile; sourceTree = "<group>"; usesTabs = 1; xcLanguageSpecificationIdentifier = xcode.lang.sh; };
D4694F9C1E295B5E00F813BA /* marlin_compatibility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = marlin_compatibility.cpp; sourceTree = "<group>"; };
D4694F9D1E295B5E00F813BA /* marlin_compatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = marlin_compatibility.h; sourceTree = "<group>"; };
D47B744C1D4925B4004FAB53 /* device */ = {isa = PBXFileReference; lastKnownFileType = folder; path = device; sourceTree = "<group>"; };
D48F5A40172CB1F900D0E055 /* canonical_machine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = canonical_machine.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
D48F5A41172CB1F900D0E055 /* config_app.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = config_app.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
@@ -160,6 +163,8 @@
D48F5A74172CB21100D0E055 /* json_parser.h */,
D48F5A4A172CB1FA00D0E055 /* kinematics.cpp */,
D48F5A75172CB21100D0E055 /* kinematics.h */,
D4694F9C1E295B5E00F813BA /* marlin_compatibility.cpp */,
D4694F9D1E295B5E00F813BA /* marlin_compatibility.h */,
D48F5A4C172CB1FA00D0E055 /* persistence.cpp */,
D48F5A76172CB21100D0E055 /* persistence.h */,
D48F5A4D172CB1FA00D0E055 /* plan_arc.cpp */,
@@ -201,7 +206,7 @@
/* Begin PBXLegacyTarget section */
D4037C091CDA42F300BC72AD /* G2 printrboardG2v3 PrintrbotPlus */ = {
isa = PBXLegacyTarget;
buildArgumentsString = "$(ACTION) VERBOSE=1 COLOR=0 CONFIG=PrintrbotPlus BOARD=printrboardG2v3 DEBUG=2";
buildArgumentsString = "$(ACTION) VERBOSE=1 COLOR=0 CONFIG=PrintrbotPlus BOARD=printrboardG2v3 DEBUG=1";
buildConfigurationList = D4037C0A1CDA42F300BC72AD /* Build configuration list for PBXLegacyTarget "G2 printrboardG2v3 PrintrbotPlus" */;
buildPhases = (
);
@@ -420,6 +425,7 @@
D457117C17053EFA00EA19A8 /* Makefile in Sources */,
D4B657A718B5C23C00F8616C /* pwm.cpp in Sources */,
D44E72C11D663B0300ECD5DD /* coolant.cpp in Sources */,
D4694F9E1E295B5E00F813BA /* marlin_compatibility.cpp in Sources */,
D4B657A318B5C21600F8616C /* cycle_probing.cpp in Sources */,
D4D6453919BCAE3F0053705B /* plan_zoid.cpp in Sources */,
D4B657A218B5C21600F8616C /* cycle_jogging.cpp in Sources */,
+1 -1
View File
@@ -21,7 +21,7 @@
#ifndef G2CORE_INFO_H_ONCE
#define G2CORE_INFO_H_ONCE
#define G2CORE_FIRMWARE_BUILD 100.22 // Merged dev-253-text-mode-compile. See PR #254
#define G2CORE_FIRMWARE_BUILD 100.23 // Merged dev-227-marlin-compat - see #227 and #244
#define G2CORE_FIRMWARE_VERSION 0.99
#ifdef GIT_VERSION
+2 -53
View File
@@ -24,37 +24,6 @@
/**** Gcode-specific definitions ****/
/* The difference between NextAction and MotionMode is that NextAction is
* used by the current block, and may carry non-modal commands, whereas
* MotionMode persists across blocks (as G modal group 1)
*/
typedef enum { // these are in order to optimized CASE statement
NEXT_ACTION_DEFAULT = 0, // Must be zero (invokes motion modes)
NEXT_ACTION_DWELL, // G4
NEXT_ACTION_SET_G10_DATA, // G10
NEXT_ACTION_GOTO_G28_POSITION, // G28 go to machine position
NEXT_ACTION_SET_G28_POSITION, // G28.1 set position in abs coordinates
NEXT_ACTION_SEARCH_HOME, // G28.2 homing cycle
NEXT_ACTION_SET_ABSOLUTE_ORIGIN, // G28.3 origin set
NEXT_ACTION_HOMING_NO_SET, // G28.4 homing cycle with no coordinate setting
NEXT_ACTION_GOTO_G30_POSITION, // G30 go to machine position
NEXT_ACTION_SET_G30_POSITION, // G30.1 set position in abs coordinates
NEXT_ACTION_STRAIGHT_PROBE_ERR, // G38.2
NEXT_ACTION_STRAIGHT_PROBE, // G38.3
NEXT_ACTION_STRAIGHT_PROBE_AWAY_ERR,// G38.4
NEXT_ACTION_STRAIGHT_PROBE_AWAY, // G38.5
NEXT_ACTION_SET_TL_OFFSET, // G43
NEXT_ACTION_SET_ADDITIONAL_TL_OFFSET,// G43.2
NEXT_ACTION_CANCEL_TL_OFFSET, // G49
NEXT_ACTION_SET_G92_OFFSETS, // G92
NEXT_ACTION_RESET_G92_OFFSETS, // G92.1
NEXT_ACTION_SUSPEND_G92_OFFSETS, // G92.2
NEXT_ACTION_RESUME_G92_OFFSETS, // G92.3
NEXT_ACTION_JSON_COMMAND_SYNC, // M100
NEXT_ACTION_JSON_WAIT // M101
} cmNextAction;
typedef enum { // G Modal Group 1
MOTION_MODE_STRAIGHT_TRAVERSE=0, // G0 - straight traverse
MOTION_MODE_STRAIGHT_FEED, // G1 - straight feed
@@ -73,29 +42,8 @@ typedef enum { // G Modal Group 1
MOTION_MODE_CANNED_CYCLE_89 // G89 - boring, dwell, feed out
} cmMotionMode;
typedef enum { // Used for detecting gcode errors. See NIST section 3.4
MODAL_GROUP_G0 = 0, // {G10,G28,G28.1,G92} non-modal axis commands (note 1)
MODAL_GROUP_G1, // {G0,G1,G2,G3,G80} motion
MODAL_GROUP_G2, // {G17,G18,G19} plane selection
MODAL_GROUP_G3, // {G90,G91} distance mode
MODAL_GROUP_G5, // {G93,G94} feed rate mode
MODAL_GROUP_G6, // {G20,G21} units
MODAL_GROUP_G7, // {G40,G41,G42} cutter radius compensation
MODAL_GROUP_G8, // {G43,G49} tool length offset
MODAL_GROUP_G9, // {G98,G99} return mode in canned cycles
MODAL_GROUP_G12, // {G54,G55,G56,G57,G58,G59} coordinate system selection
MODAL_GROUP_G13, // {G61,G61.1,G64} path control mode
MODAL_GROUP_M4, // {M0,M1,M2,M30,M60} stopping
MODAL_GROUP_M6, // {M6} tool change
MODAL_GROUP_M7, // {M3,M4,M5} spindle turning
MODAL_GROUP_M8, // {M7,M8,M9} coolant (M7 & M8 may be active together)
MODAL_GROUP_M9 // {M48,M49} speed/feed override switches
} cmModalGroup;
#define MODAL_GROUP_COUNT (MODAL_GROUP_M9+1)
// Note 1: Our G0 omits G4,G30,G53,G92.1,G92.2,G92.3 as these have no axis components to error check
typedef enum { // canonical plane - translates to:
// axis_0 axis_1 axis_2
// axis_0 axis_1 axis_2
CANON_PLANE_XY = 0, // G17 X Y Z
CANON_PLANE_XZ, // G18 X Z Y
CANON_PLANE_YZ // G19 Y Z X
@@ -263,6 +211,7 @@ typedef struct GCodeStateExtended { // Gcode dynamic state extensions - used
uint16_t magic_start; // magic number to test memory integrity
uint8_t next_action; // handles G modal group 1 moves & non-modals
uint8_t program_flow; // used only by the gcode_parser
int32_t last_line_number; // used with line checksums
float position[AXES]; // XYZABC model position (Note: not used in gn or gf)
float g92_offset[AXES]; // XYZABC G92 offsets (aka origin offsets) (Note: not used in gn or gf)
+640 -16
View File
File diff suppressed because it is too large Load Diff
+30
View File
@@ -0,0 +1,30 @@
/*
* gcode_parser.h - rs274/ngc Gcode parser
* This file is part of the g2core project
*
* Copyright (c) 2010 - 2017 Alden S. Hart, Jr.
*
* This file ("the software") is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2 as published by the
* Free Software Foundation. You should have received a copy of the GNU General Public
* License, version 2 along with the software. If not, see <http://www.gnu.org/licenses/>.
*
* THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef GCODE_H_ONCE
#define GCODE_H_ONCE
/*
* Global Scope Functions
*/
stat_t gcode_parser(char* block);
stat_t gc_get_gc(nvObj_t* nv);
stat_t gc_run_gc(nvObj_t* nv);
#endif // End of include guard: GCODE_H_ONCE
+5 -4
View File
@@ -85,7 +85,7 @@ static stat_t _get_nv_pair(nvObj_t *nv, char **pstr, int8_t *depth);
* _json_parser_execute() executes sets and gets in an application agnostic way. It should work for other apps than g2core
*/
void json_parser(char *str)
stat_t json_parser(char *str, bool suppress_response) // suppress_response defaults to false, see decalaration in .h
{
nvObj_t *nv = nv_reset_nv_list(); // get a fresh nvObj list
stat_t status = _json_parser_kernal(nv, str);
@@ -93,11 +93,12 @@ void json_parser(char *str)
nv = nv_body;
status = _json_parser_execute(nv);
}
if (status == STAT_COMPLETE) { // skip the print if returning from something that already did it.
return;
if (suppress_response || (status == STAT_COMPLETE)) { // skip the print if returning from something that already did it.
return status;
}
nv_print_list(status, TEXT_MULTILINE_FORMATTED, JSON_RESPONSE_FORMAT);
sr_request_status_report(SR_REQUEST_TIMED); // generate incremental status report to show any changes
return STAT_OK;
}
// This is almost the same as json_parser, except it doesn't *always* execute the parsed out list, and it never returns a reponse
@@ -529,7 +530,7 @@ void json_print_list(stat_t status, uint8_t flags)
void json_print_response(uint8_t status, const bool only_to_muted /*= false*/)
{
if (js.json_verbosity == JV_SILENT) { // silent means no responses
if ((js.json_verbosity == JV_SILENT) || (cs.responses_suppressed)) { // silent means no responses
return;
}
if (js.json_verbosity == JV_EXCEPTIONS) { // cutout for JV_EXCEPTIONS mode
+1 -1
View File
@@ -82,7 +82,7 @@ extern jsSingleton_t js;
/**** Function Prototypes ****/
void json_parser(char *str);
stat_t json_parser(char *str, bool suppress_response = false);
void json_parse_for_exec(char *str, bool execute);
uint16_t json_serialize(nvObj_t *nv, char *out_buf, uint16_t size);
void json_print_object(nvObj_t *nv);
File diff suppressed because it is too large Load Diff
+68
View File
@@ -0,0 +1,68 @@
/*
* marlin_compatibility.cpp - support for marlin protocol and gcode
* This file is part of the g2core project
*
* Copyright (c) 2017 Alden S. Hart, Jr.
* Copyright (c) 2017 Rob Giseburt
*
* This file ("the software") is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2 as published by the
* Free Software Foundation. You should have received a copy of the GNU General Public
* License, version 2 along with the software. If not, see <http://www.gnu.org/licenses/>.
*
* THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MARLIN_COMPAT_H_ONCE
#define MARLIN_COMPAT_H_ONCE
#include "g2core.h" // #1
#include "config.h" // #2
enum cmExtruderMode {
EXTRUDER_MOVES_NORMAL = 0, // M82
EXTRUDER_MOVES_RELATIVE, // M83
EXTRUDER_MOVES_VOLUMETRIC // Ultimaker2Marlin
};
typedef struct MarlinStateExtended { // Canonical machine extensions for Marlin
bool marlin_flavor; // true if we are parsing gcode as Marlin-flavor
cmExtruderMode extruder_mode; // Mode of the extruder - changes how "E" is interpreted
} MarlinStateExtended_t;
extern MarlinStateExtended_t mst; // Marlin state object
/*
* Global Scope Functions
*/
// *** gcode and Mcode handling ***
stat_t marlin_start_tramming_bed(); // G29
stat_t marlin_list_sd_response(); // M20
stat_t marlin_select_sd_response(const char *file); // M23
stat_t marlin_set_extruder_mode(const uint8_t mode); // M82, M82
stat_t marlin_disable_motors(); // M84
stat_t marlin_set_motor_timeout(float s); // M84 Sxxx, M85 Sxxx, M18 Sxxx
stat_t marlin_set_temperature(uint8_t tool, float temperature, bool wait); // M104, M109, M140, M190
stat_t marlin_request_temperature_report(); // M105
stat_t marlin_set_fan_speed(const uint8_t fan, float speed); // M106, M107
stat_t marlin_request_position_report(); // M114
stat_t marlin_report_version(); // M115
// *** Marlin internal functions ***
stat_t marlin_callback(); // controller loop callback
void marlin_response(const stat_t status, char *buf); // response handler (primarily just prints "ok")
bool marlin_handle_fake_stk500(char *str); // fake stk500v2
#endif // End of include guard: MARLIN_COMPAT_H_ONCE
+28 -22
View File
@@ -80,7 +80,6 @@ mpBuf_t mp2_queue[SECONDARY_QUEUE_SIZE]; // storage allocation for secondary
// Execution routines (NB: These are called from the LO interrupt)
static stat_t _exec_dwell(mpBuf_t *bf);
static stat_t _exec_command(mpBuf_t *bf);
static stat_t _exec_json_wait(mpBuf_t *bf);
// DIAGNOSTICS
//static void _planner_time_accounting();
@@ -332,8 +331,9 @@ stat_t mp_runtime_command(mpBuf_t *bf)
}
/****************************************************************************************
* _exec_json_command() - execute json string (from exec system)
* mp_json_command() - queue a json command
* _exec_json_command() - execute json string
* mp_json_command_immediate() - execute a json command with response suppressed
*/
static void _exec_json_command(float *value, bool *flag)
@@ -351,29 +351,16 @@ stat_t mp_json_command(char *json_string)
return (STAT_OK);
}
/****************************************************************************************
* mp_json_wait() - queue a json wait command
* _exec_json_wait() - execute json wait string
*/
stat_t mp_json_wait(char *json_string)
stat_t mp_json_command_immediate(char *json_string)
{
// Never supposed to fail, since we stopped parsing when we were full
jc.write_buffer(json_string);
mpBuf_t *bf;
// Never supposed to fail as buffer availability was checked upstream in the controller
if ((bf = mp_get_write_buffer()) == NULL) {
cm_panic(STAT_FAILED_GET_PLANNER_BUFFER, "mp_json_wait()");
return STAT_ERROR;
}
bf->block_type = BLOCK_TYPE_COMMAND;
bf->bf_func = _exec_json_wait; // callback to planner queue exec function
mp_commit_write_buffer(BLOCK_TYPE_COMMAND); // must be final operation before exit
return (STAT_OK);
return json_parser(json_string);
}
/****************************************************************************************
* _exec_json_wait() - execute json wait string
* mp_json_wait() - queue a json wait command
*/
static stat_t _exec_json_wait(mpBuf_t *bf)
{
char *json_string = jc.read_buffer();
@@ -406,6 +393,25 @@ static stat_t _exec_json_wait(mpBuf_t *bf)
return (STAT_OK);
}
stat_t mp_json_wait(char *json_string)
{
// Never supposed to fail, since we stopped parsing when we were full
jc.write_buffer(json_string);
mpBuf_t *bf;
// Never supposed to fail as buffer availability was checked upstream in the controller
if ((bf = mp_get_write_buffer()) == NULL) {
cm_panic(STAT_FAILED_GET_PLANNER_BUFFER, "mp_json_wait()");
return STAT_ERROR;
}
bf->block_type = BLOCK_TYPE_COMMAND;
bf->bf_func = _exec_json_wait; // callback to planner queue exec function
mp_commit_write_buffer(BLOCK_TYPE_COMMAND); // must be final operation before exit
return (STAT_OK);
}
/****************************************************************************************
* mp_dwell() - queue a dwell
* _exec_dwell() - dwell execution
+1
View File
@@ -586,6 +586,7 @@ void mp_queue_command(void(*cm_exec)(float *, bool *), float *value, bool *flag)
stat_t mp_runtime_command(mpBuf_t *bf);
stat_t mp_json_command(char *json_string);
stat_t mp_json_command_immediate(char *json_string);
stat_t mp_json_wait(char *json_string);
stat_t mp_dwell(const float seconds);
+6
View File
@@ -112,7 +112,13 @@ void rpt_print_loading_configs_message(void)
void rpt_print_system_ready_message(void)
{
#if MARLIN_COMPAT_ENABLED == true
if (MARLIN_COMM_MODE != js.json_mode) {
_startup_helper(STAT_OK, "SYSTEM READY");
}
#else
_startup_helper(STAT_OK, "SYSTEM READY");
#endif
if (cs.comm_mode == TEXT_MODE) { text_response(STAT_OK, (char *)"");}// prompt
}
+6 -2
View File
@@ -35,7 +35,11 @@
#ifndef SETTINGS_H_ONCE
#define SETTINGS_H_ONCE
#include "canonical_machine.h"
//#include "canonical_machine.h"
// Defines that need to be here instead of a more logical place
#define RADIUS_MIN (0.0001) // minimum value for ABC radius settings
/**** MACHINE PROFILES ******************************************************
*
@@ -61,7 +65,7 @@
#define stringify2(a) #a
#define stringify(a) stringify2(a)
//static_assert ( bool_constexpr , message ) // bool_constexpr must be true or assertion will fail
//static_assert ( bool_constexpr , message ) // bool_constexpr must be true or assertion will fail
static_assert ( (A_RADIUS > RADIUS_MIN), "A axis radius must be more than " stringify(RADIUS_MIN) ", but is " stringify(A_RADIUS) );
static_assert ( (B_RADIUS > RADIUS_MIN), "B axis radius must be more than " stringify(RADIUS_MIN) ", but is " stringify(B_RADIUS) );
static_assert ( (C_RADIUS > RADIUS_MIN), "C axis radius must be more than " stringify(RADIUS_MIN) ", but is " stringify(C_RADIUS) );
+18 -16
View File
@@ -57,8 +57,10 @@
// Communications and reporting settings
#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE
#define XIO_ENABLE_FLOW_CONTROL FLOW_CONTROL_RTS // FLOW_CONTROL_OFF, FLOW_CONTROL_RTS
#define MARLIN_COMPAT_ENABLED true // enable marlin compatibility mode
#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE
#define XIO_ENABLE_FLOW_CONTROL FLOW_CONTROL_RTS // FLOW_CONTROL_OFF, FLOW_CONTROL_RTS
#define XIO_UART_MUTES_WHEN_USB_CONNECTED 1 // Mute the UART when USB connects
#define TEXT_VERBOSITY TV_VERBOSE // one of: TV_SILENT, TV_VERBOSE
#define JSON_VERBOSITY JV_LINENUM // one of: JV_SILENT, JV_FOOTER, JV_CONFIGS, JV_MESSAGES, JV_LINENUM, JV_VERBOSE
@@ -103,13 +105,13 @@
#define M1_POWER_LEVEL 0.4 // 1mp
// 80 steps/mm at 1/16 microstepping = 40 mm/rev
#define M3_MOTOR_MAP AXIS_Y
#define M3_STEP_ANGLE 1.8
#define M3_TRAVEL_PER_REV 40.64
#define M3_MICROSTEPS 32
#define M3_POLARITY 0
#define M3_POWER_MODE MOTOR_POWER_MODE
#define M3_POWER_LEVEL 0.4
#define M5_MOTOR_MAP AXIS_Y
#define M5_STEP_ANGLE 1.8
#define M5_TRAVEL_PER_REV 40.64
#define M5_MICROSTEPS 32
#define M5_POLARITY 0
#define M5_POWER_MODE MOTOR_POWER_MODE
#define M5_POWER_LEVEL 0.4
#define M2_MOTOR_MAP AXIS_Z
#define M2_STEP_ANGLE 1.8
@@ -129,13 +131,13 @@
#define M4_POWER_LEVEL 0.4
// 96 steps/mm at 1/16 microstepping = 33.3333 mm/rev
#define M5_MOTOR_MAP AXIS_B
#define M5_STEP_ANGLE 1.8
#define M5_TRAVEL_PER_REV 360 // degrees moved per motor rev
#define M5_MICROSTEPS 32
#define M5_POLARITY 0
#define M5_POWER_MODE MOTOR_POWER_MODE
#define M5_POWER_LEVEL 0.35
#define M3_MOTOR_MAP AXIS_B
#define M3_STEP_ANGLE 1.8
#define M3_TRAVEL_PER_REV 360 // degrees moved per motor rev
#define M3_MICROSTEPS 32
#define M3_POLARITY 0
#define M3_POWER_MODE MOTOR_POWER_MODE
#define M3_POWER_LEVEL 0.35
// *** axis settings **********************************************************************************
@@ -57,8 +57,10 @@
// Communications and reporting settings
#define MARLIN_COMPAT_ENABLED true // enable marlin compatibility mode
#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE
#define XIO_ENABLE_FLOW_CONTROL FLOW_CONTROL_RTS // FLOW_CONTROL_OFF, FLOW_CONTROL_RTS
#define XIO_UART_MUTES_WHEN_USB_CONNECTED 1 // Mute the UART when USB connects
#define TEXT_VERBOSITY TV_VERBOSE // one of: TV_SILENT, TV_VERBOSE
#define JSON_VERBOSITY JV_MESSAGES // one of: JV_SILENT, JV_FOOTER, JV_CONFIGS, JV_MESSAGES, JV_LINENUM, JV_VERBOSE
@@ -57,8 +57,10 @@
// Communications and reporting settings
#define MARLIN_COMPAT_ENABLED true // enable marlin compatibility mode
#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE
#define XIO_ENABLE_FLOW_CONTROL FLOW_CONTROL_RTS // FLOW_CONTROL_OFF, FLOW_CONTROL_RTS
#define XIO_UART_MUTES_WHEN_USB_CONNECTED 1 // Mute the UART when USB connects
#define TEXT_VERBOSITY TV_VERBOSE // one of: TV_SILENT, TV_VERBOSE
#define JSON_VERBOSITY JV_MESSAGES // one of: JV_SILENT, JV_FOOTER, JV_CONFIGS, JV_MESSAGES, JV_LINENUM, JV_VERBOSE
@@ -57,6 +57,7 @@
// Communications and reporting settings
#define MARLIN_COMPAT_ENABLED true // enable marlin compatibility mode
#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE
#define XIO_ENABLE_FLOW_CONTROL FLOW_CONTROL_RTS // FLOW_CONTROL_OFF, FLOW_CONTROL_RTS
#define XIO_UART_MUTES_WHEN_USB_CONNECTED 1 // Mute the UART when USB connects
@@ -86,6 +87,23 @@
#define GCODE_DEFAULT_PATH_CONTROL PATH_CONTINUOUS
#define GCODE_DEFAULT_DISTANCE_MODE ABSOLUTE_DISTANCE_MODE
#define MARLIN_G29_SCRIPT \
"(MSG Tramming started)\n" \
"M100 ({\"_leds\":3})\n" \
"G1 X0 Y145 Z6 F20000\n" \
"G38.2 Z-10 F200\n" \
"G1 Z5 F20000\n" \
"M100 ({\"_leds\":5})\n" \
"G1 X210 Y65 F20000\n" \
"G38.2 Z-10 F200\n" \
"G1 Z5 F20000\n" \
"M100 ({\"_leds\":6})\n" \
"G1 X0 Y10 F20000\n" \
"G38.2 Z-10 F200\n" \
"G1 Z5 F20000\n" \
"M100 ({\"_leds\":3})\n" \
"M100 ({\"tram\":1})" \
"(MSG Tramming completed)\n"
// *** motor settings ************************************************************************************
@@ -282,7 +300,7 @@
// Zmin
#define DI5_MODE IO_ACTIVE_LOW // Z probe
#define DI5_ACTION INPUT_ACTION_NONE
#define DI5_FUNCTION INPUT_FUNCTION_NONE
#define DI5_FUNCTION INPUT_FUNCTION_PROBE
// Zmax
#define DI6_MODE IO_MODE_DISABLED
+4
View File
@@ -189,6 +189,10 @@
//#define STATUS_REPORT_DEFAULTS "line","vel","mpox","mpoy","mpoz","mpoa","coor","ofsa","ofsx","ofsy","ofsz","dist","unit","stat","homz","homy","homx","momo"
#endif
#ifndef MARLIN_COMPAT_ENABLED
#define MARLIN_COMPAT_ENABLED false // boolean, either true or false
#endif
// *** Gcode Startup Defaults *** //
#ifndef GCODE_DEFAULT_UNITS
+1 -1
View File
@@ -58,7 +58,7 @@
// Communications and reporting settings
#define USB_SERIAL_PORTS_EXPOSED 2 // Valid options are 1 or 2, only!
#define MARLIN_COMPAT_ENABLED false // enable marlin compatibility mode //+++++
#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE
#define TEXT_VERBOSITY TV_VERBOSE // one of: TV_SILENT, TV_VERBOSE
+1 -1
View File
@@ -86,7 +86,7 @@
#define GCODE_DEFAULT_PLANE CANON_PLANE_XY // CANON_PLANE_XY, CANON_PLANE_XZ, or CANON_PLANE_YZ
#define GCODE_DEFAULT_COORD_SYSTEM G54 // G54, G55, G56, G57, G58 or G59
#define GCODE_DEFAULT_PATH_CONTROL PATH_CONTINUOUS
#define GCODE_DEFAULT_DISTANCE_MODE ABSOLUTE_MODE
#define GCODE_DEFAULT_DISTANCE_MODE ABSOLUTE_DISTANCE_MODE
// *** motor settings ************************************************************************************
-1
View File
@@ -369,7 +369,6 @@ void spindle_end_override(const float ramp_time)
return;
}
/****************************
* END OF SPINDLE FUNCTIONS *
****************************/
+7 -3
View File
@@ -116,11 +116,11 @@ void stepper_init()
dda_timer.setInterrupts(kInterruptOnOverflow | kInterruptPriorityHighest);
// setup software interrupt exec timer & initial condition
exec_timer.setInterrupts(kInterruptOnSoftwareTrigger | kInterruptPriorityMedium);
exec_timer.setInterrupts(kInterruptOnSoftwareTrigger | kInterruptPriorityHigh);
st_pre.buffer_state = PREP_BUFFER_OWNED_BY_EXEC;
// setup software interrupt forward plan timer & initial condition
fwd_plan_timer.setInterrupts(kInterruptOnSoftwareTrigger | kInterruptPriorityLow);
fwd_plan_timer.setInterrupts(kInterruptOnSoftwareTrigger | kInterruptPriorityMedium);
// setup motor power levels and apply power level to stepper drivers
for (uint8_t motor=0; motor<MOTORS; motor++) {
@@ -203,6 +203,7 @@ stat_t st_clc(nvObj_t *nv) // clear diagnostic counters, reset stepper prep
*
* Handles motor power-down timing, low-power idle, and adaptive motor power
*/
stat_t st_motor_power_callback() // called by controller
{
if (!mp_is_phat_city_time()) { // don't process this if you are time constrained in the planner
@@ -210,7 +211,10 @@ stat_t st_motor_power_callback() // called by controller
}
bool have_actually_stopped = false;
if ((!st_runtime_isbusy()) && (st_pre.buffer_state != PREP_BUFFER_OWNED_BY_LOADER)) { // if there are no moves to load...
if ((!st_runtime_isbusy()) &&
(st_pre.buffer_state != PREP_BUFFER_OWNED_BY_LOADER) &&
// (cm_get_cycle_state() == CYCLE_OFF)
(cm_get_machine_state() != MACHINE_CYCLE)) { // if there are no moves to load...
have_actually_stopped = true;
}
+172 -164
View File
File diff suppressed because it is too large Load Diff
Executable → Regular
+20 -3
View File
@@ -37,8 +37,8 @@ void temperature_init();
void temperature_reset();
stat_t temperature_callback();
stat_t cm_get_heater_enable(nvObj_t* nv);
stat_t cm_set_heater_enable(nvObj_t* nv);
stat_t cm_get_heater_enable(nvObj_t *nv);
stat_t cm_set_heater_enable(nvObj_t *nv);
stat_t cm_get_heater_p(nvObj_t* nv);
stat_t cm_set_heater_p(nvObj_t* nv);
@@ -49,20 +49,37 @@ stat_t cm_set_heater_d(nvObj_t* nv);
stat_t cm_get_pid_p(nvObj_t* nv);
stat_t cm_get_pid_i(nvObj_t* nv);
stat_t cm_get_pid_d(nvObj_t* nv);
stat_t cm_get_set_temperature(nvObj_t* nv);
float cm_get_set_temperature(const uint8_t heater);
stat_t cm_get_set_temperature(nvObj_t *nv);
void cm_set_set_temperature(const uint8_t heater, const float value);
stat_t cm_set_set_temperature(nvObj_t* nv);
float cm_get_fan_power(const uint8_t heater);
stat_t cm_get_fan_power(nvObj_t* nv);
void cm_set_fan_power(const uint8_t heater, const float value);
stat_t cm_set_fan_power(nvObj_t* nv);
stat_t cm_get_fan_min_power(nvObj_t* nv);
stat_t cm_set_fan_min_power(nvObj_t* nv);
stat_t cm_get_fan_low_temp(nvObj_t* nv);
stat_t cm_set_fan_low_temp(nvObj_t* nv);
stat_t cm_get_fan_high_temp(nvObj_t* nv);
stat_t cm_set_fan_high_temp(nvObj_t* nv);
bool cm_get_at_temperature(const uint8_t heater);
stat_t cm_get_at_temperature(nvObj_t* nv);
float cm_get_heater_output(const uint8_t heater);
stat_t cm_get_heater_output(nvObj_t* nv);
stat_t cm_get_heater_adc(nvObj_t* nv);
float cm_get_temperature(const uint8_t heater);
stat_t cm_get_temperature(nvObj_t* nv);
stat_t cm_get_thermistor_resistance(nvObj_t* nv);
+20
View File
@@ -160,6 +160,21 @@ inline T avg(const T a,const T b) {return (a+b)/2; }
#define M_SQRT3 (1.73205080756888)
#endif
// Fraction part
constexpr float c_atof_frac_(char *&p_, float v_, float m_) {
return ((*p_ >= '0') && (*p_ <= '9')) ? (v_ = ((v_) + ((*p_) - '0') * m_), c_atof_frac_(++p_, v_, m_ / 10.0)) : v_;
}
// Integer part
template <typename int_type>
constexpr float c_atof_int_(char *&p_, int_type v_) {
return (*p_ == '.')
? (float)(v_) + c_atof_frac_(++p_, 0, 1.0 / 10.0)
: (((*p_ >= '0') && (*p_ <= '9')) ? ((v_ = ((*p_) - '0') + (v_ * 10)), c_atof_int_(++p_, v_)) : v_);
}
// Start portion
constexpr float c_atof(char *&p_) { return (*p_ == '-') ? (c_atof_int_(++p_, 0) * -1.0) : ( (*p_ == '+') ? c_atof_int_(++p_, 0) : (c_atof_int_(p_, 0))); }
// It's assumed that the string buffer contains at lest count_ non-\0 chars
//constexpr int c_strreverse(char * const t, const int count_, char hold = 0) {
@@ -240,5 +255,10 @@ inline void debug_trap_if_true(bool condition, const char *reason) {
void LAGER(const char * msg);
void LAGER_cm(const char * msg);
template <int32_t length>
void str_concat(char *&dest, const char (&data)[length]) {
// length includes the \0
strncpy(dest, data, length); dest += length-1;
};
#endif // End of include guard: UTIL_H_ONCE
+144 -19
View File
@@ -33,7 +33,6 @@
#include "g2core.h"
#include "config.h"
#include "hardware.h"
#include "canonical_machine.h" // needs cm_has_hold()
#include "xio.h"
#include "report.h"
#include "controller.h"
@@ -168,6 +167,10 @@ struct xioDeviceWrapperBase { // C++ base class for device primit
virtual int16_t write(const char *buffer, int16_t len) { return -1; };
virtual char *readline(devflags_t limit_flags, uint16_t &size) { return nullptr; };
#if MARLIN_COMPAT_ENABLED == true
virtual void exitFakeBootloaderMode() {};
#endif
};
// Here we create the xio_t class, which has convenience methods to handle cross-device actions as a whole.
@@ -352,18 +355,18 @@ struct xio_t {
// Always check control-capable devices FIRST
for (uint8_t dev=0; dev < _dev_count; dev++) {
if (!DeviceWrappers[dev]->isActive())
if (!DeviceWrappers[dev]->isActive()) {
continue;
}
// If this channel is a DATA only, skip it this pass
if (!DeviceWrappers[dev]->isCtrl())
if (!DeviceWrappers[dev]->isCtrl()) {
continue;
}
ret_buffer = DeviceWrappers[dev]->readline(DEV_IS_CTRL, size);
if (size > 0) {
flags = DeviceWrappers[dev]->flags;
return ret_buffer;
}
}
@@ -378,18 +381,24 @@ struct xio_t {
if (size > 0) {
flags = DeviceWrappers[dev]->flags;
return ret_buffer;
}
}
}
size = 0;
flags = 0;
return (NULL);
};
#if MARLIN_COMPAT_ENABLED == true
void exitFakeBootloaderMode() {
for (int8_t i = 0; i < _dev_count; ++i) {
DeviceWrappers[i]->exitFakeBootloaderMode();
}
};
#endif
uint16_t magic_end;
};
@@ -442,6 +451,32 @@ struct LineRXBuffer : RXBuffer<_size, owner_type, char> {
bool _last_returned_a_control = false;
#if MARLIN_COMPAT_ENABLED == true
enum class STK500V2_State {
Done, // not in the faked stk500v2 bootloader
Timeout, // timeout period, waiting for a start character
Start, // waiting for 0x1B
Sequence, // waiting for sequence byte
Length_0, // waiting for MSB of length
Length_1, // waiting for LSB of length
Header_End,// waiting for 0x0E
Data, // waiting for more data
Checksum // waiting for checksum byte
};
STK500V2_State _stk_parser_state;
uint16_t _stk_packet_data_length;
Motate::Timeout _stk_timeout;
void startFakeBootloaderMode() {
_stk_parser_state = STK500V2_State::Timeout;
_stk_timeout.set(2000); // two seconds
}
void exitFakeBootloaderMode() {
_stk_parser_state = STK500V2_State::Done;
}
#endif
LineRXBuffer(owner_type owner) : parent_type{owner} {};
void init() {
@@ -596,14 +631,80 @@ struct LineRXBuffer : RXBuffer<_size, owner_type, char> {
while (_isMoreToScan()) {
bool ends_line = false;
bool is_control = false;
char c = _data[_scan_offset];
#if MARLIN_COMPAT_ENABLED == true
// it's possible something will try to talk stk500v2 to us.
// See https://github.com/synthetos/g2/wiki/Marlin-Compatibility#stk500v2
if ((_stk_parser_state == STK500V2_State::Done) && (c == 0)) {
debug_trap("scan ran into NULL (Marlin-mode)");
flush(); // consider the connection and all data trashed
return false;
}
if (_stk_parser_state >= STK500V2_State::Timeout) {
if (_stk_parser_state == STK500V2_State::Timeout) {
if (_stk_timeout.isPast()) {
_stk_parser_state = STK500V2_State::Done;
// start over, outside of stk500v2 mode
continue;
}
// if we got something before the timeout, then we're in stk500v2 mode
// we'll look at what we got and maybe exit anyway
_stk_parser_state = STK500V2_State::Start;
}
if (_stk_parser_state == STK500V2_State::Start) {
if (c == 0x1B) {
_stk_parser_state = STK500V2_State::Sequence;
// this is the start of this "line" and we can "read" (skip) everything up to here.
_read_offset = _scan_offset;
_line_start_offset = _scan_offset;
}
else if ((c == '{') || (c == 'N') || (c == '\n') || (c == '\r') || (c == 'G') || (c == 'M')) {
_stk_parser_state = STK500V2_State::Done; // jump out of bootloader mode
_read_offset = _scan_offset;
continue;
}
} else if (_stk_parser_state == STK500V2_State::Sequence) {
_stk_parser_state = STK500V2_State::Length_0; // we ignore the sequence
} else if (_stk_parser_state == STK500V2_State::Length_0) {
_stk_packet_data_length = c << 8;
_stk_parser_state = STK500V2_State::Length_1;
} else if (_stk_parser_state == STK500V2_State::Length_1) {
_stk_packet_data_length |= c;
_stk_parser_state = STK500V2_State::Header_End;
} else if (_stk_parser_state == STK500V2_State::Header_End) {
if (c == 0x0E) {
_stk_parser_state = STK500V2_State::Data;
} else { // end-of-header marker was corrupt, start over
_stk_packet_data_length = 0;
_read_offset = _scan_offset;
_stk_parser_state = STK500V2_State::Start;
}
} else if (_stk_parser_state == STK500V2_State::Data) {
if (--_stk_packet_data_length == 0) { // we don't read the data here, just return it
_stk_parser_state = STK500V2_State::Checksum;
}
} else if (_stk_parser_state == STK500V2_State::Checksum) {
// We do NOT check the checksum, since if it's corrupt, we'd need to reply, and we can't reply here.
// At this point, we at least have a complete packet we will use the "control" return mechanism to
// handle this since controls don't have to be \r\n-terminated
is_control = true;
ends_line = true;
_stk_parser_state = STK500V2_State::Start; // this line is complete, reset the state engine
}
}
else
#else // not MARLIN_COMPAT_ENABLED
if (c == 0) {
debug_trap("_scanBuffer() scan ran into NULL");
flush(); // consider the connection and all data trashed
return false;
}
#endif // MARLIN_COMPAT_ENABLED
// Look for line endings
if (c == '\r' || c == '\n') {
@@ -673,7 +774,6 @@ struct LineRXBuffer : RXBuffer<_size, owner_type, char> {
if (_data[_line_start_offset] == '{') {
is_control = true;
}
// TODO ---
}
@@ -708,7 +808,6 @@ struct LineRXBuffer : RXBuffer<_size, owner_type, char> {
// move the start of the next skip section to after this skip
_line_start_offset = _scan_offset;
}
return false; // no control was found
};
@@ -997,11 +1096,11 @@ struct xioDeviceWrapper : xioDeviceWrapperBase { // describes a device for re
// set it as a MUTED channel, call controller_set_connected(true)
// then controller_set_muted(true)
flush(); // toss anything that has been written so far.
setAsConnectedAndReady();
if (isAlwaysDataAndCtrl()) {
// Case 1 (ignoring others)
if (isAlwaysDataAndCtrl()) { // Case 1 (ignoring others)
setActive();
controller_set_connected(true);
@@ -1009,11 +1108,10 @@ struct xioDeviceWrapper : xioDeviceWrapperBase { // describes a device for re
if (isMuteAsSecondary() && xio.othersConnected(this)) {
controller_set_muted(true); // something was muted
}
return;
}
if(!xio.othersConnected(this)) {
if (!xio.othersConnected(this)) {
// Case 1
setAsPrimaryActiveDualRole();
// report that there is now have a connection (only for the first one)
@@ -1022,15 +1120,17 @@ struct xioDeviceWrapper : xioDeviceWrapperBase { // describes a device for re
if (xio.checkMutedSecondaryChannels()) {
controller_set_muted(true); // something was muted
}
#if MARLIN_COMPAT_ENABLED == true
// start the "fake bootloader" to signal the Host that Marlin (mode) is operating
_rx_buffer.startFakeBootloaderMode();
#endif
}
else if (isMuteAsSecondary()) {
// Case 2b
else if (isMuteAsSecondary()) { // Case 2b
setAsMuted();
controller_set_connected(true); // it DID just just get connected
controller_set_muted(true); // but it muted it too
}
else {
// Case 2a
else { // Case 2a
xio.removeDataFromPrimary();
if (xio.checkMutedSecondaryChannels()) {
controller_set_muted(true); // something was muted
@@ -1084,6 +1184,13 @@ struct xioDeviceWrapper : xioDeviceWrapperBase { // describes a device for re
} // flags & DEV_IS_CONNECTED
}
};
#if MARLIN_COMPAT_ENABLED == true
void exitFakeBootloaderMode() override {
_rx_buffer.exitFakeBootloaderMode();
};
#endif
};
@@ -1120,6 +1227,14 @@ struct xioFlashFileDeviceWrapper : xioDeviceWrapperBase { // describes a devi
// to flush the file, just forget about it
// next time it's used it'll get reset
_current_file = nullptr;
cs.responses_suppressed = false;
}
bool flushToCommand() final {
// the end of the file is the next "command"
_current_file = nullptr;
cs.responses_suppressed = false;
return false;
}
int16_t write(const char *buffer, int16_t len) final {
@@ -1136,6 +1251,7 @@ struct xioFlashFileDeviceWrapper : xioDeviceWrapperBase { // describes a devi
if ((nullptr == from) && (_current_file->isDone())) {
// all done sending this file, "close" it
_current_file = nullptr;
cs.responses_suppressed = false;
clearActive();
return nullptr;
}
@@ -1150,6 +1266,7 @@ struct xioFlashFileDeviceWrapper : xioDeviceWrapperBase { // describes a devi
// null-terminate the string
*dst_ptr = 0;
cs.responses_suppressed = true;
return _line_buffer;
};
};
@@ -1286,7 +1403,15 @@ void xio_flush_to_command() {
return xio.flushToCommand();
}
#if MARLIN_COMPAT_ENABLED == true
/*
* xio_end_fake_bootloader() - end the fake bootloader mode
*/
void xio_exit_fake_bootloader() {
return xio.exitFakeBootloaderMode();
}
#endif
/***********************************************************************************
* newlib-nano support functions
+5 -1
View File
@@ -48,9 +48,10 @@
#ifndef XIO_H_ONCE
#define XIO_H_ONCE
//#include "g2core.h" // not required if used in g2core project
//#include "g2core.h" // not required if used in g2core project
#include "config.h" // required for nvObj typedef
#include "canonical_machine.h" // needed for cm_has_hold()
#include "settings.h" // needed for MARLIN_COMPAT_ENABLED
/**** Defines, Macros, and Assorted Parameters ****/
@@ -120,6 +121,9 @@ char *xio_readline(devflags_t &flags, uint16_t &size);
int16_t xio_writeline(const char *buffer, bool only_to_muted = false);
bool xio_connected();
void xio_flush_to_command();
#if MARLIN_COMPAT_ENABLED == true
void xio_exit_fake_bootloader();
#endif
stat_t xio_set_spi(nvObj_t *nv);