Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Feature Request] HMS Code mapping

未关闭
#5 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
javascript
领域
api

调研方向

首先检查打印报告 payload 的 hms 数组以及提供的 Node-RED 转换代码片段。将十进制的 attr 和 code 值与链接的 Bambu HMS 代码文档进行比较;完成标准和实现位置仍需协商确定,因为 issue 没有指出项目入口点或预期的 API 形式。

由索引模型根据 Issue 内容生成。

描述

Wasn't sure where this would fit in the current layout, so I will give my findings here.

In the report print payload for all sensors (or a subset if the P1P as it does not send all unless pushall is invoked), there is the value hms with an array.

If it contains values, it is as such:

"hms": [
    {
        "code": "somecode",
        "attr": "somecode"
    },
    {
        "code": "somecode",
        "attr": "somecode"
    }
]

The codes and attributes are not recognizable at first, but can be mapped to errors. Both the code and attr are decimal numbers that when converted to Hex with Two's complement, then append the code after the attr and separate each set of 4 character with an underscore, it will be in the format of Bambu's official HMS code errors as per their website.

Note: Not all hms codes are documented yet.

Here is a snippet of how I convert them in nodered:

function DecimalHexTwosComplement(decimal) {
    var size = 8;
    var hexadecimal;
    if (decimal >= 0) {
        hexadecimal = decimal.toString(16);

        while ((hexadecimal.length % size) != 0) {
            hexadecimal = "" + 0 + hexadecimal;
        }

        return hexadecimal;
    } else {
        hexadecimal = Math.abs(decimal).toString(16);
        while ((hexadecimal.length % size) != 0) {
            hexadecimal = "" + 0 + hexadecimal;
        }

        var output = '';
        for (var i = 0; i < hexadecimal.length; i++) {
            output += (0x0F - parseInt(hexadecimal[i], 16)).toString(16);
        }

        output = (0x01 + parseInt(output, 16)).toString(16);
        return output;
    }
}

let template = [];
if(msg.payload.print.hms != undefined){
    for (var hms_code of msg.payload.print.hms) {
        var attr = DecimalHexTwosComplement(hms_code.attr);
        var code = DecimalHexTwosComplement(hms_code.code);
        let full_code = (attr + code).replace(/(.{4})/g, "$1_");
        full_code = full_code.substring(0, full_code.length - 1);
        let url = "https://wiki.bambulab.com/en/x1/troubleshooting/hmscode/"+full_code;
        template.push({"code": "HMS_"+full_code, "url": url});
    }
    msg.payload.print.hms = template;
}
主要语言
没有语言数据
星标
696
派生
99
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Doridian/OpenBambuAPI 的其他 Issue

查看 Doridian/OpenBambuAPI 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。