Updated initialization flags in config table, and added a Zero initialization to some parameters; added ABC axes to make block config for testing.

This commit is contained in:
Alden Hart
2017-01-06 13:39:31 -05:00
parent cb8b824cce
commit c6138819dd
4 changed files with 320 additions and 310 deletions
+11 -8
View File
@@ -68,7 +68,6 @@ stat_t nv_set(nvObj_t *nv)
return(STAT_INTERNAL_RANGE_ERROR);
}
return (((fptrCmd)cfgArray[nv->index].set)(nv));
// return (((fptrCmd)GET_TABLE_WORD(set))(nv));
}
stat_t nv_get(nvObj_t *nv)
@@ -77,7 +76,6 @@ stat_t nv_get(nvObj_t *nv)
return(STAT_INTERNAL_RANGE_ERROR);
}
return (((fptrCmd)cfgArray[nv->index].get)(nv));
// return (((fptrCmd)GET_TABLE_WORD(get))(nv));
}
void nv_print(nvObj_t *nv)
@@ -86,7 +84,6 @@ void nv_print(nvObj_t *nv)
return;
}
((fptrCmd)cfgArray[nv->index].print)(nv);
// ((fptrCmd)GET_TABLE_WORD(print))(nv);
}
stat_t nv_persist(nvObj_t *nv)
@@ -128,13 +125,19 @@ void config_init()
static void _set_defa(nvObj_t *nv, bool print)
{
cm_set_units_mode(MILLIMETERS); // must do inits in MM mode
cm_set_units_mode(MILLIMETERS); // must do inits in MM mode
for (nv->index=0; nv_index_is_single(nv->index); nv->index++) {
if (GET_TABLE_BYTE(flags) & F_INITIALIZE) {
nv->value = cfgArray[nv->index].def_value;
if (cfgArray[nv->index].flags & F_INITIALIZE) {
if (cfgArray[nv->index].flags & F_ZERO) {
nv->value = 0;
} else {
nv->value = cfgArray[nv->index].def_value;
}
strncpy(nv->token, cfgArray[nv->index].token, TOKEN_LEN);
nv_set(nv);
nv_persist(nv);
cfgArray[nv->index].set(nv); // run the set method, nv_set(nv);
if (cfgArray[nv->index].flags & F_PERSIST) {
nv_persist(nv);
}
}
}
sr_init_status_report(); // reset status reports
+3 -1
View File
@@ -169,7 +169,6 @@
***********************************************************************************/
// Sizing and footprints // chose one based on # of elements in cfgArray
//typedef uint8_t index_t; // use this if there are < 256 indexed objects
typedef uint16_t index_t; // use this if there are > 255 indexed objects
// defines allocated from stack (not-pre-allocated)
@@ -223,6 +222,7 @@ typedef enum { // value typing for config and JSON
#define F_NOSTRIP 0x04 // do not strip the group prefix from the token
#define F_CONVERT 0x08 // set if unit conversion is required
#define F_ICONVERT 0x10 // set if unit conversion is required AND value is an inverse quantity
#define F_ZERO 0x20 // initialize to zero (requires F_INITIALIZE set as well)
#define _f0 0x00
#define _fi (F_INITIALIZE)
@@ -231,6 +231,8 @@ typedef enum { // value typing for config and JSON
#define _fc (F_CONVERT)
#define _fic (F_INITIALIZE | F_CONVERT)
#define _fip (F_INITIALIZE | F_PERSIST)
#define _fiz (F_INITIALIZE | F_ZERO)
#define _fizc (F_INITIALIZE | F_ZERO | F_CONVERT)
#define _fipc (F_INITIALIZE | F_PERSIST | F_CONVERT)
#define _fipn (F_INITIALIZE | F_PERSIST | F_NOSTRIP)
#define _fipi (F_INITIALIZE | F_PERSIST | F_ICONVERT)
+253 -299
View File
File diff suppressed because it is too large Load Diff
+53 -2
View File
@@ -2,7 +2,7 @@
* settings_makeblock.h - makeblock engraving table
* This file is part of the g2core project
*
* Copyright (c) 2016 Alden S. Hart, Jr.
* Copyright (c) 2016 - 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
@@ -52,7 +52,7 @@
// Communications and reporting settings
#define USB_SERIAL_PORTS_EXPOSED 1 // Valid options are 1 or 2, only!
#define USB_SERIAL_PORTS_EXPOSED 1 // Valid options are 1 or 2, only!
#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE
#define TEXT_VERBOSITY TV_VERBOSE // one of: TV_SILENT, TV_VERBOSE
@@ -153,3 +153,54 @@
#define Z_LATCH_VELOCITY 25
#define Z_LATCH_BACKOFF 4
#define Z_ZERO_BACKOFF 2
#define A_AXIS_MODE AXIS_STANDARD
#define A_VELOCITY_MAX (360 * 25.4)
#define A_FEEDRATE_MAX A_VELOCITY_MAX
#define A_TRAVEL_MIN -1 // degrees
#define A_TRAVEL_MAX -1 // same value means infinite, no limit
#define A_JERK_MAX (2 * 25.4)
#define A_JERK_HIGH_SPEED A_JERK_MAX
#define A_RADIUS 1.0
#define A_HOMING_INPUT 0
#define A_HOMING_DIRECTION 0
#define A_SEARCH_VELOCITY (60 * 25.4)
#define A_LATCH_VELOCITY (30 * 25.4)
#define A_LATCH_BACKOFF (0.125 * 25.4)
#define A_ZERO_BACKOFF (0.375 * 25.4)
#define A_HOMING_INPUT 0
#define A_HOMING_DIR 0
#define B_AXIS_MODE AXIS_DISABLED
#define B_VELOCITY_MAX (360 * 25.4)
#define B_FEEDRATE_MAX B_VELOCITY_MAX
#define B_TRAVEL_MAX -1
#define B_TRAVEL_MIN -1
#define B_JERK_MAX (2 * 25.4)
#define B_JERK_HIGH_SPEED B_JERK_MAX
#define B_RADIUS 1
#define B_HOMING_INPUT 0
#define B_HOMING_DIRECTION 0
#define B_SEARCH_VELOCITY (60 * 25.4)
#define B_LATCH_VELOCITY (30 * 25.4)
#define B_LATCH_BACKOFF (0.125 * 25.4)
#define B_ZERO_BACKOFF (0.375 * 25.4)
#define B_HOMING_INPUT 0
#define B_HOMING_DIR 0
#define C_AXIS_MODE AXIS_DISABLED
#define C_VELOCITY_MAX (360 * 25.4)
#define C_FEEDRATE_MAX C_VELOCITY_MAX
#define C_TRAVEL_MAX -1
#define C_TRAVEL_MIN -1
#define C_JERK_MAX (2 * 25.4)
#define C_JERK_HIGH_SPEED C_JERK_MAX
#define C_RADIUS 1
#define C_HOMING_INPUT 0
#define C_HOMING_DIRECTION 0
#define C_SEARCH_VELOCITY (60 * 25.4)
#define C_LATCH_VELOCITY (30 * 25.4)
#define C_LATCH_BACKOFF (0.125 * 25.4)
#define C_ZERO_BACKOFF (0.375 * 25.4)
#define C_HOMING_INPUT 0
#define C_HOMING_DIR 0