This patch adds support for pwncnc

This commit is contained in:
saifullah-N
2023-02-12 14:01:05 +05:30
parent 2baae7965a
commit f0c4579b61
9 changed files with 102 additions and 12 deletions

2
.gitignore vendored
View File

@@ -23,6 +23,6 @@ __pycache__
/package-lock.json
/src/bbserial/linux-rpi-raspberrypi-kernel*
/src/bbserial/raspberrypi-kernel*
*.rej
*.elf
*.hex

View File

@@ -26,7 +26,7 @@ PKG_NAME := bbctrl-$(VERSION)
SUBPROJECTS := avr boot pwr jig
ifndef HOST
HOST=onefinity
HOST=onefinity.local
endif
ifndef PASSWORD

View File

@@ -3,6 +3,7 @@
cd /mnt/host
scons -j 8 -C cbang disable_local="re2 libevent"
export CBANG_HOME="/mnt/host/cbang"
export LC_ALL=C
CAMOTICS_ROOT="/mnt/host/camotics"
CAMOTICS_PLAN="${CAMOTICS_ROOT}/src/gcode/plan"

View File

@@ -58,6 +58,7 @@ typedef enum
SPINDLE_TYPE_SUNFAR_E300,
SPINDLE_TYPE_OMRON_MX2,
SPINDLE_TYPE_V70,
SPINDLE_TYPE_PWNCNC,
} spindle_type_t;
typedef void (*deinit_cb_t)();

View File

@@ -29,7 +29,6 @@
#include "modbus.h"
#include "rtc.h"
#include "config.h"
#include "estop.h"
#include "pgmspace.h"
#include <util/atomic.h>
@@ -170,6 +169,18 @@ const vfd_reg_t v70_regs[] PROGMEM = {
{REG_DISABLED},
};
const vfd_reg_t pwncnc_regs[] PROGMEM = {
{REG_MAX_FREQ_READ, 0x0007, 0}, // Read max frequency
+{REG_FREQ_SCALED_SET, 0xa001, 10000}, // Set scaled frequency
+{REG_FREQ_READ, 0x9000, 0}, // Read frequency
+{REG_FWD_WRITE, 0xa000, 1}, // Run forward
+{REG_REV_WRITE, 0xa000, 2}, // Run reverse
+{REG_STOP_WRITE, 0xa000, 5}, // Stop
+{REG_DISCONNECT_WRITE, 0xa000, 5}, // Stop
+{REG_STATUS_READ, 0xb000, 0}, // Read status
{REG_DISABLED},
};
static vfd_reg_t regs[VFDREG];
static vfd_reg_t custom_regs[VFDREG];
@@ -226,7 +237,8 @@ static bool _next_state()
break;
case REG_STATUS_READ:
if (vfd.shutdown || estop_triggered())
// if (vfd.shutdown || estop_triggered()) vfd.state = REG_DISCONNECT_WRITE;
if (vfd.shutdown)
vfd.state = REG_DISCONNECT_WRITE;
else if (vfd.changed)
@@ -289,7 +301,8 @@ static void _modbus_cb(bool ok, uint16_t addr, uint16_t value)
{
if (regs[vfd.reg].fails < 255)
regs[vfd.reg].fails++;
if (vfd.shutdown || estop_triggered())
// if (vfd.shutdown || estop_triggered()) _disconnected();
if (vfd.shutdown)
_disconnected();
else
_connect();
@@ -452,6 +465,10 @@ void vfd_spindle_init()
case SPINDLE_TYPE_V70:
_load(v70_regs);
break;
case SPINDLE_TYPE_PWNCNC:
_load(pwncnc_regs);
break;
default:
break;
}

View File

@@ -8,7 +8,7 @@ module.exports = {
computed: {
has_user_value: function () {
var type = this.model["reg-type"];
return type.indexOf("write") != -1 || type.indexOf("fixed") != -1;
return type.includes("write") || type.includes("fixed") || type.includes("scaled");
},
},

View File

@@ -27,6 +27,10 @@ module.exports = {
type: "PWM Spindle",
name: "Laser (J Tech, etc)",
},
{
id: "pwncnc-vfd",
name: "PwnCNC VFD",
},
{
id: "pwm",
name: "PWM Spindle",
@@ -82,6 +86,11 @@ module.exports = {
name: "OMRON MX2",
unsupported: true,
},
{
id: "v70-vfd",
name: "V70",
unsupported: true
}
],
};
},

View File

@@ -43,7 +43,7 @@ script#tool-view-template(type="text/x-template")
label.units RPM
fieldset.modbus-program(
v-if="is_modbus && this.tool_type != 'HUANYANG VFD'")
v-if="is_modbus && tool_type != 'HUANYANG VFD' && tool_type != 'PWNCNC VFD'")
h2 Active Modbus Program
p(v-if="$root.modified")
| (Click #[tt(class="save") Save] to activate the selected
@@ -81,9 +81,7 @@ script#tool-view-template(type="text/x-template")
tr(v-for="(index, reg) in config['modbus-spindle'].regs",
is="modbus-reg", :index="index", :model.sync="reg",
:template="template['modbus-spindle'].regs.template",
v-if="!index || reg['reg-type'] != 'disabled' || " +
"config['modbus-spindle'].regs[index - 1]['reg-type'] != " +
"'disabled'")
v-if="!index || reg['reg-type'] != 'disabled' || config['modbus-spindle'].regs[index - 1]['reg-type'] != 'disabled'")
.notes(v-if="tool_type == 'HUANYANG VFD'")
h2 Notes
@@ -380,3 +378,65 @@ script#tool-view-template(type="text/x-template")
|
| and spindle type. The VFD must be rebooted after changing
| the above settings.
.notes(v-if="tool_type.startsWith('V70')")
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 F001
td.reg-value 2
td Communication port
td Control mode
tr
td.reg-addr P0.0.04
td.reg-value 9
td Modbus
td Frequency source A
tr
td.reg-addr P0.1.00
td.reg-value 0
td Source A
td Frequency source
tr
td.reg-addr P4.1.00
td.reg-value 3
td 9600 BAUD
td Must match #[tt baud] above
tr
td.reg-addr F002
td.reg-value 2
td Communication port
td Frequency setting selection
tr
td.reg-addr F163
td.reg-value 1
td Slave address
td Must match #[tt bus-id] above
tr
td.reg-addr F164
td.reg-value 1
td 9600 BAUD
td Must match #[tt baud] above
tr
td.reg-addr F165
td.reg-value 3
td 8 data, no parity, 1 stop, RTU
td Must match #[tt parity] above
p
| Other settings according to the
|
a(href="https://buildbotics.com/upload/vfd/stepperonline-v70.pdf",
target="_blank") Stepper Online V70 VFD manual
.notes(v-if="tool_type.startsWith('PWNCNC')")
h2 Notes
p For support and more information about the PwnCNC Spindle Kit, please visit #{''}
a(href="https://pwncnc.com/onefinity-controller", target="_blank")
| https://pwncnc.com/onefinity-controller

View File

@@ -270,7 +270,9 @@
"YL600, YL620, YL620-A VFD (Beta)",
"FR-D700 (Beta)",
"Sunfar E300 (Beta)",
"OMRON MX2"
"OMRON MX2",
"V70",
"PwnCNC VFD"
],
"default": "Disabled",
"code": "st"