Pin state reporting of all pins. Flash optimization.

- New pin state realtime reporting feature. Instead of `Lim:000` for
limit state reports, the new feature shows `Pin:000|0|0000`, or
something similar. The `|` delimited fields indicate xyz limits, probe,
and control pin states, where 0 is always not triggered, and 1 is
triggered. Invert masks ARE accounted for.
  Each field may be enabled or disabled via the `$10` status report
setting. The probe and control pin flags are bits 5 and 6, respectively.

- Remove the now deprecated `REPORT_CONTROL_PIN_STATE` option in
config.h

- The old limit pin reports `Lim:000` may be re-enabled by commenting
out `REPORT_ALL_PIN_STATES` in config.h.

- Incremented the version letter (v1.0c) to indicate the change in
reporting style.

- Replaced all bit_true_atomic and bit_false_atomic macros with
function calls. This saved a couple hundred bytes of flash.
This commit is contained in:
Sonny Jeon
2015-11-09 21:54:26 -07:00
parent b9c3461932
commit 5eee10845b
16 changed files with 182 additions and 63 deletions

View File

@ -69,13 +69,26 @@
#define SUSPEND_SAFETY_DOOR_AJAR bit(5) // Indicates suspend was initiated by a safety door state.
#define SUSPEND_MOTION_CANCEL bit(6) // Indicates a canceled resume motion. Currently used by probing routine.
// Define step segment generator state flags.
#define STEP_CONTROL_NORMAL_OP 0
// #define STEP_CONTROL_RECOMPUTE_ACTIVE_BLOCK bit(0)
#define STEP_CONTROL_END_MOTION bit(1)
#define STEP_CONTROL_EXECUTE_HOLD bit(2)
#define STEP_CONTROL_EXECUTE_PARK bit(3)
// Define control pin index for Grbl internal use. Pin maps may change, but these values don't.
#ifdef ENABLE_SAFETY_DOOR_INPUT_PIN
#define N_CONTROL_PIN 4
#define CONTROL_PIN_INDEX_SAFETY_DOOR bit(0)
#define CONTROL_PIN_INDEX_RESET bit(1)
#define CONTROL_PIN_INDEX_FEED_HOLD bit(2)
#define CONTROL_PIN_INDEX_CYCLE_START bit(3)
#else
#define N_CONTROL_PIN 3
#define CONTROL_PIN_INDEX_RESET bit(0)
#define CONTROL_PIN_INDEX_FEED_HOLD bit(1)
#define CONTROL_PIN_INDEX_CYCLE_START bit(2)
#endif
// Define global system variables
@ -102,6 +115,9 @@ volatile uint8_t sys_rt_exec_alarm; // Global realtime executor bitflag variabl
// Initialize the serial protocol
void system_init();
// Returns bitfield of control pin states, organized by CONTROL_PIN_INDEX. (1=triggered, 0=not triggered).
uint8_t system_control_get_state();
// Returns if safety door is open or closed, based on pin state.
uint8_t system_check_safety_door_ajar();
@ -117,4 +133,11 @@ float system_convert_axis_steps_to_mpos(int32_t *steps, uint8_t idx);
// Updates a machine 'position' array based on the 'step' array sent.
void system_convert_array_steps_to_mpos(float *position, int32_t *steps);
// Special handlers for setting and clearing Grbl's real-time execution flags.
void system_set_exec_state_flag(uint8_t mask);
void system_clear_exec_state_flag(uint8_t mask);
void system_set_exec_alarm_flag(uint8_t mask);
void system_clear_exec_alarm_flag(uint8_t mask);
#endif