Ok, I have a first cut working:
http://git.mah.priv.at/gitweb/emc2-dev.git/shortlog/refs/heads/inspect-wip .
This branch introduces a generalized framework for read-only named parameters
(which started with #<_vmajor>/#<_vminor>).
As a base again I've taken most of _setup.active_settings, active_g_codes, and
active_m_codes.
These parameters may be used in arbitrary expressions to find out about
interpreter state, like if/then/else etc.
Test-driving this branch:
-------------------------
Just pull and build. Any config should do.
Then run this file, which should be fairly self-explaining (for now ;-): (also
in nc_files/roparams.ngc):
You might want to single step this file, it overwhelms an NML message queue if
run.
; existing parameters
(DEBUG, _vmajor: = #<_vmajor>)
(DEBUG, _vminor: = #<_vminor>)
; new introspection parameters:
(DEBUG, _line: = #<_line>)
(DEBUG, _motion_mode: = #<_motion_mode>)
(DEBUG, _plane: = #<_plane>)
(DEBUG, _ccomp: = #<_ccomp>)
(DEBUG, _metric: = #<_metric>)
(DEBUG, _imperial: = #<_imperial>)
(DEBUG, _absolute: = #<_absolute>)
(DEBUG, _incremental: = #<_incremental>)
(DEBUG, _inverse_time: = #<_inverse_time>)
(DEBUG, _units_per_minute: = #<_units_per_minute>)
(DEBUG, _units_per_rev: = #<_units_per_rev>)
(DEBUG, _coord_system: = #<_coord_system>)
(DEBUG, _tool_offset: = #<_tool_offset>)
(DEBUG, _retract_r_plane: = #<_retract_r_plane>)
(DEBUG, _retract_old_z: = #<_retract_old_z>)
(DEBUG, _spindle_rpm_mode: = #<_spindle_rpm_mode>)
(DEBUG, _spindle_css_mode: = #<_spindle_css_mode>)
(DEBUG, _ijk_absolute_mode: = #<_ijk_absolute_mode>)
(DEBUG, _lathe_diameter_mode: = #<_lathe_diameter_mode>)
(DEBUG, _lathe_radius_mode: = #<_lathe_radius_mode>)
(DEBUG, _spindle_on: = #<_spindle_on>)
(DEBUG, _spindle_cw: = #<_spindle_cw>)
(DEBUG, _mist: = #<_mist>)
(DEBUG, _flood: = #<_flood>)
(DEBUG, _speed_override: = #<_speed_override>)
(DEBUG, _feed_override: = #<_feed_override>)
(DEBUG, _adaptive_feed: = #<_adaptive_feed>)
(DEBUG, _feed_hold: = #<_feed_hold>)
(DEBUG, _feed: = #<_feed>)
(DEBUG, _rpm: = #<_rpm>)
Adding new parameters:
----------------------
Really easy - proceed as follows:
- edit rs274ngc/interp_namedparams.cc init_named_parameters() (near bottom of
file)
- add your parameter, picking an unused index value (like for example 230) and
define your parameter as follows:
init_readonly_param("_the_answer", 230, PA_USE_LOOKUP);
- add a corresponding accessor case in lookup_named_param() (just above
previous function). Lots of examples there.
case 230: // feed
*value = 42.0;
break;
- recompile
- in MDI window, try
(DEBUG, the answer is #<_the_answer>)
which should return 42.0 .
I restructured the code so all functions pertaining to named parameters are now
collected in rs274ngc/interp_namedparams.cc .
I also fixed a memory leak in the old param storage code while I was at it.
Feedback welcome.
-Michael
--
------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers