From 82d42f4fa469b34aa9a52a3d2a72e52e83f5b5ac Mon Sep 17 00:00:00 2001 From: Terje Io Date: Mon, 1 Nov 2021 08:40:55 +0100 Subject: [PATCH] Fixed variable name typo, renamed hal.stream.disable to hal.stream.disable_rx --- driver_opts.h | 7 +++++++ gcode.c | 2 +- grbl.h | 2 +- grbllib.c | 2 +- hal.h | 2 +- ngc_params.c | 2 +- protocol.c | 2 +- report.c | 6 +++--- stream.c | 12 ++++++------ stream.h | 4 ++-- system.h | 2 +- 11 files changed, 25 insertions(+), 18 deletions(-) diff --git a/driver_opts.h b/driver_opts.h index 4884e5e..e577d67 100644 --- a/driver_opts.h +++ b/driver_opts.h @@ -119,6 +119,13 @@ #ifndef SPINDLE_HUANYANG #define SPINDLE_HUANYANG 0 #endif +#ifndef MODBUS_ENABLE +#if SPINDLE_HUANYANG +#define MODBUS_ENABLE 1 +#else +#define MODBUS_ENABLE 0 +#endif +#endif #ifndef QEI_ENABLE #define QEI_ENABLE 0 #endif diff --git a/gcode.c b/gcode.c index 49cf3bd..01e2355 100644 --- a/gcode.c +++ b/gcode.c @@ -2569,7 +2569,7 @@ status_code_t gc_execute_block(char *block) break; case 66: - sys.var5933 = hal.port.wait_on_input(gc_block.output_command.is_digital, gc_block.output_command.port, (wait_mode_t)gc_block.values.l, gc_block.values.q); + sys.var5399 = hal.port.wait_on_input(gc_block.output_command.is_digital, gc_block.output_command.port, (wait_mode_t)gc_block.values.l, gc_block.values.q); sys.report.m66result = On; break; diff --git a/grbl.h b/grbl.h index ca744e3..ab42228 100644 --- a/grbl.h +++ b/grbl.h @@ -34,7 +34,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_VERSION_BUILD "20211024" +#define GRBL_VERSION_BUILD "20211029" // The following symbols are set here if not already set by the compiler or in config.h // Do NOT change here! diff --git a/grbllib.c b/grbllib.c index 6aa720f..c907542 100644 --- a/grbllib.c +++ b/grbllib.c @@ -214,7 +214,7 @@ int grbl_enter (void) else memset(&sys, 0, offsetof(system_t, alarm)); // Clear system variables except state & alarm. - sys.var5933 = -2; // Clear last M66 result + sys.var5399 = -2; // Clear last M66 result sys.override.feed_rate = DEFAULT_FEED_OVERRIDE; // Set to 100% sys.override.rapid_rate = DEFAULT_RAPID_OVERRIDE; // Set to 100% sys.override.spindle_rpm = DEFAULT_SPINDLE_RPM_OVERRIDE; // Set to 100% diff --git a/hal.h b/hal.h index abc623d..f429d32 100644 --- a/hal.h +++ b/hal.h @@ -116,7 +116,7 @@ typedef bool (*analog_out_ptr)(uint8_t port, float value); /*! \brief Pointer to function for reading a digital or analog input. -__NOTE:__ The latest value read is stored in \ref #sys \ref #sys#var5933. +__NOTE:__ The latest value read is stored in \ref #sys \ref #sys#var5399. \param digital true if port is digital, false if analog. \param port port number. diff --git a/ngc_params.c b/ngc_params.c index 741a453..d211f4b 100644 --- a/ngc_params.c +++ b/ngc_params.c @@ -111,7 +111,7 @@ static float home_pos (ngc_param_id_t id) */ static float m66_result (ngc_param_id_t id) { - return (float)sys.var5933; + return (float)sys.var5399; } static float tool_number (ngc_param_id_t id) diff --git a/protocol.c b/protocol.c index 76c152d..819ae10 100644 --- a/protocol.c +++ b/protocol.c @@ -714,7 +714,7 @@ ISR_CODE bool protocol_enqueue_realtime_command (char c) bool tlo = sys.report.tool_offset; sys.report.value = (uint32_t)-1; sys.report.tool_offset = tlo; - sys.report.m66result = sys.var5933 > -2; + sys.report.m66result = sys.var5399 > -2; } // no break diff --git a/report.c b/report.c index 8b84e04..32cb6b0 100644 --- a/report.c +++ b/report.c @@ -1332,9 +1332,9 @@ void report_realtime_status (void) if(sys.report.tlo_reference) hal.stream.write_all(appendbuf(2, "|TLR:", uitoa(sys.tlo_reference_set.mask != 0))); - if(sys.report.m66result && sys.var5933 > -2) { // M66 result - if(sys.var5933 >= 0) - hal.stream.write_all(appendbuf(2, "|In:", uitoa(sys.var5933))); + if(sys.report.m66result && sys.var5399 > -2) { // M66 result + if(sys.var5399 >= 0) + hal.stream.write_all(appendbuf(2, "|In:", uitoa(sys.var5399))); else hal.stream.write_all("|In:-1"); } diff --git a/stream.c b/stream.c index 12405c7..a5e126c 100644 --- a/stream.c +++ b/stream.c @@ -113,9 +113,9 @@ ISR_CODE bool stream_enable_mpg (const io_stream_t *mpg_stream, bool mpg_mode) if(mpg_mode) { if(org_stream.type == StreamType_Redirected) { memcpy(&org_stream, &hal.stream, sizeof(io_stream_t)); - if(hal.stream.disable) - hal.stream.disable(true); - mpg_stream->disable(false); + if(hal.stream.disable_rx) + hal.stream.disable_rx(true); + mpg_stream->disable_rx(false); mpg_stream->set_enqueue_rt_handler(org_stream.set_enqueue_rt_handler(NULL)); hal.stream.read = mpg_stream->read; hal.stream.get_rx_buffer_free = mpg_stream->get_rx_buffer_free; @@ -123,11 +123,11 @@ ISR_CODE bool stream_enable_mpg (const io_stream_t *mpg_stream, bool mpg_mode) hal.stream.reset_read_buffer = mpg_stream->reset_read_buffer; } } else if(org_stream.type != StreamType_Redirected) { - mpg_stream->disable(true); + mpg_stream->disable_rx(true); memcpy(&hal.stream, &org_stream, sizeof(io_stream_t)); org_stream.type = StreamType_Redirected; - if(hal.stream.disable) - hal.stream.disable(false); + if(hal.stream.disable_rx) + hal.stream.disable_rx(false); } hal.stream.reset_read_buffer(); diff --git a/stream.h b/stream.h index 46e3ac5..db334a8 100644 --- a/stream.h +++ b/stream.h @@ -191,7 +191,7 @@ for handing feed-holds, overrides, soft resets etc. \param disable \a true to disable stream, \a false to enable, */ -typedef bool (*disable_stream_ptr)(bool disable); +typedef bool (*disable_rx_stream_ptr)(bool disable); //! Properties and handlers for stream I/O typedef struct { @@ -208,7 +208,7 @@ typedef struct { set_enqueue_rt_handler_ptr set_enqueue_rt_handler; //!< Handler for setting the enqueue realtime command character handler. suspend_read_ptr suspend_read; //!< Optional handler for saving away and restoring the current input buffer. stream_write_n_ptr write_n; //!< Optional handler for writing n characters to current output stream only. Required for Modbus support. - disable_stream_ptr disable; //!< Optional handler for disabling/enabling a stream. Recommended? + disable_rx_stream_ptr disable_rx; //!< Optional handler for disabling/enabling a stream. Recommended? get_stream_buffer_count_ptr get_rx_buffer_count; //!< Optional handler for getting number of characters in the input buffer. get_stream_buffer_count_ptr get_tx_buffer_count; //!< Optional handler for getting number of characters in the output buffer(s). Count shall include any unsent characters in any transmit FIFO and/or transmit register. Required for Modbus support. flush_stream_buffer_ptr reset_write_buffer; //!< Optional handler for flushing the output buffer. Any transmit FIFO shall be flushed as well. Required for Modbus support. diff --git a/system.h b/system.h index 8d7b02d..a23e4fb 100644 --- a/system.h +++ b/system.h @@ -236,7 +236,7 @@ typedef struct system { volatile rt_exec_t rt_exec_state; //!< Realtime executor bitflag variable for state management. See EXEC bitmasks. volatile uint_fast16_t rt_exec_alarm; //!< Realtime executor bitflag variable for setting various alarms. float spindle_rpm; //!< Current spindle RPM - int32_t var5933; //!< Last result from M66 - wait on input + int32_t var5399; //!< Last result from M66 - wait on input #ifdef PID_LOG pid_data_t pid_log; #endif