From 3403985e6e68f8065183c750ea1b2c52594f920c Mon Sep 17 00:00:00 2001 From: Joseph Coffland Date: Tue, 29 Sep 2020 15:33:23 -0700 Subject: [PATCH] Clear planner coolant and spindle state on stop, Added M8.1 and M7.1 coolant off commands, Support for WJ200 VFD --- CHANGELOG.md | 3 ++ src/avr/src/spindle.h | 1 + src/avr/src/state.c | 1 + src/avr/src/vfd_spindle.c | 6 ++++ src/pug/templates/tool-view.pug | 45 ++++++++++++++++++++++++++++++ src/resources/config-template.json | 2 +- 6 files changed, 57 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77a6144..7182698 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ Buildbotics CNC Controller Firmware Changelog - Fix motor step alignment when changing motor parameters like microsteping. - Stall detect homing. - Improved voltage spike clamping time. + - Support for WJ200 VFD + - Added M8.1 and M7.1 coolant off commands. + - Clear planner coolant and spindle state on stop. ## v0.4.14 - Handle file uploads with '#' or '?' in the name. diff --git a/src/avr/src/spindle.h b/src/avr/src/spindle.h index 0b01476..1420741 100644 --- a/src/avr/src/spindle.h +++ b/src/avr/src/spindle.h @@ -58,6 +58,7 @@ typedef enum { SPINDLE_TYPE_SUNFAR_E300, SPINDLE_TYPE_OMRON_MX2, SPINDLE_TYPE_V70, + SPINDLE_TYPE_WJ200, } spindle_type_t; diff --git a/src/avr/src/state.c b/src/avr/src/state.c index 946cae3..6410b54 100644 --- a/src/avr/src/state.c +++ b/src/avr/src/state.c @@ -126,6 +126,7 @@ static void _stop() { spindle_stop(); outputs_stop(); seek_cancel(); + _set_state(STATE_HOLDING); break; case STATE_STOPPING: diff --git a/src/avr/src/vfd_spindle.c b/src/avr/src/vfd_spindle.c index 82bd422..144383c 100644 --- a/src/avr/src/vfd_spindle.c +++ b/src/avr/src/vfd_spindle.c @@ -154,6 +154,7 @@ const vfd_reg_t sunfar_e300_regs[] PROGMEM = { }; +// Register value for Modbus is one less than in the datasheet const vfd_reg_t omron_mx2_regs[] PROGMEM = { {REG_CONNECT_WRITE, 0x1200, 3}, // A001 Frequency reference modbus {REG_CONNECT_WRITE, 0x1201, 3}, // A002 Run command modbus @@ -180,6 +181,10 @@ const vfd_reg_t v70_regs[] PROGMEM = { }; +// Same as OMRON MX2 +#define wj200_regs omron_mx2_regs + + static vfd_reg_t regs[VFDREG]; static vfd_reg_t custom_regs[VFDREG]; @@ -399,6 +404,7 @@ void vfd_spindle_init() { case SPINDLE_TYPE_SUNFAR_E300: _load(sunfar_e300_regs); break; case SPINDLE_TYPE_OMRON_MX2: _load(omron_mx2_regs); break; case SPINDLE_TYPE_V70: _load(v70_regs); break; + case SPINDLE_TYPE_WJ200: _load(wj200_regs); break; default: break; } diff --git a/src/pug/templates/tool-view.pug b/src/pug/templates/tool-view.pug index 390fd20..7b9a611 100644 --- a/src/pug/templates/tool-view.pug +++ b/src/pug/templates/tool-view.pug @@ -442,3 +442,48 @@ script#tool-view-template(type="text/x-template") | a(href="https://buildbotics.com/upload/vfd/stepperonline-v70.pdf", target="_blank") Stepper Online V70 VFD manual + + .notes(v-if="tool_type.startsWith('WJ200')") + h2 Notes + p Set the following using the VFD's front panel. + table.modbus-regs.fixed-regs + tr + th Address + th Value + th Meaning + th Description + tr + td.reg-addr A001 + td.reg-value 3 + td Modbus + td Frequency source + tr + td.reg-addr A002 + td.reg-value 3 + td Modbus + td Run source + tr + td.reg-addr C071 + td.reg-value 5 + td 9600 BAUD rate + td Must match #[tt baud] above + tr + td.reg-addr C072 + td.reg-value 1 + td Slave address + td Must match #[tt bus-id] above + tr + td.reg-addr C074 + td.reg-value 0 + td no parity + td Must match #[tt parity] above + tr + td.reg-addr C075 + td.reg-value 2 + td 2 stop bits + td Communication stop bits + p + | Other settings according to the + | + a(href="https://buildbotics.com/upload/vfd/wj200.pdf", + target="_blank") WJ200 VFD manual diff --git a/src/resources/config-template.json b/src/resources/config-template.json index 90c1f52..72e553a 100644 --- a/src/resources/config-template.json +++ b/src/resources/config-template.json @@ -253,7 +253,7 @@ "values": ["Disabled", "PWM Spindle", "Huanyang VFD", "Custom Modbus VFD", "AC-Tech VFD", "Nowforever VFD", "Delta VFD015M21A (Beta)", "YL600, YL620, YL620-A VFD (Beta)", "FR-D700 (Beta)", - "Sunfar E300 (Beta)", "OMRON MX2", "V70"], + "Sunfar E300 (Beta)", "OMRON MX2", "V70", "WJ200"], "default": "Disabled", "code": "st" }, -- 2.27.0