文章目录
- openpnp - Warning - Unknown firmware
- 概述
- 笔记
- https://github.com/openpnp/openpnp/wiki/Motion-Controller-Firmwares
- 备注
- END
openpnp - Warning - Unknown firmware
概述
接上飞达控制板后, 显示未知固件的警告
开始没看源码之前, 总以为是回答的版本号不合适, 就照着冰沙板子回的版本号来回固件版本. 还是有这个警告.
现在已经在使用自己编译出来的openpnp, 就想去看看这个警告咋来的.
笔记
判断是否有未知固件的函数为 findIssues()
D:\my_openpnp\openpnp_dev_2022_0801\src\main\java\org\openpnp\machine\reference\solutions\GcodeDriverSolutions.java
public void findIssues(Solutions solutions) {
// ...
if (gcodeDriver.getFirmwareProperty("FIRMWARE_NAME", "").contains("Smoothieware")) {firmware = (gcodeDriver.getFirmwareProperty("X-GRBL_MODE", "").contains("1"))? FirmwareType.SmoothiewareGrblSyntax : gcodeDriver.getFirmwareProperty("FIRMWARE_VERSION", "").contains("chmt-")?FirmwareType.SmoothiewareChmt : FirmwareType.Smoothieware;firmwareAxesCount = Integer.valueOf(gcodeDriver.getFirmwareProperty("X-AXES", "0"));if (firmware == FirmwareType.SmoothiewareChmt) {// OK, CHMT STM32 Smoothieware board. Take PAXES == 5 if missing (legacy build).firmwarePrimaryAxesCount = Integer.valueOf(gcodeDriver.getFirmwareProperty("X-PAXES", "5"));}else if (gcodeDriver.getFirmwareProperty("X-SOURCE_CODE_URL", "").contains("best-for-pnp")) {// OK, regular Smoothieboard with pnp firmware.firmwarePrimaryAxesCount = Integer.valueOf(gcodeDriver.getFirmwareProperty("X-PAXES", "3"));}else {solutions.add(new Solutions.PlainIssue(gcodeDriver, "There is a better Smoothieware firmware available. "+gcodeDriver.getDetectedFirmware(), "Please upgrade to the special PnP version. See info link.", Severity.Error, "https://github.com/openpnp/openpnp/wiki/Motion-Controller-Firmwares#smoothieware"));}if (firmwarePrimaryAxesCount != null && firmwarePrimaryAxesCount != firmwareAxesCount) {solutions.add(new Solutions.PlainIssue(gcodeDriver, "Smoothieware firmware should be built with the PAXIS="+firmwareAxesCount+" option.", "Download up-to-date firmware optimized for OpenPnP, or if you build the firmware yourself, please use the `make AXIS="+firmwareAxesCount+" PAXIS="+firmwareAxesCount+"` command. See info link.", Severity.Warning, "https://github.com/openpnp/openpnp/wiki/Motion-Controller-Firmwares#smoothieware"));}}else if (gcodeDriver.getFirmwareProperty("FIRMWARE_NAME", "").contains("Duet")) {firmware = FirmwareType.Duet;String firmwareVersion = gcodeDriver.getFirmwareProperty("FIRMWARE_VERSION", "0.0");Integer major = null;Integer minor = null;try {Matcher matcher =Pattern.compile("(?<major>-?\\d+)\\.(?<minor>-?\\d+).*").matcher(firmwareVersion);matcher.matches();major = Integer.parseUnsignedInt(matcher.group("major"));minor = Integer.parseUnsignedInt(matcher.group("minor"));}catch (Exception e) {Logger.warn(e);}if (major == null || minor == null|| major < 3 || (major == 3 && minor < 3)) {solutions.add(new Solutions.PlainIssue(gcodeDriver,"Duet3D firmware was improved for OpenPnP, please use version 3.3beta or newer. Current version is "+firmwareVersion,"Get the new version through the linked web page.",Severity.Error,"https://github.com/openpnp/openpnp/wiki/Motion-Controller-Firmwares#duet"));}if (gcodeDriver.getConfiguredAxes() != null) {try {Matcher matcher =Pattern.compile(".*\\s(?<axes>-?\\d+)\\saxes\\svisible.*").matcher(gcodeDriver.getConfiguredAxes());matcher.matches();firmwareAxesCount = Integer.parseUnsignedInt(matcher.group("axes"));}catch (NumberFormatException e) {// ignore}if (gcodeDriver.getConfiguredAxes().contains("(r)")) {solutions.add(new Solutions.PlainIssue(gcodeDriver,"Axes should be configured as linear in feedrate calculations on the Duet controller. See the linked web page.","Use the M584 S0 option in your config.g file.",Severity.Error,"https://duet3d.dozuki.com/Wiki/Gcode#Section_M584_Set_drive_mapping"));}else {firmwarePrimaryAxesCount = firmwareAxesCount;}}}else if (gcodeDriver.getFirmwareProperty("FIRMWARE_NAME", "").contains("Marlin")) {firmware = FirmwareType.Marlin;firmwareAxesCount = Integer.valueOf(gcodeDriver.getFirmwareProperty("AXIS_COUNT", "0"));if (firmwareAxesCount > 3) { firmwarePrimaryAxesCount = firmwareAxesCount;}else {solutions.add(new Solutions.PlainIssue(gcodeDriver, "Marlin firmware is not reporting support for rotation axes (A B C). "+gcodeDriver.getDetectedFirmware(), "Please upgrade the firmware and/or axis configuration. See the info link.", Severity.Error, "https://github.com/openpnp/openpnp/wiki/Motion-Controller-Firmwares#marlin-20"));}}else if (gcodeDriver.getFirmwareProperty("FIRMWARE_NAME", "").contains("TinyG")) {// Having a response already means we have a new firmware.firmware = FirmwareType.TinyG;}else if (gcodeDriver.getFirmwareProperty("FIRMWARE_NAME", "").contains("Grbl")) {firmware = FirmwareType.Grbl;}else if (gcodeDriver.getFirmwareProperty("FIRMWARE_NAME", "").contains("GcodeServer")) {firmware = FirmwareType.Generic;}else { solutions.add(new Solutions.PlainIssue(gcodeDriver, "Unknown firmware. "+gcodeDriver.getDetectedFirmware(), "Check out firmwares known to be well supported. See info link.", Severity.Warning, "https://github.com/openpnp/openpnp/wiki/Motion-Controller-Firmwares"));}// ...
}
看了判断是否为未知固件的实现, 明白了.
原来openpnp只支持几种御用固件, 其他的固件都是未知固件.
在代码中, 看到openpnp支持的御用固件如下:
Smoothieware
Duet
Marlin
TinyG
Grbl
GcodeServer
以前和一个同学讨论, 他问一个主板是否支持openpnp, 我当时现去查, 看到有个openpnp硬件项目拟采用那个主板, 才知道那个主板可以用做openpnp的主板.
现在看了代码就很清楚了, openpnp就支持有限的几种御用主板.
如果不是openpnp主板, 而是辅助用的飞达控制板, 出现这种未知固件的警告是不用担心的, 将这个警告禁止掉就行.
飞达控制板不涉及到openpnp硬件的运动位置, 只在固定位置送料, 这种只要送料控制好使就行.
下面是openpnp未知主板固件的提示信息
else { solutions.add(new Solutions.PlainIssue(gcodeDriver, "Unknown firmware. "+gcodeDriver.getDetectedFirmware(), "Check out firmwares known to be well supported. See info link.", Severity.Warning, "https://github.com/openpnp/openpnp/wiki/Motion-Controller-Firmwares"));}
看到给出了官方openpnp支持的主板固件的wiki连接.
看了一下, 知道了如果用于openpnp, 主板需要支持哪些特性(GCode)
https://github.com/openpnp/openpnp/wiki/Motion-Controller-Firmwares
主板固件支持异步GCode驱动和高级运动控制.
不过异步GCode驱动停危险的, 同步GCode驱动就够用了.
异步GCode驱动的官方wiki GcodeAsyncDriver
高级运动控制的官方wiki Advanced Motion Control
openpnp要求的主板关键特性:
- 支持M115命令, 用来向openpnp上报固件版本, 好让openpnp能判断固件.
- 必须支持除了X, Y, Z之外的附加轴(A, B, C)控制, 而且可以使多个轴的混合控制好使.
- 支持M114命令, 用来上报所有轴的位置.
- 支持G92命令, 用来让每个轴位置归零.
- 支持M400命令, 用来等待移动完成. 在移动完成之前, 通讯必须是阻塞的. (在M400之后, 可能会发送其他命令, 但是移动完成之前, 必须阻塞住, 不能执行后续的指令)
- 必须支持M204(加速度控制), M201.3(禁止加速)
- 最好内置GcodeServer控制器模拟器(可选), 用来和openpnp联调, 用来确定openpnp发送的指令能产生正确的动作和效果.
官方御用的主板和固件如下:
Duet3D => https://docs.duet3d.com/en/Duet3D_hardware/Hardware_overview
RepRapFirmware
只是固件, 板子支持多种, 没细看.
Smoothieware 官方特意说, 不支持中国同学做的山寨版冰沙, 不过都是吓唬人, 用起来挺好的.
冰沙有第三方出的新固件 => makr.zone: “Smoothieware: New Firmware for PnP”
Marlin 2.0
TinyG
备注
对换冰沙主板之外的板子, 不感兴趣. 因为都是钱和时间啊, 等以后时机到了, 再折腾其他主板.