liurunyu
2025-01-20 ce759f7bdf3f46ce2fbc8d97be4ae95eb947c4be
在解析RTU升级hex文件的逻辑中,增加去除无效行的判断逻辑
1个文件已修改
5 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/softUpgrade/parse/HexFileParse.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/softUpgrade/parse/HexFileParse.java
@@ -17,6 +17,7 @@
    private static final int hexFileMinLine = 4 ;
    private static final int lineHeadEndIndex = 9 ;
    private static final int lineValidCharCount = 43 ;//每行有效字符(冒号与十六进制)个数,例如:1096C000DC96010010020020203E00000441000052,但倒数第3行不受限制
    private static final int bytesSplitUnit512 = 512 ;
    public static void main(String[] args) throws Exception{
@@ -137,6 +138,9 @@
                        if(!line.startsWith(":")){
                            vo.errors.add("第" + counter + "行内容不是以:开头") ;
                        }else{
                            if(counter != vo.totalLines - 3 && line.length() != lineValidCharCount){
                                //无效数据,舍弃本行数据
                            }else{
                            line = line.substring(lineHeadEndIndex, line.length() - 2) ;
                            if(vo.bytes.length == 0){
                                vo.bytes = HexUtil.decodeHex(line) ;
@@ -148,6 +152,7 @@
                    }
                }
            }
            }
            counter ++ ;
        }
        if(vo.bytes != null && vo.bytes.length > 0){