grblHAL core  20241107
ngc_params.h
Go to the documentation of this file.
1 /*
2  ngc_params.h - get/set NGC parameter value by id or name
3 
4  Part of grblHAL
5 
6  Copyright (c) 2021-2024 Terje Io
7 
8  grblHAL is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  grblHAL is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with grblHAL. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 /*
23  All predefined parameters defined in NIST RS274NGC version 3 (ref section 3.2.1) are implemented.
24  Most additional predefined parameters defined by LinuxCNC (ref section 5.2.3.1) are implemented.
25  Currently it is not possible to set any parameters or reference them from gcode.
26 */
27 
28 #ifndef _NGC_PARAMS_H_
29 #define _NGC_PARAMS_H_
30 
31 #include "gcode.h"
32 
33 #ifndef NGC_MAX_PARAM_LENGTH
34 #define NGC_MAX_PARAM_LENGTH 20
35 #endif
36 
37 #define NGC_MAX_PARAM_ID 65535
38 
39 typedef uint16_t ngc_param_id_t;
40 
41 typedef struct {
43  float value;
44 } ngc_param_t;
45 
46 typedef enum {
104 
105 uint8_t ngc_float_decimals (void);
106 bool ngc_param_get (ngc_param_id_t id, float *value);
107 bool ngc_param_set (ngc_param_id_t id, float value);
110 bool ngc_named_param_get (char *name, float *value);
112 bool ngc_named_param_set (char *name, float value);
113 bool ngc_named_param_exists (char *name);
114 bool ngc_call_push (void *context);
115 bool ngc_call_pop (void);
116 uint_fast8_t ngc_call_level (void);
117 bool ngc_modal_state_save (gc_modal_t *state, bool auto_restore);
118 bool ngc_modal_state_restore (void);
119 void ngc_modal_state_invalidate (void);
120 
121 #endif // _NGC_PARAMS_H_
bool ngc_param_set(ngc_param_id_t id, float value)
Definition: ngc_params.c:308
bool ngc_call_push(void *context)
Definition: ngc_params.c:771
uint8_t ngc_float_decimals(void)
Definition: ngc_params.c:840
void ngc_modal_state_invalidate(void)
Definition: ngc_params.c:756
bool ngc_named_param_get(char *name, float *value)
Definition: ngc_params.c:633
bool ngc_param_get(ngc_param_id_t id, float *value)
Definition: ngc_params.c:272
bool ngc_call_pop(void)
Definition: ngc_params.c:781
float ngc_named_param_get_by_id(ncg_name_param_id_t id)
Definition: ngc_params.c:406
bool ngc_param_is_rw(ngc_param_id_t id)
Definition: ngc_params.c:298
bool ngc_named_param_set(char *name, float value)
Definition: ngc_params.c:694
uint_fast8_t ngc_call_level(void)
Definition: ngc_params.c:835
uint16_t ngc_param_id_t
Definition: ngc_params.h:39
bool ngc_param_exists(ngc_param_id_t id)
Definition: ngc_params.c:303
ncg_name_param_id_t
Definition: ngc_params.h:46
@ NGCParam_c
Definition: ngc_params.h:84
@ NGCParam_motion_mode
Definition: ngc_params.h:50
@ NGCParam_lathe_radius_mode
Definition: ngc_params.h:68
@ NGCParam_coord_system
Definition: ngc_params.h:60
@ NGCParam_lathe_diameter_mode
Definition: ngc_params.h:67
@ NGCParam_selected_pocket
Definition: ngc_params.h:100
@ NGCParam_feed
Definition: ngc_params.h:77
@ NGCParam_spindle_cw
Definition: ngc_params.h:70
@ NGCParam_y
Definition: ngc_params.h:80
@ NGCParam_abs_b
Definition: ngc_params.h:92
@ NGCParam_units_per_minute
Definition: ngc_params.h:58
@ NGCParam_ccomp
Definition: ngc_params.h:52
@ NGCParam_speed_override
Definition: ngc_params.h:73
@ NGCParam_adaptive_feed
Definition: ngc_params.h:75
@ NGCParam_vmajor
Definition: ngc_params.h:47
@ NGCParam_abs_a
Definition: ngc_params.h:91
@ NGCParam_inverse_time
Definition: ngc_params.h:57
@ NGCParam_abs_c
Definition: ngc_params.h:93
@ NGCParam_u
Definition: ngc_params.h:85
@ NGCParam_mist
Definition: ngc_params.h:71
@ NGCParam_flood
Definition: ngc_params.h:72
@ NGCParam_metric
Definition: ngc_params.h:53
@ NGCParam_current_tool
Definition: ngc_params.h:97
@ NGCParam_abs_u
Definition: ngc_params.h:94
@ NGCParam_abs_y
Definition: ngc_params.h:89
@ NGCParam_abs_x
Definition: ngc_params.h:88
@ NGCParam_retract_r_plane
Definition: ngc_params.h:62
@ NGCParam_spindle_on
Definition: ngc_params.h:69
@ NGCParam_abs_w
Definition: ngc_params.h:96
@ NGCParam_imperial
Definition: ngc_params.h:54
@ NGCParam_spindle_rpm_mode
Definition: ngc_params.h:64
@ NGCParam_a
Definition: ngc_params.h:82
@ NGCParam_units_per_rev
Definition: ngc_params.h:59
@ NGCParam_feed_override
Definition: ngc_params.h:74
@ NGCParam_Last
Definition: ngc_params.h:102
@ NGCParam_x
Definition: ngc_params.h:79
@ NGCParam_z
Definition: ngc_params.h:81
@ NGCParam_selected_tool
Definition: ngc_params.h:99
@ NGCParam_line
Definition: ngc_params.h:49
@ NGCParam_plane
Definition: ngc_params.h:51
@ NGCParam_ijk_absolute_mode
Definition: ngc_params.h:66
@ NGCParam_call_level
Definition: ngc_params.h:101
@ NGCParam_v
Definition: ngc_params.h:86
@ NGCParam_rpm
Definition: ngc_params.h:78
@ NGCParam_retract_old_z
Definition: ngc_params.h:63
@ NGCParam_absolute
Definition: ngc_params.h:55
@ NGCParam_current_pocket
Definition: ngc_params.h:98
@ NGCParam_vminor
Definition: ngc_params.h:48
@ NGCParam_w
Definition: ngc_params.h:87
@ NGCParam_abs_v
Definition: ngc_params.h:95
@ NGCParam_incremental
Definition: ngc_params.h:56
@ NGCParam_abs_z
Definition: ngc_params.h:90
@ NGCParam_tool_offset
Definition: ngc_params.h:61
@ NGCParam_feed_hold
Definition: ngc_params.h:76
@ NGCParam_b
Definition: ngc_params.h:83
@ NGCParam_spindle_css_mode
Definition: ngc_params.h:65
bool ngc_modal_state_save(gc_modal_t *state, bool auto_restore)
Definition: ngc_params.c:743
bool ngc_named_param_exists(char *name)
Definition: ngc_params.c:662
bool ngc_modal_state_restore(void)
Definition: ngc_params.c:766
Definition: gcode.h:513
Definition: ngc_params.h:41
float value
Definition: ngc_params.h:43
ngc_param_id_t id
Definition: ngc_params.h:42